do one last XML cleanup before deploying final xml

This commit is contained in:
Bitl 2022-05-01 09:47:35 -07:00
parent d233f4a9b6
commit de246376a4
1 changed files with 27 additions and 0 deletions

View File

@ -676,6 +676,32 @@ public partial class AssetSDK : Form
}
}
public static void FinalXMLCleanup(string filepath)
{
string[] file = File.ReadAllLines(filepath);
try
{
int index = 0;
foreach (var line in file)
{
++index;
RobloxXML.ReplaceHexadecimalSymbols(line);
RobloxXML.RemoveInvalidXmlChars(line);
}
}
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);
}
}
private void WorkerProgress(BackgroundWorker worker, int progress)
{
if (worker != null)
@ -1029,6 +1055,7 @@ public partial class AssetSDK : Form
//download any assets we missed.
FixURLSOrDownloadFromScript(path, GlobalPaths.AssetCacheDirAssets, GlobalPaths.AssetCacheAssetsGameDir, useURLs, url);
FinalXMLCleanup(path);
WorkerProgress(worker, 100);
}
}