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:
parent
3d130690c4
commit
ab4371e5d2
@ -85,7 +85,7 @@ namespace Wabbajack.Common
|
||||
|
||||
public static T Log<T>(T msg) where T : IStatusMessage
|
||||
{
|
||||
LogToFile(msg.ExtendedDescription);
|
||||
LogStraightToFile(msg.ExtendedDescription);
|
||||
LoggerSubj.OnNext(msg);
|
||||
return msg;
|
||||
}
|
||||
@ -108,7 +108,7 @@ namespace Wabbajack.Common
|
||||
|
||||
public static void Error(IException err)
|
||||
{
|
||||
LogToFile($"{err.ShortDescription}\n{err.Exception.StackTrace}");
|
||||
LogStraightToFile($"{err.ShortDescription}\n{err.Exception.StackTrace}");
|
||||
LoggerSubj.OnNext(err);
|
||||
}
|
||||
|
||||
@ -118,7 +118,7 @@ namespace Wabbajack.Common
|
||||
throw err.Exception;
|
||||
}
|
||||
|
||||
private static void LogToFile(string msg)
|
||||
public static void LogStraightToFile(string msg)
|
||||
{
|
||||
lock (_lock)
|
||||
{
|
||||
|
@ -42,6 +42,8 @@ namespace Wabbajack.Lib
|
||||
|
||||
public bool ShowReportWhenFinished { get; set; } = true;
|
||||
|
||||
public bool IgnoreMissingFiles { get; set; }
|
||||
|
||||
public ICollection<Archive> SelectedArchives = new List<Archive>();
|
||||
public List<Directive> InstallDirectives = new List<Directive>();
|
||||
public List<RawSourceFile> AllFiles = new List<RawSourceFile>();
|
||||
@ -50,7 +52,7 @@ namespace Wabbajack.Lib
|
||||
public List<IndexedArchive> IndexedArchives = new List<IndexedArchive>();
|
||||
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);
|
||||
}
|
||||
@ -60,7 +62,7 @@ namespace Wabbajack.Lib
|
||||
Queue.Report(msg, 0);
|
||||
}
|
||||
|
||||
public void Error(string msg)
|
||||
public static void Error(string msg)
|
||||
{
|
||||
Utils.Log(msg);
|
||||
throw new Exception(msg);
|
||||
@ -260,5 +262,47 @@ namespace Wabbajack.Lib
|
||||
|
||||
public abstract IEnumerable<ICompilationStep> GetStack();
|
||||
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 bool IgnoreMissingFiles { get; set; }
|
||||
|
||||
public string MO2DownloadsFolder
|
||||
{
|
||||
get
|
||||
@ -239,22 +237,9 @@ namespace Wabbajack.Lib
|
||||
UpdateTracker.NextStep($"Adding {ExtraFiles.Count} that were generated by the stack");
|
||||
results = results.Concat(ExtraFiles).ToArray();
|
||||
|
||||
var nomatch = results.OfType<NoMatch>().ToArray();
|
||||
Info($"No match for {nomatch.Length} files");
|
||||
if (nomatch.Any())
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
var noMatch = results.OfType<NoMatch>().ToArray();
|
||||
PrintNoMatches(noMatch);
|
||||
if (CheckForNoMatchExit(noMatch)) return false;
|
||||
|
||||
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
|
||||
|
||||
|
@ -35,8 +35,6 @@ namespace Wabbajack.Lib
|
||||
public string StagingFolder { get; set; }
|
||||
public string DownloadsFolder { get; set; }
|
||||
|
||||
public bool IgnoreMissingFiles { get; set; }
|
||||
|
||||
public override ModManager ModManager => ModManager.Vortex;
|
||||
public override string GamePath { get; }
|
||||
public override string ModListOutputFolder => "output_folder";
|
||||
@ -214,22 +212,9 @@ namespace Wabbajack.Lib
|
||||
Info("Running Compilation Stack");
|
||||
var results = await AllFiles.PMap(Queue, f => RunStack(stack.Where(s => s != null), f));
|
||||
|
||||
IEnumerable<NoMatch> noMatch = results.OfType<NoMatch>().ToList();
|
||||
Info($"No match for {noMatch.Count()} files");
|
||||
foreach (var file in noMatch)
|
||||
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;
|
||||
}
|
||||
}
|
||||
var noMatch = results.OfType<NoMatch>().ToList();
|
||||
PrintNoMatches(noMatch);
|
||||
if (CheckForNoMatchExit(noMatch)) return false;
|
||||
|
||||
InstallDirectives = results.Where(i => !(i is IgnoredDirectly)).ToList();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user