Skip to content
This repository was archived by the owner on May 11, 2024. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 31 additions & 2 deletions AssetStudio.GUI/Studio.cs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@ public static void ExportAssets(string savePath, List<AssetItem> toExportAssets,

int toExportCount = toExportAssets.Count;
int exportedCount = 0;
string logFilePath = "";
bool ExportError = false;
int i = 0;
Progress.Reset();
foreach (var asset in toExportAssets)
Expand Down Expand Up @@ -593,9 +595,31 @@ public static void ExportAssets(string savePath, List<AssetItem> toExportAssets,
}
catch (Exception ex)
{
MessageBox.Show($"Export {asset.Type}:{asset.Text} error\r\n{ex.Message}\r\n{ex.StackTrace}");
try
{
string directory = AppDomain.CurrentDomain.BaseDirectory;
logFilePath = Path.Combine(directory, "log_error.txt");
string prevLogFilePath = Path.Combine(directory, "log_error_prev.txt");
if (!ExportError)
{
if (File.Exists(logFilePath))
{
if (File.Exists(prevLogFilePath))
{
File.Delete(prevLogFilePath);
}
File.Move(logFilePath, prevLogFilePath);
}
File.AppendAllText(logFilePath, $"Export Errors:" + $"Version {Application.ProductVersion}" + Environment.NewLine + $"----------" + Environment.NewLine);
ExportError = true;
};
File.AppendAllText(logFilePath, $"Export {asset.Type}:{asset.Text} error\r\n{ex.Message}\r\n{ex.StackTrace}" + Environment.NewLine + Environment.NewLine);
}
catch (Exception ex2)
{
Console.WriteLine("Error saving to log file: " + ex2.Message);
}
}

Progress.Report(++i, toExportCount);
}

Expand All @@ -605,6 +629,11 @@ public static void ExportAssets(string savePath, List<AssetItem> toExportAssets,
{
statusText += $" {toExportCount - exportedCount} assets skipped (not extractable or files already exist)";
}
if (ExportError)
{
Process.Start("notepad.exe", logFilePath);
}


StatusStripUpdate(statusText);

Expand Down