mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Move FsSystem/Save
This commit is contained in:
parent
fef8e16a85
commit
2d86d63fc6
27 changed files with 88 additions and 79 deletions
|
@ -6,7 +6,7 @@ using LibHac.Diag;
|
|||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Tools.FsSystem.Save;
|
||||
using LibHac.Util;
|
||||
|
||||
using OpenType = LibHac.FsSrv.SaveDataOpenTypeSetFileStorage.OpenType;
|
||||
|
|
|
@ -10,7 +10,7 @@ using LibHac.Util;
|
|||
using Buffer = LibHac.Mem.Buffer;
|
||||
using CacheHandle = System.Int64;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.FsSystem;
|
||||
|
||||
/// <summary>
|
||||
/// An <see cref="IStorage"/> that provides buffered access to a base <see cref="IStorage"/>.
|
||||
|
@ -21,7 +21,7 @@ public class BufferedStorage : IStorage
|
|||
private const int InvalidIndex = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Caches a single block of data for a <see cref="Save.BufferedStorage"/>
|
||||
/// Caches a single block of data for a <see cref="FsSystem.BufferedStorage"/>
|
||||
/// </summary>
|
||||
private struct Cache : IDisposable
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Decrements the ref-count and adds the <see cref="Cache"/> to its <see cref="Save.BufferedStorage"/>'s
|
||||
/// Decrements the ref-count and adds the <see cref="Cache"/> to its <see cref="FsSystem.BufferedStorage"/>'s
|
||||
/// fetch list if the <see cref="Cache"/> has no more references, and registering the buffer with
|
||||
/// the <see cref="IBufferManager"/> if not dirty.
|
||||
/// </summary>
|
||||
|
@ -186,7 +186,7 @@ public class BufferedStorage : IStorage
|
|||
|
||||
/// <summary>
|
||||
/// Increments the ref-count and removes the <see cref="Cache"/> from its
|
||||
/// <see cref="Save.BufferedStorage"/>'s fetch list if needed.
|
||||
/// <see cref="FsSystem.BufferedStorage"/>'s fetch list if needed.
|
||||
/// </summary>
|
||||
public void Unlink()
|
||||
{
|
||||
|
@ -557,7 +557,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Allows iteration over the <see cref="Save.BufferedStorage.Cache"/> in a <see cref="Save.BufferedStorage"/>.
|
||||
/// Allows iteration over the <see cref="Cache"/> in a <see cref="FsSystem.BufferedStorage"/>.
|
||||
/// Several options exist for which Caches to iterate.
|
||||
/// </summary>
|
||||
private ref struct SharedCache
|
||||
|
@ -584,11 +584,11 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves to the next <see cref="Save.BufferedStorage.Cache"/> that contains data from the specified range.
|
||||
/// Moves to the next <see cref="FsSystem.BufferedStorage.Cache"/> that contains data from the specified range.
|
||||
/// </summary>
|
||||
/// <param name="offset">The start offset of the range.</param>
|
||||
/// <param name="size">The size of the range.</param>
|
||||
/// <returns><see langword="true"/> if a <see cref="Save.BufferedStorage.Cache"/> from the
|
||||
/// <returns><see langword="true"/> if a <see cref="FsSystem.BufferedStorage.Cache"/> from the
|
||||
/// specified range was found. <see langword="false"/> if no matching Caches exist,
|
||||
/// or if all matching Caches have already been iterated.</returns>
|
||||
public bool AcquireNextOverlappedCache(long offset, long size)
|
||||
|
@ -643,9 +643,9 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves to the next dirty <see cref="Save.BufferedStorage.Cache"/>.
|
||||
/// Moves to the next dirty <see cref="FsSystem.BufferedStorage.Cache"/>.
|
||||
/// </summary>
|
||||
/// <returns><see langword="true"/> if a dirty <see cref="Save.BufferedStorage.Cache"/> was found.
|
||||
/// <returns><see langword="true"/> if a dirty <see cref="FsSystem.BufferedStorage.Cache"/> was found.
|
||||
/// <see langword="false"/> if no dirty Caches exist,
|
||||
/// or if all dirty Caches have already been iterated.</returns>
|
||||
public bool AcquireNextDirtyCache()
|
||||
|
@ -686,9 +686,9 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves to the next valid <see cref="Save.BufferedStorage.Cache"/>.
|
||||
/// Moves to the next valid <see cref="FsSystem.BufferedStorage.Cache"/>.
|
||||
/// </summary>
|
||||
/// <returns><see langword="true"/> if a valid <see cref="Save.BufferedStorage.Cache"/> was found.
|
||||
/// <returns><see langword="true"/> if a valid <see cref="FsSystem.BufferedStorage.Cache"/> was found.
|
||||
/// <see langword="false"/> if no valid Caches exist,
|
||||
/// or if all valid Caches have already been iterated.</returns>
|
||||
public bool AcquireNextValidCache()
|
||||
|
@ -729,10 +729,10 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Moves to a <see cref="Save.BufferedStorage.Cache"/> that can be used for
|
||||
/// Moves to a <see cref="FsSystem.BufferedStorage.Cache"/> that can be used for
|
||||
/// fetching a new block from the base <see cref="IStorage"/>.
|
||||
/// </summary>
|
||||
/// <returns><see langword="true"/> if a <see cref="Save.BufferedStorage.Cache"/> was acquired.
|
||||
/// <returns><see langword="true"/> if a <see cref="FsSystem.BufferedStorage.Cache"/> was acquired.
|
||||
/// Otherwise, <see langword="false"/>.</returns>
|
||||
public bool AcquireFetchableCache()
|
||||
{
|
||||
|
@ -758,9 +758,9 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reads from the current <see cref="Save.BufferedStorage.Cache"/>'s buffer.
|
||||
/// Reads from the current <see cref="FsSystem.BufferedStorage.Cache"/>'s buffer.
|
||||
/// The provided <paramref name="offset"/> must be inside the block of
|
||||
/// data held by the <see cref="Save.BufferedStorage.Cache"/>.
|
||||
/// data held by the <see cref="FsSystem.BufferedStorage.Cache"/>.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset in the base <see cref="IStorage"/> to be read from.</param>
|
||||
/// <param name="buffer">The buffer in which to place the read data.</param>
|
||||
|
@ -772,8 +772,8 @@ public class BufferedStorage : IStorage
|
|||
|
||||
/// <summary>
|
||||
/// Buffers data to be written to the base <see cref="IStorage"/> when the current
|
||||
/// <see cref="Save.BufferedStorage.Cache"/> is flushed. The provided <paramref name="offset"/>
|
||||
/// must be contained by the block of data held by the <see cref="Save.BufferedStorage.Cache"/>.
|
||||
/// <see cref="FsSystem.BufferedStorage.Cache"/> is flushed. The provided <paramref name="offset"/>
|
||||
/// must be contained by the block of data held by the <see cref="FsSystem.BufferedStorage.Cache"/>.
|
||||
/// </summary>
|
||||
/// <param name="offset">The offset in the base <see cref="IStorage"/> to be written to.</param>
|
||||
/// <param name="buffer">The buffer containing the data to be written.</param>
|
||||
|
@ -784,7 +784,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// If the current <see cref="Save.BufferedStorage.Cache"/> is dirty,
|
||||
/// If the current <see cref="FsSystem.BufferedStorage.Cache"/> is dirty,
|
||||
/// flushes its data to the base <see cref="IStorage"/>.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="Result"/> of the operation.</returns>
|
||||
|
@ -795,7 +795,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invalidates the data in the current <see cref="Save.BufferedStorage.Cache"/>.
|
||||
/// Invalidates the data in the current <see cref="FsSystem.BufferedStorage.Cache"/>.
|
||||
/// Any dirty data will be discarded.
|
||||
/// </summary>
|
||||
public void Invalidate()
|
||||
|
@ -805,11 +805,11 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the current <see cref="Save.BufferedStorage.Cache"/> covers any of the specified range.
|
||||
/// Checks if the current <see cref="FsSystem.BufferedStorage.Cache"/> covers any of the specified range.
|
||||
/// </summary>
|
||||
/// <param name="offset">The start offset of the range to check.</param>
|
||||
/// <param name="size">The size of the range to check.</param>
|
||||
/// <returns><see langword="true"/> if the current <see cref="Save.BufferedStorage.Cache"/>'s range
|
||||
/// <returns><see langword="true"/> if the current <see cref="FsSystem.BufferedStorage.Cache"/>'s range
|
||||
/// covers any of the input range. Otherwise, <see langword="false"/>.</returns>
|
||||
public bool Hits(long offset, long size)
|
||||
{
|
||||
|
@ -818,7 +818,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Releases the current <see cref="Save.BufferedStorage.Cache"/> to return to the fetch list.
|
||||
/// Releases the current <see cref="FsSystem.BufferedStorage.Cache"/> to return to the fetch list.
|
||||
/// </summary>
|
||||
private void Release()
|
||||
{
|
||||
|
@ -839,8 +839,8 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides exclusive access to a <see cref="Save.BufferedStorage.Cache"/>
|
||||
/// entry in a <see cref="Save.BufferedStorage"/>.
|
||||
/// Provides exclusive access to a <see cref="Cache"/>
|
||||
/// entry in a <see cref="FsSystem.BufferedStorage"/>.
|
||||
/// </summary>
|
||||
private ref struct UniqueCache
|
||||
{
|
||||
|
@ -856,7 +856,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Disposes the <see cref="UniqueCache"/>, releasing any held <see cref="Save.BufferedStorage.Cache"/>.
|
||||
/// Disposes the <see cref="UniqueCache"/>, releasing any held <see cref="FsSystem.BufferedStorage.Cache"/>.
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
|
@ -870,7 +870,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to gain exclusive access to the <see cref="Save.BufferedStorage.Cache"/> held by
|
||||
/// Attempts to gain exclusive access to the <see cref="FsSystem.BufferedStorage.Cache"/> held by
|
||||
/// <paramref name="sharedCache"/> and prepare it to read a new block from the base <see cref="IStorage"/>.
|
||||
/// </summary>
|
||||
/// <param name="sharedCache">The <see cref="SharedCache"/> to gain exclusive access to.</param>
|
||||
|
@ -894,7 +894,7 @@ public class BufferedStorage : IStorage
|
|||
|
||||
/// <summary>
|
||||
/// Reads the storage block containing the specified offset into the
|
||||
/// <see cref="Save.BufferedStorage.Cache"/>'s buffer, and sets the Cache to that offset.
|
||||
/// <see cref="FsSystem.BufferedStorage.Cache"/>'s buffer, and sets the Cache to that offset.
|
||||
/// </summary>
|
||||
/// <param name="offset">An offset in the block to fetch.</param>
|
||||
/// <returns><see cref="Result.Success"/>: The operation was successful.<br/>
|
||||
|
@ -907,7 +907,7 @@ public class BufferedStorage : IStorage
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills the <see cref="Save.BufferedStorage.Cache"/>'s buffer from an input buffer containing a block of data
|
||||
/// Fills the <see cref="FsSystem.BufferedStorage.Cache"/>'s buffer from an input buffer containing a block of data
|
||||
/// read from the base <see cref="IStorage"/>, and sets the Cache to that offset.
|
||||
/// </summary>
|
||||
/// <param name="offset">The start offset of the block in the base <see cref="IStorage"/>
|
|
@ -3,7 +3,7 @@ using System.Buffers;
|
|||
using System.IO;
|
||||
using LibHac.Crypto;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Tools.FsSystem.Save;
|
||||
|
||||
namespace LibHac.FsSystem;
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ using LibHac.Common;
|
|||
using LibHac.Diag;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Tools.FsSystem.Save;
|
||||
|
||||
namespace LibHac.FsSystem;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ using LibHac.Fs;
|
|||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Ncm;
|
||||
using LibHac.Ns;
|
||||
using LibHac.Tools.FsSystem.Save;
|
||||
using LibHac.Tools.Ncm;
|
||||
using LibHac.Util;
|
||||
|
||||
|
|
|
@ -3,8 +3,9 @@ using System.Diagnostics;
|
|||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class AllocationTable
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class AllocationTableIterator
|
||||
{
|
|
@ -3,7 +3,7 @@ using System.IO;
|
|||
using LibHac.Fs;
|
||||
using LibHac.Util;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class AllocationTableStorage : IStorage
|
||||
{
|
|
@ -2,8 +2,9 @@
|
|||
using System.Collections;
|
||||
using System.IO;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class DuplexBitmap
|
||||
{
|
|
@ -1,7 +1,8 @@
|
|||
using System;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class DuplexStorage : IStorage
|
||||
{
|
|
@ -3,8 +3,9 @@ using System.IO;
|
|||
using LibHac.Common.Keys;
|
||||
using LibHac.Crypto;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class Header
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using LibHac.Fs;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class HierarchicalDuplexStorage : IStorage
|
||||
{
|
|
@ -3,9 +3,10 @@ using System.IO;
|
|||
using System.Runtime.InteropServices;
|
||||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.Util;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class HierarchicalSaveFileTable
|
||||
{
|
|
@ -1,8 +1,9 @@
|
|||
using System.IO;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.Util;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class JournalMap
|
||||
{
|
|
@ -2,8 +2,9 @@
|
|||
using System.Collections;
|
||||
using System.IO;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class JournalStorage : IStorage
|
||||
{
|
|
@ -3,8 +3,9 @@ using System.Collections.Generic;
|
|||
using System.IO;
|
||||
using System.Linq;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class RemapStorage : IStorage
|
||||
{
|
|
@ -4,7 +4,7 @@ using LibHac.Fs;
|
|||
using LibHac.Fs.Fsa;
|
||||
using LibHac.Util;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class SaveDataDirectory : IDirectory
|
||||
{
|
|
@ -4,7 +4,7 @@ using LibHac.Common;
|
|||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class SaveDataFile : IFile
|
||||
{
|
|
@ -5,9 +5,10 @@ using LibHac.Common.Keys;
|
|||
using LibHac.Crypto;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem;
|
||||
using Path = LibHac.Fs.Path;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class SaveDataFileSystem : IFileSystem
|
||||
{
|
|
@ -2,10 +2,11 @@
|
|||
using LibHac.Common;
|
||||
using LibHac.Fs;
|
||||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.Util;
|
||||
using Path = LibHac.Fs.Path;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public class SaveDataFileSystemCore : IFileSystem
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
public static class SaveExtensions
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
internal ref struct SaveEntryKey
|
||||
{
|
|
@ -7,7 +7,7 @@ using LibHac.Common;
|
|||
using LibHac.Fs;
|
||||
using LibHac.Util;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
// todo: Change constraint to "unmanaged" after updating to
|
||||
// a newer SDK https://github.com/dotnet/csharplang/issues/1937
|
|
@ -1,6 +1,6 @@
|
|||
using LibHac.Fs;
|
||||
|
||||
namespace LibHac.FsSystem.Save;
|
||||
namespace LibHac.Tools.FsSystem.Save;
|
||||
|
||||
internal static class SaveResults
|
||||
{
|
|
@ -10,7 +10,7 @@ using LibHac.Fs;
|
|||
using LibHac.Fs.Fsa;
|
||||
using LibHac.Fs.Impl;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Tools.FsSystem.Save;
|
||||
using static hactoolnet.Print;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
|
|
|
@ -9,9 +9,9 @@ using LibHac.Fs;
|
|||
using LibHac.Fs.Fsa;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.NcaUtils;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Ns;
|
||||
using LibHac.Tools.Fs;
|
||||
using LibHac.Tools.FsSystem.Save;
|
||||
using Path = System.IO.Path;
|
||||
|
||||
namespace hactoolnet;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
using System.Collections.Generic;
|
||||
using LibHac.Fs;
|
||||
using LibHac.FsSystem;
|
||||
using LibHac.FsSystem.Save;
|
||||
using LibHac.Tests.Fs;
|
||||
using Xunit;
|
||||
|
||||
|
|
Loading…
Reference in a new issue