public static void CheckCurrentSave() { DateTime saveTime = File.GetLastWriteTime(IsaacSave); ObservableCollection <IsaacArchive> archives = GetArchiveList(); if (archives == null) { ArchiveCurrentSave(saveTime.ToString("yyyyMMdd-hhmmss")); return; } IsaacArchive lastArchive = archives[0]; if (saveTime > lastArchive.SaveDate) { ArchiveCurrentSave(saveTime.ToString("yyyyMMdd-hhmmss")); } //else //Console.WriteLine("Archives current."); }
public int CompareTo(object obj) { if (obj == null) { return(1); } IsaacArchive archive = obj as IsaacArchive; if (this.SaveDate > archive.SaveDate) { return(-1); } else if (this.SaveDate < archive.SaveDate) { return(1); } else { return(0); } }
public static void RestoreArchivedSave(IsaacArchive archive) { //Console.WriteLine("Restoring archived save " + archive.Name); string serial = Path.Combine(IsaacDirectory, "serial.txt"); if (File.Exists(IsaacSave)) { File.Delete(IsaacSave); } if (File.Exists(serial)) { File.Delete(serial); } File.Copy(Path.Combine(archive.Location, "so.sol"), IsaacSave); File.Copy(Path.Combine(archive.Location, "serial.txt"), serial); if (File.Exists(ArchiveText)) { File.Delete(ArchiveText); } File.WriteAllText(ArchiveText, archive.Name); }
public static void RestoreArchivedSave(IsaacArchive archive) { //Console.WriteLine("Restoring archived save " + archive.Name); string serial = Path.Combine(IsaacDirectory, "serial.txt"); if (File.Exists(IsaacSave)) File.Delete(IsaacSave); if (File.Exists(serial)) File.Delete(serial); File.Copy(Path.Combine(archive.Location, "so.sol"), IsaacSave); File.Copy(Path.Combine(archive.Location, "serial.txt"), serial); if (File.Exists(ArchiveText)) File.Delete(ArchiveText); File.WriteAllText(ArchiveText, archive.Name); }
public static void RenameArchive(IsaacArchive archive, string name) { Directory.Move(archive.Location, Path.Combine(Archives, name)); }
public static void DeleteArchive(IsaacArchive archive) { Directory.Delete(archive.Location, true); }