mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
ACompiler no match printing limited to 10 in GUI.
Refactored printing and failure mechanics for nomatch to ACompiler for general reuse
This commit is contained in:
@ -85,7 +85,7 @@ namespace Wabbajack.Common
|
|||||||
|
|
||||||
public static T Log<T>(T msg) where T : IStatusMessage
|
public static T Log<T>(T msg) where T : IStatusMessage
|
||||||
{
|
{
|
||||||
LogToFile(msg.ExtendedDescription);
|
LogStraightToFile(msg.ExtendedDescription);
|
||||||
LoggerSubj.OnNext(msg);
|
LoggerSubj.OnNext(msg);
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ namespace Wabbajack.Common
|
|||||||
|
|
||||||
public static void Error(IException err)
|
public static void Error(IException err)
|
||||||
{
|
{
|
||||||
LogToFile($"{err.ShortDescription}\n{err.Exception.StackTrace}");
|
LogStraightToFile($"{err.ShortDescription}\n{err.Exception.StackTrace}");
|
||||||
LoggerSubj.OnNext(err);
|
LoggerSubj.OnNext(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +118,7 @@ namespace Wabbajack.Common
|
|||||||
throw err.Exception;
|
throw err.Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void LogToFile(string msg)
|
public static void LogStraightToFile(string msg)
|
||||||
{
|
{
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,8 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
public bool ShowReportWhenFinished { get; set; } = true;
|
public bool ShowReportWhenFinished { get; set; } = true;
|
||||||
|
|
||||||
|
public bool IgnoreMissingFiles { get; set; }
|
||||||
|
|
||||||
public ICollection<Archive> SelectedArchives = new List<Archive>();
|
public ICollection<Archive> SelectedArchives = new List<Archive>();
|
||||||
public List<Directive> InstallDirectives = new List<Directive>();
|
public List<Directive> InstallDirectives = new List<Directive>();
|
||||||
public List<RawSourceFile> AllFiles = new List<RawSourceFile>();
|
public List<RawSourceFile> AllFiles = new List<RawSourceFile>();
|
||||||
@ -50,7 +52,7 @@ namespace Wabbajack.Lib
|
|||||||
public List<IndexedArchive> IndexedArchives = new List<IndexedArchive>();
|
public List<IndexedArchive> IndexedArchives = new List<IndexedArchive>();
|
||||||
public Dictionary<string, IEnumerable<VirtualFile>> IndexedFiles = new Dictionary<string, IEnumerable<VirtualFile>>();
|
public Dictionary<string, IEnumerable<VirtualFile>> IndexedFiles = new Dictionary<string, IEnumerable<VirtualFile>>();
|
||||||
|
|
||||||
public void Info(string msg)
|
public static void Info(string msg)
|
||||||
{
|
{
|
||||||
Utils.Log(msg);
|
Utils.Log(msg);
|
||||||
}
|
}
|
||||||
@ -60,7 +62,7 @@ namespace Wabbajack.Lib
|
|||||||
Queue.Report(msg, 0);
|
Queue.Report(msg, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Error(string msg)
|
public static void Error(string msg)
|
||||||
{
|
{
|
||||||
Utils.Log(msg);
|
Utils.Log(msg);
|
||||||
throw new Exception(msg);
|
throw new Exception(msg);
|
||||||
@ -260,5 +262,47 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
public abstract IEnumerable<ICompilationStep> GetStack();
|
public abstract IEnumerable<ICompilationStep> GetStack();
|
||||||
public abstract IEnumerable<ICompilationStep> MakeStack();
|
public abstract IEnumerable<ICompilationStep> MakeStack();
|
||||||
|
|
||||||
|
public static void PrintNoMatches(ICollection<NoMatch> noMatches)
|
||||||
|
{
|
||||||
|
const int max = 10;
|
||||||
|
Info($"No match for {noMatches.Count} files");
|
||||||
|
if (noMatches.Count > 0)
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
foreach (var file in noMatches)
|
||||||
|
{
|
||||||
|
if (count++ < max)
|
||||||
|
{
|
||||||
|
Utils.Log($" {file.To} - {file.Reason}");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Utils.LogStraightToFile($" {file.To} - {file.Reason}");
|
||||||
|
}
|
||||||
|
if (count == max && noMatches.Count > max)
|
||||||
|
{
|
||||||
|
Utils.Log($" ...");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CheckForNoMatchExit(ICollection<NoMatch> noMatches)
|
||||||
|
{
|
||||||
|
if (noMatches.Count > 0)
|
||||||
|
{
|
||||||
|
if (IgnoreMissingFiles)
|
||||||
|
{
|
||||||
|
Info("Continuing even though files were missing at the request of the user.");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Info("Exiting due to no way to compile these files");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -54,8 +54,6 @@ namespace Wabbajack.Lib
|
|||||||
|
|
||||||
public dynamic MO2Ini { get; }
|
public dynamic MO2Ini { get; }
|
||||||
|
|
||||||
public bool IgnoreMissingFiles { get; set; }
|
|
||||||
|
|
||||||
public string MO2DownloadsFolder
|
public string MO2DownloadsFolder
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
@ -239,22 +237,9 @@ namespace Wabbajack.Lib
|
|||||||
UpdateTracker.NextStep($"Adding {ExtraFiles.Count} that were generated by the stack");
|
UpdateTracker.NextStep($"Adding {ExtraFiles.Count} that were generated by the stack");
|
||||||
results = results.Concat(ExtraFiles).ToArray();
|
results = results.Concat(ExtraFiles).ToArray();
|
||||||
|
|
||||||
var nomatch = results.OfType<NoMatch>().ToArray();
|
var noMatch = results.OfType<NoMatch>().ToArray();
|
||||||
Info($"No match for {nomatch.Length} files");
|
PrintNoMatches(noMatch);
|
||||||
if (nomatch.Any())
|
if (CheckForNoMatchExit(noMatch)) return false;
|
||||||
{
|
|
||||||
foreach (var file in nomatch)
|
|
||||||
Info($" {file.To} - {file.Reason}");
|
|
||||||
if (IgnoreMissingFiles)
|
|
||||||
{
|
|
||||||
Info("Continuing even though files were missing at the request of the user.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info("Exiting due to no way to compile these files");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
|
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
|
||||||
|
|
||||||
|
@ -35,8 +35,6 @@ namespace Wabbajack.Lib
|
|||||||
public string StagingFolder { get; set; }
|
public string StagingFolder { get; set; }
|
||||||
public string DownloadsFolder { get; set; }
|
public string DownloadsFolder { get; set; }
|
||||||
|
|
||||||
public bool IgnoreMissingFiles { get; set; }
|
|
||||||
|
|
||||||
public override ModManager ModManager => ModManager.Vortex;
|
public override ModManager ModManager => ModManager.Vortex;
|
||||||
public override string GamePath { get; }
|
public override string GamePath { get; }
|
||||||
public override string ModListOutputFolder => "output_folder";
|
public override string ModListOutputFolder => "output_folder";
|
||||||
@ -214,22 +212,9 @@ namespace Wabbajack.Lib
|
|||||||
Info("Running Compilation Stack");
|
Info("Running Compilation Stack");
|
||||||
var results = await AllFiles.PMap(Queue, f => RunStack(stack.Where(s => s != null), f));
|
var results = await AllFiles.PMap(Queue, f => RunStack(stack.Where(s => s != null), f));
|
||||||
|
|
||||||
IEnumerable<NoMatch> noMatch = results.OfType<NoMatch>().ToList();
|
var noMatch = results.OfType<NoMatch>().ToList();
|
||||||
Info($"No match for {noMatch.Count()} files");
|
PrintNoMatches(noMatch);
|
||||||
foreach (var file in noMatch)
|
if (CheckForNoMatchExit(noMatch)) return false;
|
||||||
Info($" {file.To} - {file.Reason}");
|
|
||||||
if (noMatch.Any())
|
|
||||||
{
|
|
||||||
if (IgnoreMissingFiles)
|
|
||||||
{
|
|
||||||
Info("Continuing even though files were missing at the request of the user.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Info("Exiting due to no way to compile these files");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
|
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user