Redo Reformat and cleanup.

Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted.
This is now done with Rider-stable.
This commit is contained in:
2023-10-04 17:34:40 +01:00
parent bc8bf7a2dc
commit 7363a5d9c5
453 changed files with 7241 additions and 7126 deletions

View File

@@ -133,8 +133,7 @@ public sealed class AppleDouble : IFilter
parentFolder ??= "";
if(filename is null ||
filenameNoExt is null)
if(filename is null || filenameNoExt is null)
return false;
// Prepend data fork name with "R."
@@ -314,8 +313,7 @@ public sealed class AppleDouble : IFilter
parentFolder ??= "";
if(filename is null ||
filenameNoExt is null)
if(filename is null || filenameNoExt is null)
return ErrorNumber.InvalidArgument;
// Prepend data fork name with "R."

View File

@@ -159,8 +159,7 @@ public sealed class AppleSingle : IFilter
/// <inheritdoc />
public bool Identify(byte[] buffer)
{
if(buffer == null ||
buffer.Length < 26)
if(buffer == null || buffer.Length < 26)
return false;
var hdrB = new byte[26];
@@ -173,8 +172,7 @@ public sealed class AppleSingle : IFilter
/// <inheritdoc />
public bool Identify(Stream stream)
{
if(stream == null ||
stream.Length < 26)
if(stream == null || stream.Length < 26)
return false;
var hdrB = new byte[26];

View File

@@ -83,11 +83,7 @@ public class BZip2 : IFilter
/// <inheritdoc />
public bool Identify(byte[] buffer)
{
if(buffer[0] != 0x42 ||
buffer[1] != 0x5A ||
buffer[2] != 0x68 ||
buffer[3] < 0x31 ||
buffer[3] > 0x39)
if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 || buffer[3] > 0x39)
return false;
if(buffer.Length <= 512)
@@ -105,11 +101,7 @@ public class BZip2 : IFilter
stream.EnsureRead(buffer, 0, 4);
stream.Seek(0, SeekOrigin.Begin);
if(buffer[0] != 0x42 ||
buffer[1] != 0x5A ||
buffer[2] != 0x68 ||
buffer[3] < 0x31 ||
buffer[3] > 0x39)
if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 || buffer[3] > 0x39)
return false;
if(stream.Length <= 512)
@@ -136,11 +128,7 @@ public class BZip2 : IFilter
stream.EnsureRead(buffer, 0, 4);
stream.Seek(0, SeekOrigin.Begin);
if(buffer[0] != 0x42 ||
buffer[1] != 0x5A ||
buffer[2] != 0x68 ||
buffer[3] < 0x31 ||
buffer[3] > 0x39)
if(buffer[0] != 0x42 || buffer[1] != 0x5A || buffer[2] != 0x68 || buffer[3] < 0x31 || buffer[3] > 0x39)
return false;
if(stream.Length <= 512)

View File

@@ -82,8 +82,11 @@ public sealed class LZip : IFilter
public bool HasResourceFork => false;
/// <inheritdoc />
public bool Identify(byte[] buffer) => buffer[0] == 0x4C && buffer[1] == 0x5A && buffer[2] == 0x49 &&
buffer[3] == 0x50 && buffer[4] == 0x01;
public bool Identify(byte[] buffer) => buffer[0] == 0x4C &&
buffer[1] == 0x5A &&
buffer[2] == 0x49 &&
buffer[3] == 0x50 &&
buffer[4] == 0x01;
/// <inheritdoc />
public bool Identify(Stream stream)

View File

@@ -150,24 +150,26 @@ public sealed class MacBinary : IFilter
/// <inheritdoc />
public bool Identify(byte[] buffer)
{
if(buffer == null ||
buffer.Length < 128)
if(buffer == null || buffer.Length < 128)
return false;
var hdrB = new byte[128];
Array.Copy(buffer, 0, hdrB, 0, 128);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
return _header.magic == MAGIC ||
_header.version == 0 &&
_header.filename[0] > 0 &&
_header.filename[0] < 64 &&
_header.zero1 == 0 &&
_header is { zero2: 0, reserved: 0 } &&
(_header.dataLength > 0 || _header.resourceLength > 0);
}
/// <inheritdoc />
public bool Identify(Stream stream)
{
if(stream == null ||
stream.Length < 128)
if(stream == null || stream.Length < 128)
return false;
var hdrB = new byte[128];
@@ -175,8 +177,12 @@ public sealed class MacBinary : IFilter
stream.EnsureRead(hdrB, 0, 128);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
return _header.magic == MAGIC ||
_header.version == 0 &&
_header.filename[0] > 0 &&
_header.filename[0] < 64 &&
_header.zero1 == 0 &&
_header is { zero2: 0, reserved: 0 } &&
(_header.dataLength > 0 || _header.resourceLength > 0);
}
@@ -197,8 +203,12 @@ public sealed class MacBinary : IFilter
fstream.Close();
return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
return _header.magic == MAGIC ||
_header.version == 0 &&
_header.filename[0] > 0 &&
_header.filename[0] < 64 &&
_header.zero1 == 0 &&
_header is { zero2: 0, reserved: 0 } &&
(_header.dataLength > 0 || _header.resourceLength > 0);
}

View File

@@ -205,8 +205,7 @@ public sealed class OffsetStream : Stream
/// <param name="start">Start position</param>
/// <param name="end">Last readable position</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">Invalid range</exception>
public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start,
long end)
public OffsetStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync, long start, long end)
{
if(start < 0)
throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number);
@@ -248,8 +247,8 @@ public sealed class OffsetStream : Stream
/// <param name="start">Start position</param>
/// <param name="end">Last readable position</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">Invalid range</exception>
public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize,
bool useAsync, long start, long end)
public OffsetStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync,
long start, long end)
{
if(start < 0)
throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number);
@@ -422,8 +421,7 @@ public sealed class OffsetStream : Stream
/// <param name="start">Start position</param>
/// <param name="end">Last readable position</param>
/// <exception cref="T:System.ArgumentOutOfRangeException">Invalid range</exception>
public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start,
long end)
public OffsetStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible, long start, long end)
{
if(start < 0)
throw new ArgumentOutOfRangeException(nameof(start), Localization.Start_cant_be_a_negative_number);
@@ -593,8 +591,7 @@ public sealed class OffsetStream : Stream
}
/// <inheritdoc />
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback,
object state)
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
if(_baseStream.Position + count > _streamEnd)
throw new IOException(Localization.Cannot_read_past_stream_end);
@@ -603,8 +600,7 @@ public sealed class OffsetStream : Stream
}
/// <inheritdoc />
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback,
object state)
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
{
if(_baseStream.Position + count > _streamEnd)
throw new IOException(Localization.Cannot_write_past_stream_end);

View File

@@ -147,14 +147,13 @@ public sealed class PcExchange : IFilter
Array.Copy(datEntry.dosName, 0, tmpDosNameB, 0, 8);
Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3);
string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + "." +
string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() +
"." +
Encoding.ASCII.GetString(tmpDosExtB).Trim();
string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture);
if(baseFilename != macName &&
baseFilename != dosName &&
baseFilename != dosNameLow)
if(baseFilename != macName && baseFilename != dosName && baseFilename != dosNameLow)
continue;
dataFound |=
@@ -204,14 +203,13 @@ public sealed class PcExchange : IFilter
Array.Copy(datEntry.dosName, 0, tmpDosNameB, 0, 8);
Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3);
string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + "." +
string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() +
"." +
Encoding.ASCII.GetString(tmpDosExtB).Trim();
string dosNameLow = dosName.ToLower(CultureInfo.CurrentCulture);
if(baseFilename != macName &&
baseFilename != dosName &&
baseFilename != dosNameLow)
if(baseFilename != macName && baseFilename != dosName && baseFilename != dosNameLow)
continue;
if(File.Exists(System.IO.Path.Combine(parentFolder, macName ?? throw new InvalidOperationException())))

View File

@@ -81,9 +81,14 @@ public sealed class XZ : IFilter
public bool HasResourceFork => false;
/// <inheritdoc />
public bool Identify(byte[] buffer) => buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A &&
buffer[3] == 0x58 && buffer[4] == 0x5A && buffer[5] == 0x00 &&
buffer[^2] == 0x59 && buffer[^1] == 0x5A;
public bool Identify(byte[] buffer) => buffer[0] == 0xFD &&
buffer[1] == 0x37 &&
buffer[2] == 0x7A &&
buffer[3] == 0x58 &&
buffer[4] == 0x5A &&
buffer[5] == 0x00 &&
buffer[^2] == 0x59 &&
buffer[^1] == 0x5A;
/// <inheritdoc />
public bool Identify(Stream stream)
@@ -100,8 +105,14 @@ public sealed class XZ : IFilter
stream.EnsureRead(footer, 0, 2);
stream.Seek(0, SeekOrigin.Begin);
return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A &&
buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A;
return buffer[0] == 0xFD &&
buffer[1] == 0x37 &&
buffer[2] == 0x7A &&
buffer[3] == 0x58 &&
buffer[4] == 0x5A &&
buffer[5] == 0x00 &&
footer[0] == 0x59 &&
footer[1] == 0x5A;
}
/// <inheritdoc />
@@ -123,8 +134,14 @@ public sealed class XZ : IFilter
stream.EnsureRead(footer, 0, 2);
stream.Seek(0, SeekOrigin.Begin);
return buffer[0] == 0xFD && buffer[1] == 0x37 && buffer[2] == 0x7A && buffer[3] == 0x58 && buffer[4] == 0x5A &&
buffer[5] == 0x00 && footer[0] == 0x59 && footer[1] == 0x5A;
return buffer[0] == 0xFD &&
buffer[1] == 0x37 &&
buffer[2] == 0x7A &&
buffer[3] == 0x58 &&
buffer[4] == 0x5A &&
buffer[5] == 0x00 &&
footer[0] == 0x59 &&
footer[1] == 0x5A;
}
/// <inheritdoc />
@@ -248,8 +265,7 @@ public sealed class XZ : IFilter
while((buf[i++] & 0x80) == 0x80)
{
if(i >= sizeMax ||
buf[i] == 0x00)
if(i >= sizeMax || buf[i] == 0x00)
return 0;
num |= (ulong)(buf[i] & 0x7F) << i * 7;