mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
Rename FileBase "Impl" methods
This commit is contained in:
parent
e1ff89060c
commit
dd54249125
15 changed files with 87 additions and 87 deletions
|
@ -17,14 +17,14 @@ namespace LibHac.Fs.Accessors
|
|||
OpenMode = mode;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
CheckIfDisposed();
|
||||
|
||||
return File.Read(out bytesRead, offset, destination, options);
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
CheckIfDisposed();
|
||||
|
||||
|
@ -45,7 +45,7 @@ namespace LibHac.Fs.Accessors
|
|||
return rc;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
CheckIfDisposed();
|
||||
|
||||
|
@ -59,14 +59,14 @@ namespace LibHac.Fs.Accessors
|
|||
return rc;
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
CheckIfDisposed();
|
||||
|
||||
return File.GetSize(out size);
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
CheckIfDisposed();
|
||||
|
||||
|
|
|
@ -9,13 +9,13 @@ namespace LibHac.Fs
|
|||
private int _disposedState;
|
||||
private bool IsDisposed => _disposedState != 0;
|
||||
|
||||
protected abstract Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options);
|
||||
protected abstract Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options);
|
||||
protected abstract Result FlushImpl();
|
||||
protected abstract Result SetSizeImpl(long size);
|
||||
protected abstract Result GetSizeImpl(out long size);
|
||||
protected abstract Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options);
|
||||
protected abstract Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options);
|
||||
protected abstract Result DoFlush();
|
||||
protected abstract Result DoSetSize(long size);
|
||||
protected abstract Result DoGetSize(out long size);
|
||||
|
||||
protected virtual Result OperateRangeImpl(Span<byte> outBuffer, OperationId operationId, long offset, long size,
|
||||
protected virtual Result DoOperateRange(Span<byte> outBuffer, OperationId operationId, long offset, long size,
|
||||
ReadOnlySpan<byte> inBuffer)
|
||||
{
|
||||
return ResultFs.NotImplemented.Log();
|
||||
|
@ -31,7 +31,7 @@ namespace LibHac.Fs
|
|||
if (offset < 0) return ResultFs.OutOfRange.Log();
|
||||
if (long.MaxValue - offset < destination.Length) return ResultFs.OutOfRange.Log();
|
||||
|
||||
return ReadImpl(out bytesRead, offset, destination, options);
|
||||
return DoRead(out bytesRead, offset, destination, options);
|
||||
}
|
||||
|
||||
public Result Write(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
|
@ -42,7 +42,7 @@ namespace LibHac.Fs
|
|||
{
|
||||
if (options.HasFlag(WriteOptionFlag.Flush))
|
||||
{
|
||||
return FlushImpl();
|
||||
return DoFlush();
|
||||
}
|
||||
|
||||
return Result.Success;
|
||||
|
@ -51,14 +51,14 @@ namespace LibHac.Fs
|
|||
if (offset < 0) return ResultFs.OutOfRange.Log();
|
||||
if (long.MaxValue - offset < source.Length) return ResultFs.OutOfRange.Log();
|
||||
|
||||
return WriteImpl(offset, source, options);
|
||||
return DoWrite(offset, source, options);
|
||||
}
|
||||
|
||||
public Result Flush()
|
||||
{
|
||||
if (IsDisposed) return ResultFs.PreconditionViolation.Log();
|
||||
|
||||
return FlushImpl();
|
||||
return DoFlush();
|
||||
}
|
||||
|
||||
public Result SetSize(long size)
|
||||
|
@ -66,7 +66,7 @@ namespace LibHac.Fs
|
|||
if (IsDisposed) return ResultFs.PreconditionViolation.Log();
|
||||
if (size < 0) return ResultFs.OutOfRange.Log();
|
||||
|
||||
return SetSizeImpl(size);
|
||||
return DoSetSize(size);
|
||||
}
|
||||
|
||||
public Result GetSize(out long size)
|
||||
|
@ -77,7 +77,7 @@ namespace LibHac.Fs
|
|||
return ResultFs.PreconditionViolation.Log();
|
||||
}
|
||||
|
||||
return GetSizeImpl(out size);
|
||||
return DoGetSize(out size);
|
||||
}
|
||||
|
||||
public Result OperateRange(Span<byte> outBuffer, OperationId operationId, long offset, long size,
|
||||
|
@ -85,7 +85,7 @@ namespace LibHac.Fs
|
|||
{
|
||||
if (IsDisposed) return ResultFs.PreconditionViolation.Log();
|
||||
|
||||
return OperateRangeImpl(outBuffer, operationId, offset, size, inBuffer);
|
||||
return DoOperateRange(outBuffer, operationId, offset, size, inBuffer);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -180,7 +180,7 @@ namespace LibHac.Fs
|
|||
Mode = mode;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
if (!Mode.HasFlag(OpenMode.Read))
|
||||
{
|
||||
|
@ -191,7 +191,7 @@ namespace LibHac.Fs
|
|||
return BaseStream.Read(out bytesRead, offset, destination);
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
if (!Mode.HasFlag(OpenMode.Write))
|
||||
{
|
||||
|
@ -201,17 +201,17 @@ namespace LibHac.Fs
|
|||
return BaseStream.Write(offset, source, Mode.HasFlag(OpenMode.AllowAppend));
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return BaseStream.Flush();
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
return BaseStream.SetSize(size);
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
return BaseStream.GetSize(out size);
|
||||
}
|
||||
|
|
|
@ -54,7 +54,7 @@ namespace LibHac.FsSystem
|
|||
return key;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -68,14 +68,14 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out bool isResizeNeeded);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
if (isResizeNeeded)
|
||||
{
|
||||
rc = SetSizeImpl(offset + source.Length);
|
||||
rc = DoSetSize(offset + source.Length);
|
||||
if (rc.IsFailure()) return rc;
|
||||
}
|
||||
|
||||
|
@ -90,18 +90,18 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return BaseStorage.Flush();
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = Header.Size;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
Header.SetSize(size, VerificationKey);
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -70,7 +70,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out _);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
@ -107,7 +107,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
foreach (IFile file in Sources)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = default;
|
||||
|
||||
|
@ -133,7 +133,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
Result rc = GetSize(out long currentSize);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
|
|
@ -16,27 +16,27 @@ namespace LibHac.FsSystem
|
|||
Mode = mode;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
return BaseFile.Read(out bytesRead, offset, destination, options);
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
return BaseFile.Write(offset, source, options);
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return BaseFile.Flush();
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
return BaseFile.GetSize(out size);
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
return BaseFile.SetSize(size);
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@ namespace LibHac.FsSystem
|
|||
File = new StreamFile(Stream, mode);
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = 0;
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace LibHac.FsSystem
|
|||
return File.Read(out bytesRead, offset, destination.Slice(0, (int)toRead), options);
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out _);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
@ -45,7 +45,7 @@ namespace LibHac.FsSystem
|
|||
return File.Write(offset, source, options);
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -70,7 +70,7 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace LibHac.FsSystem
|
|||
|
||||
private long Length { get; }
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = 0;
|
||||
|
||||
|
@ -29,23 +29,23 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = Length;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
return ResultFs.UnsupportedOperation.Log();
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace LibHac.FsSystem
|
|||
Size = size;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = 0;
|
||||
|
||||
|
@ -32,7 +32,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out bool isResizeNeeded);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
@ -53,7 +53,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
if (!Mode.HasFlag(OpenMode.Write))
|
||||
{
|
||||
|
@ -63,13 +63,13 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = Size;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
if (!Mode.HasFlag(OpenMode.Write))
|
||||
{
|
||||
|
|
|
@ -123,7 +123,7 @@ namespace LibHac.FsSystem
|
|||
Mode = mode;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -240,7 +240,7 @@ namespace LibHac.FsSystem
|
|||
return rc;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out bool isResizeNeeded);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
@ -257,7 +257,7 @@ namespace LibHac.FsSystem
|
|||
return ParentFs.BaseStorage.Write(ParentFs.DataOffset + _entry.Offset + offset, source);
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
if (Mode.HasFlag(OpenMode.Write))
|
||||
{
|
||||
|
@ -267,7 +267,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
if (Mode.HasFlag(OpenMode.Write))
|
||||
{
|
||||
|
@ -277,14 +277,14 @@ namespace LibHac.FsSystem
|
|||
return ResultFs.InvalidOpenModeForWrite.Log();
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = _entry.Size;
|
||||
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result OperateRangeImpl(Span<byte> outBuffer, OperationId operationId, long offset, long size, ReadOnlySpan<byte> inBuffer)
|
||||
protected override Result DoOperateRange(Span<byte> outBuffer, OperationId operationId, long offset, long size, ReadOnlySpan<byte> inBuffer)
|
||||
{
|
||||
switch (operationId)
|
||||
{
|
||||
|
|
|
@ -12,27 +12,27 @@ namespace LibHac.FsSystem
|
|||
BaseFile = baseFile;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
return BaseFile.Read(out bytesRead, offset, destination, options);
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
return BaseFile.GetSize(out size);
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
return ResultFs.InvalidOpenModeForWrite.Log();
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
return ResultFs.InvalidOpenModeForWrite.Log();
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace LibHac.FsSystem.RomFs
|
|||
Size = size;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -33,23 +33,23 @@ namespace LibHac.FsSystem.RomFs
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
return ResultFs.UnsupportedOperationModifyRomFsFile.Log();
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = Size;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
return ResultFs.UnsupportedOperationModifyRomFsFile.Log();
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace LibHac.FsSystem.Save
|
|||
Size = size;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -42,14 +42,14 @@ namespace LibHac.FsSystem.Save
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out bool isResizeNeeded);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
if (isResizeNeeded)
|
||||
{
|
||||
rc = SetSizeImpl(offset + source.Length);
|
||||
rc = DoSetSize(offset + source.Length);
|
||||
if (rc.IsFailure()) return rc;
|
||||
}
|
||||
|
||||
|
@ -63,18 +63,18 @@ namespace LibHac.FsSystem.Save
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
return BaseStorage.Flush();
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
size = Size;
|
||||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
if (size < 0) throw new ArgumentOutOfRangeException(nameof(size));
|
||||
if (Size == size) return Result.Success;
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace LibHac.FsSystem
|
|||
Mode = mode;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -34,14 +34,14 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out bool isResizeNeeded);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
||||
if (isResizeNeeded)
|
||||
{
|
||||
rc = SetSizeImpl(offset + source.Length);
|
||||
rc = DoSetSize(offset + source.Length);
|
||||
if (rc.IsFailure()) return rc;
|
||||
}
|
||||
|
||||
|
@ -56,7 +56,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
if (!Mode.HasFlag(OpenMode.Write))
|
||||
return Result.Success;
|
||||
|
@ -64,12 +64,12 @@ namespace LibHac.FsSystem
|
|||
return BaseStorage.Flush();
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
return BaseStorage.GetSize(out size);
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
if (!Mode.HasFlag(OpenMode.Write))
|
||||
return ResultFs.InvalidOpenModeForWrite.Log();
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace LibHac.FsSystem
|
|||
Mode = mode;
|
||||
}
|
||||
|
||||
protected override Result ReadImpl(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
protected override Result DoRead(out long bytesRead, long offset, Span<byte> destination, ReadOptionFlag options)
|
||||
{
|
||||
bytesRead = default;
|
||||
|
||||
|
@ -40,7 +40,7 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result WriteImpl(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
protected override Result DoWrite(long offset, ReadOnlySpan<byte> source, WriteOptionFlag options)
|
||||
{
|
||||
Result rc = ValidateWriteParams(offset, source.Length, Mode, out _);
|
||||
if (rc.IsFailure()) return rc;
|
||||
|
@ -59,7 +59,7 @@ namespace LibHac.FsSystem
|
|||
return Result.Success;
|
||||
}
|
||||
|
||||
protected override Result FlushImpl()
|
||||
protected override Result DoFlush()
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
|
@ -68,7 +68,7 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result GetSizeImpl(out long size)
|
||||
protected override Result DoGetSize(out long size)
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ namespace LibHac.FsSystem
|
|||
}
|
||||
}
|
||||
|
||||
protected override Result SetSizeImpl(long size)
|
||||
protected override Result DoSetSize(long size)
|
||||
{
|
||||
lock (Locker)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue