Skip to content

Commit

Permalink
Merge pull request #1424 from Romualdo666/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Grossley authored Jul 7, 2023
2 parents fa327ab + 474c2bf commit 32cd3ea
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions UndertaleModTool/Editors/UndertaleCodeEditor.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -874,31 +874,27 @@ private async Task DecompiledLostFocusBody(object sender, RoutedEventArgs e)
}

code.Replace(compileContext.ResultAssembly);

if (!mainWindow.Data.IsVersionAtLeast(2, 3))
try
{
try
string path = Path.Combine(TempPath, code.Name.Content + ".gml");
if (SettingsWindow.ProfileModeEnabled)
{
string path = Path.Combine(TempPath, code.Name.Content + ".gml");
if (SettingsWindow.ProfileModeEnabled)
{
// Write text, only if in the profile mode.
File.WriteAllText(path, DecompiledEditor.Text);
}
else
{
// Destroy file with comments if it's been edited outside the profile mode.
// We're dealing with the decompiled code only, it has to happen.
// Otherwise it will cause a desync, which is more important to prevent.
if (File.Exists(path))
File.Delete(path);
}
// Write text, only if in the profile mode.
File.WriteAllText(path, DecompiledEditor.Text);
}
catch (Exception exc)
else
{
mainWindow.ShowError("Error during writing of GML code to profile:\n" + exc);
// Destroy file with comments if it's been edited outside the profile mode.
// We're dealing with the decompiled code only, it has to happen.
// Otherwise it will cause a desync, which is more important to prevent.
if (File.Exists(path))
File.Delete(path);
}
}
catch (Exception exc)
{
mainWindow.ShowError("Error during writing of GML code to profile:\n" + exc);
}

// Invalidate gettext if necessary
if (code.Name.Content == "gml_Script_textdata_en")
Expand Down

0 comments on commit 32cd3ea

Please sign in to comment.