public void InsertForUpdate(string fullPath, BackupAction action) { if (this.ForUpdate.ContainsKey(fullPath)) { this.ForUpdate.Remove(fullPath); } this.ForUpdate.Add(fullPath, action); }
public void Register(BackupAction action) { if (action.ParseIsValid) { this.ValidRecords++; this.MinActionTime = Math.Min(this.MinActionTime, action.ActionTime); this.MaxActionTime = Math.Max(this.MaxActionTime, action.ActionTime); } else { this.InvalidRecords++; } }
private PathsCollector CollectPaths(long targetTime, out RestoreStatistics logStatistics) { var pathsCollector = new PathsCollector(); logStatistics = new RestoreStatistics(forActionTimeCount: true); this.Log.Reset(); while (!this.Log.EndOfStream) { var line = this.Log.ReadLine(excludeComments: true); if (line == string.Empty) { continue; } var action = new BackupAction(line); logStatistics.Register(action); if (!action.ParseIsValid) { continue; } if (action.ActionTime <= targetTime) { switch (action.ActionType) { case ActionType.FileNewIgnored: case ActionType.FileNewErrorSaving: break; default: pathsCollector.InsertForUpdate(action.FullPath, action); break; } } else { pathsCollector.InsertForDelete(action.FullPath); } } return(pathsCollector); }
public void WriteLogToConsole(out RestoreStatistics statistics) { statistics = new RestoreStatistics(forActionTimeCount: true); this.Log.Reset(); while (!this.Log.EndOfStream) { var line = this.Log.ReadLine(excludeComments: true); if (line == string.Empty) { continue; } var action = new BackupAction(line); statistics.Register(action); if (action.ParseIsValid) { var time = new DateTime(action.ActionTime); Console.WriteLine($"*** {statistics.ValidRecords}: {time.ToShortDateString()} {time.TimeOfDay} {action.Comment}"); } } }