private void CleanUpStructuresWorker() { var Timer = new Stopwatch(); Timer.Start(); var MoveToDirectory = Path.Combine(EmpyrionConfiguration.SaveGamePath, Configuration.Current.MoveToDirectory); List <string> Errors = null; Array.ForEach(mPossibleCleanUpObjects, O => { try { if (Configuration.Current.DeletePermanent) { O.Delete(); } else { O.MoveTo(MoveToDirectory); } } catch (Exception Error) { if (Errors == null) { Errors = new List <string>(); } Errors.Add($"{O.InfoFile} {O.DataDirectory}: " + Error.Message); } }); Timer.Stop(); if (Errors != null) { Log(Errors.Aggregate("", (S, E) => S + E + "\n"), LogLevel.Error); } mCleanUpStatus = $"ExecCleanUp: ({(Errors == null ? "success" : Errors.Count + " errors")}) total: {Timer.Elapsed.TotalSeconds:N2}s"; }
public string ErrorString(string delim = "\r\n") { string output = Errors.Aggregate((result, item) => $"{result}{delim}{item}"); return(output); }