Skip to content

Commit

Permalink
Fixed copy/pasting compile output not displaying properly in discord
Browse files Browse the repository at this point in the history
  • Loading branch information
Exactol committed Oct 29, 2023
1 parent 8f29f07 commit ab1ae8d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
5 changes: 4 additions & 1 deletion CompilePalX/Compiling/CompilingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,9 @@ private static void CompileThreaded(CancellationToken cancellationToken)

ProgressManager.Progress += (1d / ConfigurationManager.CompileProcesses.Count(c => c.Metadata.DoRun &&
c.PresetDictionary.ContainsKey(ConfigurationManager.CurrentPreset))) / MapFiles.Count;

// log empty line to make a space inbetween compile step logs
CompilePalLogger.LogLine();
}

mapErrors.Add(new MapErrors { MapName = cleanMapName, Errors = compileErrors });
Expand All @@ -205,7 +208,7 @@ private static void CompileThreaded(CancellationToken cancellationToken)
private static void postCompile(List<MapErrors> errors)
{
CompilePalLogger.LogLineColor(
$"\n'{ConfigurationManager.CurrentPreset!.Name}' compile finished in {compileTimeStopwatch.Elapsed.ToString(@"hh\:mm\:ss")}", (Brush) Application.Current.TryFindResource("CompilePal.Brushes.Success"));
$"'{ConfigurationManager.CurrentPreset!.Name}' compile finished in {compileTimeStopwatch.Elapsed.ToString(@"hh\:mm\:ss")}", (Brush) Application.Current.TryFindResource("CompilePal.Brushes.Success"));

if (errors != null && errors.Any())
{
Expand Down
10 changes: 7 additions & 3 deletions CompilePalX/Compiling/Logger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,10 @@ public static void LogCompileError(string errorText, Error e)
File.AppendAllText(logFile, errorText);
OnErrorFound(e);
}
public static void LogLineCompileError(string errorText, Error e)
{
LogCompileError(errorText + Environment.NewLine, e);
}

private static Dictionary<Error, int> errorsFound = new ();

Expand All @@ -141,7 +145,7 @@ public static void LogProgressive(string s)
}

// Log has completed at least 1 line, process it further
List<string> lines = lineBuffer.ToString().Split('\n').ToList();
List<string> lines = lineBuffer.ToString().Split("\r\n").ToList();

string suffixText = lines.Last();

Expand All @@ -155,9 +159,9 @@ public static void LogProgressive(string s)
Error? error = ErrorFinder.GetError(line);

if (error == null)
Log(line);
LogLine(line);
else
LogCompileError(line, error);
LogLineCompileError(line, error);
}

if (suffixText.Length > 0)
Expand Down

0 comments on commit ab1ae8d

Please sign in to comment.