added script support to localization

This commit is contained in:
Bitl 2021-11-22 10:51:35 -07:00
parent 7ce67d3219
commit 2d7cca55d0
10 changed files with 274 additions and 184 deletions

View File

@ -110,7 +110,7 @@ class Downloader
{ {
//wait a few seconds for the download to finish //wait a few seconds for the download to finish
//Thread.Sleep(2000); //Thread.Sleep(2000);
if (/*File.Exists(name)*/ read > 0) if (File.Exists(name) && read > 0)
{ {
downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + GlobalFuncs.SizeSuffix(Convert.ToInt64(read), 2) + " written (" + read + " bytes)! " + additionalText; downloadOutcome = "File " + Path.GetFileName(name) + " downloaded! " + GlobalFuncs.SizeSuffix(Convert.ToInt64(read), 2) + " written (" + read + " bytes)! " + additionalText;
} }

View File

@ -27,9 +27,8 @@ public enum RobloxFileType
TShirt, TShirt,
Shirt, Shirt,
Pants, Pants,
HeadNoCustomMesh, Script,
//for downloading script assets HeadNoCustomMesh
//Script
} }
#endregion #endregion

View File

@ -1,5 +1,6 @@
#region Usings #region Usings
using System; using System;
using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
@ -135,7 +136,7 @@ public static class RobloxXML
return ""; return "";
} }
private static void DownloadFilesFromNode(string url, string path, string fileext, string id) public static void DownloadFilesFromNode(string url, string path, string fileext, string id)
{ {
if (!string.IsNullOrWhiteSpace(id)) if (!string.IsNullOrWhiteSpace(id))
{ {
@ -144,6 +145,10 @@ public static class RobloxXML
try try
{ {
download.InitDownload(path, fileext, "", true); download.InitDownload(path, fileext, "", true);
if (download.getDownloadOutcome().Contains("Error"))
{
throw new IOException(download.getDownloadOutcome());
}
} }
#if URI || LAUNCHER || CMD || BASICLAUNCHER #if URI || LAUNCHER || CMD || BASICLAUNCHER
catch (Exception ex) catch (Exception ex)
@ -396,90 +401,6 @@ public static class RobloxXML
return ""; return "";
} }
//TODO: actually download the script assets instead of fixing the scripts lol. fixing the scripts won't work anyways because we don't support https natively.
/*
public static void DownloadScriptFromNodes(string filepath, string itemClassValue)
{
string oldfile = File.ReadAllText(filepath);
string fixedfile = RemoveInvalidXmlChars(ReplaceHexadecimalSymbols(oldfile));
XDocument doc = XDocument.Parse(fixedfile);
try
{
var v = from nodes in doc.Descendants("Item")
where nodes.Attribute("class").Value == itemClassValue
select nodes;
foreach (var item in v)
{
var v2 = from nodes in item.Descendants("Properties")
select nodes;
foreach (var item2 in v2)
{
var v3 = from nodes in doc.Descendants("ProtectedString")
where nodes.Attribute("name").Value == "Source"
select nodes;
foreach (var item3 in v3)
{
string newurl = "assetdelivery.roblox.com/v1/asset/?id=";
item3.Value.Replace("http://", "https://")
.Replace("?version=1&id=", "?id=")
.Replace("www.roblox.com/asset/?id=", newurl)
.Replace("www.roblox.com/asset?id=", newurl)
.Replace("assetgame.roblox.com/asset/?id=", newurl)
.Replace("assetgame.roblox.com/asset?id=", newurl)
.Replace("roblox.com/asset/?id=", newurl)
.Replace("roblox.com/asset?id=", newurl);
}
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
doc.Save(filepath);
}
}
public static void DownloadFromScript(string filepath)
{
string[] file = File.ReadAllLines(filepath);
try
{
foreach (var line in file)
{
if (line.Contains("www.roblox.com/asset/?id=") || line.Contains("assetgame.roblox.com/asset/?id="))
{
string newurl = "assetdelivery.roblox.com/v1/asset/?id=";
line.Replace("http://", "https://")
.Replace("?version=1&id=", "?id=")
.Replace("www.roblox.com/asset/?id=", newurl)
.Replace("www.roblox.com/asset?id=", newurl)
.Replace("assetgame.roblox.com/asset/?id=", newurl)
.Replace("assetgame.roblox.com/asset?id=", newurl)
.Replace("roblox.com/asset/?id=", newurl)
.Replace("roblox.com/asset?id=", newurl);
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("The download has experienced an error: " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
File.WriteAllLines(filepath, file);
}
}*/
public static string RemoveInvalidXmlChars(string content) public static string RemoveInvalidXmlChars(string content)
{ {
return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray()); return new string(content.Where(ch => XmlConvert.IsXmlChar(ch)).ToArray());

View File

@ -1190,6 +1190,10 @@ public class GlobalFuncs
string id = item.After(peram); string id = item.After(peram);
fullname = id + ".png"; fullname = id + ".png";
} }
else
{
return item;
}
Downloader download = new Downloader(item, fullname, "", GlobalPaths.AssetCacheDirTextures); Downloader download = new Downloader(item, fullname, "", GlobalPaths.AssetCacheDirTextures);
@ -1224,6 +1228,12 @@ public class GlobalFuncs
if (item.Contains("http://") || item.Contains("https://")) if (item.Contains("http://") || item.Contains("https://"))
{ {
string peram = "id=";
if (!item.Contains(peram))
{
return item;
}
Downloader download = new Downloader(item, name + "Temp.rbxm", "", GlobalPaths.AssetCacheDirFonts); Downloader download = new Downloader(item, name + "Temp.rbxm", "", GlobalPaths.AssetCacheDirFonts);
try try
@ -2468,6 +2478,11 @@ public class GlobalFuncs
Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds); Directory.CreateDirectory(GlobalPaths.AssetCacheDirSounds);
} }
if (!Directory.Exists(GlobalPaths.AssetCacheDirTextures))
{
Directory.CreateDirectory(GlobalPaths.AssetCacheDirTextures);
}
if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI)) if (!Directory.Exists(GlobalPaths.AssetCacheDirTexturesGUI))
{ {
Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI); Directory.CreateDirectory(GlobalPaths.AssetCacheDirTexturesGUI);
@ -2477,12 +2492,11 @@ public class GlobalFuncs
{ {
Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts); Directory.CreateDirectory(GlobalPaths.AssetCacheDirScripts);
} }
/* if (!Directory.Exists(GlobalPaths.AssetCacheDirAssets))
if (!Directory.Exists(GlobalPaths.AssetCacheDirScriptAssets))
{ {
Directory.CreateDirectory(GlobalPaths.AssetCacheDirScriptAssets); Directory.CreateDirectory(GlobalPaths.AssetCacheDirAssets);
}*/ }
} }
// Credit to Carrot for the original code. Rewote it to be smaller. // Credit to Carrot for the original code. Rewote it to be smaller.

View File

@ -69,7 +69,7 @@ public class GlobalPaths
public static string AssetCacheDirTextures = AssetCacheDir + DirTextures; public static string AssetCacheDirTextures = AssetCacheDir + DirTextures;
public static string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui"; public static string AssetCacheDirTexturesGUI = AssetCacheDirTextures + "\\gui";
public static string AssetCacheDirScripts = AssetCacheDir + DirScripts; public static string AssetCacheDirScripts = AssetCacheDir + DirScripts;
//public static string AssetCacheDirScriptAssets = AssetCacheDir + "\\scriptassets"; public static string AssetCacheDirAssets = AssetCacheDir + "\\assets";
public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/"; public static string AssetCacheGameDir = SharedDataGameDir + "assetcache/";
public static string AssetCacheFontsGameDir = AssetCacheGameDir + FontsGameDir; public static string AssetCacheFontsGameDir = AssetCacheGameDir + FontsGameDir;
@ -78,7 +78,7 @@ public class GlobalPaths
public static string AssetCacheTexturesGameDir = AssetCacheGameDir + TexturesGameDir; public static string AssetCacheTexturesGameDir = AssetCacheGameDir + TexturesGameDir;
public static string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/"; public static string AssetCacheTexturesGUIGameDir = AssetCacheTexturesGameDir + "gui/";
public static string AssetCacheScriptsGameDir = AssetCacheGameDir + ScriptsGameDir; public static string AssetCacheScriptsGameDir = AssetCacheGameDir + ScriptsGameDir;
//public static string AssetCacheScriptAssetsGameDir = AssetCacheGameDir + "scriptassets/"; public static string AssetCacheAssetsGameDir = AssetCacheGameDir + "assets/";
#endregion #endregion
#region Item Dirs #region Item Dirs

View File

@ -1053,6 +1053,7 @@ namespace NovetusLauncher
if (Directory.Exists(GlobalPaths.AssetCacheDir)) if (Directory.Exists(GlobalPaths.AssetCacheDir))
{ {
Directory.Delete(GlobalPaths.AssetCacheDir, true); Directory.Delete(GlobalPaths.AssetCacheDir, true);
GlobalFuncs.CreateAssetCacheDirectories();
GlobalFuncs.ConsolePrint("Asset cache cleared!", 3, ConsoleBox); GlobalFuncs.ConsolePrint("Asset cache cleared!", 3, ConsoleBox);
MessageBox.Show("Asset cache cleared!", "Novetus - Asset Cache Cleared", MessageBoxButtons.OK, MessageBoxIcon.Information); MessageBox.Show("Asset cache cleared!", "Novetus - Asset Cache Cleared", MessageBoxButtons.OK, MessageBoxIcon.Information);
} }

View File

@ -853,7 +853,7 @@
<CheckBox x:Name="minimizeOnLaunchBox" Content="Minimize on Launch" HorizontalAlignment="Left" Margin="62,67,0,0" VerticalAlignment="Top" Width="144" Checked="minimizeOnLaunchBox_Checked" Unchecked="minimizeOnLaunchBox_Unchecked"/> <CheckBox x:Name="minimizeOnLaunchBox" Content="Minimize on Launch" HorizontalAlignment="Left" Margin="62,67,0,0" VerticalAlignment="Top" Width="144" Checked="minimizeOnLaunchBox_Checked" Unchecked="minimizeOnLaunchBox_Unchecked"/>
<Button x:Name="resetConfigButton" Content="Reset Config" HorizontalAlignment="Left" Margin="233,46,0,0" VerticalAlignment="Top" Width="75" Click="resetConfigButton_Click"/> <Button x:Name="resetConfigButton" Content="Reset Config" HorizontalAlignment="Left" Margin="233,46,0,0" VerticalAlignment="Top" Width="75" Click="resetConfigButton_Click"/>
<Button x:Name="saveConfigButton" Content="Save Config" HorizontalAlignment="Left" Margin="233,67,0,0" VerticalAlignment="Top" Width="75" Click="saveConfigButton_Click"/> <Button x:Name="saveConfigButton" Content="Save Config" HorizontalAlignment="Left" Margin="233,67,0,0" VerticalAlignment="Top" Width="75" Click="saveConfigButton_Click"/>
<Button x:Name="resetAssetCacheButton" Content="Reset Cache" HorizontalAlignment="Left" Margin="313,46,0,0" VerticalAlignment="Top" Width="81" Height="16" Click="resetAssetCacheButton_Click"/> <Button x:Name="resetAssetCacheButton" Content="Clear Cache" HorizontalAlignment="Left" Margin="313,46,0,0" VerticalAlignment="Top" Width="81" Height="16" Click="resetAssetCacheButton_Click"/>
<Button x:Name="novetusSDKButton" Content="Novetus SDK" HorizontalAlignment="Left" Margin="313,67,0,0" VerticalAlignment="Top" Width="81" Click="novetusSDKButton_Click"/> <Button x:Name="novetusSDKButton" Content="Novetus SDK" HorizontalAlignment="Left" Margin="313,67,0,0" VerticalAlignment="Top" Width="81" Click="novetusSDKButton_Click"/>
<Button x:Name="settingsButtons" Style="{DynamicResource ImportantButtonSmall}" Content="Settings" HorizontalAlignment="Left" Margin="399,46,0,0" VerticalAlignment="Top" Width="103" Height="17" Click="settingsButtons_Click" Grid.ColumnSpan="2"/> <Button x:Name="settingsButtons" Style="{DynamicResource ImportantButtonSmall}" Content="Settings" HorizontalAlignment="Left" Margin="399,46,0,0" VerticalAlignment="Top" Width="103" Height="17" Click="settingsButtons_Click" Grid.ColumnSpan="2"/>
<Button x:Name="modInstallerButton" Content="Install Mods" HorizontalAlignment="Left" Margin="399,67,0,0" VerticalAlignment="Top" Width="103" Click="modInstallerButton_Click" Grid.ColumnSpan="2"/> <Button x:Name="modInstallerButton" Content="Install Mods" HorizontalAlignment="Left" Margin="399,67,0,0" VerticalAlignment="Top" Width="103" Click="modInstallerButton_Click" Grid.ColumnSpan="2"/>

View File

@ -1,9 +1,11 @@
#region Usings #region Usings
using System; using System;
using System.Collections.Generic;
using System.ComponentModel; using System.ComponentModel;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
using System.Xml; using System.Xml;
using System.Xml.Linq; using System.Xml.Linq;
@ -357,9 +359,9 @@ public partial class AssetSDK : Form
case RobloxFileType.RBXL: case RobloxFileType.RBXL:
typeFilter = "Roblox Level (*.rbxl)|*.rbxl|Roblox Level (*.rbxlx)|*.rbxlx"; typeFilter = "Roblox Level (*.rbxl)|*.rbxl|Roblox Level (*.rbxlx)|*.rbxlx";
break; break;
/*case RobloxFileType.Script: case RobloxFileType.Script:
typeFilter = "Lua Script (*.lua)|*.lua"; typeFilter = "Lua Script (*.lua)|*.lua";
break;*/ break;
default: default:
typeFilter = "Roblox Model (*.rbxm)|*.rbxm"; typeFilter = "Roblox Model (*.rbxm)|*.rbxm";
break; break;
@ -423,12 +425,9 @@ public partial class AssetSDK : Form
case 90: case 90:
progressString = "Downloading RBXL Linked LocalScripts..."; progressString = "Downloading RBXL Linked LocalScripts...";
break; break;
//case 95: case 95:
//progressString = "Fixing RBXL Scripts..."; progressString = "Downloading extra assets...";
//break; break;
//case 97:
//progressString = "Fixing RBXL LocalScripts...";
//break;
} }
break; break;
case RobloxFileType.RBXM: case RobloxFileType.RBXM:
@ -473,12 +472,9 @@ public partial class AssetSDK : Form
case 90: case 90:
progressString = "Downloading RBXM Linked LocalScripts..."; progressString = "Downloading RBXM Linked LocalScripts...";
break; break;
//case 95: case 95:
//progressString = "Fixing RBXM Scripts..."; progressString = "Downloading extra assets...";
//break; break;
//case 97:
//progressString = "Fixing RBXM LocalScripts...";
//break;
} }
break; break;
case RobloxFileType.Hat: case RobloxFileType.Hat:
@ -496,6 +492,9 @@ public partial class AssetSDK : Form
case 75: case 75:
progressString = "Downloading Hat Linked LocalScripts..."; progressString = "Downloading Hat Linked LocalScripts...";
break; break;
case 95:
progressString = "Downloading extra assets...";
break;
} }
break; break;
case RobloxFileType.Head: case RobloxFileType.Head:
@ -505,6 +504,9 @@ public partial class AssetSDK : Form
case 0: case 0:
progressString = "Downloading Head Meshes and Textures..."; progressString = "Downloading Head Meshes and Textures...";
break; break;
case 95:
progressString = "Downloading extra assets...";
break;
} }
break; break;
case RobloxFileType.Face: case RobloxFileType.Face:
@ -514,6 +516,9 @@ public partial class AssetSDK : Form
case 0: case 0:
progressString = "Downloading Face Textures..."; progressString = "Downloading Face Textures...";
break; break;
case 95:
progressString = "Downloading extra assets...";
break;
} }
break; break;
case RobloxFileType.TShirt: case RobloxFileType.TShirt:
@ -523,6 +528,9 @@ public partial class AssetSDK : Form
case 0: case 0:
progressString = "Downloading T-Shirt Textures..."; progressString = "Downloading T-Shirt Textures...";
break; break;
case 95:
progressString = "Downloading extra assets...";
break;
} }
break; break;
case RobloxFileType.Shirt: case RobloxFileType.Shirt:
@ -532,6 +540,9 @@ public partial class AssetSDK : Form
case 0: case 0:
progressString = "Downloading Shirt Textures..."; progressString = "Downloading Shirt Textures...";
break; break;
case 95:
progressString = "Downloading extra assets...";
break;
} }
break; break;
case RobloxFileType.Pants: case RobloxFileType.Pants:
@ -541,18 +552,20 @@ public partial class AssetSDK : Form
case 0: case 0:
progressString = "Downloading Pants Textures..."; progressString = "Downloading Pants Textures...";
break; break;
case 95:
progressString = "Downloading extra assets...";
break;
}
break;
case RobloxFileType.Script:
//script
switch (percent)
{
case 0:
progressString = "Fixing Script...";
break;
} }
break; break;
/*
case RobloxFileType.Script:
//script
switch (percent)
{
case 0:
progressString = "Fixing Script...";
break;
}
break;*/
default: default:
progressString = "Idle"; progressString = "Idle";
break; break;
@ -561,17 +574,177 @@ public partial class AssetSDK : Form
return progressString + " " + percent.ToString() + "%"; return progressString + " " + percent.ToString() + "%";
} }
public static void DownloadFromScript(string filepath, string savefilepath, string inGameDir)
{
string[] file = File.ReadAllLines(filepath);
try
{
int index = 0;
foreach (var line in file)
{
++index;
if (line.Contains("http://") || line.Contains("https://"))
{
//https://stackoverflow.com/questions/10576686/c-sharp-regex-pattern-to-extract-urls-from-given-string-not-full-html-urls-but
List<string> links = new List<string>();
var linkParser = new Regex(@"\b(?:https?://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
foreach (Match m in linkParser.Matches(line))
{
string link = m.Value;
links.Add(link);
}
foreach (string link in links)
{
string newurl = ((!link.Contains("http://") || !link.Contains("https://")) ? "https://" : "")
+ "assetdelivery.roblox.com/v1/asset/?id=";
string urlReplaced = newurl.Contains("https://") ? link.Replace("http://", "").Replace("https://", "") : link.Replace("http://", "https://");
string urlFixed = urlReplaced.Replace("?version=1&amp;id=", "?id=")
.Replace("www.roblox.com/asset/?id=", newurl)
.Replace("www.roblox.com/asset?id=", newurl)
.Replace("assetgame.roblox.com/asset/?id=", newurl)
.Replace("assetgame.roblox.com/asset?id=", newurl)
.Replace("roblox.com/asset/?id=", newurl)
.Replace("roblox.com/asset?id=", newurl)
.Replace("&amp;", "&")
.Replace("amp;", "&")
.Replace("}", "")
.Replace("]", "")
.Replace("\"", "")
.Replace("'", "")
.Replace("&quot;", "")
.Replace("&quot", "");
string peram = "id=";
if (urlFixed.Contains(peram))
{
string IDVal = urlFixed.After(peram);
string OriginalIDVal = link.After(peram);
RobloxXML.DownloadFilesFromNode(urlFixed, savefilepath, "", IDVal);
file[index - 1] = file[index - 1].Replace(link, inGameDir + OriginalIDVal);
}
}
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Error: Unable to fix the asset. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
File.WriteAllLines(filepath, file);
}
}
public static void FixURLSInScript(string filepath, string url)
{
string[] file = File.ReadAllLines(filepath);
try
{
int index = 0;
foreach (var line in file)
{
++index;
if ((line.Contains("http://") || line.Contains("https://")) && !line.Contains(url))
{
string oldurl = line;
string urlFixed = oldurl.Replace("http://", "")
.Replace("https://", "")
.Replace("?version=1&amp;id=", "?id=")
.Replace("www.roblox.com/asset/?id=", url)
.Replace("www.roblox.com/asset?id=", url)
.Replace("assetgame.roblox.com/asset/?id=", url)
.Replace("assetgame.roblox.com/asset?id=", url)
.Replace("roblox.com/asset/?id=", url)
.Replace("roblox.com/asset?id=", url)
.Replace("&amp;", "&")
.Replace("amp;", "&");
string peram = "id=";
if (urlFixed.Contains(peram))
{
file[index - 1] = urlFixed;
}
}
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
MessageBox.Show("Error: Unable to fix the asset. " + ex.Message, "Novetus Asset SDK - Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
finally
{
File.WriteAllLines(filepath, file);
}
}
public static void FixURLSOrDownloadFromScript(string filepath, string savefilepath, string inGameDir, bool useURLs, string url)
{
if (useURLs)
{
FixURLSInScript(filepath, url);
}
else
{
DownloadFromScript(filepath, savefilepath, inGameDir);
}
}
public void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, string itemname, string meshname, bool useURLs = false, string remoteurl = "") public void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, string itemname, string meshname, bool useURLs = false, string remoteurl = "")
{ {
string oldfile = File.ReadAllText(path); string oldfile = File.ReadAllText(path);
string fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)).Replace("&#9;", "\t").Replace("#9;", "\t");
XDocument doc = null; XDocument doc = null;
XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { CheckCharacters = false };
Stream filestream = GlobalFuncs.GenerateStreamFromString(fixedfile); try
using (XmlReader xmlReader = XmlReader.Create(filestream, xmlReaderSettings))
{ {
xmlReader.MoveToContent(); string fixedfile = RobloxXML.RemoveInvalidXmlChars(RobloxXML.ReplaceHexadecimalSymbols(oldfile)).Replace("&#9;", "\t").Replace("#9;", "\t");
doc = XDocument.Load(xmlReader); XmlReaderSettings xmlReaderSettings = new XmlReaderSettings { CheckCharacters = false };
Stream filestream = GlobalFuncs.GenerateStreamFromString(fixedfile);
using (XmlReader xmlReader = XmlReader.Create(filestream, xmlReaderSettings))
{
xmlReader.MoveToContent();
doc = XDocument.Load(xmlReader);
}
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
//assume we're a script
if (type == RobloxFileType.Script)
{
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
{
try
{
worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".lua", " - BAK.lua"), false);
}
catch (Exception ex2)
{
GlobalFuncs.LogExceptions(ex2);
worker.ReportProgress(100);
return;
}
}
else
{
worker.ReportProgress(0);
}
FixURLSOrDownloadFromScript(path, GlobalPaths.AssetCacheDirAssets, GlobalPaths.AssetCacheAssetsGameDir, useURLs, url);
worker.ReportProgress(100);
}
return;
} }
try try
@ -591,6 +764,7 @@ public partial class AssetSDK : Form
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -637,13 +811,7 @@ public partial class AssetSDK : Form
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.Script); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.Script);
worker.ReportProgress(90); worker.ReportProgress(90);
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.LocalScript); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.LocalScript);
//localize any scripts that are not handled
/*
worker.ReportProgress(95); worker.ReportProgress(95);
RobloxXML.DownloadScriptFromNodes(doc, "Script");
worker.ReportProgress(97);
RobloxXML.DownloadScriptFromNodes(doc, "LocalScript");*/
worker.ReportProgress(100);
break; break;
case RobloxFileType.RBXM: case RobloxFileType.RBXM:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -651,12 +819,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -702,13 +871,7 @@ public partial class AssetSDK : Form
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.Script); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.Script);
worker.ReportProgress(90); worker.ReportProgress(90);
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.LocalScript); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.LocalScript);
//localize any scripts that are not handled
/*
worker.ReportProgress(95); worker.ReportProgress(95);
RobloxXML.DownloadScriptFromNodes(doc, "Script");
worker.ReportProgress(97);
RobloxXML.DownloadScriptFromNodes(doc, "LocalScript");*/
worker.ReportProgress(100);
break; break;
case RobloxFileType.Hat: case RobloxFileType.Hat:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -716,12 +879,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -738,7 +902,7 @@ public partial class AssetSDK : Form
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHatScript); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHatScript);
worker.ReportProgress(75); worker.ReportProgress(75);
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHatLocalScript); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHatLocalScript);
worker.ReportProgress(100); worker.ReportProgress(95);
break; break;
case RobloxFileType.Head: case RobloxFileType.Head:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -746,12 +910,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -761,7 +926,7 @@ public partial class AssetSDK : Form
//meshes //meshes
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHeadFonts, itemname); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHeadFonts, itemname);
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHeadFonts, 1, 1, 1, 1, itemname); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemHeadFonts, 1, 1, 1, 1, itemname);
worker.ReportProgress(100); worker.ReportProgress(95);
break; break;
case RobloxFileType.Face: case RobloxFileType.Face:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -769,12 +934,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -783,7 +949,7 @@ public partial class AssetSDK : Form
} }
//decal //decal
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemFaceTexture, itemname); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemFaceTexture, itemname);
worker.ReportProgress(100); worker.ReportProgress(95);
break; break;
case RobloxFileType.TShirt: case RobloxFileType.TShirt:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -791,12 +957,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -805,7 +972,7 @@ public partial class AssetSDK : Form
} }
//texture //texture
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemTShirtTexture, itemname); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemTShirtTexture, itemname);
worker.ReportProgress(100); worker.ReportProgress(95);
break; break;
case RobloxFileType.Shirt: case RobloxFileType.Shirt:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -813,12 +980,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -827,7 +995,7 @@ public partial class AssetSDK : Form
} }
//texture //texture
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemShirtTexture, itemname); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemShirtTexture, itemname);
worker.ReportProgress(100); worker.ReportProgress(95);
break; break;
case RobloxFileType.Pants: case RobloxFileType.Pants:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups) if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
@ -835,12 +1003,13 @@ public partial class AssetSDK : Form
try try
{ {
worker.ReportProgress(0); worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " BAK.rbxm"), false); GlobalFuncs.FixedFileCopy(path, path.Replace(".rbxm", " - BAK.rbxm"), false);
} }
catch (Exception ex) catch (Exception ex)
{ {
GlobalFuncs.LogExceptions(ex); GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100); worker.ReportProgress(100);
return;
} }
} }
else else
@ -849,30 +1018,8 @@ public partial class AssetSDK : Form
} }
//texture //texture
RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemPantsTexture, itemname); RobloxXML.DownloadOrFixURLS(doc, useURLs, remoteurl, RobloxDefs.ItemPantsTexture, itemname);
worker.ReportProgress(100); worker.ReportProgress(95);
break; break;
/*case RobloxFileType.Script:
if (GlobalVars.UserConfiguration.AssetLocalizerSaveBackups)
{
try
{
worker.ReportProgress(0);
GlobalFuncs.FixedFileCopy(path, path.Replace(".lua", " BAK.lua"), false);
}
catch (Exception ex)
{
GlobalFuncs.LogExceptions(ex);
worker.ReportProgress(100);
}
}
else
{
worker.ReportProgress(0);
}
RobloxXML.DownloadFromScript(path);
worker.ReportProgress(100);
break;*/
default: default:
worker.ReportProgress(100); worker.ReportProgress(100);
break; break;
@ -890,6 +1037,10 @@ public partial class AssetSDK : Form
{ {
doc.WriteTo(xmlReader); doc.WriteTo(xmlReader);
} }
//download any assets we missed.
FixURLSOrDownloadFromScript(path, GlobalPaths.AssetCacheDirAssets, GlobalPaths.AssetCacheAssetsGameDir, useURLs, url);
worker.ReportProgress(100);
} }
} }
@ -904,7 +1055,9 @@ public partial class AssetSDK : Form
GlobalPaths.AssetCacheDirTextures = GlobalPaths.AssetCacheDir + GlobalPaths.DirTextures; GlobalPaths.AssetCacheDirTextures = GlobalPaths.AssetCacheDir + GlobalPaths.DirTextures;
GlobalPaths.AssetCacheDirTexturesGUI = GlobalPaths.AssetCacheDirTextures + "\\gui"; GlobalPaths.AssetCacheDirTexturesGUI = GlobalPaths.AssetCacheDirTextures + "\\gui";
GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts; GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts;
//GlobalPaths.AssetCacheDirScriptAssets = GlobalPaths.AssetCacheDir + "\\scriptassets"; GlobalPaths.AssetCacheDirAssets = GlobalPaths.AssetCacheDir + "\\assets";
GlobalFuncs.CreateAssetCacheDirectories();
GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir; GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir;
GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir; GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir;
@ -913,7 +1066,7 @@ public partial class AssetSDK : Form
GlobalPaths.AssetCacheTexturesGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.TexturesGameDir; GlobalPaths.AssetCacheTexturesGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.TexturesGameDir;
GlobalPaths.AssetCacheTexturesGUIGameDir = GlobalPaths.AssetCacheTexturesGameDir + "gui/"; GlobalPaths.AssetCacheTexturesGUIGameDir = GlobalPaths.AssetCacheTexturesGameDir + "gui/";
GlobalPaths.AssetCacheScriptsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.ScriptsGameDir; GlobalPaths.AssetCacheScriptsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.ScriptsGameDir;
//GlobalPaths.AssetCacheScriptAssetsGameDir = GlobalPaths.AssetCacheGameDir + "scriptassets/"; GlobalPaths.AssetCacheAssetsGameDir = GlobalPaths.AssetCacheGameDir + "assets/";
} }
else else
{ {
@ -924,7 +1077,7 @@ public partial class AssetSDK : Form
GlobalPaths.AssetCacheDirTextures = GlobalPaths.AssetCacheDir + GlobalPaths.DirTextures; GlobalPaths.AssetCacheDirTextures = GlobalPaths.AssetCacheDir + GlobalPaths.DirTextures;
GlobalPaths.AssetCacheDirTexturesGUI = GlobalPaths.AssetCacheDirTextures + "\\gui"; GlobalPaths.AssetCacheDirTexturesGUI = GlobalPaths.AssetCacheDirTextures + "\\gui";
GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts; GlobalPaths.AssetCacheDirScripts = GlobalPaths.AssetCacheDir + GlobalPaths.DirScripts;
//GlobalPaths.AssetCacheDirScriptAssets = GlobalPaths.AssetCacheDir + "\\scriptassets"; GlobalPaths.AssetCacheDirAssets = GlobalPaths.AssetCacheDir + "\\assets";
GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir + "assetcache/"; GlobalPaths.AssetCacheGameDir = GlobalPaths.SharedDataGameDir + "assetcache/";
GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir; GlobalPaths.AssetCacheFontsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.FontsGameDir;
@ -933,7 +1086,7 @@ public partial class AssetSDK : Form
GlobalPaths.AssetCacheTexturesGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.TexturesGameDir; GlobalPaths.AssetCacheTexturesGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.TexturesGameDir;
GlobalPaths.AssetCacheTexturesGUIGameDir = GlobalPaths.AssetCacheTexturesGameDir + "gui/"; GlobalPaths.AssetCacheTexturesGUIGameDir = GlobalPaths.AssetCacheTexturesGameDir + "gui/";
GlobalPaths.AssetCacheScriptsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.ScriptsGameDir; GlobalPaths.AssetCacheScriptsGameDir = GlobalPaths.AssetCacheGameDir + GlobalPaths.ScriptsGameDir;
//GlobalPaths.AssetCacheScriptAssetsGameDir = GlobalPaths.AssetCacheGameDir + "scriptassets/"; GlobalPaths.AssetCacheAssetsGameDir = GlobalPaths.AssetCacheGameDir + "assets/";
} }
} }

View File

@ -1,8 +1,9 @@
1.3 v11.2021.2 1.3 v12.2021.1
Changes from v11.2021.1: Changes from v11.2021.1:
New Features: New Features:
- The Asset SDK Asset Localizer is now known as the Asset Fixer! - The Asset SDK Asset Localizer is now known as the Asset Fixer!
- Added the ability to "fix" all asset URLs by changing them to a URL of your choice! - Added the ability to "fix" all asset URLs by changing them to a URL of your choice!
- The Asset SDK's Asset Fixer now properly supports fixing the URLs inside of scripts.
- Added T-Shirt support to 2007E/2007E-Shaders. - Added T-Shirt support to 2007E/2007E-Shaders.
- T-Shirts with Roblox Asset URLs/Redirects are not supported due to 2 issues with 2007e: Roblox Asset URLs/Redirects do not work properly in 2007E if it's a texture and using anything to get the current texture value for a ShirtGraphic or Decal returns a "bad cast" error. - T-Shirts with Roblox Asset URLs/Redirects are not supported due to 2 issues with 2007e: Roblox Asset URLs/Redirects do not work properly in 2007E if it's a texture and using anything to get the current texture value for a ShirtGraphic or Decal returns a "bad cast" error.
- As a result, T-Shirts with Roblox Asset URLs/Redirects will not load in 2007e. - As a result, T-Shirts with Roblox Asset URLs/Redirects will not load in 2007e.
@ -15,6 +16,8 @@ New Features:
- Icons loaded from a URL will show up for all players. - Icons loaded from a URL will show up for all players.
- Added the ability to assign a custom client EXE name in the Client SDK. - Added the ability to assign a custom client EXE name in the Client SDK.
- Server hosters and map authors may now insert a "DisableCustomization" object into Lighting that will disable player customizations. DisableCustomization may also be removed to re-enable player customizations. - Server hosters and map authors may now insert a "DisableCustomization" object into Lighting that will disable player customizations. DisableCustomization may also be removed to re-enable player customizations.
- 2011M's GUI is now more accurate to when it released (Mid June 2011).
- You can re-enable the previous GUI by going into Novetus' settings.
Enhancements: Enhancements:
- The Bootstrapper now creates error logs of its own. - The Bootstrapper now creates error logs of its own.
@ -25,15 +28,14 @@ Enhancements:
- The server browser now displays versions in red if they're not the same exact version. - The server browser now displays versions in red if they're not the same exact version.
- The master server security warning will now show up once for every Novetus session. - The master server security warning will now show up once for every Novetus session.
- Novetus now bases your tripcode off of your computer's hardware information. (Powered by https://github.com/davcs86/csharp-uhwid) - Novetus now bases your tripcode off of your computer's hardware information. (Powered by https://github.com/davcs86/csharp-uhwid)
- 2011M's GUI is now more accurate to when it released (Mid June 2011).
- You can re-enable the previous GUI by going into Novetus' settings.
- The Client SDK now has specific version numbers for each clientinfo version. - The Client SDK now has specific version numbers for each clientinfo version.
- Made the Client Description and Warning fields larger in the Client SDK. - Made the Client Description and Warning fields larger in the Client SDK.
- The Client Description field now resizes with the rest of the Client SDK window. - The Client Description field now resizes with the rest of the Client SDK window.
- 2006S and 2006S-Shaders now use "PlayerHopper" instead of "Backpack" for compatibility with 2006 levels. - 2006S and 2006S-Shaders now use "PlayerHopper" instead of "Backpack" for compatibility with 2006 levels.
- All customization items are now named properly in 2006S-2007M. - All customization items are now named properly in 2006S-2007M.
- Studio can now be launched alongside other game types and clients. - Studio can now be launched alongside other game types and clients.
- Universal clients are caegoriozed based on client optimizations. - Universal maps are now categorized based on client optimizations.
- Clearing asset cache now properly clears the folder.
Fixes: Fixes:
- Fixed the URL Override box in the Asset SDK not being functional. - Fixed the URL Override box in the Asset SDK not being functional.

View File

@ -6,6 +6,6 @@ UserAgentRegisterClient1=2007M
UserAgentRegisterClient2=2010L UserAgentRegisterClient2=2010L
ExtendedVersionNumber=True ExtendedVersionNumber=True
ExtendedVersionEditChangelog=False ExtendedVersionEditChangelog=False
ExtendedVersionTemplate=%version% v11.2021.%extended-revision%%lite% ExtendedVersionTemplate=%version% v12.2021.%extended-revision%%lite%
ExtendedVersionRevision=2 ExtendedVersionRevision=1
IsLite=False IsLite=False