mirror of
https://github.com/sp-tarkov/assembly-tool.git
synced 2025-02-12 20:30:43 -05:00
Use .Count() instead of .Where() and account for faulted tasks
This commit is contained in:
parent
44d6ae6148
commit
1a9cd5f163
@ -23,7 +23,7 @@ internal class Publicizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: This is broken. No idea why.
|
// TODO: This is broken. No idea why.
|
||||||
while (!publicizeTasks.TrueForAll(t => t.Status == TaskStatus.RanToCompletion))
|
while (!publicizeTasks.TrueForAll(t => t.Status is TaskStatus.RanToCompletion or TaskStatus.Faulted))
|
||||||
{
|
{
|
||||||
Logger.DrawProgressBar(publicizeTasks.Count(t => t.IsCompleted), publicizeTasks.Count, 50);
|
Logger.DrawProgressBar(publicizeTasks.Count(t => t.IsCompleted), publicizeTasks.Count, 50);
|
||||||
}
|
}
|
||||||
|
@ -11,8 +11,6 @@ namespace ReCodeItLib.ReMapper;
|
|||||||
public class ReMapper
|
public class ReMapper
|
||||||
{
|
{
|
||||||
private ModuleDefMD? Module { get; set; }
|
private ModuleDefMD? Module { get; set; }
|
||||||
|
|
||||||
public static bool IsRunning { get; private set; } = false;
|
|
||||||
|
|
||||||
private static readonly Stopwatch Stopwatch = new();
|
private static readonly Stopwatch Stopwatch = new();
|
||||||
private string OutPath { get; set; } = string.Empty;
|
private string OutPath { get; set; } = string.Empty;
|
||||||
@ -44,8 +42,7 @@ public class ReMapper
|
|||||||
OutPath = outPath;
|
OutPath = outPath;
|
||||||
|
|
||||||
if (!Validate(_remaps)) return;
|
if (!Validate(_remaps)) return;
|
||||||
|
|
||||||
IsRunning = true;
|
|
||||||
Stopwatch.Start();
|
Stopwatch.Start();
|
||||||
|
|
||||||
var types = Module.GetTypes();
|
var types = Module.GetTypes();
|
||||||
@ -92,9 +89,9 @@ public class ReMapper
|
|||||||
|
|
||||||
if (!validate)
|
if (!validate)
|
||||||
{
|
{
|
||||||
while (!tasks.TrueForAll(t => t.Status == TaskStatus.RanToCompletion))
|
while (!tasks.TrueForAll(t => t.Status is TaskStatus.RanToCompletion or TaskStatus.Faulted))
|
||||||
{
|
{
|
||||||
Logger.DrawProgressBar(tasks.Where(t => t.IsCompleted)!.Count() + 1, tasks.Count, 50);
|
Logger.DrawProgressBar(tasks.Count(t => t.IsCompleted), tasks.Count, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -120,7 +117,7 @@ public class ReMapper
|
|||||||
|
|
||||||
while (!renameTasks.TrueForAll(t => t.Status is TaskStatus.RanToCompletion or TaskStatus.Faulted))
|
while (!renameTasks.TrueForAll(t => t.Status is TaskStatus.RanToCompletion or TaskStatus.Faulted))
|
||||||
{
|
{
|
||||||
Logger.DrawProgressBar(renameTasks.Where(t => t.IsCompleted)!.Count(), renameTasks.Count, 50);
|
Logger.DrawProgressBar(renameTasks.Count(t => t.IsCompleted), renameTasks.Count, 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
Task.WaitAll(renameTasks.ToArray());
|
Task.WaitAll(renameTasks.ToArray());
|
||||||
@ -141,7 +138,7 @@ public class ReMapper
|
|||||||
.Where(g => g.Count() > 1)
|
.Where(g => g.Count() > 1)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (duplicateGroups.Count() > 1)
|
if (duplicateGroups.Count > 1)
|
||||||
{
|
{
|
||||||
Logger.Log($"There were {duplicateGroups.Count()} duplicated sets of remaps.", ConsoleColor.Yellow);
|
Logger.Log($"There were {duplicateGroups.Count()} duplicated sets of remaps.", ConsoleColor.Yellow);
|
||||||
|
|
||||||
@ -194,16 +191,15 @@ public class ReMapper
|
|||||||
{
|
{
|
||||||
foreach (var type in types)
|
foreach (var type in types)
|
||||||
{
|
{
|
||||||
if (type.Name == mapping.OriginalTypeName)
|
if (type.Name != mapping.OriginalTypeName) continue;
|
||||||
{
|
|
||||||
mapping.TypePrimeCandidate = type;
|
mapping.TypePrimeCandidate = type;
|
||||||
mapping.OriginalTypeName = type.Name.String;
|
mapping.OriginalTypeName = type.Name.String;
|
||||||
mapping.Succeeded = true;
|
mapping.Succeeded = true;
|
||||||
|
|
||||||
_alreadyGivenNames.Add(mapping.OriginalTypeName);
|
_alreadyGivenNames.Add(mapping.OriginalTypeName);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,8 +349,6 @@ public class ReMapper
|
|||||||
|
|
||||||
Stopwatch.Reset();
|
Stopwatch.Reset();
|
||||||
Module = null;
|
Module = null;
|
||||||
|
|
||||||
IsRunning = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user