stability fixes

This commit is contained in:
Bitl 2022-11-02 14:32:23 -07:00
parent 506ceaa1db
commit 0f924008a2
1 changed files with 25 additions and 16 deletions

View File

@ -23,7 +23,7 @@ public partial class AssetFixer : Form
private string customFolder; private string customFolder;
private int errors = 0; private int errors = 0;
private bool hasOverrideWarningOpenedOnce = false; private bool hasOverrideWarningOpenedOnce = false;
private bool compressedMap = true; private bool compressedMap = false;
#endregion #endregion
#region Constructor #region Constructor
@ -284,25 +284,14 @@ public partial class AssetFixer : Form
public void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, bool useURLs = false, string remoteurl = "") public void LocalizeAsset(RobloxFileType type, BackgroundWorker worker, string path, bool useURLs = false, string remoteurl = "")
{ {
if (GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups)
{
try
{
Util.FixedFileCopy(path, path + ".bak", false);
}
catch (Exception ex)
{
Util.LogExceptions(ex);
return;
}
}
if (path.Contains(".bz2")) if (path.Contains(".bz2"))
{ {
Util.Decompress(path, true); Util.Decompress(path, true);
compressedMap = true; compressedMap = true;
} }
string fixedPath = path.Replace(".rbxlx.bz2", ".rbxlx").Replace(".rbxl.bz2", ".rbxl");
LocalizePermanentlyIfNeeded(); LocalizePermanentlyIfNeeded();
AssetFixer_ProgressLabel.Text = "Loading..."; AssetFixer_ProgressLabel.Text = "Loading...";
@ -318,11 +307,30 @@ public partial class AssetFixer : Form
} }
} }
if (!error && GlobalVars.UserConfiguration.AssetSDKFixerSaveBackups)
{
try
{
Util.FixedFileCopy(fixedPath, fixedPath + ".bak", false);
}
catch (Exception ex)
{
Util.LogExceptions(ex);
return;
}
}
//assume we're a script //assume we're a script
try try
{ {
if (error) if (error)
{ {
if (compressedMap)
{
Util.FixedFileDelete(fixedPath);
compressedMap = false;
}
throw new FileFormatException("Cannot load models/places in binary format."); throw new FileFormatException("Cannot load models/places in binary format.");
} }
else else
@ -332,8 +340,9 @@ public partial class AssetFixer : Form
if (compressedMap) if (compressedMap)
{ {
//compress adds bz2 to our file though? this shouldn't be necessary. //compress adds bz2 to our file though? this shouldn't be necessary.
Util.Compress(path.Replace(".rbxlx.bz2", ".rbxlx").Replace(".rbxl.bz2", ".rbxl"), true); Util.Compress(fixedPath, true);
Util.FixedFileDelete(path.Replace(".rbxlx.bz2", ".rbxlx").Replace(".rbxl.bz2", ".rbxl")); Util.FixedFileDelete(fixedPath);
compressedMap = false;
} }
} }
} }