mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Change names of some enum members
This commit is contained in:
parent
dfff3b1ccf
commit
f0ce5a9946
16 changed files with 30 additions and 30 deletions
|
@ -58,8 +58,8 @@ namespace LibHac.Fs
|
||||||
|
|
||||||
private bool CanReturnEntry(DirectoryEntry entry, bool isSplit)
|
private bool CanReturnEntry(DirectoryEntry entry, bool isSplit)
|
||||||
{
|
{
|
||||||
return Mode.HasFlag(OpenDirectoryMode.Files) && (entry.Type == DirectoryEntryType.File || isSplit) ||
|
return Mode.HasFlag(OpenDirectoryMode.File) && (entry.Type == DirectoryEntryType.File || isSplit) ||
|
||||||
Mode.HasFlag(OpenDirectoryMode.Directories) && entry.Type == DirectoryEntryType.Directory && !isSplit;
|
Mode.HasFlag(OpenDirectoryMode.Directory) && entry.Type == DirectoryEntryType.Directory && !isSplit;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsConcatenationFile(DirectoryEntry entry)
|
private bool IsConcatenationFile(DirectoryEntry entry)
|
||||||
|
|
|
@ -72,7 +72,7 @@ namespace LibHac.Fs
|
||||||
|
|
||||||
if (BaseFileSystem.GetEntryType(PathTools.Combine(path, "00")) != DirectoryEntryType.File) return false;
|
if (BaseFileSystem.GetEntryType(PathTools.Combine(path, "00")) != DirectoryEntryType.File) return false;
|
||||||
|
|
||||||
if (BaseFileSystem.OpenDirectory(path, OpenDirectoryMode.Directories).GetEntryCount() > 0) return false;
|
if (BaseFileSystem.OpenDirectory(path, OpenDirectoryMode.Directory).GetEntryCount() > 0) return false;
|
||||||
|
|
||||||
// Should be enough checks to avoid most false positives. Maybe
|
// Should be enough checks to avoid most false positives. Maybe
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -46,7 +46,7 @@ namespace LibHac.Fs
|
||||||
|
|
||||||
if (offset + size > fileSize)
|
if (offset + size > fileSize)
|
||||||
{
|
{
|
||||||
if ((Mode & OpenMode.Append) == 0)
|
if ((Mode & OpenMode.AllowAppend) == 0)
|
||||||
{
|
{
|
||||||
ThrowHelper.ThrowResult(ResultFs.AllowAppendRequiredForImplicitExtension);
|
ThrowHelper.ThrowResult(ResultFs.AllowAppendRequiredForImplicitExtension);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ namespace LibHac.Fs
|
||||||
{
|
{
|
||||||
Read = 1,
|
Read = 1,
|
||||||
Write = 2,
|
Write = 2,
|
||||||
Append = 4,
|
AllowAppend = 4,
|
||||||
ReadWrite = Read | Write
|
ReadWrite = Read | Write
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ namespace LibHac.Fs
|
||||||
destFs.CreateOrOverwriteFile(subDstPath, entry.Size, options);
|
destFs.CreateOrOverwriteFile(subDstPath, entry.Size, options);
|
||||||
|
|
||||||
using (IFile srcFile = sourceFs.OpenFile(subSrcPath, OpenMode.Read))
|
using (IFile srcFile = sourceFs.OpenFile(subSrcPath, OpenMode.Read))
|
||||||
using (IFile dstFile = destFs.OpenFile(subDstPath, OpenMode.Write | OpenMode.Append))
|
using (IFile dstFile = destFs.OpenFile(subDstPath, OpenMode.Write | OpenMode.AllowAppend))
|
||||||
{
|
{
|
||||||
logger?.LogMessage(subSrcPath);
|
logger?.LogMessage(subSrcPath);
|
||||||
srcFile.CopyTo(dstFile, logger);
|
srcFile.CopyTo(dstFile, logger);
|
||||||
|
@ -142,8 +142,8 @@ namespace LibHac.Fs
|
||||||
|
|
||||||
foreach (DirectoryEntry entry in directory.EnumerateEntries())
|
foreach (DirectoryEntry entry in directory.EnumerateEntries())
|
||||||
{
|
{
|
||||||
if (entry.Type == DirectoryEntryType.Directory && (mode & OpenDirectoryMode.Directories) != 0 ||
|
if (entry.Type == DirectoryEntryType.Directory && (mode & OpenDirectoryMode.Directory) != 0 ||
|
||||||
entry.Type == DirectoryEntryType.File && (mode & OpenDirectoryMode.Files) != 0)
|
entry.Type == DirectoryEntryType.File && (mode & OpenDirectoryMode.File) != 0)
|
||||||
{
|
{
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ namespace LibHac.Fs
|
||||||
/// or write as many bytes as it can and return that number of bytes to the caller.
|
/// or write as many bytes as it can and return that number of bytes to the caller.
|
||||||
///
|
///
|
||||||
/// - If <see cref="Write"/> is called on an offset past the end of the <see cref="IFile"/>,
|
/// - If <see cref="Write"/> is called on an offset past the end of the <see cref="IFile"/>,
|
||||||
/// the <see cref="OpenMode.Append"/> mode is set and the file supports expansion,
|
/// the <see cref="OpenMode.AllowAppend"/> mode is set and the file supports expansion,
|
||||||
/// the file will be expanded so that it is large enough to contain the written data.</remarks>
|
/// the file will be expanded so that it is large enough to contain the written data.</remarks>
|
||||||
public interface IFile : IDisposable
|
public interface IFile : IDisposable
|
||||||
{
|
{
|
||||||
|
|
|
@ -204,9 +204,9 @@ namespace LibHac.Fs
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum OpenDirectoryMode
|
public enum OpenDirectoryMode
|
||||||
{
|
{
|
||||||
Directories = 1,
|
Directory = 1,
|
||||||
Files = 2,
|
File = 2,
|
||||||
All = Directories | Files
|
All = Directory | File
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
@ -73,8 +73,8 @@ namespace LibHac.Fs
|
||||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||||
private static bool CanReturnEntry(bool isDir, OpenDirectoryMode mode)
|
private static bool CanReturnEntry(bool isDir, OpenDirectoryMode mode)
|
||||||
{
|
{
|
||||||
return isDir && (mode & OpenDirectoryMode.Directories) != 0 ||
|
return isDir && (mode & OpenDirectoryMode.Directory) != 0 ||
|
||||||
!isDir && (mode & OpenDirectoryMode.Files) != 0;
|
!isDir && (mode & OpenDirectoryMode.File) != 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace LibHac.Fs
|
||||||
|
|
||||||
public IEnumerable<DirectoryEntry> Read()
|
public IEnumerable<DirectoryEntry> Read()
|
||||||
{
|
{
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Files))
|
if (Mode.HasFlag(OpenDirectoryMode.File))
|
||||||
{
|
{
|
||||||
foreach (PartitionFileEntry entry in ParentFileSystem.Files)
|
foreach (PartitionFileEntry entry in ParentFileSystem.Files)
|
||||||
{
|
{
|
||||||
|
@ -38,7 +38,7 @@ namespace LibHac.Fs
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Files))
|
if (Mode.HasFlag(OpenDirectoryMode.File))
|
||||||
{
|
{
|
||||||
count += ParentFileSystem.Files.Length;
|
count += ParentFileSystem.Files.Length;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ namespace LibHac.Fs
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public PartitionFileSystemBuilder(IFileSystem input)
|
public PartitionFileSystemBuilder(IFileSystem input)
|
||||||
{
|
{
|
||||||
IDirectory rootDir = input.OpenDirectory("/", OpenDirectoryMode.Files);
|
IDirectory rootDir = input.OpenDirectory("/", OpenDirectoryMode.File);
|
||||||
|
|
||||||
foreach (DirectoryEntry file in rootDir.Read().OrderBy(x => x.FullPath, StringComparer.Ordinal))
|
foreach (DirectoryEntry file in rootDir.Read().OrderBy(x => x.FullPath, StringComparer.Ordinal))
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace LibHac.Fs.RomFs
|
||||||
FindPosition position = InitialPosition;
|
FindPosition position = InitialPosition;
|
||||||
HierarchicalRomFileTable<RomFileInfo> tab = ParentFileSystem.FileTable;
|
HierarchicalRomFileTable<RomFileInfo> tab = ParentFileSystem.FileTable;
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Directories))
|
if (Mode.HasFlag(OpenDirectoryMode.Directory))
|
||||||
{
|
{
|
||||||
while (tab.FindNextDirectory(ref position, out string name))
|
while (tab.FindNextDirectory(ref position, out string name))
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace LibHac.Fs.RomFs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Files))
|
if (Mode.HasFlag(OpenDirectoryMode.File))
|
||||||
{
|
{
|
||||||
while (tab.FindNextFile(ref position, out RomFileInfo info, out string name))
|
while (tab.FindNextFile(ref position, out RomFileInfo info, out string name))
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace LibHac.Fs.RomFs
|
||||||
FindPosition position = InitialPosition;
|
FindPosition position = InitialPosition;
|
||||||
HierarchicalRomFileTable<RomFileInfo> tab = ParentFileSystem.FileTable;
|
HierarchicalRomFileTable<RomFileInfo> tab = ParentFileSystem.FileTable;
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Directories))
|
if (Mode.HasFlag(OpenDirectoryMode.Directory))
|
||||||
{
|
{
|
||||||
while (tab.FindNextDirectory(ref position, out string _))
|
while (tab.FindNextDirectory(ref position, out string _))
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ namespace LibHac.Fs.RomFs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Files))
|
if (Mode.HasFlag(OpenDirectoryMode.File))
|
||||||
{
|
{
|
||||||
while (tab.FindNextFile(ref position, out RomFileInfo _, out string _))
|
while (tab.FindNextFile(ref position, out RomFileInfo _, out string _))
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace LibHac.Fs.Save
|
||||||
SaveFindPosition position = InitialPosition;
|
SaveFindPosition position = InitialPosition;
|
||||||
HierarchicalSaveFileTable tab = ParentFileSystem.FileTable;
|
HierarchicalSaveFileTable tab = ParentFileSystem.FileTable;
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Directories))
|
if (Mode.HasFlag(OpenDirectoryMode.Directory))
|
||||||
{
|
{
|
||||||
while (tab.FindNextDirectory(ref position, out string name))
|
while (tab.FindNextDirectory(ref position, out string name))
|
||||||
{
|
{
|
||||||
|
@ -33,7 +33,7 @@ namespace LibHac.Fs.Save
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Files))
|
if (Mode.HasFlag(OpenDirectoryMode.File))
|
||||||
{
|
{
|
||||||
while (tab.FindNextFile(ref position, out SaveFileInfo info, out string name))
|
while (tab.FindNextFile(ref position, out SaveFileInfo info, out string name))
|
||||||
{
|
{
|
||||||
|
@ -49,7 +49,7 @@ namespace LibHac.Fs.Save
|
||||||
SaveFindPosition position = InitialPosition;
|
SaveFindPosition position = InitialPosition;
|
||||||
HierarchicalSaveFileTable tab = ParentFileSystem.FileTable;
|
HierarchicalSaveFileTable tab = ParentFileSystem.FileTable;
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Directories))
|
if (Mode.HasFlag(OpenDirectoryMode.Directory))
|
||||||
{
|
{
|
||||||
while (tab.FindNextDirectory(ref position, out string _))
|
while (tab.FindNextDirectory(ref position, out string _))
|
||||||
{
|
{
|
||||||
|
@ -57,7 +57,7 @@ namespace LibHac.Fs.Save
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Mode.HasFlag(OpenDirectoryMode.Files))
|
if (Mode.HasFlag(OpenDirectoryMode.File))
|
||||||
{
|
{
|
||||||
while (tab.FindNextFile(ref position, out SaveFileInfo _, out string _))
|
while (tab.FindNextFile(ref position, out SaveFileInfo _, out string _))
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,7 +39,7 @@ namespace LibHac.FsClient
|
||||||
public static void CopyFile(this FileSystemManager fs, string sourcePath, string destPath, IProgressReport logger = null)
|
public static void CopyFile(this FileSystemManager fs, string sourcePath, string destPath, IProgressReport logger = null)
|
||||||
{
|
{
|
||||||
using (FileHandle sourceHandle = fs.OpenFile(sourcePath, OpenMode.Read))
|
using (FileHandle sourceHandle = fs.OpenFile(sourcePath, OpenMode.Read))
|
||||||
using (FileHandle destHandle = fs.OpenFile(destPath, OpenMode.Write | OpenMode.Append))
|
using (FileHandle destHandle = fs.OpenFile(destPath, OpenMode.Write | OpenMode.AllowAppend))
|
||||||
{
|
{
|
||||||
const int maxBufferSize = 0x10000;
|
const int maxBufferSize = 0x10000;
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ namespace LibHac.FsService.Creators
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
baseFileSystem.OpenDirectory(path, OpenDirectoryMode.Directories);
|
baseFileSystem.OpenDirectory(path, OpenDirectoryMode.Directory);
|
||||||
}
|
}
|
||||||
catch (HorizonResultException ex)
|
catch (HorizonResultException ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace LibHac.FsService
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
baseFileSystem.OpenDirectory(path, OpenDirectoryMode.Directories);
|
baseFileSystem.OpenDirectory(path, OpenDirectoryMode.Directory);
|
||||||
}
|
}
|
||||||
catch (HorizonResultException ex)
|
catch (HorizonResultException ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -67,7 +67,7 @@ namespace hactoolnet
|
||||||
public static void CopyFileWithProgress(FileSystemManager fs, string sourcePath, string destPath, IProgressReport logger = null)
|
public static void CopyFileWithProgress(FileSystemManager fs, string sourcePath, string destPath, IProgressReport logger = null)
|
||||||
{
|
{
|
||||||
using (FileHandle sourceHandle = fs.OpenFile(sourcePath, OpenMode.Read))
|
using (FileHandle sourceHandle = fs.OpenFile(sourcePath, OpenMode.Read))
|
||||||
using (FileHandle destHandle = fs.OpenFile(destPath, OpenMode.Write | OpenMode.Append))
|
using (FileHandle destHandle = fs.OpenFile(destPath, OpenMode.Write | OpenMode.AllowAppend))
|
||||||
{
|
{
|
||||||
const int maxBufferSize = 1024 * 1024;
|
const int maxBufferSize = 1024 * 1024;
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace hactoolnet
|
||||||
using (var logger = new ProgressBar())
|
using (var logger = new ProgressBar())
|
||||||
{
|
{
|
||||||
ctx.Logger = logger;
|
ctx.Logger = logger;
|
||||||
ctx.Horizon = new Horizon(new TimeSpanTimer());
|
ctx.Horizon = new Horizon(new StopWatchTimeSpanGenerator());
|
||||||
|
|
||||||
if (ctx.Options.AccessLog != null)
|
if (ctx.Options.AccessLog != null)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue