public void Revert() { if (_archiveStates.Count == 0) { return; } var states = _archiveStates.Values.ToArray(); // Reverse archives for (int i = 0; i < states.Length; i++) { var archive = _archiveTable[states[i].ArchivePath]; foreach (var entry in states[i].OriginalValues) { archive.Files[entry.Key] = entry.Value; } _writer.WriteArchive(archive, archive.FilePath); _writer.SetDataLength(archive, states[i].OriginalLength); archive.DataLength = states[i].OriginalLength; } // Reverse manifest File.WriteAllBytes(LeagueLocations.GetManifestPath(_leaguePath), File.ReadAllBytes(LeagueLocations.GetManifestStatePath(_leaguePath))); File.Delete(LeagueLocations.GetManifestStatePath(_leaguePath)); // Clear local variables and save them _archiveStates = new Dictionary <string, ArchiveState>(); Manifest = ReleaseManifest.LoadFromFile(LeagueLocations.GetManifestPath(_leaguePath)); LoadManifestPaths(); WriteStateInfo(); // Remove the corrupt data flag if it exists if (File.Exists(LeagueLocations.GetCorruptFlagPath(_leaguePath))) { File.Delete(LeagueLocations.GetCorruptFlagPath(_leaguePath)); } }