public void DumpSaveNames() { var arr = SaveReader.SaveFileNames; for (int i = 0; i < arr.Count; i++) { var index = SaveReader.GetIndex(arr[i]); index.Should().Be(i); } }
private static void Dump(string[] args) { // Drag & Drop save file folder. if (args.Length == 1) { var first = args[0]; if (Directory.Exists(first)) { Console.WriteLine("Extracting save data..."); SaveDumper.ExtractEntries(first, first); Console.WriteLine("Done!"); return; } if (File.Exists(first)) { Console.WriteLine("Extracting save data..."); SaveDumper.ExtractFile(first); Console.WriteLine("Done!"); return; } } if (args.Length is not(2 or 3 or 4)) { PrintUsage(); return; } var mode = args[0]; var path = args[1]; switch (mode) { case "-sav" when File.Exists(path): { var index = SaveReader.GetIndex(Path.GetFileNameWithoutExtension(path)); string GetDestination() { var p = args.Length > 2 ? args[2] : Directory.GetParent(Path.GetFullPath(path)).FullName; return(Path.Combine(p, $"{index:00}")); } var dest = GetDestination(); SaveDumper.ExtractFiles(path, dest, index); break; } case "-sav" when !Directory.Exists(path): Console.WriteLine("Input save file directory not found."); return; case "-sav": { var dest = args.Length == 3 ? args[2] : path; SaveDumper.ExtractEntries(path, dest); break; } case "-drp" when Directory.Exists(path): { var dest = args.Length == 3 ? args[2] : path; DumpUtil.DumpAllDrp(path, dest); break; } case "-drp" when !File.Exists(path): Console.WriteLine("Input drp file not found."); return; case "-drp": { var dest = args.Length == 3 ? args[2] : Path.GetFullPath(path); DumpUtil.DumpToPath(path, dest); break; } case "-ms" or "-mf" when !File.Exists(path): Console.WriteLine("Input drp file not found."); return; case "-ms" when args.Length > 2 && File.Exists(args[2]): // src, inj DrpArchiveChanger.Replace(path, path, args[2..]);