diff --git a/src/LibHac/IO/Save/Savefile.cs b/src/LibHac/IO/Save/SaveData.cs similarity index 90% rename from src/LibHac/IO/Save/Savefile.cs rename to src/LibHac/IO/Save/SaveData.cs index 4bfc2017..08971e80 100644 --- a/src/LibHac/IO/Save/Savefile.cs +++ b/src/LibHac/IO/Save/SaveData.cs @@ -4,14 +4,14 @@ using System.IO; namespace LibHac.IO.Save { - public class Savefile : IDisposable + public class SaveData : IDisposable { public Header Header { get; } public IStorage BaseStorage { get; } public bool LeaveOpen { get; } public HierarchicalIntegrityVerificationStorage IvfcStorage { get; } - public SaveFs SaveFs { get; } + public SaveDataFileSystemCore SaveDataFileSystemCore { get; } public RemapStorage DataRemapStorage { get; } public RemapStorage MetaRemapStorage { get; } @@ -19,11 +19,11 @@ namespace LibHac.IO.Save public HierarchicalDuplexStorage DuplexStorage { get; } public JournalStorage JournalStorage { get; } - public DirectoryEntry RootDirectory => SaveFs.RootDirectory; - public FileEntry[] Files => SaveFs.Files; - public DirectoryEntry[] Directories => SaveFs.Directories; + public DirectoryEntry RootDirectory => SaveDataFileSystemCore.RootDirectory; + public FileEntry[] Files => SaveDataFileSystemCore.Files; + public DirectoryEntry[] Directories => SaveDataFileSystemCore.Directories; - public Savefile(Keyset keyset, IStorage storage, IntegrityCheckLevel integrityCheckLevel, bool leaveOpen) + public SaveData(Keyset keyset, IStorage storage, IntegrityCheckLevel integrityCheckLevel, bool leaveOpen) { BaseStorage = storage; LeaveOpen = leaveOpen; @@ -63,7 +63,7 @@ namespace LibHac.IO.Save fatStorage = InitFatIvfcStorage(integrityCheckLevel); } - SaveFs = new SaveFs(IvfcStorage, fatStorage, Header.SaveHeader); + SaveDataFileSystemCore = new SaveDataFileSystemCore(IvfcStorage, fatStorage, Header.SaveHeader); } private static HierarchicalDuplexStorage InitDuplexStorage(IStorage baseStorage, Header header) @@ -121,15 +121,15 @@ namespace LibHac.IO.Save public IStorage OpenFile(string filename) { - return SaveFs.OpenFile(filename); + return SaveDataFileSystemCore.OpenFile(filename); } public IStorage OpenFile(FileEntry file) { - return SaveFs.OpenFile(file); + return SaveDataFileSystemCore.OpenFile(file); } - public bool FileExists(string filename) => SaveFs.FileExists(filename); + public bool FileExists(string filename) => SaveDataFileSystemCore.FileExists(filename); public bool CommitHeader(Keyset keyset) { @@ -187,7 +187,7 @@ namespace LibHac.IO.Save public static class SavefileExtensions { - public static void Extract(this Savefile save, string outDir, IProgressReport logger = null) + public static void Extract(this SaveData save, string outDir, IProgressReport logger = null) { foreach (FileEntry file in save.Files) { diff --git a/src/LibHac/IO/Save/SaveFs.cs b/src/LibHac/IO/Save/SaveDataFileSystemCore.cs similarity index 97% rename from src/LibHac/IO/Save/SaveFs.cs rename to src/LibHac/IO/Save/SaveDataFileSystemCore.cs index 72b60b22..f56b33b8 100644 --- a/src/LibHac/IO/Save/SaveFs.cs +++ b/src/LibHac/IO/Save/SaveDataFileSystemCore.cs @@ -3,7 +3,7 @@ using System.IO; namespace LibHac.IO.Save { - public class SaveFs + public class SaveDataFileSystemCore { private IStorage BaseStorage { get; } private IStorage HeaderStorage { get; } @@ -16,7 +16,7 @@ namespace LibHac.IO.Save public DirectoryEntry[] Directories { get; private set; } public Dictionary FileDictionary { get; } - public SaveFs(IStorage storage, IStorage allocationTable, IStorage header) + public SaveDataFileSystemCore(IStorage storage, IStorage allocationTable, IStorage header) { HeaderStorage = header; BaseStorage = storage; diff --git a/src/LibHac/SwitchFs.cs b/src/LibHac/SwitchFs.cs index 59a49785..a97788c0 100644 --- a/src/LibHac/SwitchFs.cs +++ b/src/LibHac/SwitchFs.cs @@ -17,7 +17,7 @@ namespace LibHac public string SaveDir { get; } public Dictionary Ncas { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase); - public Dictionary Saves { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase); + public Dictionary Saves { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase); public Dictionary Titles { get; } = new Dictionary(); public Dictionary Applications { get; } = new Dictionary(); @@ -118,7 +118,7 @@ namespace LibHac foreach (string file in files) { - Savefile save = null; + SaveData save = null; string saveName = Path.GetFileNameWithoutExtension(file); try @@ -127,7 +127,7 @@ namespace LibHac string sdPath = "/" + Util.GetRelativePath(file, SaveDir).Replace('\\', '/'); var nax0 = new Nax0(Keyset, storage, sdPath, false); - save = new Savefile(Keyset, nax0.BaseStorage, IntegrityCheckLevel.None, true); + save = new SaveData(Keyset, nax0.BaseStorage, IntegrityCheckLevel.None, true); } catch (Exception ex) { diff --git a/src/NandReader/Program.cs b/src/NandReader/Program.cs index 74e3dfc0..e41eb999 100644 --- a/src/NandReader/Program.cs +++ b/src/NandReader/Program.cs @@ -103,7 +103,7 @@ namespace NandReader private static List ReadTickets(Keyset keyset, Stream savefile) { var tickets = new List(); - var save = new Savefile(keyset, savefile.AsStorage(), IntegrityCheckLevel.None, true); + var save = new SaveData(keyset, savefile.AsStorage(), IntegrityCheckLevel.None, true); var ticketList = new BinaryReader(save.OpenFile("/ticket_list.bin").AsStream()); var ticketFile = new BinaryReader(save.OpenFile("/ticket.bin").AsStream()); diff --git a/src/NandReaderGui/ViewModel/NandViewModel.cs b/src/NandReaderGui/ViewModel/NandViewModel.cs index b6fc0de0..9068a8cd 100644 --- a/src/NandReaderGui/ViewModel/NandViewModel.cs +++ b/src/NandReaderGui/ViewModel/NandViewModel.cs @@ -87,7 +87,7 @@ namespace NandReaderGui.ViewModel private static List ReadTickets(Keyset keyset, Stream savefile) { var tickets = new List(); - var save = new Savefile(keyset, savefile.AsStorage(), IntegrityCheckLevel.None, true); + var save = new SaveData(keyset, savefile.AsStorage(), IntegrityCheckLevel.None, true); var ticketList = new BinaryReader(save.OpenFile("/ticket_list.bin").AsStream()); var ticketFile = new BinaryReader(save.OpenFile("/ticket.bin").AsStream()); diff --git a/src/hactoolnet/ProcessSave.cs b/src/hactoolnet/ProcessSave.cs index 1c72786d..af740d2c 100644 --- a/src/hactoolnet/ProcessSave.cs +++ b/src/hactoolnet/ProcessSave.cs @@ -14,7 +14,7 @@ namespace hactoolnet { using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.ReadWrite)) { - var save = new Savefile(ctx.Keyset, file.AsStorage(), ctx.Options.IntegrityLevel, true); + var save = new SaveData(ctx.Keyset, file.AsStorage(), ctx.Options.IntegrityLevel, true); if (ctx.Options.Validate) { @@ -62,10 +62,10 @@ namespace hactoolnet string saveDir = Path.Combine(dir, "save"); Directory.CreateDirectory(saveDir); - save.SaveFs.GetHeaderStorage().WriteAllBytes(Path.Combine(saveDir, "Save_Header")); - save.SaveFs.GetBaseStorage().WriteAllBytes(Path.Combine(saveDir, "Save_Data")); - save.SaveFs.AllocationTable.GetHeaderStorage().WriteAllBytes(Path.Combine(saveDir, "FAT_header")); - save.SaveFs.AllocationTable.GetBaseStorage().WriteAllBytes(Path.Combine(saveDir, "FAT_Data")); + save.SaveDataFileSystemCore.GetHeaderStorage().WriteAllBytes(Path.Combine(saveDir, "Save_Header")); + save.SaveDataFileSystemCore.GetBaseStorage().WriteAllBytes(Path.Combine(saveDir, "Save_Data")); + save.SaveDataFileSystemCore.AllocationTable.GetHeaderStorage().WriteAllBytes(Path.Combine(saveDir, "FAT_header")); + save.SaveDataFileSystemCore.AllocationTable.GetBaseStorage().WriteAllBytes(Path.Combine(saveDir, "FAT_Data")); save.Header.DataIvfcMaster.WriteAllBytes(Path.Combine(saveDir, "Save_MasterHash")); @@ -118,7 +118,7 @@ namespace hactoolnet } } - private static string Print(this Savefile save) + private static string Print(this SaveData save) { int colLen = 25; var sb = new StringBuilder(); diff --git a/src/hactoolnet/ProcessSwitchFs.cs b/src/hactoolnet/ProcessSwitchFs.cs index 4d1136fe..f4eae639 100644 --- a/src/hactoolnet/ProcessSwitchFs.cs +++ b/src/hactoolnet/ProcessSwitchFs.cs @@ -286,7 +286,7 @@ namespace hactoolnet private static void ExportSdSaves(Context ctx, SwitchFs switchFs) { - foreach (KeyValuePair save in switchFs.Saves) + foreach (KeyValuePair save in switchFs.Saves) { string outDir = Path.Combine(ctx.Options.SaveOutDir, save.Key); save.Value.Extract(outDir, ctx.Logger);