A fork of Eusth's IPA
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

BackupManager.cs 723B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Linq;
  5. using System.Text;
  6. namespace IPA.Patcher
  7. {
  8. public class BackupManager
  9. {
  10. public static void MakeBackup(string file)
  11. {
  12. File.Copy(file, GetBackupName(file));
  13. }
  14. private static string GetBackupName(string file)
  15. {
  16. string backup = file + ".Original";
  17. if (File.Exists(backup))
  18. {
  19. int i = 1;
  20. string backupBase = backup;
  21. while (File.Exists(backup))
  22. {
  23. backup = backupBase + i++;
  24. }
  25. }
  26. return backup;
  27. }
  28. }
  29. }