From 5acff2acab14ef315058db4ec63eb7cf41bad3f7 Mon Sep 17 00:00:00 2001 From: Alex Barney Date: Sun, 19 Dec 2021 00:10:20 -0700 Subject: [PATCH] Move CachedStorage, SectorStorage and derivatives --- src/LibHac/Boot/Package1.cs | 3 ++- src/LibHac/Boot/Package2StorageReader.cs | 3 ++- .../HierarchicalIntegrityVerificationStorage.cs | 1 + src/LibHac/FsSystem/IntegrityVerificationStorage.cs | 1 + src/LibHac/{ => Tools}/FsSystem/Aes128CtrExStorage.cs | 5 +++-- src/LibHac/{ => Tools}/FsSystem/Aes128CtrStorage.cs | 4 ++-- src/LibHac/{ => Tools}/FsSystem/Aes128CtrTransform.cs | 2 +- src/LibHac/{ => Tools}/FsSystem/Aes128XtsStorage.cs | 4 ++-- src/LibHac/{ => Tools}/FsSystem/Aes128XtsTransform.cs | 2 +- src/LibHac/{ => Tools}/FsSystem/AesCbcStorage.cs | 10 +++++----- src/LibHac/{ => Tools}/FsSystem/CachedStorage.cs | 4 ++-- src/LibHac/{ => Tools}/FsSystem/SectorStorage.cs | 4 ++-- src/hactoolnet/ProcessBench.cs | 1 + src/hactoolnet/ProcessPackage.cs | 1 + tests/LibHac.Tests/AesXts.cs | 4 ++-- 15 files changed, 28 insertions(+), 21 deletions(-) rename src/LibHac/{ => Tools}/FsSystem/Aes128CtrExStorage.cs (98%) rename src/LibHac/{ => Tools}/FsSystem/Aes128CtrStorage.cs (99%) rename src/LibHac/{ => Tools}/FsSystem/Aes128CtrTransform.cs (98%) rename src/LibHac/{ => Tools}/FsSystem/Aes128XtsStorage.cs (98%) rename src/LibHac/{ => Tools}/FsSystem/Aes128XtsTransform.cs (99%) rename src/LibHac/{ => Tools}/FsSystem/AesCbcStorage.cs (96%) rename src/LibHac/{ => Tools}/FsSystem/CachedStorage.cs (99%) rename src/LibHac/{ => Tools}/FsSystem/SectorStorage.cs (98%) diff --git a/src/LibHac/Boot/Package1.cs b/src/LibHac/Boot/Package1.cs index 628555e2..b93972cd 100644 --- a/src/LibHac/Boot/Package1.cs +++ b/src/LibHac/Boot/Package1.cs @@ -7,6 +7,7 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using LibHac.Common.Keys; using LibHac.Diag; +using LibHac.Tools.FsSystem; using LibHac.Util; namespace LibHac.Boot; @@ -550,4 +551,4 @@ public class Package1 { (byte) '2', (byte) '0', (byte) '1', (byte) '8', (byte) '1', (byte) '1', (byte) '0', (byte) '7' }; -} +} \ No newline at end of file diff --git a/src/LibHac/Boot/Package2StorageReader.cs b/src/LibHac/Boot/Package2StorageReader.cs index 87551c3d..f9d77bf7 100644 --- a/src/LibHac/Boot/Package2StorageReader.cs +++ b/src/LibHac/Boot/Package2StorageReader.cs @@ -7,6 +7,7 @@ using LibHac.Crypto; using LibHac.Fs; using LibHac.FsSystem; using LibHac.Kernel; +using LibHac.Tools.FsSystem; namespace LibHac.Boot; @@ -266,4 +267,4 @@ public class Package2StorageReader : IDisposable { return _header.Meta.PayloadSizes[IniPayloadIndex] != 0; } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs b/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs index 69d7f091..045de887 100644 --- a/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs +++ b/src/LibHac/FsSystem/HierarchicalIntegrityVerificationStorage.cs @@ -5,6 +5,7 @@ using System.Security.Cryptography; using System.Text; using LibHac.Common; using LibHac.Fs; +using LibHac.Tools.FsSystem; using LibHac.Util; namespace LibHac.FsSystem; diff --git a/src/LibHac/FsSystem/IntegrityVerificationStorage.cs b/src/LibHac/FsSystem/IntegrityVerificationStorage.cs index 5ee42392..77fc6877 100644 --- a/src/LibHac/FsSystem/IntegrityVerificationStorage.cs +++ b/src/LibHac/FsSystem/IntegrityVerificationStorage.cs @@ -4,6 +4,7 @@ using System.IO; using LibHac.Common; using LibHac.Crypto; using LibHac.Fs; +using LibHac.Tools.FsSystem; using LibHac.Tools.FsSystem.Save; namespace LibHac.FsSystem; diff --git a/src/LibHac/FsSystem/Aes128CtrExStorage.cs b/src/LibHac/Tools/FsSystem/Aes128CtrExStorage.cs similarity index 98% rename from src/LibHac/FsSystem/Aes128CtrExStorage.cs rename to src/LibHac/Tools/FsSystem/Aes128CtrExStorage.cs index decc5e66..8a9c095c 100644 --- a/src/LibHac/FsSystem/Aes128CtrExStorage.cs +++ b/src/LibHac/Tools/FsSystem/Aes128CtrExStorage.cs @@ -2,8 +2,9 @@ using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using LibHac.Fs; +using LibHac.FsSystem; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class Aes128CtrExStorage : Aes128CtrStorage { @@ -111,4 +112,4 @@ public class Aes128CtrExStorage : Aes128CtrStorage Counter[5] = (byte)(value >> 16); Counter[4] = (byte)(value >> 24); } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/Aes128CtrStorage.cs b/src/LibHac/Tools/FsSystem/Aes128CtrStorage.cs similarity index 99% rename from src/LibHac/FsSystem/Aes128CtrStorage.cs rename to src/LibHac/Tools/FsSystem/Aes128CtrStorage.cs index 9da95257..3442976c 100644 --- a/src/LibHac/FsSystem/Aes128CtrStorage.cs +++ b/src/LibHac/Tools/FsSystem/Aes128CtrStorage.cs @@ -3,7 +3,7 @@ using System.Buffers; using System.Buffers.Binary; using LibHac.Fs; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class Aes128CtrStorage : SectorStorage { @@ -121,4 +121,4 @@ public class Aes128CtrStorage : SectorStorage return counter; } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/Aes128CtrTransform.cs b/src/LibHac/Tools/FsSystem/Aes128CtrTransform.cs similarity index 98% rename from src/LibHac/FsSystem/Aes128CtrTransform.cs rename to src/LibHac/Tools/FsSystem/Aes128CtrTransform.cs index 6626f999..4c0a6bc3 100644 --- a/src/LibHac/FsSystem/Aes128CtrTransform.cs +++ b/src/LibHac/Tools/FsSystem/Aes128CtrTransform.cs @@ -6,7 +6,7 @@ using System.Security.Cryptography; using LibHac.Common; using LibHac.Util; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class Aes128CtrTransform { diff --git a/src/LibHac/FsSystem/Aes128XtsStorage.cs b/src/LibHac/Tools/FsSystem/Aes128XtsStorage.cs similarity index 98% rename from src/LibHac/FsSystem/Aes128XtsStorage.cs rename to src/LibHac/Tools/FsSystem/Aes128XtsStorage.cs index b2813fe7..5c9d949f 100644 --- a/src/LibHac/FsSystem/Aes128XtsStorage.cs +++ b/src/LibHac/Tools/FsSystem/Aes128XtsStorage.cs @@ -1,7 +1,7 @@ using System; using LibHac.Fs; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class Aes128XtsStorage : SectorStorage { @@ -75,4 +75,4 @@ public class Aes128XtsStorage : SectorStorage { return BaseStorage.Flush(); } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/Aes128XtsTransform.cs b/src/LibHac/Tools/FsSystem/Aes128XtsTransform.cs similarity index 99% rename from src/LibHac/FsSystem/Aes128XtsTransform.cs rename to src/LibHac/Tools/FsSystem/Aes128XtsTransform.cs index d6957c57..2edccd25 100644 --- a/src/LibHac/FsSystem/Aes128XtsTransform.cs +++ b/src/LibHac/Tools/FsSystem/Aes128XtsTransform.cs @@ -31,7 +31,7 @@ using System.Security.Cryptography; using LibHac.Common; using LibHac.Util; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class Aes128XtsTransform { diff --git a/src/LibHac/FsSystem/AesCbcStorage.cs b/src/LibHac/Tools/FsSystem/AesCbcStorage.cs similarity index 96% rename from src/LibHac/FsSystem/AesCbcStorage.cs rename to src/LibHac/Tools/FsSystem/AesCbcStorage.cs index 36ec8e67..5696fa0e 100644 --- a/src/LibHac/FsSystem/AesCbcStorage.cs +++ b/src/LibHac/Tools/FsSystem/AesCbcStorage.cs @@ -1,9 +1,9 @@ -using LibHac.Crypto; -using LibHac.Fs; -using System; +using System; using LibHac.Common; +using LibHac.Crypto; +using LibHac.Fs; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class AesCbcStorage : SectorStorage { @@ -80,4 +80,4 @@ public class AesCbcStorage : SectorStorage decryptor = tmpDecryptor; return Result.Success; } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/CachedStorage.cs b/src/LibHac/Tools/FsSystem/CachedStorage.cs similarity index 99% rename from src/LibHac/FsSystem/CachedStorage.cs rename to src/LibHac/Tools/FsSystem/CachedStorage.cs index 22029840..59cc92fc 100644 --- a/src/LibHac/FsSystem/CachedStorage.cs +++ b/src/LibHac/Tools/FsSystem/CachedStorage.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using LibHac.Fs; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class CachedStorage : IStorage { @@ -205,4 +205,4 @@ public class CachedStorage : IStorage public int Length { get; set; } public bool Dirty { get; set; } } -} +} \ No newline at end of file diff --git a/src/LibHac/FsSystem/SectorStorage.cs b/src/LibHac/Tools/FsSystem/SectorStorage.cs similarity index 98% rename from src/LibHac/FsSystem/SectorStorage.cs rename to src/LibHac/Tools/FsSystem/SectorStorage.cs index 39d6073f..e8fdc2b4 100644 --- a/src/LibHac/FsSystem/SectorStorage.cs +++ b/src/LibHac/Tools/FsSystem/SectorStorage.cs @@ -2,7 +2,7 @@ using LibHac.Fs; using LibHac.Util; -namespace LibHac.FsSystem; +namespace LibHac.Tools.FsSystem; public class SectorStorage : IStorage { @@ -84,4 +84,4 @@ public class SectorStorage : IStorage if (offset % SectorSize != 0) throw new ArgumentException($"Offset must be a multiple of {SectorSize}"); } -} +} \ No newline at end of file diff --git a/src/hactoolnet/ProcessBench.cs b/src/hactoolnet/ProcessBench.cs index 57b284cb..8681dee1 100644 --- a/src/hactoolnet/ProcessBench.cs +++ b/src/hactoolnet/ProcessBench.cs @@ -9,6 +9,7 @@ using LibHac.Crypto; using LibHac.Crypto.Impl; using LibHac.Fs; using LibHac.FsSystem; +using LibHac.Tools.FsSystem; namespace hactoolnet; diff --git a/src/hactoolnet/ProcessPackage.cs b/src/hactoolnet/ProcessPackage.cs index e1e79c20..1ab47203 100644 --- a/src/hactoolnet/ProcessPackage.cs +++ b/src/hactoolnet/ProcessPackage.cs @@ -6,6 +6,7 @@ using LibHac.Boot; using LibHac.Common; using LibHac.Fs; using LibHac.FsSystem; +using LibHac.Tools.FsSystem; using static hactoolnet.Print; using Path = System.IO.Path; diff --git a/tests/LibHac.Tests/AesXts.cs b/tests/LibHac.Tests/AesXts.cs index 48485847..a2a04882 100644 --- a/tests/LibHac.Tests/AesXts.cs +++ b/tests/LibHac.Tests/AesXts.cs @@ -1,5 +1,5 @@ using System.Linq; -using LibHac.FsSystem; +using LibHac.Tools.FsSystem; using LibHac.Util; using Xunit; @@ -138,4 +138,4 @@ public class AesXts public byte[] GetInitialText(bool decrypting) => decrypting ? CipherText : PlainText; public byte[] GetTransformedText(bool decrypting) => decrypting ? PlainText : CipherText; } -} +} \ No newline at end of file