mirror of
https://github.com/xivdev/Penumbra.git
synced 2025-12-12 10:17:22 +01:00
Reuse same list for warnings and exceptions.
This commit is contained in:
parent
e9628afaf8
commit
076dab924f
1 changed files with 16 additions and 14 deletions
|
|
@ -28,8 +28,8 @@ public partial class ModEditWindow
|
|||
|
||||
private bool _dirty;
|
||||
public bool PendingIo { get; private set; }
|
||||
public List<Exception> IoExceptions { get; private set; } = [];
|
||||
public List<string> IoWarnings { get; private set; } = [];
|
||||
public List<Exception> IoExceptions { get; } = [];
|
||||
public List<string> IoWarnings { get; } = [];
|
||||
|
||||
public MdlTab(ModEditWindow edit, byte[] bytes, string path)
|
||||
{
|
||||
|
|
@ -92,10 +92,7 @@ public partial class ModEditWindow
|
|||
.ToList();
|
||||
});
|
||||
|
||||
task.ContinueWith(t =>
|
||||
{
|
||||
GamePaths = FinalizeIo(task);
|
||||
});
|
||||
task.ContinueWith(t => { GamePaths = FinalizeIo(task); });
|
||||
}
|
||||
|
||||
private EstManipulation[] GetCurrentEstManipulations()
|
||||
|
|
@ -246,8 +243,8 @@ public partial class ModEditWindow
|
|||
private void BeginIo()
|
||||
{
|
||||
PendingIo = true;
|
||||
IoWarnings = [];
|
||||
IoExceptions = [];
|
||||
IoWarnings.Clear();
|
||||
IoExceptions.Clear();
|
||||
}
|
||||
|
||||
private void FinalizeIo(Task<IoNotifier> task)
|
||||
|
|
@ -264,8 +261,9 @@ public partial class ModEditWindow
|
|||
{
|
||||
result = getResult(task.Result);
|
||||
if (getNotifier != null)
|
||||
IoWarnings = getNotifier(task.Result).GetWarnings().ToList();
|
||||
IoWarnings.AddRange(getNotifier(task.Result).GetWarnings());
|
||||
}
|
||||
|
||||
PendingIo = false;
|
||||
|
||||
return result;
|
||||
|
|
@ -273,12 +271,16 @@ public partial class ModEditWindow
|
|||
|
||||
private void RecordIoExceptions(Exception? exception)
|
||||
{
|
||||
IoExceptions = exception switch
|
||||
switch (exception)
|
||||
{
|
||||
null => [],
|
||||
AggregateException ae => [.. ae.Flatten().InnerExceptions],
|
||||
_ => [exception],
|
||||
};
|
||||
case null: break;
|
||||
case AggregateException ae:
|
||||
IoExceptions.AddRange(ae.Flatten().InnerExceptions);
|
||||
break;
|
||||
default:
|
||||
IoExceptions.Add(exception);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary> Read a file from the active collection or game. </summary>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue