Reformat and cleanup.

This commit is contained in:
2023-10-03 21:49:17 +01:00
parent a957e741ae
commit dbc5be31a2
32 changed files with 2729 additions and 2498 deletions

View File

@@ -44,10 +44,10 @@ public class AppleRle
/// <returns>The number of decoded bytes</returns>
public static int DecodeBuffer(byte[] source, byte[] destination)
{
int count = 0;
bool nextA = true; // true if A, false if B
var count = 0;
var nextA = true; // true if A, false if B
byte repeatedByteA = 0, repeatedByteB = 0;
bool repeatMode = false; // true if we're repeating, false if we're just copying
var repeatMode = false; // true if we're repeating, false if we're just copying
int inPosition = 0, outPosition = 0;
while(inPosition <= source.Length &&
@@ -87,9 +87,9 @@ public class AppleRle
while(true)
{
byte b1 = source[inPosition++];
byte b2 = source[inPosition++];
short s = (short)((b1 << 8) | b2);
byte b1 = source[inPosition++];
byte b2 = source[inPosition++];
var s = (short)(b1 << 8 | b2);
if(s == 0 ||
s >= DART_CHUNK ||
@@ -101,7 +101,7 @@ public class AppleRle
repeatMode = true;
repeatedByteA = source[inPosition++];
repeatedByteB = source[inPosition++];
count = (-s * 2) - 1;
count = -s * 2 - 1;
nextA = false;
destination[outPosition++] = repeatedByteA;
@@ -110,7 +110,7 @@ public class AppleRle
}
repeatMode = false;
count = (s * 2) - 1;
count = s * 2 - 1;
destination[outPosition++] = source[inPosition++];