diff --git a/Aaru.Checksums b/Aaru.Checksums
index 41d26c705..843291076 160000
--- a/Aaru.Checksums
+++ b/Aaru.Checksums
@@ -1 +1 @@
-Subproject commit 41d26c7057aa40afaf4d43fdd018d9403c2a29a7
+Subproject commit 843291076cd12156aaa09040ecc511eee64db4bd
diff --git a/Aaru.CommonTypes b/Aaru.CommonTypes
index 222d660d6..1fe6700b1 160000
--- a/Aaru.CommonTypes
+++ b/Aaru.CommonTypes
@@ -1 +1 @@
-Subproject commit 222d660d6b2da77b151e0a5a3dcf03c06a5f8343
+Subproject commit 1fe6700b1143a9054ea48903a6a1647060971674
diff --git a/Aaru.Compression/AppleRle.cs b/Aaru.Compression/AppleRle.cs
index d577c8c53..2a39176f5 100644
--- a/Aaru.Compression/AppleRle.cs
+++ b/Aaru.Compression/AppleRle.cs
@@ -39,60 +39,60 @@ namespace Aaru.Compression
{
const uint DART_CHUNK = 20960;
- readonly Stream inStream;
- int count;
- bool nextA; // true if A, false if B
+ readonly Stream _inStream;
+ int _count;
+ bool _nextA; // true if A, false if B
- byte repeatedbyteA, repeatedbyteB;
- bool repeatMode; // true if we're repeating, false if we're just copying
+ byte _repeatedByteA, _repeatedByteB;
+ bool _repeatMode; // true if we're repeating, false if we're just copying
public AppleRle(Stream stream)
{
- inStream = stream;
+ _inStream = stream;
Reset();
}
void Reset()
{
- repeatedbyteA = repeatedbyteB = 0;
- count = 0;
- nextA = true;
- repeatMode = false;
+ _repeatedByteA = _repeatedByteB = 0;
+ _count = 0;
+ _nextA = true;
+ _repeatMode = false;
}
public int ProduceByte()
{
- if(repeatMode && count > 0)
+ if(_repeatMode && _count > 0)
{
- count--;
+ _count--;
- if(nextA)
+ if(_nextA)
{
- nextA = false;
+ _nextA = false;
- return repeatedbyteA;
+ return _repeatedByteA;
}
- nextA = true;
+ _nextA = true;
- return repeatedbyteB;
+ return _repeatedByteB;
}
- if(!repeatMode &&
- count > 0)
+ if(!_repeatMode &&
+ _count > 0)
{
- count--;
+ _count--;
- return inStream.ReadByte();
+ return _inStream.ReadByte();
}
- if(inStream.Position == inStream.Length)
+ if(_inStream.Position == _inStream.Length)
return -1;
while(true)
{
- byte b1 = (byte)inStream.ReadByte();
- byte b2 = (byte)inStream.ReadByte();
+ byte b1 = (byte)_inStream.ReadByte();
+ byte b2 = (byte)_inStream.ReadByte();
short s = (short)((b1 << 8) | b2);
if(s == 0 ||
@@ -102,22 +102,22 @@ namespace Aaru.Compression
if(s < 0)
{
- repeatMode = true;
- repeatedbyteA = (byte)inStream.ReadByte();
- repeatedbyteB = (byte)inStream.ReadByte();
- count = (-s * 2) - 1;
- nextA = false;
+ _repeatMode = true;
+ _repeatedByteA = (byte)_inStream.ReadByte();
+ _repeatedByteB = (byte)_inStream.ReadByte();
+ _count = (-s * 2) - 1;
+ _nextA = false;
- return repeatedbyteA;
+ return _repeatedByteA;
}
if(s <= 0)
continue;
- repeatMode = false;
- count = (s * 2) - 1;
+ _repeatMode = false;
+ _count = (s * 2) - 1;
- return inStream.ReadByte();
+ return _inStream.ReadByte();
}
}
}
diff --git a/Aaru.Compression/TeleDiskLzh.cs b/Aaru.Compression/TeleDiskLzh.cs
index 236b2129f..486ab8e0c 100644
--- a/Aaru.Compression/TeleDiskLzh.cs
+++ b/Aaru.Compression/TeleDiskLzh.cs
@@ -77,7 +77,7 @@ namespace Aaru.Compression
*/
/* decoder table */
- readonly byte[] d_code =
+ readonly byte[] _dCode =
{
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
@@ -96,7 +96,7 @@ namespace Aaru.Compression
0x3C, 0x3D, 0x3E, 0x3F
};
- readonly byte[] d_len =
+ readonly byte[] _dLen =
{
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04,
@@ -114,40 +114,40 @@ namespace Aaru.Compression
0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08,
0x08, 0x08, 0x08, 0x08
};
- readonly ushort[] freq = new ushort[T + 1]; /* cumulative freq table */
+ readonly ushort[] _freq = new ushort[T + 1]; /* cumulative freq table */
- readonly Stream inStream;
+ readonly Stream _inStream;
/*
* pointing parent nodes.
* area [T..(T + N_CHAR - 1)] are pointers for leaves
*/
- readonly short[] prnt = new short[T + N_CHAR];
+ readonly short[] _prnt = new short[T + N_CHAR];
/* pointing children nodes (son[], son[] + 1)*/
- readonly short[] son = new short[T];
- readonly byte[] text_buf = new byte[(N + F) - 1];
+ readonly short[] _son = new short[T];
+ readonly byte[] _textBuf = new byte[(N + F) - 1];
- ushort getbuf;
- byte getlen;
+ ushort _getbuf;
+ byte _getlen;
- Tdlzhuf tdctl;
+ Tdlzhuf _tdctl;
public TeleDiskLzh(Stream dataStream)
{
int i;
- getbuf = 0;
- getlen = 0;
- tdctl = new Tdlzhuf();
- tdctl.Ibufcnt = tdctl.Ibufndx = 0; // input buffer is empty
- tdctl.Bufcnt = 0;
+ _getbuf = 0;
+ _getlen = 0;
+ _tdctl = new Tdlzhuf();
+ _tdctl.Ibufcnt = _tdctl.Ibufndx = 0; // input buffer is empty
+ _tdctl.Bufcnt = 0;
StartHuff();
for(i = 0; i < N - F; i++)
- text_buf[i] = 0x20;
+ _textBuf[i] = 0x20;
- tdctl.R = N - F;
- inStream = dataStream;
+ _tdctl.R = N - F;
+ _inStream = dataStream;
}
/* DeCompression
@@ -163,16 +163,16 @@ namespace Aaru.Compression
int count; // was an unsigned long, seems unnecessary
for(count = 0; count < len;)
- if(tdctl.Bufcnt == 0)
+ if(_tdctl.Bufcnt == 0)
{
if((c = DecodeChar()) < 0)
return count; // fatal error
if(c < 256)
{
- buf[count] = (byte)c;
- text_buf[tdctl.R++] = (byte)c;
- tdctl.R &= N - 1;
+ buf[count] = (byte)c;
+ _textBuf[_tdctl.R++] = (byte)c;
+ _tdctl.R &= N - 1;
count++;
}
else
@@ -182,28 +182,28 @@ namespace Aaru.Compression
if((pos = DecodePosition()) < 0)
return count; // fatal error
- tdctl.Bufpos = (ushort)((tdctl.R - pos - 1) & (N - 1));
- tdctl.Bufcnt = (ushort)((c - 255) + THRESHOLD);
- tdctl.Bufndx = 0;
+ _tdctl.Bufpos = (ushort)((_tdctl.R - pos - 1) & (N - 1));
+ _tdctl.Bufcnt = (ushort)((c - 255) + THRESHOLD);
+ _tdctl.Bufndx = 0;
}
}
else
{
// still chars from last string
- while(tdctl.Bufndx < tdctl.Bufcnt &&
- count < len)
+ while(_tdctl.Bufndx < _tdctl.Bufcnt &&
+ count < len)
{
- c = text_buf[(tdctl.Bufpos + tdctl.Bufndx) & (N - 1)];
+ c = _textBuf[(_tdctl.Bufpos + _tdctl.Bufndx) & (N - 1)];
buf[count] = (byte)c;
- tdctl.Bufndx++;
- text_buf[tdctl.R++] = (byte)c;
- tdctl.R &= N - 1;
+ _tdctl.Bufndx++;
+ _textBuf[_tdctl.R++] = (byte)c;
+ _tdctl.R &= N - 1;
count++;
}
// reset bufcnt after copy string from text_buf[]
- if(tdctl.Bufndx >= tdctl.Bufcnt)
- tdctl.Bufndx = tdctl.Bufcnt = 0;
+ if(_tdctl.Bufndx >= _tdctl.Bufcnt)
+ _tdctl.Bufndx = _tdctl.Bufcnt = 0;
}
return count; // count == len, success
@@ -211,31 +211,31 @@ namespace Aaru.Compression
long DataRead(out byte[] buf, long size)
{
- if(size > inStream.Length - inStream.Position)
- size = inStream.Length - inStream.Position;
+ if(size > _inStream.Length - _inStream.Position)
+ size = _inStream.Length - _inStream.Position;
buf = new byte[size];
- inStream.Read(buf, 0, (int)size);
+ _inStream.Read(buf, 0, (int)size);
return size;
}
int NextWord()
{
- if(tdctl.Ibufndx >= tdctl.Ibufcnt)
+ if(_tdctl.Ibufndx >= _tdctl.Ibufcnt)
{
- tdctl.Ibufndx = 0;
- tdctl.Ibufcnt = (ushort)DataRead(out tdctl.Inbuf, BUFSZ);
+ _tdctl.Ibufndx = 0;
+ _tdctl.Ibufcnt = (ushort)DataRead(out _tdctl.Inbuf, BUFSZ);
- if(tdctl.Ibufcnt <= 0)
+ if(_tdctl.Ibufcnt <= 0)
return -1;
}
- while(getlen <= 8)
+ while(_getlen <= 8)
{
// typically reads a word at a time
- getbuf |= (ushort)(tdctl.Inbuf[tdctl.Ibufndx++] << (8 - getlen));
- getlen += 8;
+ _getbuf |= (ushort)(_tdctl.Inbuf[_tdctl.Ibufndx++] << (8 - _getlen));
+ _getlen += 8;
}
return 0;
@@ -246,9 +246,9 @@ namespace Aaru.Compression
if(NextWord() < 0)
return -1;
- short i = (short)getbuf;
- getbuf <<= 1;
- getlen--;
+ short i = (short)_getbuf;
+ _getbuf <<= 1;
+ _getlen--;
return i < 0 ? 1 : 0;
}
@@ -258,10 +258,10 @@ namespace Aaru.Compression
if(NextWord() != 0)
return -1;
- ushort i = getbuf;
- getbuf <<= 8;
- getlen -= 8;
- i = (ushort)(i >> 8);
+ ushort i = _getbuf;
+ _getbuf <<= 8;
+ _getlen -= 8;
+ i = (ushort)(i >> 8);
return i;
}
@@ -274,9 +274,9 @@ namespace Aaru.Compression
for(i = 0; i < N_CHAR; i++)
{
- freq[i] = 1;
- son[i] = (short)(i + T);
- prnt[i + T] = (short)i;
+ _freq[i] = 1;
+ _son[i] = (short)(i + T);
+ _prnt[i + T] = (short)i;
}
i = 0;
@@ -284,15 +284,15 @@ namespace Aaru.Compression
while(j <= ROOT)
{
- freq[j] = (ushort)(freq[i] + freq[i + 1]);
- son[j] = (short)i;
- prnt[i] = prnt[i + 1] = (short)j;
- i += 2;
+ _freq[j] = (ushort)(_freq[i] + _freq[i + 1]);
+ _son[j] = (short)i;
+ _prnt[i] = _prnt[i + 1] = (short)j;
+ i += 2;
j++;
}
- freq[T] = 0xffff;
- prnt[ROOT] = 0;
+ _freq[T] = 0xffff;
+ _prnt[ROOT] = 0;
}
/* reconstruct freq tree */
@@ -305,10 +305,10 @@ namespace Aaru.Compression
short j = 0;
for(i = 0; i < T; i++)
- if(son[i] >= T)
+ if(_son[i] >= T)
{
- freq[j] = (ushort)((freq[i] + 1) / 2);
- son[j] = son[i];
+ _freq[j] = (ushort)((_freq[i] + 1) / 2);
+ _son[j] = _son[i];
j++;
}
@@ -316,75 +316,75 @@ namespace Aaru.Compression
for(i = 0, j = N_CHAR; j < T; i += 2, j++)
{
k = (short)(i + 1);
- ushort f = freq[j] = (ushort)(freq[i] + freq[k]);
+ ushort f = _freq[j] = (ushort)(_freq[i] + _freq[k]);
- for(k = (short)(j - 1); f < freq[k]; k--) {}
+ for(k = (short)(j - 1); f < _freq[k]; k--) {}
k++;
ushort l = (ushort)((j - k) * 2);
- Array.ConstrainedCopy(freq, k, freq, k + 1, l);
- freq[k] = f;
- Array.ConstrainedCopy(son, k, son, k + 1, l);
- son[k] = i;
+ Array.ConstrainedCopy(_freq, k, _freq, k + 1, l);
+ _freq[k] = f;
+ Array.ConstrainedCopy(_son, k, _son, k + 1, l);
+ _son[k] = i;
}
/* connect parent nodes */
for(i = 0; i < T; i++)
- if((k = son[i]) >= T)
- prnt[k] = i;
+ if((k = _son[i]) >= T)
+ _prnt[k] = i;
else
- prnt[k] = prnt[k + 1] = i;
+ _prnt[k] = _prnt[k + 1] = i;
}
/* update freq tree */
void Update(int c)
{
- if(freq[ROOT] == MAX_FREQ)
+ if(_freq[ROOT] == MAX_FREQ)
Reconst();
- c = prnt[c + T];
+ c = _prnt[c + T];
do
{
- int k = ++freq[c];
+ int k = ++_freq[c];
/* swap nodes to keep the tree freq-ordered */
int l;
- if(k <= freq[l = c + 1])
+ if(k <= _freq[l = c + 1])
continue;
- while(k > freq[++l]) {}
+ while(k > _freq[++l]) {}
l--;
- freq[c] = freq[l];
- freq[l] = (ushort)k;
+ _freq[c] = _freq[l];
+ _freq[l] = (ushort)k;
- int i = son[c];
- prnt[i] = (short)l;
+ int i = _son[c];
+ _prnt[i] = (short)l;
if(i < T)
- prnt[i + 1] = (short)l;
+ _prnt[i + 1] = (short)l;
- int j = son[l];
- son[l] = (short)i;
+ int j = _son[l];
+ _son[l] = (short)i;
- prnt[j] = (short)c;
+ _prnt[j] = (short)c;
if(j < T)
- prnt[j + 1] = (short)c;
+ _prnt[j + 1] = (short)c;
- son[c] = (short)j;
+ _son[c] = (short)j;
c = l;
- } while((c = prnt[c]) != 0); /* do it until reaching the root */
+ } while((c = _prnt[c]) != 0); /* do it until reaching the root */
}
short DecodeChar()
{
- ushort c = (ushort)son[ROOT];
+ ushort c = (ushort)_son[ROOT];
/*
* start searching tree from the root to leaves.
@@ -399,7 +399,7 @@ namespace Aaru.Compression
return -1;
c += (ushort)ret;
- c = (ushort)son[c];
+ c = (ushort)_son[c];
}
c -= T;
@@ -417,8 +417,8 @@ namespace Aaru.Compression
return -1;
ushort i = (ushort)bit;
- ushort c = (ushort)(d_code[i] << 6);
- ushort j = d_len[i];
+ ushort c = (ushort)(_dCode[i] << 6);
+ ushort j = _dLen[i];
/* input lower 6 bits directly */
j -= 2;
diff --git a/Aaru.Core/Checksum.cs b/Aaru.Core/Checksum.cs
index 2bc4c15f7..89ea07ed6 100644
--- a/Aaru.Core/Checksum.cs
+++ b/Aaru.Core/Checksum.cs
@@ -53,304 +53,304 @@ namespace Aaru.Core
/// Checksums and hashes data, with different algorithms multithreaded
public class Checksum
{
- readonly IChecksum adler32Ctx;
- readonly IChecksum crc16Ctx;
- readonly IChecksum crc32Ctx;
- readonly IChecksum crc64Ctx;
- readonly EnableChecksum enabled;
- readonly IChecksum f16Ctx;
- readonly IChecksum f32Ctx;
- readonly IChecksum md5Ctx;
- readonly IChecksum sha1Ctx;
- readonly IChecksum sha256Ctx;
- readonly IChecksum sha384Ctx;
- readonly IChecksum sha512Ctx;
- readonly IChecksum ssctx;
- HashPacket adlerPkt;
- Thread adlerThread;
- HashPacket crc16Pkt;
- Thread crc16Thread;
- HashPacket crc32Pkt;
- Thread crc32Thread;
- HashPacket crc64Pkt;
- Thread crc64Thread;
- HashPacket f16Pkt;
- Thread f16Thread;
- HashPacket f32Pkt;
- Thread f32Thread;
- HashPacket md5Pkt;
- Thread md5Thread;
- HashPacket sha1Pkt;
- Thread sha1Thread;
- HashPacket sha256Pkt;
- Thread sha256Thread;
- HashPacket sha384Pkt;
- Thread sha384Thread;
- HashPacket sha512Pkt;
- Thread sha512Thread;
- HashPacket spamsumPkt;
- Thread spamsumThread;
+ readonly IChecksum _adler32Ctx;
+ readonly IChecksum _crc16Ctx;
+ readonly IChecksum _crc32Ctx;
+ readonly IChecksum _crc64Ctx;
+ readonly EnableChecksum _enabled;
+ readonly IChecksum _f16Ctx;
+ readonly IChecksum _f32Ctx;
+ readonly IChecksum _md5Ctx;
+ readonly IChecksum _sha1Ctx;
+ readonly IChecksum _sha256Ctx;
+ readonly IChecksum _sha384Ctx;
+ readonly IChecksum _sha512Ctx;
+ readonly IChecksum _ssCtx;
+ HashPacket _adlerPkt;
+ Thread _adlerThread;
+ HashPacket _crc16Pkt;
+ Thread _crc16Thread;
+ HashPacket _crc32Pkt;
+ Thread _crc32Thread;
+ HashPacket _crc64Pkt;
+ Thread _crc64Thread;
+ HashPacket _f16Pkt;
+ Thread _f16Thread;
+ HashPacket _f32Pkt;
+ Thread _f32Thread;
+ HashPacket _md5Pkt;
+ Thread _md5Thread;
+ HashPacket _sha1Pkt;
+ Thread _sha1Thread;
+ HashPacket _sha256Pkt;
+ Thread _sha256Thread;
+ HashPacket _sha384Pkt;
+ Thread _sha384Thread;
+ HashPacket _sha512Pkt;
+ Thread _sha512Thread;
+ HashPacket _spamsumPkt;
+ Thread _spamsumThread;
public Checksum(EnableChecksum enabled = EnableChecksum.All)
{
- this.enabled = enabled;
+ _enabled = enabled;
if(enabled.HasFlag(EnableChecksum.Adler32))
{
- adler32Ctx = new Adler32Context();
+ _adler32Ctx = new Adler32Context();
- adlerPkt = new HashPacket
+ _adlerPkt = new HashPacket
{
- Context = adler32Ctx
+ Context = _adler32Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Crc16))
{
- crc16Ctx = new CRC16IBMContext();
+ _crc16Ctx = new CRC16IBMContext();
- crc16Pkt = new HashPacket
+ _crc16Pkt = new HashPacket
{
- Context = crc16Ctx
+ Context = _crc16Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Crc32))
{
- crc32Ctx = new Crc32Context();
+ _crc32Ctx = new Crc32Context();
- crc32Pkt = new HashPacket
+ _crc32Pkt = new HashPacket
{
- Context = crc32Ctx
+ Context = _crc32Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Crc64))
{
- crc64Ctx = new Crc64Context();
+ _crc64Ctx = new Crc64Context();
- crc64Pkt = new HashPacket
+ _crc64Pkt = new HashPacket
{
- Context = crc64Ctx
+ Context = _crc64Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Md5))
{
- md5Ctx = new Md5Context();
+ _md5Ctx = new Md5Context();
- md5Pkt = new HashPacket
+ _md5Pkt = new HashPacket
{
- Context = md5Ctx
+ Context = _md5Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Sha1))
{
- sha1Ctx = new Sha1Context();
+ _sha1Ctx = new Sha1Context();
- sha1Pkt = new HashPacket
+ _sha1Pkt = new HashPacket
{
- Context = sha1Ctx
+ Context = _sha1Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Sha256))
{
- sha256Ctx = new Sha256Context();
+ _sha256Ctx = new Sha256Context();
- sha256Pkt = new HashPacket
+ _sha256Pkt = new HashPacket
{
- Context = sha256Ctx
+ Context = _sha256Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Sha384))
{
- sha384Ctx = new Sha384Context();
+ _sha384Ctx = new Sha384Context();
- sha384Pkt = new HashPacket
+ _sha384Pkt = new HashPacket
{
- Context = sha384Ctx
+ Context = _sha384Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Sha512))
{
- sha512Ctx = new Sha512Context();
+ _sha512Ctx = new Sha512Context();
- sha512Pkt = new HashPacket
+ _sha512Pkt = new HashPacket
{
- Context = sha512Ctx
+ Context = _sha512Ctx
};
}
if(enabled.HasFlag(EnableChecksum.SpamSum))
{
- ssctx = new SpamSumContext();
+ _ssCtx = new SpamSumContext();
- spamsumPkt = new HashPacket
+ _spamsumPkt = new HashPacket
{
- Context = ssctx
+ Context = _ssCtx
};
}
if(enabled.HasFlag(EnableChecksum.Fletcher16))
{
- f16Ctx = new Fletcher16Context();
+ _f16Ctx = new Fletcher16Context();
- f16Pkt = new HashPacket
+ _f16Pkt = new HashPacket
{
- Context = f16Ctx
+ Context = _f16Ctx
};
}
if(enabled.HasFlag(EnableChecksum.Fletcher32))
{
- f32Ctx = new Fletcher32Context();
+ _f32Ctx = new Fletcher32Context();
- f32Pkt = new HashPacket
+ _f32Pkt = new HashPacket
{
- Context = f32Ctx
+ Context = _f32Ctx
};
}
- adlerThread = new Thread(UpdateHash);
- crc16Thread = new Thread(UpdateHash);
- crc32Thread = new Thread(UpdateHash);
- crc64Thread = new Thread(UpdateHash);
- md5Thread = new Thread(UpdateHash);
- sha1Thread = new Thread(UpdateHash);
- sha256Thread = new Thread(UpdateHash);
- sha384Thread = new Thread(UpdateHash);
- sha512Thread = new Thread(UpdateHash);
- spamsumThread = new Thread(UpdateHash);
- f16Thread = new Thread(UpdateHash);
- f32Thread = new Thread(UpdateHash);
+ _adlerThread = new Thread(UpdateHash);
+ _crc16Thread = new Thread(UpdateHash);
+ _crc32Thread = new Thread(UpdateHash);
+ _crc64Thread = new Thread(UpdateHash);
+ _md5Thread = new Thread(UpdateHash);
+ _sha1Thread = new Thread(UpdateHash);
+ _sha256Thread = new Thread(UpdateHash);
+ _sha384Thread = new Thread(UpdateHash);
+ _sha512Thread = new Thread(UpdateHash);
+ _spamsumThread = new Thread(UpdateHash);
+ _f16Thread = new Thread(UpdateHash);
+ _f32Thread = new Thread(UpdateHash);
}
public void Update(byte[] data)
{
- if(enabled.HasFlag(EnableChecksum.Adler32))
+ if(_enabled.HasFlag(EnableChecksum.Adler32))
{
- adlerPkt.Data = data;
- adlerThread.Start(adlerPkt);
+ _adlerPkt.Data = data;
+ _adlerThread.Start(_adlerPkt);
}
- if(enabled.HasFlag(EnableChecksum.Crc16))
+ if(_enabled.HasFlag(EnableChecksum.Crc16))
{
- crc16Pkt.Data = data;
- crc16Thread.Start(crc16Pkt);
+ _crc16Pkt.Data = data;
+ _crc16Thread.Start(_crc16Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Crc32))
+ if(_enabled.HasFlag(EnableChecksum.Crc32))
{
- crc32Pkt.Data = data;
- crc32Thread.Start(crc32Pkt);
+ _crc32Pkt.Data = data;
+ _crc32Thread.Start(_crc32Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Crc64))
+ if(_enabled.HasFlag(EnableChecksum.Crc64))
{
- crc64Pkt.Data = data;
- crc64Thread.Start(crc64Pkt);
+ _crc64Pkt.Data = data;
+ _crc64Thread.Start(_crc64Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Md5))
+ if(_enabled.HasFlag(EnableChecksum.Md5))
{
- md5Pkt.Data = data;
- md5Thread.Start(md5Pkt);
+ _md5Pkt.Data = data;
+ _md5Thread.Start(_md5Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Sha1))
+ if(_enabled.HasFlag(EnableChecksum.Sha1))
{
- sha1Pkt.Data = data;
- sha1Thread.Start(sha1Pkt);
+ _sha1Pkt.Data = data;
+ _sha1Thread.Start(_sha1Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Sha256))
+ if(_enabled.HasFlag(EnableChecksum.Sha256))
{
- sha256Pkt.Data = data;
- sha256Thread.Start(sha256Pkt);
+ _sha256Pkt.Data = data;
+ _sha256Thread.Start(_sha256Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Sha384))
+ if(_enabled.HasFlag(EnableChecksum.Sha384))
{
- sha384Pkt.Data = data;
- sha384Thread.Start(sha384Pkt);
+ _sha384Pkt.Data = data;
+ _sha384Thread.Start(_sha384Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Sha512))
+ if(_enabled.HasFlag(EnableChecksum.Sha512))
{
- sha512Pkt.Data = data;
- sha512Thread.Start(sha512Pkt);
+ _sha512Pkt.Data = data;
+ _sha512Thread.Start(_sha512Pkt);
}
- if(enabled.HasFlag(EnableChecksum.SpamSum))
+ if(_enabled.HasFlag(EnableChecksum.SpamSum))
{
- spamsumPkt.Data = data;
- spamsumThread.Start(spamsumPkt);
+ _spamsumPkt.Data = data;
+ _spamsumThread.Start(_spamsumPkt);
}
- if(enabled.HasFlag(EnableChecksum.Fletcher16))
+ if(_enabled.HasFlag(EnableChecksum.Fletcher16))
{
- f16Pkt.Data = data;
- f16Thread.Start(f16Pkt);
+ _f16Pkt.Data = data;
+ _f16Thread.Start(_f16Pkt);
}
- if(enabled.HasFlag(EnableChecksum.Fletcher32))
+ if(_enabled.HasFlag(EnableChecksum.Fletcher32))
{
- f32Pkt.Data = data;
- f32Thread.Start(f32Pkt);
+ _f32Pkt.Data = data;
+ _f32Thread.Start(_f32Pkt);
}
- while(adlerThread.IsAlive ||
- crc16Thread.IsAlive ||
- crc32Thread.IsAlive ||
- crc64Thread.IsAlive ||
- md5Thread.IsAlive ||
- sha1Thread.IsAlive ||
- sha256Thread.IsAlive ||
- sha384Thread.IsAlive ||
- sha512Thread.IsAlive ||
- spamsumThread.IsAlive ||
- f16Thread.IsAlive ||
- f32Thread.IsAlive) {}
+ while(_adlerThread.IsAlive ||
+ _crc16Thread.IsAlive ||
+ _crc32Thread.IsAlive ||
+ _crc64Thread.IsAlive ||
+ _md5Thread.IsAlive ||
+ _sha1Thread.IsAlive ||
+ _sha256Thread.IsAlive ||
+ _sha384Thread.IsAlive ||
+ _sha512Thread.IsAlive ||
+ _spamsumThread.IsAlive ||
+ _f16Thread.IsAlive ||
+ _f32Thread.IsAlive) {}
- if(enabled.HasFlag(EnableChecksum.Adler32))
- adlerThread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Adler32))
+ _adlerThread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Crc16))
- crc16Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Crc16))
+ _crc16Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Crc32))
- crc32Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Crc32))
+ _crc32Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Crc16))
- crc64Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Crc16))
+ _crc64Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Md5))
- md5Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Md5))
+ _md5Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Sha1))
- sha1Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Sha1))
+ _sha1Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Sha256))
- sha256Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Sha256))
+ _sha256Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Sha384))
- sha384Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Sha384))
+ _sha384Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Sha512))
- sha512Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Sha512))
+ _sha512Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.SpamSum))
- spamsumThread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.SpamSum))
+ _spamsumThread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Fletcher16))
- f16Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Fletcher16))
+ _f16Thread = new Thread(UpdateHash);
- if(enabled.HasFlag(EnableChecksum.Fletcher32))
- f32Thread = new Thread(UpdateHash);
+ if(_enabled.HasFlag(EnableChecksum.Fletcher32))
+ _f32Thread = new Thread(UpdateHash);
}
public List End()
@@ -359,134 +359,134 @@ namespace Aaru.Core
ChecksumType chk;
- if(enabled.HasFlag(EnableChecksum.All))
+ if(_enabled.HasFlag(EnableChecksum.All))
{
chk = new ChecksumType
{
type = ChecksumTypeType.adler32,
- Value = adler32Ctx.End()
+ Value = _adler32Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Crc16))
+ if(_enabled.HasFlag(EnableChecksum.Crc16))
{
chk = new ChecksumType
{
type = ChecksumTypeType.crc16,
- Value = crc16Ctx.End()
+ Value = _crc16Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Crc32))
+ if(_enabled.HasFlag(EnableChecksum.Crc32))
{
chk = new ChecksumType
{
type = ChecksumTypeType.crc32,
- Value = crc32Ctx.End()
+ Value = _crc32Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Crc64))
+ if(_enabled.HasFlag(EnableChecksum.Crc64))
{
chk = new ChecksumType
{
type = ChecksumTypeType.crc64,
- Value = crc64Ctx.End()
+ Value = _crc64Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Md5))
+ if(_enabled.HasFlag(EnableChecksum.Md5))
{
chk = new ChecksumType
{
type = ChecksumTypeType.md5,
- Value = md5Ctx.End()
+ Value = _md5Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Sha1))
+ if(_enabled.HasFlag(EnableChecksum.Sha1))
{
chk = new ChecksumType
{
type = ChecksumTypeType.sha1,
- Value = sha1Ctx.End()
+ Value = _sha1Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Sha256))
+ if(_enabled.HasFlag(EnableChecksum.Sha256))
{
chk = new ChecksumType
{
type = ChecksumTypeType.sha256,
- Value = sha256Ctx.End()
+ Value = _sha256Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Sha384))
+ if(_enabled.HasFlag(EnableChecksum.Sha384))
{
chk = new ChecksumType
{
type = ChecksumTypeType.sha384,
- Value = sha384Ctx.End()
+ Value = _sha384Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Sha512))
+ if(_enabled.HasFlag(EnableChecksum.Sha512))
{
chk = new ChecksumType
{
type = ChecksumTypeType.sha512,
- Value = sha512Ctx.End()
+ Value = _sha512Ctx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.SpamSum))
+ if(_enabled.HasFlag(EnableChecksum.SpamSum))
{
chk = new ChecksumType
{
type = ChecksumTypeType.spamsum,
- Value = ssctx.End()
+ Value = _ssCtx.End()
};
chks.Add(chk);
}
- if(enabled.HasFlag(EnableChecksum.Fletcher16))
+ if(_enabled.HasFlag(EnableChecksum.Fletcher16))
{
chk = new ChecksumType
{
type = ChecksumTypeType.fletcher16,
- Value = f16Ctx.End()
+ Value = _f16Ctx.End()
};
chks.Add(chk);
}
- if(!enabled.HasFlag(EnableChecksum.Fletcher32))
+ if(!_enabled.HasFlag(EnableChecksum.Fletcher32))
return chks;
chk = new ChecksumType
{
type = ChecksumTypeType.fletcher32,
- Value = f32Ctx.End()
+ Value = _f32Ctx.End()
};
chks.Add(chk);
diff --git a/Aaru.Core/DataFile.cs b/Aaru.Core/DataFile.cs
index 382797129..60763367b 100644
--- a/Aaru.Core/DataFile.cs
+++ b/Aaru.Core/DataFile.cs
@@ -40,40 +40,40 @@ namespace Aaru.Core
[SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
public class DataFile
{
- readonly FileStream dataFs;
+ readonly FileStream _dataFs;
/// Opens, or create, a new file
/// File
public DataFile(string outputFile) =>
- dataFs = new FileStream(outputFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
+ _dataFs = new FileStream(outputFile, FileMode.OpenOrCreate, FileAccess.ReadWrite);
/// Closes the file
- public void Close() => dataFs?.Close();
+ public void Close() => _dataFs?.Close();
/// Reads bytes at current position
/// Array to place read data within
/// Offset of where data will be read
/// How many bytes to read
/// How many bytes were read
- public int Read(byte[] array, int offset, int count) => dataFs.Read(array, offset, count);
+ public int Read(byte[] array, int offset, int count) => _dataFs.Read(array, offset, count);
/// Seeks to the specified block
/// Block to seek to
/// Block size in bytes
/// Position
- public long Seek(ulong block, ulong blockSize) => dataFs.Seek((long)(block * blockSize), SeekOrigin.Begin);
+ public long Seek(ulong block, ulong blockSize) => _dataFs.Seek((long)(block * blockSize), SeekOrigin.Begin);
/// Seeks to specified byte position
/// Byte position
/// Where to count for position
/// Position
- public long Seek(ulong offset, SeekOrigin origin) => dataFs.Seek((long)offset, origin);
+ public long Seek(ulong offset, SeekOrigin origin) => _dataFs.Seek((long)offset, origin);
/// Seeks to specified byte position
/// Byte position
/// Where to count for position
/// Position
- public long Seek(long offset, SeekOrigin origin) => dataFs.Seek(offset, origin);
+ public long Seek(long offset, SeekOrigin origin) => _dataFs.Seek(offset, origin);
/// Writes data at current position
/// Data
@@ -83,7 +83,7 @@ namespace Aaru.Core
/// Data
/// Offset of data from where to start taking data to write
/// How many bytes to write
- public void Write(byte[] data, int offset, int count) => dataFs.Write(data, offset, count);
+ public void Write(byte[] data, int offset, int count) => _dataFs.Write(data, offset, count);
/// Writes data at specified block
/// Data
@@ -100,12 +100,12 @@ namespace Aaru.Core
/// How many bytes to write
public void WriteAt(byte[] data, ulong block, uint blockSize, int offset, int count)
{
- dataFs.Seek((long)(block * blockSize), SeekOrigin.Begin);
- dataFs.Write(data, offset, count);
+ _dataFs.Seek((long)(block * blockSize), SeekOrigin.Begin);
+ _dataFs.Write(data, offset, count);
}
/// Current file position
- public long Position => dataFs.Position;
+ public long Position => _dataFs.Position;
/// Writes data to a newly created file
/// Who asked the file to be written (class, plugin, etc.)
diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs
index 0110d5515..84769e92b 100644
--- a/Aaru.Core/Devices/Dumping/ATA.cs
+++ b/Aaru.Core/Devices/Dumping/ATA.cs
@@ -68,8 +68,8 @@ namespace Aaru.Core.Devices.Dumping
}
}
- const ushort ATA_PROFILE = 0x0001;
- const uint TIMEOUT = 5;
+ const ushort ataProfile = 0x0001;
+ const uint timeout = 5;
double imageWriteDuration = 0;
MediaType mediaType = MediaType.Unknown;
@@ -99,7 +99,7 @@ namespace Aaru.Core.Devices.Dumping
// Initializate reader
UpdateStatus?.Invoke("Initializing reader.");
_dumpLog.WriteLine("Initializing reader.");
- var ataReader = new Reader(_dev, TIMEOUT, ataIdentify, _errorLog);
+ var ataReader = new Reader(_dev, timeout, ataIdentify, _errorLog);
// Fill reader blocks
ulong blocks = ataReader.GetDeviceBlocks();
@@ -248,7 +248,7 @@ namespace Aaru.Core.Devices.Dumping
mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead,
_private);
- ibgLog = new IbgLog(_outputPrefix + ".ibg", ATA_PROFILE);
+ ibgLog = new IbgLog(_outputPrefix + ".ibg", ataProfile);
if(_resume.NextBlock > 0)
{
@@ -469,7 +469,7 @@ namespace Aaru.Core.Devices.Dumping
mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead,
_private);
- ibgLog = new IbgLog(_outputPrefix + ".ibg", ATA_PROFILE);
+ ibgLog = new IbgLog(_outputPrefix + ".ibg", ataProfile);
ulong currentBlock = 0;
blocks = (ulong)(cylinders * heads * sectors);
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
index d7bff321a..64b7ef395 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
@@ -179,7 +179,7 @@ namespace Aaru.Core.Devices.Dumping
int trackRetries = 0;
// First track of each session has at least 150 sectors of pregap and is not always readable
- if(tracks.Where(t => t.TrackSession == track.TrackSession).OrderBy(t => t.TrackSequence).
+ if(tracks.Where(trk => trk.TrackSession == track.TrackSession).OrderBy(trk => trk.TrackSequence).
FirstOrDefault().TrackSequence == track.TrackSequence)
{
AaruConsole.DebugWriteLine("Pregap calculator", "Skipping track {0}", track.TrackSequence);
@@ -203,7 +203,7 @@ namespace Aaru.Core.Devices.Dumping
int lba = (int)track.TrackStartSector - 1;
bool pregapFound = false;
- Track previousTrack = tracks.FirstOrDefault(t => t.TrackSequence == track.TrackSequence - 1);
+ Track previousTrack = tracks.FirstOrDefault(trk => trk.TrackSequence == track.TrackSequence - 1);
bool goneBack = false;
bool goFront = false;
diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs
index dedc44238..5a9282e2c 100644
--- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs
+++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs
@@ -54,8 +54,8 @@ namespace Aaru.Core.Devices.Dumping
{
void DumpMs()
{
- const ushort SBC_PROFILE = 0x0001;
- const uint BLOCK_SIZE = 512;
+ const ushort sbcProfile = 0x0001;
+ const uint blockSize = 512;
double totalDuration = 0;
double currentSpeed = 0;
double maxSpeed = double.MinValue;
@@ -81,23 +81,23 @@ namespace Aaru.Core.Devices.Dumping
blocks++;
- ulong totalSize = blocks * (ulong)BLOCK_SIZE;
+ ulong totalSize = blocks * (ulong)blockSize;
if(totalSize > 1099511627776)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1099511627776d:F3} TiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1099511627776d:F3} TiB)");
else if(totalSize > 1073741824)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1073741824d:F3} GiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1073741824d:F3} GiB)");
else if(totalSize > 1048576)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1048576d:F3} MiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1048576d:F3} MiB)");
else if(totalSize > 1024)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1024d:F3} KiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1024d:F3} KiB)");
else
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize} bytes)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize} bytes)");
if(blocks == 0)
{
@@ -107,9 +107,9 @@ namespace Aaru.Core.Devices.Dumping
return;
}
- UpdateStatus?.Invoke($"Device reports {blocks} blocks ({blocks * BLOCK_SIZE} bytes).");
+ UpdateStatus?.Invoke($"Device reports {blocks} blocks ({blocks * blockSize} bytes).");
UpdateStatus?.Invoke($"Device can read {blocksToRead} blocks at a time.");
- UpdateStatus?.Invoke($"Device reports {BLOCK_SIZE} bytes per logical block.");
+ UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block.");
UpdateStatus?.Invoke($"SCSI device type: {_dev.ScsiType}.");
if(blocks > 262144)
@@ -127,9 +127,9 @@ namespace Aaru.Core.Devices.Dumping
bool ret;
- var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, BLOCK_SIZE, blocksToRead, _private);
- var ibgLog = new IbgLog(_outputPrefix + ".ibg", SBC_PROFILE);
- ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, BLOCK_SIZE);
+ var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private);
+ var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
+ ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
// Cannot create image
if(!ret)
@@ -196,7 +196,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i, blocks);
- sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, BLOCK_SIZE, 0,
+ sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, blockSize, 0,
blocksToRead, false, _dev.Timeout, out double cmdDuration);
totalDuration += cmdDuration;
@@ -224,7 +224,7 @@ namespace Aaru.Core.Devices.Dumping
// Write empty data
DateTime writeStart = DateTime.Now;
- _outputPlugin.WriteSectors(new byte[BLOCK_SIZE * _skip], i, _skip);
+ _outputPlugin.WriteSectors(new byte[blockSize * _skip], i, _skip);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
for(ulong b = i; b < i + _skip; b++)
@@ -246,7 +246,7 @@ namespace Aaru.Core.Devices.Dumping
if(elapsed < 1)
continue;
- currentSpeed = (sectorSpeedStart * BLOCK_SIZE) / (1048576 * elapsed);
+ currentSpeed = (sectorSpeedStart * blockSize) / (1048576 * elapsed);
sectorSpeedStart = 0;
timeSpeedStart = DateTime.UtcNow;
}
@@ -255,24 +255,24 @@ namespace Aaru.Core.Devices.Dumping
EndProgress?.Invoke();
mhddLog.Close();
- ibgLog.Close(_dev, blocks, BLOCK_SIZE, (end - start).TotalSeconds, currentSpeed * 1024,
- (BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000), _devicePath);
+ ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000), _devicePath);
UpdateStatus?.Invoke($"Dump finished in {(end - start).TotalSeconds} seconds.");
UpdateStatus?.
- Invoke($"Average dump speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000):F3} KiB/sec.");
+ Invoke($"Average dump speed {((double)blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000):F3} KiB/sec.");
UpdateStatus?.
- Invoke($"Average write speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / imageWriteDuration:F3} KiB/sec.");
+ Invoke($"Average write speed {((double)blockSize * (double)(blocks + 1)) / 1024 / imageWriteDuration:F3} KiB/sec.");
_dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
_dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000));
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000));
_dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / imageWriteDuration);
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / imageWriteDuration);
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -301,7 +301,7 @@ namespace Aaru.Core.Devices.Dumping
PulseProgress?.Invoke($"Trimming sector {badSector}");
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)badSector,
- BLOCK_SIZE, 0, 1, false, _dev.Timeout, out double _);
+ blockSize, 0, 1, false, _dev.Timeout, out double _);
if(sense || _dev.Error)
{
@@ -458,7 +458,7 @@ namespace Aaru.Core.Devices.Dumping
runningPersistent ? "recovering partial data, " : ""));
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)badSector,
- BLOCK_SIZE, 0, 1, false, _dev.Timeout, out double cmdDuration);
+ blockSize, 0, 1, false, _dev.Timeout, out double cmdDuration);
totalDuration += cmdDuration;
@@ -585,12 +585,12 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke($"Sidecar created in {(end - chkStart).TotalSeconds} seconds.");
UpdateStatus?.
- Invoke($"Average checksum speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalChkDuration / 1000):F3} KiB/sec.");
+ Invoke($"Average checksum speed {((double)blockSize * (double)(blocks + 1)) / 1024 / (totalChkDuration / 1000):F3} KiB/sec.");
_dumpLog.WriteLine("Sidecar created in {0} seconds.", (end - chkStart).TotalSeconds);
_dumpLog.WriteLine("Average checksum speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalChkDuration / 1000));
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / (totalChkDuration / 1000));
if(_preSidecar != null)
{
@@ -622,15 +622,15 @@ namespace Aaru.Core.Devices.Dumping
sidecar.BlockMedia[0].DiskSubType = xmlType.subType;
sidecar.BlockMedia[0].Interface = "USB";
sidecar.BlockMedia[0].LogicalBlocks = blocks;
- sidecar.BlockMedia[0].PhysicalBlockSize = (int)BLOCK_SIZE;
- sidecar.BlockMedia[0].LogicalBlockSize = (int)BLOCK_SIZE;
+ sidecar.BlockMedia[0].PhysicalBlockSize = (int)blockSize;
+ sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize;
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
sidecar.BlockMedia[0].Model = _dev.Model;
if(!_private)
sidecar.BlockMedia[0].Serial = _dev.Serial;
- sidecar.BlockMedia[0].Size = blocks * BLOCK_SIZE;
+ sidecar.BlockMedia[0].Size = blocks * blockSize;
if(_dev.IsRemovable)
sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray();
@@ -650,7 +650,7 @@ namespace Aaru.Core.Devices.Dumping
Invoke($"Took a total of {(end - start).TotalSeconds:F3} seconds ({totalDuration / 1000:F3} processing commands, {totalChkDuration / 1000:F3} checksumming, {imageWriteDuration:F3} writing, {(closeEnd - closeStart).TotalSeconds:F3} closing).");
UpdateStatus?.
- Invoke($"Average speed: {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1048576 / (totalDuration / 1000):F3} MiB/sec.");
+ Invoke($"Average speed: {((double)blockSize * (double)(blocks + 1)) / 1048576 / (totalDuration / 1000):F3} MiB/sec.");
if(maxSpeed > 0)
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/PlayStationPortable.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/PlayStationPortable.cs
index 971508250..5ba8433bd 100644
--- a/Aaru.Core/Devices/Dumping/PlayStationPortable/PlayStationPortable.cs
+++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/PlayStationPortable.cs
@@ -42,11 +42,11 @@ namespace Aaru.Core.Devices.Dumping
{
public partial class Dump
{
- static readonly byte[] FatSignature =
+ static readonly byte[] _fatSignature =
{
0x46, 0x41, 0x54, 0x31, 0x36, 0x20, 0x20, 0x20
};
- static readonly byte[] IsoExtension =
+ static readonly byte[] _isoExtension =
{
0x49, 0x53, 0x4F
};
@@ -114,7 +114,7 @@ namespace Aaru.Core.Devices.Dumping
Array.Copy(buffer, 0x36, tmp, 0, 8);
// UMDs are stored inside a FAT16 volume
- if(!tmp.SequenceEqual(FatSignature))
+ if(!tmp.SequenceEqual(_fatSignature))
{
DumpMs();
@@ -142,7 +142,7 @@ namespace Aaru.Core.Devices.Dumping
tmp = new byte[3];
Array.Copy(buffer, 0x28, tmp, 0, 3);
- if(!tmp.SequenceEqual(IsoExtension))
+ if(!tmp.SequenceEqual(_isoExtension))
{
DumpMs();
diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs
index 7b75d2899..d07fa3ece 100644
--- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs
+++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs
@@ -52,8 +52,8 @@ namespace Aaru.Core.Devices.Dumping
{
void DumpUmd()
{
- const uint BLOCK_SIZE = 2048;
- const MediaType DSK_TYPE = MediaType.UMD;
+ const uint blockSize = 2048;
+ const MediaType dskType = MediaType.UMD;
uint blocksToRead = 16;
double totalDuration = 0;
double currentSpeed = 0;
@@ -95,47 +95,47 @@ namespace Aaru.Core.Devices.Dumping
}
uint umdSizeInBytes = BitConverter.ToUInt32(readBuffer, 0x3C);
- ulong blocks = umdSizeInBytes / BLOCK_SIZE;
+ ulong blocks = umdSizeInBytes / blockSize;
string mediaPartNumber = Encoding.ASCII.GetString(readBuffer, 0, 11).Trim();
- ulong totalSize = blocks * BLOCK_SIZE;
+ ulong totalSize = blocks * blockSize;
if(totalSize > 1099511627776)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1099511627776d:F3} TiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1099511627776d:F3} TiB)");
else if(totalSize > 1073741824)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1073741824d:F3} GiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1073741824d:F3} GiB)");
else if(totalSize > 1048576)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1048576d:F3} MiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1048576d:F3} MiB)");
else if(totalSize > 1024)
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize / 1024d:F3} KiB)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize / 1024d:F3} KiB)");
else
UpdateStatus?.
- Invoke($"Media has {blocks} blocks of {BLOCK_SIZE} bytes/each. (for a total of {totalSize} bytes)");
+ Invoke($"Media has {blocks} blocks of {blockSize} bytes/each. (for a total of {totalSize} bytes)");
- UpdateStatus?.Invoke($"Device reports {blocks} blocks ({blocks * BLOCK_SIZE} bytes).");
+ UpdateStatus?.Invoke($"Device reports {blocks} blocks ({blocks * blockSize} bytes).");
UpdateStatus?.Invoke($"Device can read {blocksToRead} blocks at a time.");
- UpdateStatus?.Invoke($"Device reports {BLOCK_SIZE} bytes per logical block.");
+ UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block.");
UpdateStatus?.Invoke($"Device reports {2048} bytes per physical block.");
UpdateStatus?.Invoke($"SCSI device type: {_dev.ScsiType}.");
- UpdateStatus?.Invoke($"Media identified as {DSK_TYPE}.");
+ UpdateStatus?.Invoke($"Media identified as {dskType}.");
UpdateStatus?.Invoke($"Media part number is {mediaPartNumber}.");
- _dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * BLOCK_SIZE);
+ _dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);
_dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead);
- _dumpLog.WriteLine("Device reports {0} bytes per logical block.", BLOCK_SIZE);
+ _dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize);
_dumpLog.WriteLine("Device reports {0} bytes per physical block.", 2048);
_dumpLog.WriteLine("SCSI device type: {0}.", _dev.ScsiType);
- _dumpLog.WriteLine("Media identified as {0}.", DSK_TYPE);
+ _dumpLog.WriteLine("Media identified as {0}.", dskType);
_dumpLog.WriteLine("Media part number is {0}.", mediaPartNumber);
bool ret;
- var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, BLOCK_SIZE, blocksToRead, _private);
+ var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private);
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010);
- ret = _outputPlugin.Create(_outputPath, DSK_TYPE, _formatOptions, blocks, BLOCK_SIZE);
+ ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
// Cannot create image
if(!ret)
@@ -156,10 +156,10 @@ namespace Aaru.Core.Devices.Dumping
{
new Track
{
- TrackBytesPerSector = (int)BLOCK_SIZE,
+ TrackBytesPerSector = (int)blockSize,
TrackEndSector = blocks - 1,
TrackSequence = 1,
- TrackRawBytesPerSector = (int)BLOCK_SIZE,
+ TrackRawBytesPerSector = (int)blockSize,
TrackSubchannelType = TrackSubchannelType.None,
TrackSession = 1,
TrackType = TrackType.Data
@@ -246,7 +246,7 @@ namespace Aaru.Core.Devices.Dumping
// Write empty data
DateTime writeStart = DateTime.Now;
- _outputPlugin.WriteSectors(new byte[BLOCK_SIZE * _skip], i, _skip);
+ _outputPlugin.WriteSectors(new byte[blockSize * _skip], i, _skip);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
for(ulong b = i; b < i + _skip; b++)
@@ -268,7 +268,7 @@ namespace Aaru.Core.Devices.Dumping
if(elapsed < 1)
continue;
- currentSpeed = (sectorSpeedStart * BLOCK_SIZE) / (1048576 * elapsed);
+ currentSpeed = (sectorSpeedStart * blockSize) / (1048576 * elapsed);
sectorSpeedStart = 0;
timeSpeedStart = DateTime.UtcNow;
}
@@ -277,24 +277,24 @@ namespace Aaru.Core.Devices.Dumping
EndProgress?.Invoke();
mhddLog.Close();
- ibgLog.Close(_dev, blocks, BLOCK_SIZE, (end - start).TotalSeconds, currentSpeed * 1024,
- (BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000), _devicePath);
+ ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000), _devicePath);
UpdateStatus?.Invoke($"Dump finished in {(end - start).TotalSeconds} seconds.");
UpdateStatus?.
- Invoke($"Average dump speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000):F3} KiB/sec.");
+ Invoke($"Average dump speed {((double)blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000):F3} KiB/sec.");
UpdateStatus?.
- Invoke($"Average write speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / imageWriteDuration:F3} KiB/sec.");
+ Invoke($"Average write speed {((double)blockSize * (double)(blocks + 1)) / 1024 / imageWriteDuration:F3} KiB/sec.");
_dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
_dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000));
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000));
_dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / imageWriteDuration);
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / imageWriteDuration);
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -562,7 +562,7 @@ namespace Aaru.Core.Devices.Dumping
double totalChkDuration = 0;
if(_metadata)
- WriteOpticalSidecar(BLOCK_SIZE, blocks, DSK_TYPE, null, null, 1, out totalChkDuration, null);
+ WriteOpticalSidecar(blockSize, blocks, dskType, null, null, 1, out totalChkDuration, null);
UpdateStatus?.Invoke("");
@@ -570,7 +570,7 @@ namespace Aaru.Core.Devices.Dumping
Invoke($"Took a total of {(end - start).TotalSeconds:F3} seconds ({totalDuration / 1000:F3} processing commands, {totalChkDuration / 1000:F3} checksumming, {imageWriteDuration:F3} writing, {(closeEnd - closeStart).TotalSeconds:F3} closing).");
UpdateStatus?.
- Invoke($"Average speed: {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1048576 / (totalDuration / 1000):F3} MiB/sec.");
+ Invoke($"Average speed: {((double)blockSize * (double)(blocks + 1)) / 1048576 / (totalDuration / 1000):F3} MiB/sec.");
if(maxSpeed > 0)
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
@@ -582,7 +582,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke($"{_resume.BadBlocks.Count} sectors could not be read.");
UpdateStatus?.Invoke("");
- Statistics.AddMedia(DSK_TYPE, true);
+ Statistics.AddMedia(dskType, true);
}
}
}
\ No newline at end of file
diff --git a/Aaru.Core/Devices/Dumping/SBC.cs b/Aaru.Core/Devices/Dumping/SBC.cs
index 8e39b248d..943d59645 100644
--- a/Aaru.Core/Devices/Dumping/SBC.cs
+++ b/Aaru.Core/Devices/Dumping/SBC.cs
@@ -69,7 +69,7 @@ namespace Aaru.Core.Devices.Dumping
byte scsiMediumType = 0;
byte scsiDensityCode = 0;
bool containsFloppyPage = false;
- const ushort SBC_PROFILE = 0x0001;
+ const ushort sbcProfile = 0x0001;
DateTime start;
DateTime end;
double totalDuration = 0;
@@ -338,7 +338,7 @@ namespace Aaru.Core.Devices.Dumping
_dumpLog.WriteLine("Reading {0} sectors at a time.", blocksToRead);
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private);
- var ibgLog = new IbgLog(_outputPrefix + ".ibg", SBC_PROFILE);
+ var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile);
ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
// Cannot create image
diff --git a/Aaru.Core/Devices/Dumping/SecureDigital.cs b/Aaru.Core/Devices/Dumping/SecureDigital.cs
index 6a1309ced..e5c00d010 100644
--- a/Aaru.Core/Devices/Dumping/SecureDigital.cs
+++ b/Aaru.Core/Devices/Dumping/SecureDigital.cs
@@ -69,8 +69,8 @@ namespace Aaru.Core.Devices.Dumping
}
bool sense;
- const ushort SD_PROFILE = 0x0001;
- const uint TIMEOUT = 5;
+ const ushort sdProfile = 0x0001;
+ const uint timeout = 5;
double duration;
uint blocksToRead = 1;
@@ -92,7 +92,7 @@ namespace Aaru.Core.Devices.Dumping
{
UpdateStatus?.Invoke("Reading Extended CSD");
_dumpLog.WriteLine("Reading Extended CSD");
- sense = _dev.ReadExtendedCsd(out ecsd, out response, TIMEOUT, out duration);
+ sense = _dev.ReadExtendedCsd(out ecsd, out response, timeout, out duration);
if(!sense)
{
@@ -118,7 +118,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Reading CSD");
_dumpLog.WriteLine("Reading CSD");
- sense = _dev.ReadCsd(out csd, out response, TIMEOUT, out duration);
+ sense = _dev.ReadCsd(out csd, out response, timeout, out duration);
if(!sense)
{
@@ -139,7 +139,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Reading OCR");
_dumpLog.WriteLine("Reading OCR");
- sense = _dev.ReadOcr(out ocr, out response, TIMEOUT, out duration);
+ sense = _dev.ReadOcr(out ocr, out response, timeout, out duration);
if(sense)
{
@@ -156,7 +156,7 @@ namespace Aaru.Core.Devices.Dumping
{
UpdateStatus?.Invoke("Reading CSD");
_dumpLog.WriteLine("Reading CSD");
- sense = _dev.ReadCsd(out csd, out response, TIMEOUT, out duration);
+ sense = _dev.ReadCsd(out csd, out response, timeout, out duration);
if(!sense)
{
@@ -180,7 +180,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Reading OCR");
_dumpLog.WriteLine("Reading OCR");
- sense = _dev.ReadSdocr(out ocr, out response, TIMEOUT, out duration);
+ sense = _dev.ReadSdocr(out ocr, out response, timeout, out duration);
if(sense)
{
@@ -192,7 +192,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Reading SCR");
_dumpLog.WriteLine("Reading SCR");
- sense = _dev.ReadScr(out scr, out response, TIMEOUT, out duration);
+ sense = _dev.ReadScr(out scr, out response, timeout, out duration);
if(sense)
{
@@ -208,7 +208,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Reading CID");
_dumpLog.WriteLine("Reading CID");
- sense = _dev.ReadCid(out byte[] cid, out response, TIMEOUT, out duration);
+ sense = _dev.ReadCid(out byte[] cid, out response, timeout, out duration);
if(sense)
{
@@ -241,7 +241,7 @@ namespace Aaru.Core.Devices.Dumping
while(true)
{
- error = _dev.Read(out cmdBuf, out _, 0, blockSize, blocksToRead, byteAddressed, TIMEOUT, out duration);
+ error = _dev.Read(out cmdBuf, out _, 0, blockSize, blocksToRead, byteAddressed, timeout, out duration);
if(error)
blocksToRead /= 2;
@@ -308,7 +308,7 @@ namespace Aaru.Core.Devices.Dumping
}
var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private);
- var ibgLog = new IbgLog(_outputPrefix + ".ibg", SD_PROFILE);
+ var ibgLog = new IbgLog(_outputPrefix + ".ibg", sdProfile);
ret = _outputPlugin.Create(_outputPath,
_dev.Type == DeviceType.SecureDigital ? MediaType.SecureDigital : MediaType.MMC,
@@ -367,7 +367,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)blocks);
- error = _dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed, TIMEOUT,
+ error = _dev.Read(out cmdBuf, out response, (uint)i, blockSize, blocksToRead, byteAddressed, timeout,
out duration);
if(!error)
@@ -462,7 +462,7 @@ namespace Aaru.Core.Devices.Dumping
PulseProgress?.Invoke($"Trimming sector {badSector}");
- error = _dev.Read(out cmdBuf, out response, (uint)badSector, blockSize, 1, byteAddressed, TIMEOUT,
+ error = _dev.Read(out cmdBuf, out response, (uint)badSector, blockSize, 1, byteAddressed, timeout,
out duration);
totalDuration += duration;
@@ -514,7 +514,7 @@ namespace Aaru.Core.Devices.Dumping
forward ? "forward" : "reverse",
runningPersistent ? "recovering partial data, " : ""));
- error = _dev.Read(out cmdBuf, out response, (uint)badSector, blockSize, 1, byteAddressed, TIMEOUT,
+ error = _dev.Read(out cmdBuf, out response, (uint)badSector, blockSize, 1, byteAddressed, timeout,
out duration);
totalDuration += duration;
diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs
index 813b8f4b6..a23486d18 100644
--- a/Aaru.Core/Devices/Dumping/XGD.cs
+++ b/Aaru.Core/Devices/Dumping/XGD.cs
@@ -62,7 +62,7 @@ namespace Aaru.Core.Devices.Dumping
internal void Xgd(Dictionary mediaTags, MediaType dskType)
{
bool sense;
- const uint BLOCK_SIZE = 2048;
+ const uint blockSize = 2048;
uint blocksToRead = 64;
DateTime start;
DateTime end;
@@ -371,7 +371,7 @@ namespace Aaru.Core.Devices.Dumping
_dumpLog.WriteLine("Total 0 size: {0} sectors", totalSize);
_dumpLog.WriteLine("Real layer break: {0}", layerBreak);
- bool read12 = !_dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, BLOCK_SIZE, 0, 1,
+ bool read12 = !_dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, 0, blockSize, 0, 1,
false, _dev.Timeout, out _);
if(!read12)
@@ -404,7 +404,7 @@ namespace Aaru.Core.Devices.Dumping
{
if(read12)
{
- sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, BLOCK_SIZE, 0,
+ sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, 0, blockSize, 0,
blocksToRead, false, _dev.Timeout, out _);
if(sense || _dev.Error)
@@ -458,9 +458,9 @@ namespace Aaru.Core.Devices.Dumping
_dumpLog.WriteLine("Reading {0} sectors at a time.", blocksToRead);
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
- var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, BLOCK_SIZE, blocksToRead, _private);
+ var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private);
var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010);
- ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, BLOCK_SIZE);
+ ret = _outputPlugin.Create(_outputPath, dskType, _formatOptions, blocks, blockSize);
// Cannot create image
if(!ret)
@@ -493,10 +493,10 @@ namespace Aaru.Core.Devices.Dumping
{
new Track
{
- TrackBytesPerSector = (int)BLOCK_SIZE,
+ TrackBytesPerSector = (int)blockSize,
TrackEndSector = blocks - 1,
TrackSequence = 1,
- TrackRawBytesPerSector = (int)BLOCK_SIZE,
+ TrackRawBytesPerSector = (int)blockSize,
TrackSubchannelType = TrackSubchannelType.None,
TrackSession = 1,
TrackType = TrackType.Data
@@ -591,8 +591,8 @@ namespace Aaru.Core.Devices.Dumping
UpdateProgress?.Invoke($"Reading sector {i} of {totalSize} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)totalSize);
- sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i,
- BLOCK_SIZE, 0, blocksToRead, false, _dev.Timeout, out cmdDuration);
+ sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize,
+ 0, blocksToRead, false, _dev.Timeout, out cmdDuration);
totalDuration += cmdDuration;
@@ -619,7 +619,7 @@ namespace Aaru.Core.Devices.Dumping
// Write empty data
DateTime writeStart = DateTime.Now;
- _outputPlugin.WriteSectors(new byte[BLOCK_SIZE * _skip], i, _skip);
+ _outputPlugin.WriteSectors(new byte[blockSize * _skip], i, _skip);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
for(ulong b = i; b < i + _skip; b++)
@@ -654,7 +654,7 @@ namespace Aaru.Core.Devices.Dumping
if(elapsed < 1)
continue;
- currentSpeed = (sectorSpeedStart * BLOCK_SIZE) / (1048576 * elapsed);
+ currentSpeed = (sectorSpeedStart * blockSize) / (1048576 * elapsed);
sectorSpeedStart = 0;
timeSpeedStart = DateTime.UtcNow;
}
@@ -680,7 +680,7 @@ namespace Aaru.Core.Devices.Dumping
// Write empty data
DateTime writeStart = DateTime.Now;
- _outputPlugin.WriteSectors(new byte[BLOCK_SIZE * blocksToRead], i, blocksToRead);
+ _outputPlugin.WriteSectors(new byte[blockSize * blocksToRead], i, blocksToRead);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
blocksToRead = saveBlocksToRead;
extents.Add(i, blocksToRead, true);
@@ -722,8 +722,8 @@ namespace Aaru.Core.Devices.Dumping
// Write empty data
DateTime writeStart = DateTime.Now;
- _outputPlugin.WriteSectors(new byte[BLOCK_SIZE * blocksToRead], middle + currentSector, blocksToRead);
- imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
+ _outputPlugin.WriteSectors(new byte[blockSize * blocksToRead], middle + currentSector, blocksToRead);
+ imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
extents.Add(currentSector, blocksToRead, true);
currentSector += blocksToRead;
@@ -787,8 +787,8 @@ namespace Aaru.Core.Devices.Dumping
UpdateProgress?.Invoke($"Reading sector {currentSector} of {totalSize} ({currentSpeed:F3} MiB/sec.)",
(long)currentSector, (long)totalSize);
- sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, BLOCK_SIZE,
- 0, blocksToRead, false, _dev.Timeout, out cmdDuration);
+ sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0,
+ blocksToRead, false, _dev.Timeout, out cmdDuration);
totalDuration += cmdDuration;
@@ -812,7 +812,7 @@ namespace Aaru.Core.Devices.Dumping
// Write empty data
DateTime writeStart = DateTime.Now;
- _outputPlugin.WriteSectors(new byte[BLOCK_SIZE * _skip], currentSector, _skip);
+ _outputPlugin.WriteSectors(new byte[blockSize * _skip], currentSector, _skip);
imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds;
// TODO: Handle errors in video partition
@@ -843,7 +843,7 @@ namespace Aaru.Core.Devices.Dumping
if(elapsed < 1)
continue;
- currentSpeed = (sectorSpeedStart * BLOCK_SIZE) / (1048576 * elapsed);
+ currentSpeed = (sectorSpeedStart * blockSize) / (1048576 * elapsed);
sectorSpeedStart = 0;
timeSpeedStart = DateTime.UtcNow;
}
@@ -876,24 +876,24 @@ namespace Aaru.Core.Devices.Dumping
AaruConsole.WriteLine();
mhddLog.Close();
- ibgLog.Close(_dev, blocks, BLOCK_SIZE, (end - start).TotalSeconds, currentSpeed * 1024,
- (BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000), _devicePath);
+ ibgLog.Close(_dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
+ (blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000), _devicePath);
UpdateStatus?.Invoke($"Dump finished in {(end - start).TotalSeconds} seconds.");
UpdateStatus?.
- Invoke($"Average dump speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000):F3} KiB/sec.");
+ Invoke($"Average dump speed {((double)blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000):F3} KiB/sec.");
UpdateStatus?.
- Invoke($"Average write speed {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / imageWriteDuration:F3} KiB/sec.");
+ Invoke($"Average write speed {((double)blockSize * (double)(blocks + 1)) / 1024 / imageWriteDuration:F3} KiB/sec.");
_dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
_dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / (totalDuration / 1000));
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / (totalDuration / 1000));
_dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
- ((double)BLOCK_SIZE * (double)(blocks + 1)) / 1024 / imageWriteDuration);
+ ((double)blockSize * (double)(blocks + 1)) / 1024 / imageWriteDuration);
#region Trimming
if(_resume.BadBlocks.Count > 0 &&
@@ -921,7 +921,7 @@ namespace Aaru.Core.Devices.Dumping
PulseProgress?.Invoke($"Trimming sector {badSector}");
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)badSector,
- BLOCK_SIZE, 0, 1, false, _dev.Timeout, out cmdDuration);
+ blockSize, 0, 1, false, _dev.Timeout, out cmdDuration);
totalDuration += cmdDuration;
@@ -1084,7 +1084,7 @@ namespace Aaru.Core.Devices.Dumping
runningPersistent ? "recovering partial data, " : ""));
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)badSector,
- BLOCK_SIZE, 0, 1, false, _dev.Timeout, out cmdDuration);
+ blockSize, 0, 1, false, _dev.Timeout, out cmdDuration);
totalDuration += cmdDuration;
@@ -1224,7 +1224,7 @@ namespace Aaru.Core.Devices.Dumping
Value = layerBreak
};
- WriteOpticalSidecar(BLOCK_SIZE, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null);
+ WriteOpticalSidecar(blockSize, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null);
}
UpdateStatus?.Invoke("");
@@ -1233,7 +1233,7 @@ namespace Aaru.Core.Devices.Dumping
Invoke($"Took a total of {(end - start).TotalSeconds:F3} seconds ({totalDuration / 1000:F3} processing commands, {totalChkDuration / 1000:F3} checksumming, {imageWriteDuration:F3} writing, {(closeEnd - closeStart).TotalSeconds:F3} closing).");
UpdateStatus?.
- Invoke($"Average speed: {((double)BLOCK_SIZE * (double)(blocks + 1)) / 1048576 / (totalDuration / 1000):F3} MiB/sec.");
+ Invoke($"Average speed: {((double)blockSize * (double)(blocks + 1)) / 1048576 / (totalDuration / 1000):F3} MiB/sec.");
if(maxSpeed > 0)
UpdateStatus?.Invoke($"Fastest speed burst: {maxSpeed:F3} MiB/sec.");
diff --git a/Aaru.Core/Devices/Scanning/ATA.cs b/Aaru.Core/Devices/Scanning/ATA.cs
index 0fdcba477..82c7f96c5 100644
--- a/Aaru.Core/Devices/Scanning/ATA.cs
+++ b/Aaru.Core/Devices/Scanning/ATA.cs
@@ -47,8 +47,8 @@ namespace Aaru.Core.Devices.Scanning
var results = new ScanResults();
bool sense;
results.Blocks = 0;
- const ushort ATA_PROFILE = 0x0001;
- const uint TIMEOUT = 5;
+ const ushort ataProfile = 0x0001;
+ const uint timeout = 5;
sense = _dev.AtaIdentify(out byte[] cmdBuf, out _);
@@ -56,7 +56,7 @@ namespace Aaru.Core.Devices.Scanning
Identify.Decode(cmdBuf).HasValue)
{
// Initializate reader
- var ataReader = new Reader(_dev, TIMEOUT, cmdBuf, null);
+ var ataReader = new Reader(_dev, timeout, cmdBuf, null);
// Fill reader blocks
results.Blocks = ataReader.GetDeviceBlocks();
@@ -122,9 +122,9 @@ namespace Aaru.Core.Devices.Scanning
{
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
- InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ATA_PROFILE);
+ InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ataProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
- ibgLog = new IbgLog(_ibgLogPath, ATA_PROFILE);
+ ibgLog = new IbgLog(_ibgLogPath, ataProfile);
start = DateTime.UtcNow;
DateTime timeSpeedStart = DateTime.UtcNow;
@@ -239,9 +239,9 @@ namespace Aaru.Core.Devices.Scanning
}
else
{
- InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ATA_PROFILE);
+ InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, ataProfile);
mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
- ibgLog = new IbgLog(_ibgLogPath, ATA_PROFILE);
+ ibgLog = new IbgLog(_ibgLogPath, ataProfile);
ulong currentBlock = 0;
results.Blocks = (ulong)(cylinders * heads * sectors);
diff --git a/Aaru.Core/Devices/Scanning/SecureDigital.cs b/Aaru.Core/Devices/Scanning/SecureDigital.cs
index 583aaa333..851d8b169 100644
--- a/Aaru.Core/Devices/Scanning/SecureDigital.cs
+++ b/Aaru.Core/Devices/Scanning/SecureDigital.cs
@@ -47,9 +47,9 @@ namespace Aaru.Core.Devices.Scanning
byte[] cmdBuf;
bool sense;
results.Blocks = 0;
- const uint TIMEOUT = 5;
+ const uint timeout = 5;
double duration;
- const ushort SD_PROFILE = 0x0001;
+ const ushort sdProfile = 0x0001;
uint blocksToRead = 128;
uint blockSize = 512;
bool byteAddressed = true;
@@ -58,7 +58,7 @@ namespace Aaru.Core.Devices.Scanning
{
case DeviceType.MMC:
{
- sense = _dev.ReadExtendedCsd(out cmdBuf, out _, TIMEOUT, out _);
+ sense = _dev.ReadExtendedCsd(out cmdBuf, out _, timeout, out _);
if(!sense)
{
@@ -73,7 +73,7 @@ namespace Aaru.Core.Devices.Scanning
if(sense || results.Blocks == 0)
{
- sense = _dev.ReadCsd(out cmdBuf, out _, TIMEOUT, out _);
+ sense = _dev.ReadCsd(out cmdBuf, out _, timeout, out _);
if(!sense)
{
@@ -88,7 +88,7 @@ namespace Aaru.Core.Devices.Scanning
case DeviceType.SecureDigital:
{
- sense = _dev.ReadCsd(out cmdBuf, out _, TIMEOUT, out _);
+ sense = _dev.ReadCsd(out cmdBuf, out _, timeout, out _);
if(!sense)
{
@@ -117,7 +117,7 @@ namespace Aaru.Core.Devices.Scanning
while(true)
{
- sense = _dev.Read(out cmdBuf, out _, 0, blockSize, blocksToRead, byteAddressed, TIMEOUT, out duration);
+ sense = _dev.Read(out cmdBuf, out _, 0, blockSize, blocksToRead, byteAddressed, timeout, out duration);
if(sense)
blocksToRead /= 2;
@@ -157,9 +157,9 @@ namespace Aaru.Core.Devices.Scanning
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
- InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, SD_PROFILE);
+ InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead, sdProfile);
var mhddLog = new MhddLog(_mhddLogPath, _dev, results.Blocks, blockSize, blocksToRead, false);
- var ibgLog = new IbgLog(_ibgLogPath, SD_PROFILE);
+ var ibgLog = new IbgLog(_ibgLogPath, sdProfile);
start = DateTime.UtcNow;
DateTime timeSpeedStart = DateTime.UtcNow;
@@ -187,7 +187,7 @@ namespace Aaru.Core.Devices.Scanning
UpdateProgress?.Invoke($"Reading sector {i} of {results.Blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)results.Blocks);
- bool error = _dev.Read(out cmdBuf, out _, (uint)i, blockSize, blocksToRead, byteAddressed, TIMEOUT,
+ bool error = _dev.Read(out cmdBuf, out _, (uint)i, blockSize, blocksToRead, byteAddressed, timeout,
out duration);
if(!error)
@@ -254,7 +254,7 @@ namespace Aaru.Core.Devices.Scanning
PulseProgress?.Invoke($"Seeking to sector {seekPos}...\t\t");
- _dev.Read(out cmdBuf, out _, seekPos, blockSize, blocksToRead, byteAddressed, TIMEOUT,
+ _dev.Read(out cmdBuf, out _, seekPos, blockSize, blocksToRead, byteAddressed, timeout,
out double seekCur);
#pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
diff --git a/Aaru.Core/Entropy.cs b/Aaru.Core/Entropy.cs
index 666d8ff8d..7e2b76304 100644
--- a/Aaru.Core/Entropy.cs
+++ b/Aaru.Core/Entropy.cs
@@ -42,13 +42,13 @@ namespace Aaru.Core
{
public class Entropy
{
- readonly bool debug;
- readonly IMediaImage inputFormat;
+ readonly bool _debug;
+ readonly IMediaImage _inputFormat;
public Entropy(bool debug, IMediaImage inputFormat)
{
- this.debug = debug;
- this.inputFormat = inputFormat;
+ _debug = debug;
+ _inputFormat = inputFormat;
}
public event InitProgressHandler InitProgressEvent;
@@ -62,7 +62,7 @@ namespace Aaru.Core
{
List entropyResultses = new List();
- if(!(inputFormat is IOpticalMediaImage opticalMediaImage))
+ if(!(_inputFormat is IOpticalMediaImage opticalMediaImage))
{
AaruConsole.ErrorWriteLine("The selected image does not support tracks.");
@@ -134,7 +134,7 @@ namespace Aaru.Core
}
catch(Exception ex)
{
- if(debug)
+ if(_debug)
AaruConsole.DebugWriteLine("Could not get tracks because {0}", ex.Message);
else
AaruConsole.ErrorWriteLine("Unable to get separate tracks, not calculating their entropy");
@@ -154,14 +154,14 @@ namespace Aaru.Core
ulong diskSize = 0;
List uniqueSectors = new List();
- entropy.Sectors = inputFormat.Info.Sectors;
+ entropy.Sectors = _inputFormat.Info.Sectors;
AaruConsole.WriteLine("Sectors {0}", entropy.Sectors);
InitProgressEvent?.Invoke();
for(ulong i = 0; i < entropy.Sectors; i++)
{
UpdateProgressEvent?.Invoke($"Entropying sector {i + 1}", (long)(i + 1), (long)entropy.Sectors);
- byte[] sector = inputFormat.ReadSector(i);
+ byte[] sector = _inputFormat.ReadSector(i);
if(duplicatedSectors)
{
diff --git a/Aaru.Core/Logging/DumpLog.cs b/Aaru.Core/Logging/DumpLog.cs
index b5ab0c79d..0a1a91010 100644
--- a/Aaru.Core/Logging/DumpLog.cs
+++ b/Aaru.Core/Logging/DumpLog.cs
@@ -44,7 +44,7 @@ namespace Aaru.Core.Logging
/// Creates a dump log
public class DumpLog
{
- readonly StreamWriter logSw;
+ readonly StreamWriter _logSw;
/// Initializes the dump log
/// Output log file
@@ -55,9 +55,9 @@ namespace Aaru.Core.Logging
if(string.IsNullOrEmpty(outputFile))
return;
- logSw = new StreamWriter(outputFile, true);
+ _logSw = new StreamWriter(outputFile, true);
- logSw.WriteLine("Start logging at {0}", DateTime.Now);
+ _logSw.WriteLine("Start logging at {0}", DateTime.Now);
PlatformID platId = DetectOS.GetRealPlatformID();
string platVer = DetectOS.GetVersion();
@@ -66,25 +66,25 @@ namespace Aaru.Core.Logging
Attribute.GetCustomAttribute(typeof(DumpLog).Assembly, typeof(AssemblyInformationalVersionAttribute)) as
AssemblyInformationalVersionAttribute;
- logSw.WriteLine("################# System information #################");
+ _logSw.WriteLine("################# System information #################");
- logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
- Environment.Is64BitOperatingSystem ? 64 : 32);
+ _logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
+ Environment.Is64BitOperatingSystem ? 64 : 32);
if(DetectOS.IsMono)
- logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
+ _logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
else if(DetectOS.IsNetCore)
- logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion());
+ _logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion());
else
- logSw.WriteLine(RuntimeInformation.FrameworkDescription);
+ _logSw.WriteLine(RuntimeInformation.FrameworkDescription);
- logSw.WriteLine();
+ _logSw.WriteLine();
- logSw.WriteLine("################# Program information ################");
- logSw.WriteLine("Aaru {0}", assemblyVersion?.InformationalVersion);
- logSw.WriteLine("Running in {0}-bit", Environment.Is64BitProcess ? 64 : 32);
+ _logSw.WriteLine("################# Program information ################");
+ _logSw.WriteLine("Aaru {0}", assemblyVersion?.InformationalVersion);
+ _logSw.WriteLine("Running in {0}-bit", Environment.Is64BitProcess ? 64 : 32);
#if DEBUG
- logSw.WriteLine("DEBUG version");
+ _logSw.WriteLine("DEBUG version");
#endif
if(@private)
{
@@ -106,72 +106,72 @@ namespace Aaru.Core.Logging
}
}
- logSw.WriteLine("Command line: {0}", string.Join(" ", args));
+ _logSw.WriteLine("Command line: {0}", string.Join(" ", args));
}
else
- logSw.WriteLine("Command line: {0}", Environment.CommandLine);
+ _logSw.WriteLine("Command line: {0}", Environment.CommandLine);
- logSw.WriteLine();
+ _logSw.WriteLine();
if(dev.IsRemote)
{
- logSw.WriteLine("################# Remote information #################");
- logSw.WriteLine("Server: {0}", dev.RemoteApplication);
- logSw.WriteLine("Version: {0}", dev.RemoteVersion);
+ _logSw.WriteLine("################# Remote information #################");
+ _logSw.WriteLine("Server: {0}", dev.RemoteApplication);
+ _logSw.WriteLine("Version: {0}", dev.RemoteVersion);
- logSw.WriteLine("Operating system: {0} {1}", dev.RemoteOperatingSystem,
- dev.RemoteOperatingSystemVersion);
+ _logSw.WriteLine("Operating system: {0} {1}", dev.RemoteOperatingSystem,
+ dev.RemoteOperatingSystemVersion);
- logSw.WriteLine("Architecture: {0}", dev.RemoteArchitecture);
- logSw.WriteLine("Protocol version: {0}", dev.RemoteProtocolVersion);
- logSw.WriteLine("######################################################");
+ _logSw.WriteLine("Architecture: {0}", dev.RemoteArchitecture);
+ _logSw.WriteLine("Protocol version: {0}", dev.RemoteProtocolVersion);
+ _logSw.WriteLine("######################################################");
}
- logSw.WriteLine("################# Device information #################");
- logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer);
- logSw.WriteLine("Model: {0}", dev.Model);
- logSw.WriteLine("Firmware revision: {0}", dev.FirmwareRevision);
+ _logSw.WriteLine("################# Device information #################");
+ _logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer);
+ _logSw.WriteLine("Model: {0}", dev.Model);
+ _logSw.WriteLine("Firmware revision: {0}", dev.FirmwareRevision);
if(!@private)
- logSw.WriteLine("Serial number: {0}", dev.Serial);
+ _logSw.WriteLine("Serial number: {0}", dev.Serial);
- logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
- logSw.WriteLine("Device type: {0}", dev.Type);
- logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash);
- logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
- logSw.WriteLine("USB device: {0}", dev.IsUsb);
+ _logSw.WriteLine("Removable device: {0}", dev.IsRemovable);
+ _logSw.WriteLine("Device type: {0}", dev.Type);
+ _logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash);
+ _logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia);
+ _logSw.WriteLine("USB device: {0}", dev.IsUsb);
if(dev.IsUsb)
{
- logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
- logSw.WriteLine("USB product: {0}", dev.UsbProductString);
+ _logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString);
+ _logSw.WriteLine("USB product: {0}", dev.UsbProductString);
if(!@private)
- logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
+ _logSw.WriteLine("USB serial: {0}", dev.UsbSerialString);
- logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
- logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
+ _logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId);
+ _logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId);
}
- logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
+ _logSw.WriteLine("FireWire device: {0}", dev.IsFireWire);
if(dev.IsFireWire)
{
- logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
- logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
+ _logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName);
+ _logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName);
if(!@private)
- logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
+ _logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid);
- logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
- logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
+ _logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor);
+ _logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel);
}
- logSw.WriteLine("######################################################");
+ _logSw.WriteLine("######################################################");
- logSw.WriteLine();
- logSw.WriteLine("################ Dumping progress log ################");
- logSw.Flush();
+ _logSw.WriteLine();
+ _logSw.WriteLine("################ Dumping progress log ################");
+ _logSw.Flush();
}
/// Adds a new line to the dump log
@@ -179,20 +179,20 @@ namespace Aaru.Core.Logging
/// Arguments
public void WriteLine(string format, params object[] args)
{
- if(logSw == null)
+ if(_logSw == null)
return;
string text = string.Format(format, args);
- logSw.WriteLine("{0:s} {1}", DateTime.Now, text);
- logSw.Flush();
+ _logSw.WriteLine("{0:s} {1}", DateTime.Now, text);
+ _logSw.Flush();
}
/// Finishes and closes the dump log
public void Close()
{
- logSw?.WriteLine("######################################################");
- logSw?.WriteLine("End logging at {0}", DateTime.Now);
- logSw?.Close();
+ _logSw?.WriteLine("######################################################");
+ _logSw?.WriteLine("End logging at {0}", DateTime.Now);
+ _logSw?.Close();
}
}
}
\ No newline at end of file
diff --git a/Aaru.Core/Logging/IBGLog.cs b/Aaru.Core/Logging/IBGLog.cs
index 9b64384c3..6efd7000a 100644
--- a/Aaru.Core/Logging/IBGLog.cs
+++ b/Aaru.Core/Logging/IBGLog.cs
@@ -41,19 +41,19 @@ namespace Aaru.Core.Logging
/// Implements a log in the format used by IMGBurn
internal class IbgLog
{
- readonly CultureInfo ibgCulture;
- readonly double ibgDivider;
- readonly string ibgMediaType;
- readonly StringBuilder ibgSb;
- readonly string logFile;
- DateTime ibgDatePoint;
- ulong ibgIntSector;
- double ibgIntSpeed;
- double ibgMaxSpeed;
- int ibgSampleRate;
- int ibgSnaps;
- bool ibgStartSet;
- double ibgStartSpeed;
+ readonly CultureInfo _ibgCulture;
+ readonly double _ibgDivider;
+ readonly string _ibgMediaType;
+ readonly StringBuilder _ibgSb;
+ readonly string _logFile;
+ DateTime _ibgDatePoint;
+ ulong _ibgIntSector;
+ double _ibgIntSpeed;
+ double _ibgMaxSpeed;
+ int _ibgSampleRate;
+ int _ibgSnaps;
+ bool _ibgStartSet;
+ double _ibgStartSpeed;
/// Initializes the IMGBurn log
/// Log file
@@ -63,169 +63,169 @@ namespace Aaru.Core.Logging
if(string.IsNullOrEmpty(outputFile))
return;
- logFile = outputFile;
- ibgSb = new StringBuilder();
- ibgDatePoint = DateTime.Now;
- ibgCulture = new CultureInfo("en-US");
- ibgStartSet = false;
- ibgMaxSpeed = 0;
- ibgIntSpeed = 0;
- ibgSnaps = 0;
- ibgIntSector = 0;
+ _logFile = outputFile;
+ _ibgSb = new StringBuilder();
+ _ibgDatePoint = DateTime.Now;
+ _ibgCulture = new CultureInfo("en-US");
+ _ibgStartSet = false;
+ _ibgMaxSpeed = 0;
+ _ibgIntSpeed = 0;
+ _ibgSnaps = 0;
+ _ibgIntSector = 0;
switch(currentProfile)
{
case 0x0001:
- ibgMediaType = "HDD";
- ibgDivider = 1353;
+ _ibgMediaType = "HDD";
+ _ibgDivider = 1353;
break;
case 0x0002:
- ibgMediaType = "PD-650";
- ibgDivider = 150;
+ _ibgMediaType = "PD-650";
+ _ibgDivider = 150;
break;
case 0x0005:
- ibgMediaType = "CD-MO";
- ibgDivider = 150;
+ _ibgMediaType = "CD-MO";
+ _ibgDivider = 150;
break;
case 0x0008:
- ibgMediaType = "CD-ROM";
- ibgDivider = 150;
+ _ibgMediaType = "CD-ROM";
+ _ibgDivider = 150;
break;
case 0x0009:
- ibgMediaType = "CD-R";
- ibgDivider = 150;
+ _ibgMediaType = "CD-R";
+ _ibgDivider = 150;
break;
case 0x000A:
- ibgMediaType = "CD-RW";
- ibgDivider = 150;
+ _ibgMediaType = "CD-RW";
+ _ibgDivider = 150;
break;
case 0x0010:
- ibgMediaType = "DVD-ROM";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-ROM";
+ _ibgDivider = 1353;
break;
case 0x0011:
- ibgMediaType = "DVD-R";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-R";
+ _ibgDivider = 1353;
break;
case 0x0012:
- ibgMediaType = "DVD-RAM";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-RAM";
+ _ibgDivider = 1353;
break;
case 0x0013:
case 0x0014:
- ibgMediaType = "DVD-RW";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-RW";
+ _ibgDivider = 1353;
break;
case 0x0015:
case 0x0016:
- ibgMediaType = "DVD-R DL";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-R DL";
+ _ibgDivider = 1353;
break;
case 0x0017:
- ibgMediaType = "DVD-RW DL";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-RW DL";
+ _ibgDivider = 1353;
break;
case 0x0018:
- ibgMediaType = "DVD-Download";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD-Download";
+ _ibgDivider = 1353;
break;
case 0x001A:
- ibgMediaType = "DVD+RW";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD+RW";
+ _ibgDivider = 1353;
break;
case 0x001B:
- ibgMediaType = "DVD+R";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD+R";
+ _ibgDivider = 1353;
break;
case 0x0020:
- ibgMediaType = "DDCD-ROM";
- ibgDivider = 150;
+ _ibgMediaType = "DDCD-ROM";
+ _ibgDivider = 150;
break;
case 0x0021:
- ibgMediaType = "DDCD-R";
- ibgDivider = 150;
+ _ibgMediaType = "DDCD-R";
+ _ibgDivider = 150;
break;
case 0x0022:
- ibgMediaType = "DDCD-RW";
- ibgDivider = 150;
+ _ibgMediaType = "DDCD-RW";
+ _ibgDivider = 150;
break;
case 0x002A:
- ibgMediaType = "DVD+RW DL";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD+RW DL";
+ _ibgDivider = 1353;
break;
case 0x002B:
- ibgMediaType = "DVD+R DL";
- ibgDivider = 1353;
+ _ibgMediaType = "DVD+R DL";
+ _ibgDivider = 1353;
break;
case 0x0040:
- ibgMediaType = "BD-ROM";
- ibgDivider = 4500;
+ _ibgMediaType = "BD-ROM";
+ _ibgDivider = 4500;
break;
case 0x0041:
case 0x0042:
- ibgMediaType = "BD-R";
- ibgDivider = 4500;
+ _ibgMediaType = "BD-R";
+ _ibgDivider = 4500;
break;
case 0x0043:
- ibgMediaType = "BD-RE";
- ibgDivider = 4500;
+ _ibgMediaType = "BD-RE";
+ _ibgDivider = 4500;
break;
case 0x0050:
- ibgMediaType = "HD DVD-ROM";
- ibgDivider = 4500;
+ _ibgMediaType = "HD DVD-ROM";
+ _ibgDivider = 4500;
break;
case 0x0051:
- ibgMediaType = "HD DVD-R";
- ibgDivider = 4500;
+ _ibgMediaType = "HD DVD-R";
+ _ibgDivider = 4500;
break;
case 0x0052:
- ibgMediaType = "HD DVD-RAM";
- ibgDivider = 4500;
+ _ibgMediaType = "HD DVD-RAM";
+ _ibgDivider = 4500;
break;
case 0x0053:
- ibgMediaType = "HD DVD-RW";
- ibgDivider = 4500;
+ _ibgMediaType = "HD DVD-RW";
+ _ibgDivider = 4500;
break;
case 0x0058:
- ibgMediaType = "HD DVD-R DL";
- ibgDivider = 4500;
+ _ibgMediaType = "HD DVD-R DL";
+ _ibgDivider = 4500;
break;
case 0x005A:
- ibgMediaType = "HD DVD-RW DL";
- ibgDivider = 4500;
+ _ibgMediaType = "HD DVD-RW DL";
+ _ibgDivider = 4500;
break;
default:
- ibgMediaType = "Unknown";
- ibgDivider = 1353;
+ _ibgMediaType = "Unknown";
+ _ibgDivider = 1353;
break;
}
@@ -236,34 +236,34 @@ namespace Aaru.Core.Logging
/// Current speed at the snapshot
internal void Write(ulong sector, double currentSpeed)
{
- if(logFile == null)
+ if(_logFile == null)
return;
- ibgIntSpeed += currentSpeed;
- ibgSampleRate += (int)Math.Floor((DateTime.Now - ibgDatePoint).TotalMilliseconds);
- ibgSnaps++;
+ _ibgIntSpeed += currentSpeed;
+ _ibgSampleRate += (int)Math.Floor((DateTime.Now - _ibgDatePoint).TotalMilliseconds);
+ _ibgSnaps++;
- if(ibgSampleRate < 100)
+ if(_ibgSampleRate < 100)
return;
- if(ibgIntSpeed > 0 &&
- !ibgStartSet)
+ if(_ibgIntSpeed > 0 &&
+ !_ibgStartSet)
{
- ibgStartSpeed = ibgIntSpeed / ibgSnaps / ibgDivider;
- ibgStartSet = true;
+ _ibgStartSpeed = _ibgIntSpeed / _ibgSnaps / _ibgDivider;
+ _ibgStartSet = true;
}
- ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", ibgIntSpeed / ibgSnaps / ibgDivider, ibgIntSector,
- ibgSampleRate).AppendLine();
+ _ibgSb.AppendFormat("{0:0.00},{1},{2:0},0", _ibgIntSpeed / _ibgSnaps / _ibgDivider, _ibgIntSector,
+ _ibgSampleRate).AppendLine();
- if(ibgIntSpeed / ibgSnaps / ibgDivider > ibgMaxSpeed)
- ibgMaxSpeed = ibgIntSpeed / ibgDivider;
+ if(_ibgIntSpeed / _ibgSnaps / _ibgDivider > _ibgMaxSpeed)
+ _ibgMaxSpeed = _ibgIntSpeed / _ibgDivider;
- ibgDatePoint = DateTime.Now;
- ibgIntSpeed = 0;
- ibgSampleRate = 0;
- ibgSnaps = 0;
- ibgIntSector = sector;
+ _ibgDatePoint = DateTime.Now;
+ _ibgIntSpeed = 0;
+ _ibgSampleRate = 0;
+ _ibgSnaps = 0;
+ _ibgIntSector = sector;
}
/// Closes the IMGBurn log
@@ -277,10 +277,10 @@ namespace Aaru.Core.Logging
internal void Close(Device dev, ulong blocks, ulong blockSize, double totalSeconds, double currentSpeed,
double averageSpeed, string devicePath)
{
- if(logFile == null)
+ if(_logFile == null)
return;
- var ibgFs = new FileStream(logFile, FileMode.Create);
+ var ibgFs = new FileStream(_logFile, FileMode.Create);
var ibgHeader = new StringBuilder();
string ibgBusType;
@@ -312,7 +312,7 @@ namespace Aaru.Core.Logging
ibgHeader.AppendFormat("DEVICE_BUSTYPE={0}", ibgBusType).AppendLine();
ibgHeader.AppendLine();
- ibgHeader.AppendFormat("MEDIA_TYPE={0}", ibgMediaType).AppendLine();
+ ibgHeader.AppendFormat("MEDIA_TYPE={0}", _ibgMediaType).AppendLine();
ibgHeader.AppendLine("MEDIA_BOOKTYPE=Unknown");
ibgHeader.AppendLine("MEDIA_ID=N/A");
ibgHeader.AppendLine("MEDIA_TRACKPATH=PTP");
@@ -325,17 +325,20 @@ namespace Aaru.Core.Logging
ibgHeader.AppendFormat("DATA_TYPE=MODE1/{0}", blockSize).AppendLine();
ibgHeader.AppendLine("DATA_VOLUMEIDENTIFIER=");
ibgHeader.AppendLine();
- ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_START={0:0.00}", ibgStartSpeed).AppendLine();
- ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_END={0:0.00}", currentSpeed / ibgDivider).AppendLine();
- ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / ibgDivider).AppendLine();
- ibgHeader.AppendFormat(ibgCulture, "VERIFY_SPEED_MAX={0:0.00}", ibgMaxSpeed).AppendLine();
- ibgHeader.AppendFormat(ibgCulture, "VERIFY_TIME_TAKEN={0:0}", Math.Floor(totalSeconds)).AppendLine();
+ ibgHeader.AppendFormat(_ibgCulture, "VERIFY_SPEED_START={0:0.00}", _ibgStartSpeed).AppendLine();
+ ibgHeader.AppendFormat(_ibgCulture, "VERIFY_SPEED_END={0:0.00}", currentSpeed / _ibgDivider).AppendLine();
+
+ ibgHeader.AppendFormat(_ibgCulture, "VERIFY_SPEED_AVERAGE={0:0.00}", averageSpeed / _ibgDivider).
+ AppendLine();
+
+ ibgHeader.AppendFormat(_ibgCulture, "VERIFY_SPEED_MAX={0:0.00}", _ibgMaxSpeed).AppendLine();
+ ibgHeader.AppendFormat(_ibgCulture, "VERIFY_TIME_TAKEN={0:0}", Math.Floor(totalSeconds)).AppendLine();
ibgHeader.AppendLine("[END_CONFIGURATION]");
ibgHeader.AppendLine();
ibgHeader.AppendLine("HRPC=True");
ibgHeader.AppendLine();
ibgHeader.AppendLine("[START_VERIFY_GRAPH_VALUES]");
- ibgHeader.Append(ibgSb);
+ ibgHeader.Append(_ibgSb);
ibgHeader.AppendLine("[END_VERIFY_GRAPH_VALUES]");
ibgHeader.AppendLine();
ibgHeader.Replace("\r\n", "\n").Replace("\r", "\n").Replace("\n", "\r\n");
diff --git a/Aaru.Core/Logging/MHDDLog.cs b/Aaru.Core/Logging/MHDDLog.cs
index 406b9a5f3..61f55dcea 100644
--- a/Aaru.Core/Logging/MHDDLog.cs
+++ b/Aaru.Core/Logging/MHDDLog.cs
@@ -42,8 +42,9 @@ namespace Aaru.Core.Logging
/// Implements a log in the format used by MHDD
internal class MhddLog
{
- readonly string logFile;
- readonly MemoryStream mhddFs;
+ const string MHDD_VER = "VER:2 ";
+ readonly string _logFile;
+ readonly MemoryStream _mhddFs;
/// Initializes the MHDD log
/// Log file
@@ -59,8 +60,8 @@ namespace Aaru.Core.Logging
string.IsNullOrEmpty(outputFile))
return;
- mhddFs = new MemoryStream();
- logFile = outputFile;
+ _mhddFs = new MemoryStream();
+ _logFile = outputFile;
string mode;
@@ -102,8 +103,6 @@ namespace Aaru.Core.Logging
string scanblocksize =
string.Format(new CultureInfo("en-US"), "SCAN BLOCK SIZE: {0:n0} sectors", blocksToRead);
- const string MHDD_VER = "VER:2 ";
-
byte[] deviceBytes = Encoding.ASCII.GetBytes(device);
byte[] modeBytes = Encoding.ASCII.GetBytes(mode);
byte[] fwBytes = Encoding.ASCII.GetBytes(fw);
@@ -122,24 +121,24 @@ namespace Aaru.Core.Logging
newLine[0] = 0x0D;
newLine[1] = 0x0A;
- mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(verBytes, 0, verBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(modeBytes, 0, modeBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(deviceBytes, 0, deviceBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(fwBytes, 0, fwBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(snBytes, 0, snBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length);
- mhddFs.Write(newLine, 0, 2);
- mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length);
- mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(BitConverter.GetBytes(pointer), 0, 4);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(verBytes, 0, verBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(modeBytes, 0, modeBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(deviceBytes, 0, deviceBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(fwBytes, 0, fwBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(snBytes, 0, snBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(sectorsBytes, 0, sectorsBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(sectorsizeBytes, 0, sectorsizeBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
+ _mhddFs.Write(scanblocksizeBytes, 0, scanblocksizeBytes.Length);
+ _mhddFs.Write(newLine, 0, 2);
}
/// Logs a new read
@@ -147,25 +146,25 @@ namespace Aaru.Core.Logging
/// Duration in milliseconds
internal void Write(ulong sector, double duration)
{
- if(logFile == null)
+ if(_logFile == null)
return;
byte[] sectorBytes = BitConverter.GetBytes(sector);
byte[] durationBytes = BitConverter.GetBytes((ulong)(duration * 1000));
- mhddFs.Write(sectorBytes, 0, 8);
- mhddFs.Write(durationBytes, 0, 8);
+ _mhddFs.Write(sectorBytes, 0, 8);
+ _mhddFs.Write(durationBytes, 0, 8);
}
/// Closes and writes to file the MHDD log
internal void Close()
{
- if(logFile == null)
+ if(_logFile == null)
return;
- var fs = new FileStream(logFile, FileMode.Create);
- mhddFs.WriteTo(fs);
- mhddFs.Close();
+ var fs = new FileStream(_logFile, FileMode.Create);
+ _mhddFs.WriteTo(fs);
+ _mhddFs.Close();
fs.Close();
}
}
diff --git a/Aaru.Core/Partitions.cs b/Aaru.Core/Partitions.cs
index 89d86e523..050af9ac6 100644
--- a/Aaru.Core/Partitions.cs
+++ b/Aaru.Core/Partitions.cs
@@ -36,7 +36,6 @@ using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.CommonTypes.Structs;
using Aaru.Console;
-using Aaru.Partitions;
namespace Aaru.Core
{
diff --git a/Aaru.Core/Sidecar/BlockMedia.cs b/Aaru.Core/Sidecar/BlockMedia.cs
index 0f223f101..f59b0230e 100644
--- a/Aaru.Core/Sidecar/BlockMedia.cs
+++ b/Aaru.Core/Sidecar/BlockMedia.cs
@@ -64,7 +64,7 @@ namespace Aaru.Core
void BlockMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
{
- if(aborted)
+ if(_aborted)
return;
sidecar.BlockMedia = new[]
@@ -103,7 +103,7 @@ namespace Aaru.Core
foreach(MediaTagType tagType in image.Info.ReadableMediaTags)
{
- if(aborted)
+ if(_aborted)
return;
switch(tagType)
@@ -344,7 +344,7 @@ namespace Aaru.Core
while(doneSectors < sectors)
{
- if(aborted)
+ if(_aborted)
{
EndProgress2();
@@ -413,7 +413,7 @@ namespace Aaru.Core
{
UpdateStatus($"Hashing partition {tapePartition.Number}...");
- if(aborted)
+ if(_aborted)
return;
var tapePartitionChk = new Checksum();
@@ -429,7 +429,7 @@ namespace Aaru.Core
while(doneSectors < sectors)
{
- if(aborted)
+ if(_aborted)
{
EndProgress2();
@@ -491,7 +491,7 @@ namespace Aaru.Core
{
UpdateStatus($"Hashing file {tapeFile.File}...");
- if(aborted)
+ if(_aborted)
return;
var tapeFileChk = new Checksum();
@@ -507,7 +507,7 @@ namespace Aaru.Core
while(doneSectors < sectors)
{
- if(aborted)
+ if(_aborted)
{
EndProgress2();
@@ -561,7 +561,7 @@ namespace Aaru.Core
UpdateStatus("Checking filesystems...");
- if(aborted)
+ if(_aborted)
return;
List partitions = Partitions.GetAll(image);
@@ -575,7 +575,7 @@ namespace Aaru.Core
for(int i = 0; i < partitions.Count; i++)
{
- if(aborted)
+ if(_aborted)
return;
sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType
@@ -593,7 +593,7 @@ namespace Aaru.Core
foreach(IFilesystem plugin in plugins.PluginsList.Values)
try
{
- if(aborted)
+ if(_aborted)
return;
if(!plugin.Identify(image, partitions[i]))
@@ -627,7 +627,7 @@ namespace Aaru.Core
}
else
{
- if(aborted)
+ if(_aborted)
return;
sidecar.BlockMedia[0].FileSystemInformation[0] = new PartitionType
@@ -648,7 +648,7 @@ namespace Aaru.Core
foreach(IFilesystem plugin in plugins.PluginsList.Values)
try
{
- if(aborted)
+ if(_aborted)
return;
if(!plugin.Identify(image, wholePart))
@@ -857,7 +857,7 @@ namespace Aaru.Core
string scpFilePath = Path.Combine(Path.GetDirectoryName(imagePath),
Path.GetFileNameWithoutExtension(imagePath) + ".scp");
- if(aborted)
+ if(_aborted)
return;
if(File.Exists(scpFilePath))
@@ -886,7 +886,7 @@ namespace Aaru.Core
for(byte t = scpImage.Header.start; t <= scpImage.Header.end; t++)
{
- if(aborted)
+ if(_aborted)
return;
var scpBlockTrackType = new BlockTrackType
@@ -950,7 +950,7 @@ namespace Aaru.Core
bool kfDir = false;
- if(aborted)
+ if(_aborted)
return;
if(Directory.Exists(basename))
@@ -994,7 +994,7 @@ namespace Aaru.Core
foreach(KeyValuePair kvp in kfImage.tracks)
{
- if(aborted)
+ if(_aborted)
return;
var kfBlockTrackType = new BlockTrackType
@@ -1051,7 +1051,7 @@ namespace Aaru.Core
string dfiFilePath = Path.Combine(Path.GetDirectoryName(imagePath),
Path.GetFileNameWithoutExtension(imagePath) + ".dfi");
- if(aborted)
+ if(_aborted)
return;
if(!File.Exists(dfiFilePath))
@@ -1081,7 +1081,7 @@ namespace Aaru.Core
foreach(int t in dfiImage.TrackOffsets.Keys)
{
- if(aborted)
+ if(_aborted)
return;
var dfiBlockTrackType = new BlockTrackType
diff --git a/Aaru.Core/Sidecar/BlockTape.cs b/Aaru.Core/Sidecar/BlockTape.cs
index 61c28deb7..b08df3d80 100644
--- a/Aaru.Core/Sidecar/BlockTape.cs
+++ b/Aaru.Core/Sidecar/BlockTape.cs
@@ -44,7 +44,7 @@ namespace Aaru.Core
/// Expected block size in bytes
public CICMMetadataType BlockTape(string folderName, List files, uint blockSize)
{
- sidecar = new CICMMetadataType
+ _sidecar = new CICMMetadataType
{
BlockMedia = new[]
{
@@ -80,8 +80,8 @@ namespace Aaru.Core
}
};
- if(aborted)
- return sidecar;
+ if(_aborted)
+ return _sidecar;
ulong currentBlock = 0;
ulong totalSize = 0;
@@ -92,10 +92,10 @@ namespace Aaru.Core
for(int i = 0; i < files.Count; i++)
{
- if(aborted)
- return sidecar;
+ if(_aborted)
+ return _sidecar;
- fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
+ _fs = new FileStream(files[i], FileMode.Open, FileAccess.Read);
var fileWorker = new Checksum();
var tapeFile = new TapeFileType
@@ -106,25 +106,25 @@ namespace Aaru.Core
offset = 0,
Value = Path.GetFileName(files[i])
},
- Size = (ulong)fs.Length,
+ Size = (ulong)_fs.Length,
BlockSize = blockSize,
StartBlock = currentBlock,
Sequence = (ulong)i
};
const uint SECTORS_TO_READ = 512;
- ulong sectors = (ulong)fs.Length / blockSize;
+ ulong sectors = (ulong)_fs.Length / blockSize;
ulong doneSectors = 0;
InitProgress2();
while(doneSectors < sectors)
{
- if(aborted)
+ if(_aborted)
{
EndProgress2();
- return sidecar;
+ return _sidecar;
}
byte[] sector;
@@ -132,7 +132,7 @@ namespace Aaru.Core
if(sectors - doneSectors >= SECTORS_TO_READ)
{
sector = new byte[SECTORS_TO_READ * blockSize];
- fs.Read(sector, 0, sector.Length);
+ _fs.Read(sector, 0, sector.Length);
UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}",
(long)doneSectors, (long)sectors);
@@ -142,7 +142,7 @@ namespace Aaru.Core
else
{
sector = new byte[(uint)(sectors - doneSectors) * blockSize];
- fs.Read(sector, 0, sector.Length);
+ _fs.Read(sector, 0, sector.Length);
UpdateProgress2($"Hashing block {doneSectors} of {sectors} on file {i + 1} of {files.Count}",
(long)doneSectors, (long)sectors);
@@ -156,7 +156,7 @@ namespace Aaru.Core
tapeFile.EndBlock = (tapeFile.StartBlock + sectors) - 1;
currentBlock += sectors;
- totalSize += (ulong)fs.Length;
+ totalSize += (ulong)_fs.Length;
tapeFile.Checksums = fileWorker.End().ToArray();
tapeFiles.Add(tapeFile);
@@ -164,59 +164,59 @@ namespace Aaru.Core
}
UpdateStatus("Setting metadata...");
- sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray();
- sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums;
- sidecar.BlockMedia[0].Size = totalSize;
- sidecar.BlockMedia[0].LogicalBlocks = currentBlock;
- sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1;
- sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize;
- sidecar.BlockMedia[0].TapeInformation[0].Checksums = sidecar.BlockMedia[0].Checksums;
- sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray();
+ _sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray();
+ _sidecar.BlockMedia[0].ContentChecksums = _sidecar.BlockMedia[0].Checksums;
+ _sidecar.BlockMedia[0].Size = totalSize;
+ _sidecar.BlockMedia[0].LogicalBlocks = currentBlock;
+ _sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1;
+ _sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize;
+ _sidecar.BlockMedia[0].TapeInformation[0].Checksums = _sidecar.BlockMedia[0].Checksums;
+ _sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray();
// This is purely for convenience, as typically these kind of data represents QIC tapes
if(blockSize == 512)
{
- sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge";
+ _sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge";
if(totalSize <= 20 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-11";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-11";
else if(totalSize <= 40 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-40";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-40";
else if(totalSize <= 60 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-24";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-24";
else if(totalSize <= 80 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-80";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-80";
else if(totalSize <= 120 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-120";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-120";
else if(totalSize <= 150 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-150";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-150";
else if(totalSize <= 320 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-320";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-320";
else if(totalSize <= 340 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-3010";
else if(totalSize <= 525 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-525";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-525";
else if(totalSize <= 670 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-3020";
else if(totalSize <= 1200 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-3080";
else if(totalSize <= 1350 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-1350";
else if(totalSize <= (long)4000 * 1048576)
- sidecar.BlockMedia[0].DiskSubType = "QIC-3095";
+ _sidecar.BlockMedia[0].DiskSubType = "QIC-3095";
else
{
- sidecar.BlockMedia[0].DiskType = "Unknown tape";
- sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
+ _sidecar.BlockMedia[0].DiskType = "Unknown tape";
+ _sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
}
}
else
{
- sidecar.BlockMedia[0].DiskType = "Unknown tape";
- sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
+ _sidecar.BlockMedia[0].DiskType = "Unknown tape";
+ _sidecar.BlockMedia[0].DiskSubType = "Unknown tape";
}
- return sidecar;
+ return _sidecar;
}
}
}
\ No newline at end of file
diff --git a/Aaru.Core/Sidecar/Files.cs b/Aaru.Core/Sidecar/Files.cs
index e2dbf91df..c814fa72d 100644
--- a/Aaru.Core/Sidecar/Files.cs
+++ b/Aaru.Core/Sidecar/Files.cs
@@ -264,7 +264,7 @@ namespace Aaru.Core
while(position < stat.Length - 1048576)
{
- if(aborted)
+ if(_aborted)
return file;
data = new byte[1048576];
@@ -289,7 +289,7 @@ namespace Aaru.Core
file.Checksums = fileChkWorker.End().ToArray();
}
else
- file.Checksums = emptyChecksums;
+ file.Checksums = _emptyChecksums;
Errno ret = filesystem.ListXAttr(path + "/" + filename, out List xattrs);
diff --git a/Aaru.Core/Sidecar/OpticalDisc.cs b/Aaru.Core/Sidecar/OpticalDisc.cs
index fab038e2c..aee979938 100644
--- a/Aaru.Core/Sidecar/OpticalDisc.cs
+++ b/Aaru.Core/Sidecar/OpticalDisc.cs
@@ -63,7 +63,7 @@ namespace Aaru.Core
void OpticalDisc(IOpticalMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins,
List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding)
{
- if(aborted)
+ if(_aborted)
return;
sidecar.OpticalDisc = new[]
@@ -104,7 +104,7 @@ namespace Aaru.Core
foreach(MediaTagType tagType in image.Info.ReadableMediaTags)
{
- if(aborted)
+ if(_aborted)
return;
switch(tagType)
@@ -443,7 +443,7 @@ namespace Aaru.Core
image.Info.MediaType != MediaType.Unknown)
sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType);
- if(aborted)
+ if(_aborted)
return;
InitProgress();
@@ -456,7 +456,7 @@ namespace Aaru.Core
foreach(Track trk in tracks)
{
- if(aborted)
+ if(_aborted)
{
EndProgress();
@@ -587,7 +587,7 @@ namespace Aaru.Core
while(doneSectors < sectors)
{
- if(aborted)
+ if(_aborted)
{
EndProgress();
EndProgress2();
@@ -674,7 +674,7 @@ namespace Aaru.Core
while(doneSectors < sectors)
{
- if(aborted)
+ if(_aborted)
{
EndProgress();
EndProgress2();
@@ -746,7 +746,7 @@ namespace Aaru.Core
foreach(IFilesystem plugin in plugins.PluginsList.Values)
try
{
- if(aborted)
+ if(_aborted)
{
EndProgress();
@@ -813,7 +813,7 @@ namespace Aaru.Core
foreach(IFilesystem plugin in plugins.PluginsList.Values)
try
{
- if(aborted)
+ if(_aborted)
{
EndProgress();
diff --git a/Aaru.Core/Sidecar/Sidecar.cs b/Aaru.Core/Sidecar/Sidecar.cs
index a8a7191d0..15cce665f 100644
--- a/Aaru.Core/Sidecar/Sidecar.cs
+++ b/Aaru.Core/Sidecar/Sidecar.cs
@@ -44,27 +44,27 @@ namespace Aaru.Core
{
public partial class Sidecar
{
- readonly ChecksumType[] emptyChecksums;
- readonly Encoding encoding;
- readonly FileInfo fi;
- readonly Guid filterId;
- readonly IMediaImage image;
- readonly string imagePath;
- readonly Checksum imgChkWorker;
- readonly PluginBase plugins;
- bool aborted;
- FileStream fs;
- CICMMetadataType sidecar;
+ readonly ChecksumType[] _emptyChecksums;
+ readonly Encoding _encoding;
+ readonly FileInfo _fi;
+ readonly Guid _filterId;
+ readonly IMediaImage _image;
+ readonly string _imagePath;
+ readonly Checksum _imgChkWorker;
+ readonly PluginBase _plugins;
+ bool _aborted;
+ FileStream _fs;
+ CICMMetadataType _sidecar;
public Sidecar()
{
- plugins = GetPluginBase.Instance;
- imgChkWorker = new Checksum();
- aborted = false;
+ _plugins = GetPluginBase.Instance;
+ _imgChkWorker = new Checksum();
+ _aborted = false;
var emptyChkWorker = new Checksum();
emptyChkWorker.Update(new byte[0]);
- emptyChecksums = emptyChkWorker.End().ToArray();
+ _emptyChecksums = emptyChkWorker.End().ToArray();
}
/// Image
@@ -73,19 +73,16 @@ namespace Aaru.Core
/// Encoding for analysis
public Sidecar(IMediaImage image, string imagePath, Guid filterId, Encoding encoding)
{
- this.image = image;
- this.imagePath = imagePath;
- this.filterId = filterId;
- this.encoding = encoding;
-
- sidecar = image.CicmMetadata ?? new CICMMetadataType();
- plugins = GetPluginBase.Instance;
-
- fi = new FileInfo(imagePath);
- fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
-
- imgChkWorker = new Checksum();
- aborted = false;
+ _image = image;
+ _imagePath = imagePath;
+ _filterId = filterId;
+ _encoding = encoding;
+ _sidecar = image.CicmMetadata ?? new CICMMetadataType();
+ _plugins = GetPluginBase.Instance;
+ _fi = new FileInfo(imagePath);
+ _fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read);
+ _imgChkWorker = new Checksum();
+ _aborted = false;
}
/// Implements creating a metadata sidecar
@@ -100,50 +97,50 @@ namespace Aaru.Core
UpdateStatus("Hashing image file...");
InitProgress();
- while(position < fi.Length - 1048576)
+ while(position < _fi.Length - 1048576)
{
- if(aborted)
- return sidecar;
+ if(_aborted)
+ return _sidecar;
data = new byte[1048576];
- fs.Read(data, 0, 1048576);
+ _fs.Read(data, 0, 1048576);
- UpdateProgress("Hashing image file byte {0} of {1}", position, fi.Length);
+ UpdateProgress("Hashing image file byte {0} of {1}", position, _fi.Length);
- imgChkWorker.Update(data);
+ _imgChkWorker.Update(data);
position += 1048576;
}
- data = new byte[fi.Length - position];
- fs.Read(data, 0, (int)(fi.Length - position));
+ data = new byte[_fi.Length - position];
+ _fs.Read(data, 0, (int)(_fi.Length - position));
- UpdateProgress("Hashing image file byte {0} of {1}", position, fi.Length);
+ UpdateProgress("Hashing image file byte {0} of {1}", position, _fi.Length);
- imgChkWorker.Update(data);
+ _imgChkWorker.Update(data);
// For fast debugging, skip checksum
//skipImageChecksum:
EndProgress();
- fs.Close();
+ _fs.Close();
- List imgChecksums = imgChkWorker.End();
+ List imgChecksums = _imgChkWorker.End();
- sidecar.OpticalDisc = null;
- sidecar.BlockMedia = null;
- sidecar.AudioMedia = null;
- sidecar.LinearMedia = null;
+ _sidecar.OpticalDisc = null;
+ _sidecar.BlockMedia = null;
+ _sidecar.AudioMedia = null;
+ _sidecar.LinearMedia = null;
- if(aborted)
- return sidecar;
+ if(_aborted)
+ return _sidecar;
- switch(image.Info.XmlMediaType)
+ switch(_image.Info.XmlMediaType)
{
case XmlMediaType.OpticalDisc:
- if(image is IOpticalMediaImage opticalImage)
- OpticalDisc(opticalImage, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar,
- encoding);
+ if(_image is IOpticalMediaImage opticalImage)
+ OpticalDisc(opticalImage, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar,
+ _encoding);
else
{
AaruConsole.
@@ -154,26 +151,26 @@ namespace Aaru.Core
break;
case XmlMediaType.BlockMedia:
- BlockMedia(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar, encoding);
+ BlockMedia(_image, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding);
break;
case XmlMediaType.LinearMedia:
- LinearMedia(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar, encoding);
+ LinearMedia(_image, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding);
break;
case XmlMediaType.AudioMedia:
- AudioMedia(image, filterId, imagePath, fi, plugins, imgChecksums, ref sidecar, encoding);
+ AudioMedia(_image, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding);
break;
}
- return sidecar;
+ return _sidecar;
}
public void Abort()
{
UpdateStatus("Aborting...");
- aborted = true;
+ _aborted = true;
}
}
}
\ No newline at end of file
diff --git a/Aaru.Devices/Device/Commands.cs b/Aaru.Devices/Device/Commands.cs
index 7e40a1006..721a51612 100644
--- a/Aaru.Devices/Device/Commands.cs
+++ b/Aaru.Devices/Device/Commands.cs
@@ -163,11 +163,11 @@ namespace Aaru.Devices
{
switch(command)
{
- case MmcCommands.SendCid when cachedCid != null:
+ case MmcCommands.SendCid when _cachedCid != null:
{
DateTime start = DateTime.Now;
- buffer = new byte[cachedCid.Length];
- Array.Copy(cachedCid, buffer, buffer.Length);
+ buffer = new byte[_cachedCid.Length];
+ Array.Copy(_cachedCid, buffer, buffer.Length);
response = new uint[4];
sense = false;
DateTime end = DateTime.Now;
@@ -175,11 +175,11 @@ namespace Aaru.Devices
return 0;
}
- case MmcCommands.SendCsd when cachedCid != null:
+ case MmcCommands.SendCsd when _cachedCid != null:
{
DateTime start = DateTime.Now;
- buffer = new byte[cachedCsd.Length];
- Array.Copy(cachedCsd, buffer, buffer.Length);
+ buffer = new byte[_cachedCsd.Length];
+ Array.Copy(_cachedCsd, buffer, buffer.Length);
response = new uint[4];
sense = false;
DateTime end = DateTime.Now;
@@ -187,11 +187,11 @@ namespace Aaru.Devices
return 0;
}
- case (MmcCommands)SecureDigitalCommands.SendScr when cachedScr != null:
+ case (MmcCommands)SecureDigitalCommands.SendScr when _cachedScr != null:
{
DateTime start = DateTime.Now;
- buffer = new byte[cachedScr.Length];
- Array.Copy(cachedScr, buffer, buffer.Length);
+ buffer = new byte[_cachedScr.Length];
+ Array.Copy(_cachedScr, buffer, buffer.Length);
response = new uint[4];
sense = false;
DateTime end = DateTime.Now;
@@ -199,12 +199,12 @@ namespace Aaru.Devices
return 0;
}
- case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when cachedOcr != null:
- case MmcCommands.SendOpCond when cachedOcr != null:
+ case (MmcCommands)SecureDigitalCommands.SendOperatingCondition when _cachedOcr != null:
+ case MmcCommands.SendOpCond when _cachedOcr != null:
{
DateTime start = DateTime.Now;
- buffer = new byte[cachedOcr.Length];
- Array.Copy(cachedOcr, buffer, buffer.Length);
+ buffer = new byte[_cachedOcr.Length];
+ Array.Copy(_cachedOcr, buffer, buffer.Length);
response = new uint[4];
sense = false;
DateTime end = DateTime.Now;
diff --git a/Aaru.Devices/Device/Constructor.cs b/Aaru.Devices/Device/Constructor.cs
index 67ee9a915..91fc87ad9 100644
--- a/Aaru.Devices/Device/Constructor.cs
+++ b/Aaru.Devices/Device/Constructor.cs
@@ -307,8 +307,8 @@ namespace Aaru.Devices
if(!sense)
{
- cachedCsd = new byte[16];
- Array.Copy(sdBuffer, 0, cachedCsd, 0, 16);
+ _cachedCsd = new byte[16];
+ Array.Copy(sdBuffer, 0, _cachedCsd, 0, 16);
}
sdBuffer = new byte[16];
@@ -321,8 +321,8 @@ namespace Aaru.Devices
if(!sense)
{
- cachedCid = new byte[16];
- Array.Copy(sdBuffer, 0, cachedCid, 0, 16);
+ _cachedCid = new byte[16];
+ Array.Copy(sdBuffer, 0, _cachedCid, 0, 16);
}
sdBuffer = new byte[8];
@@ -336,14 +336,14 @@ namespace Aaru.Devices
if(!sense)
{
- cachedScr = new byte[8];
- Array.Copy(sdBuffer, 0, cachedScr, 0, 8);
+ _cachedScr = new byte[8];
+ Array.Copy(sdBuffer, 0, _cachedScr, 0, 8);
}
sdBuffer = new byte[4];
LastError = Windows.Command.SendMmcCommand((SafeFileHandle)FileHandle,
- cachedScr != null
+ _cachedScr != null
? (MmcCommands)SecureDigitalCommands.
SendOperatingCondition
: MmcCommands.SendOpCond, false, true,
@@ -353,8 +353,8 @@ namespace Aaru.Devices
if(!sense)
{
- cachedScr = new byte[4];
- Array.Copy(sdBuffer, 0, cachedScr, 0, 4);
+ _cachedScr = new byte[4];
+ Array.Copy(sdBuffer, 0, _cachedScr, 0, 4);
}
}
@@ -375,34 +375,34 @@ namespace Aaru.Devices
if(File.Exists("/sys/block/" + devPath + "/device/csd"))
{
- int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/csd", out cachedCsd);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/csd", out _cachedCsd);
if(len == 0)
- cachedCsd = null;
+ _cachedCsd = null;
}
if(File.Exists("/sys/block/" + devPath + "/device/cid"))
{
- int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/cid", out cachedCid);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/cid", out _cachedCid);
if(len == 0)
- cachedCid = null;
+ _cachedCid = null;
}
if(File.Exists("/sys/block/" + devPath + "/device/scr"))
{
- int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/scr", out cachedScr);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/scr", out _cachedScr);
if(len == 0)
- cachedScr = null;
+ _cachedScr = null;
}
if(File.Exists("/sys/block/" + devPath + "/device/ocr"))
{
- int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/ocr", out cachedOcr);
+ int len = ConvertFromHexAscii("/sys/block/" + devPath + "/device/ocr", out _cachedOcr);
if(len == 0)
- cachedOcr = null;
+ _cachedOcr = null;
}
}
@@ -426,7 +426,7 @@ namespace Aaru.Devices
break;
case DeviceType.SecureDigital:
case DeviceType.MMC:
- if(!_remote.GetSdhciRegisters(out cachedCsd, out cachedCid, out cachedOcr, out cachedScr))
+ if(!_remote.GetSdhciRegisters(out _cachedCsd, out _cachedCid, out _cachedOcr, out _cachedScr))
{
Type = DeviceType.SCSI;
ScsiType = PeripheralDeviceTypes.DirectAccess;
@@ -437,15 +437,15 @@ namespace Aaru.Devices
}
#region SecureDigital / MultiMediaCard
- if(cachedCid != null)
+ if(_cachedCid != null)
{
ScsiType = PeripheralDeviceTypes.DirectAccess;
IsRemovable = false;
- if(cachedScr != null)
+ if(_cachedScr != null)
{
Type = DeviceType.SecureDigital;
- CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(cachedCid);
+ CID decoded = Decoders.SecureDigital.Decoders.DecodeCID(_cachedCid);
Manufacturer = VendorString.Prettify(decoded.Manufacturer);
Model = decoded.ProductName;
@@ -457,7 +457,7 @@ namespace Aaru.Devices
else
{
Type = DeviceType.MMC;
- Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(cachedCid);
+ Decoders.MMC.CID decoded = Decoders.MMC.Decoders.DecodeCID(_cachedCid);
Manufacturer = Decoders.MMC.VendorString.Prettify(decoded.Manufacturer);
Model = decoded.ProductName;
@@ -513,7 +513,7 @@ namespace Aaru.Devices
string usbTemp = usbSr.ReadToEnd();
ushort.TryParse(usbTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
- out usbProduct);
+ out _usbProduct);
usbSr.Close();
@@ -521,7 +521,7 @@ namespace Aaru.Devices
usbTemp = usbSr.ReadToEnd();
ushort.TryParse(usbTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
- out usbVendor);
+ out _usbVendor);
usbSr.Close();
@@ -574,8 +574,8 @@ namespace Aaru.Devices
if(usbDevice != null)
{
UsbDescriptors = usbDevice.BinaryDescriptors;
- usbVendor = (ushort)usbDevice.DeviceDescriptor.idVendor;
- usbProduct = (ushort)usbDevice.DeviceDescriptor.idProduct;
+ _usbVendor = (ushort)usbDevice.DeviceDescriptor.idVendor;
+ _usbProduct = (ushort)usbDevice.DeviceDescriptor.idProduct;
UsbManufacturerString = usbDevice.Manufacturer;
UsbProductString = usbDevice.Product;
@@ -599,8 +599,8 @@ namespace Aaru.Devices
{
IsUsb = true;
UsbDescriptors = remoteUsbDescriptors;
- usbVendor = remoteUsbVendor;
- usbProduct = remoteUsbProduct;
+ _usbVendor = remoteUsbVendor;
+ _usbProduct = remoteUsbProduct;
UsbManufacturerString = remoteUsbManufacturer;
UsbProductString = remoteUsbProductString;
UsbSerialString = remoteUsbSerial;
@@ -611,7 +611,7 @@ namespace Aaru.Devices
#region FireWire
if(!(_remote is null))
{
- if(_remote.GetFireWireData(out firewireVendor, out firewireModel, out firewireGuid,
+ if(_remote.GetFireWireData(out _firewireVendor, out _firewireModel, out _firewireGuid,
out string remoteFireWireVendorName, out string remoteFireWireModelName))
{
IsFireWire = true;
@@ -648,7 +648,7 @@ namespace Aaru.Devices
string fwTemp = fwSr.ReadToEnd();
uint.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
- out firewireModel);
+ out _firewireModel);
fwSr.Close();
@@ -656,7 +656,7 @@ namespace Aaru.Devices
fwTemp = fwSr.ReadToEnd();
uint.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
- out firewireVendor);
+ out _firewireVendor);
fwSr.Close();
@@ -664,7 +664,7 @@ namespace Aaru.Devices
fwTemp = fwSr.ReadToEnd();
ulong.TryParse(fwTemp, NumberStyles.HexNumber, CultureInfo.InvariantCulture,
- out firewireGuid);
+ out _firewireGuid);
fwSr.Close();
@@ -886,7 +886,7 @@ namespace Aaru.Devices
Model = FireWireModelName;
if(string.IsNullOrEmpty(Serial))
- Serial = $"{firewireGuid:X16}";
+ Serial = $"{_firewireGuid:X16}";
else
foreach(char c in Serial.Where(c => !char.IsControl(c)))
Serial = $"{(uint)c:X2}";
diff --git a/Aaru.Devices/Device/Variables.cs b/Aaru.Devices/Device/Variables.cs
index 47a30cb8a..c1e3082bf 100644
--- a/Aaru.Devices/Device/Variables.cs
+++ b/Aaru.Devices/Device/Variables.cs
@@ -38,18 +38,18 @@ namespace Aaru.Devices
{
public partial class Device
{
- readonly ushort usbVendor;
- readonly ushort usbProduct;
- readonly ulong firewireGuid;
- readonly uint firewireModel;
- readonly uint firewireVendor;
+ readonly ushort _usbVendor;
+ readonly ushort _usbProduct;
+ readonly ulong _firewireGuid;
+ readonly uint _firewireModel;
+ readonly uint _firewireVendor;
// MMC and SecureDigital, values that need to be get with card idle, something that may
// not be possible to do but usually is already done by the SDHCI driver.
- readonly byte[] cachedCsd;
- readonly byte[] cachedCid;
- readonly byte[] cachedScr;
- readonly byte[] cachedOcr;
+ readonly byte[] _cachedCsd;
+ readonly byte[] _cachedCid;
+ readonly byte[] _cachedScr;
+ readonly byte[] _cachedOcr;
/// Gets the Platform ID for this device
/// The Platform ID
@@ -105,11 +105,11 @@ namespace Aaru.Devices
/// Gets the USB vendor ID.
/// The USB vendor ID.
- public ushort UsbVendorId => usbVendor;
+ public ushort UsbVendorId => _usbVendor;
/// Gets the USB product ID.
/// The USB product ID.
- public ushort UsbProductId => usbProduct;
+ public ushort UsbProductId => _usbProduct;
/// Gets the USB descriptors.
/// The USB descriptors.
@@ -133,11 +133,11 @@ namespace Aaru.Devices
/// Gets the FireWire GUID
/// The FireWire GUID.
- public ulong FireWireGuid => firewireGuid;
+ public ulong FireWireGuid => _firewireGuid;
/// Gets the FireWire model number
/// The FireWire model.
- public uint FireWireModel => firewireModel;
+ public uint FireWireModel => _firewireModel;
/// Gets the FireWire model name.
/// The FireWire model name.
@@ -145,7 +145,7 @@ namespace Aaru.Devices
/// Gets the FireWire vendor number.
/// The FireWire vendor number.
- public uint FireWireVendor => firewireVendor;
+ public uint FireWireVendor => _firewireVendor;
/// Gets the FireWire vendor name.
/// The FireWire vendor name.
diff --git a/Aaru.Devices/Remote/Consts.cs b/Aaru.Devices/Remote/Consts.cs
index 483f7a5d8..2680d0dd6 100644
--- a/Aaru.Devices/Remote/Consts.cs
+++ b/Aaru.Devices/Remote/Consts.cs
@@ -34,9 +34,9 @@ namespace Aaru.Devices.Remote
{
public class Consts
{
- public const uint RemoteId = 0x52434944; // "DICR"
- public const uint PacketId = 0x544B4350; // "PCKT"
- public const int PacketVersion = 1;
- public const int MaxProtocol = 1;
+ public const uint REMOTE_ID = 0x52434944; // "DICR"
+ public const uint PACKET_ID = 0x544B4350; // "PCKT"
+ public const int PACKET_VERSION = 1;
+ public const int MAX_PROTOCOL = 1;
}
}
\ No newline at end of file
diff --git a/Aaru.Devices/Remote/Remote.cs b/Aaru.Devices/Remote/Remote.cs
index f8ba98ed5..8485f012f 100644
--- a/Aaru.Devices/Remote/Remote.cs
+++ b/Aaru.Devices/Remote/Remote.cs
@@ -86,8 +86,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -122,7 +122,7 @@ namespace Aaru.Devices.Remote
throw new ArgumentException();
}
- if(hdr.version != Consts.PacketVersion)
+ if(hdr.version != Consts.PACKET_VERSION)
{
AaruConsole.ErrorWriteLine("Unrecognized packet version...");
@@ -152,16 +152,16 @@ namespace Aaru.Devices.Remote
{
application = "Aaru",
version = Version.GetVersion(),
- maxProtocol = Consts.MaxProtocol,
+ maxProtocol = Consts.MAX_PROTOCOL,
sysname = DetectOS.GetPlatformName(DetectOS.GetRealPlatformID(), DetectOS.GetVersion()),
release = DetectOS.GetVersion(),
machine = RuntimeInformation.ProcessArchitecture.ToString(),
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.Hello
}
};
@@ -193,10 +193,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandAmIRoot
}
};
@@ -225,8 +225,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -271,10 +271,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandListDevices
}
};
@@ -303,8 +303,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -338,7 +338,7 @@ namespace Aaru.Devices.Remote
return new DeviceInfo[0];
}
- if(hdr.version != Consts.PacketVersion)
+ if(hdr.version != Consts.PACKET_VERSION)
{
AaruConsole.ErrorWriteLine("Unrecognized packet version...");
@@ -381,10 +381,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandOpen
},
device_path = devicePath
@@ -416,8 +416,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
lastError = -1;
@@ -471,9 +471,9 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
- version = Consts.PacketVersion,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandScsi
},
direction = (int)direction,
@@ -521,8 +521,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -570,9 +570,9 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
- version = Consts.PacketVersion,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandAtaChs
},
registers = registers,
@@ -617,8 +617,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -665,9 +665,9 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
- version = Consts.PacketVersion,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandAtaLba28
},
registers = registers,
@@ -712,8 +712,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -761,9 +761,9 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
- version = Consts.PacketVersion,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandAtaLba48
},
registers = registers,
@@ -808,8 +808,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -857,9 +857,9 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
- version = Consts.PacketVersion,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandAtaLba48
},
command = command,
@@ -907,8 +907,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -953,10 +953,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandGetType
}
};
@@ -985,8 +985,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -1027,10 +1027,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandGetSdhciRegisters
}
};
@@ -1059,8 +1059,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -1145,10 +1145,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandGetUsbData
}
};
@@ -1177,8 +1177,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -1231,10 +1231,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandGetFireWireData
}
};
@@ -1263,8 +1263,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -1312,10 +1312,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandGetPcmciaData
}
};
@@ -1344,8 +1344,8 @@ namespace Aaru.Devices.Remote
AaruPacketHeader hdr = Marshal.ByteArrayToStructureLittleEndian(hdrBuf);
- if(hdr.remote_id != Consts.RemoteId ||
- hdr.packet_id != Consts.PacketId)
+ if(hdr.remote_id != Consts.REMOTE_ID ||
+ hdr.packet_id != Consts.PACKET_ID)
{
AaruConsole.ErrorWriteLine("Received data is not an Aaru Remote Packet...");
@@ -1405,10 +1405,10 @@ namespace Aaru.Devices.Remote
{
hdr = new AaruPacketHeader
{
- remote_id = Consts.RemoteId,
- packet_id = Consts.PacketId,
+ remote_id = Consts.REMOTE_ID,
+ packet_id = Consts.PACKET_ID,
len = (uint)Marshal.SizeOf(),
- version = Consts.PacketVersion,
+ version = Consts.PACKET_VERSION,
packetType = AaruPacketType.CommandCloseDevice
}
};
diff --git a/Aaru.Filesystems/AODOS.cs b/Aaru.Filesystems/AODOS.cs
index c50032e7d..76e33425c 100644
--- a/Aaru.Filesystems/AODOS.cs
+++ b/Aaru.Filesystems/AODOS.cs
@@ -46,7 +46,7 @@ namespace Aaru.Filesystems
// This may be missing fields, or not, I don't know russian so any help is appreciated
public class AODOS : IFilesystem
{
- readonly byte[] AODOSIdentifier =
+ readonly byte[] _identifier =
{
0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20
};
@@ -71,18 +71,18 @@ namespace Aaru.Filesystems
imagePlugin.Info.Sectors != 1600)
return false;
- byte[] sector = imagePlugin.ReadSector(0);
- AODOS_BootBlock bb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ byte[] sector = imagePlugin.ReadSector(0);
+ BootBlock bb = Marshal.ByteArrayToStructureLittleEndian(sector);
- return bb.identifier.SequenceEqual(AODOSIdentifier);
+ return bb.identifier.SequenceEqual(_identifier);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
Encoding = Encoding.GetEncoding("koi8-r");
- byte[] sector = imagePlugin.ReadSector(0);
- AODOS_BootBlock bb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ byte[] sector = imagePlugin.ReadSector(0);
+ BootBlock bb = Marshal.ByteArrayToStructureLittleEndian(sector);
var sbInformation = new StringBuilder();
@@ -111,7 +111,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct AODOS_BootBlock
+ struct BootBlock
{
/// A NOP opcode
public readonly byte nop;
diff --git a/Aaru.Filesystems/APFS.cs b/Aaru.Filesystems/APFS.cs
index 858aa03f9..5afd96954 100644
--- a/Aaru.Filesystems/APFS.cs
+++ b/Aaru.Filesystems/APFS.cs
@@ -58,12 +58,12 @@ namespace Aaru.Filesystems
if(partition.Start >= partition.End)
return false;
- byte[] sector = imagePlugin.ReadSector(partition.Start);
- ApfsContainerSuperBlock nxSb;
+ byte[] sector = imagePlugin.ReadSector(partition.Start);
+ ContainerSuperBlock nxSb;
try
{
- nxSb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ nxSb = Marshal.ByteArrayToStructureLittleEndian(sector);
}
catch
{
@@ -84,12 +84,12 @@ namespace Aaru.Filesystems
if(partition.Start >= partition.End)
return;
- byte[] sector = imagePlugin.ReadSector(partition.Start);
- ApfsContainerSuperBlock nxSb;
+ byte[] sector = imagePlugin.ReadSector(partition.Start);
+ ContainerSuperBlock nxSb;
try
{
- nxSb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ nxSb = Marshal.ByteArrayToStructureLittleEndian(sector);
}
catch
{
@@ -118,7 +118,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct ApfsContainerSuperBlock
+ struct ContainerSuperBlock
{
public readonly ulong unknown1; // Varies between copies of the superblock
public readonly ulong unknown2;
diff --git a/Aaru.Filesystems/AppleCommon/Enums.cs b/Aaru.Filesystems/AppleCommon/Enums.cs
index f529ddf74..16db9a252 100644
--- a/Aaru.Filesystems/AppleCommon/Enums.cs
+++ b/Aaru.Filesystems/AppleCommon/Enums.cs
@@ -32,6 +32,8 @@
using System;
+// ReSharper disable InconsistentNaming
+
namespace Aaru.Filesystems
{
// Information from Inside Macintosh
diff --git a/Aaru.Filesystems/AppleCommon/Info.cs b/Aaru.Filesystems/AppleCommon/Info.cs
index 29b9cf4d5..fcf76eb88 100644
--- a/Aaru.Filesystems/AppleCommon/Info.cs
+++ b/Aaru.Filesystems/AppleCommon/Info.cs
@@ -39,7 +39,7 @@ namespace Aaru.Filesystems
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
internal static partial class AppleCommon
{
- internal static string GetBootBlockInformation(byte[] bbSector, Encoding Encoding)
+ internal static string GetBootBlockInformation(byte[] bbSector, Encoding encoding)
{
if(bbSector is null ||
bbSector.Length < 0x100)
@@ -75,24 +75,24 @@ namespace Aaru.Filesystems
else if(bb.bbPageFlags < 0)
sb.AppendLine("Allocate secondary sound and video buffers at boot.");
- sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(bb.bbSysName, Encoding)).AppendLine();
+ sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(bb.bbSysName, encoding)).AppendLine();
- sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(bb.bbShellName, Encoding)).
+ sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(bb.bbShellName, encoding)).
AppendLine();
- sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(bb.bbDbg1Name, Encoding)).
+ sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(bb.bbDbg1Name, encoding)).
AppendLine();
- sb.AppendFormat("Disassembler filename: {0}", StringHandlers.PascalToString(bb.bbDbg2Name, Encoding)).
+ sb.AppendFormat("Disassembler filename: {0}", StringHandlers.PascalToString(bb.bbDbg2Name, encoding)).
AppendLine();
- sb.AppendFormat("Startup screen filename: {0}", StringHandlers.PascalToString(bb.bbScreenName, Encoding)).
+ sb.AppendFormat("Startup screen filename: {0}", StringHandlers.PascalToString(bb.bbScreenName, encoding)).
AppendLine();
sb.AppendFormat("First program to execute at boot: {0}",
- StringHandlers.PascalToString(bb.bbHelloName, Encoding)).AppendLine();
+ StringHandlers.PascalToString(bb.bbHelloName, encoding)).AppendLine();
- sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(bb.bbScrapName, Encoding)).
+ sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(bb.bbScrapName, encoding)).
AppendLine();
sb.AppendFormat("Maximum opened files: {0}", bb.bbCntFCBs * 4).AppendLine();
diff --git a/Aaru.Filesystems/AppleCommon/Structs.cs b/Aaru.Filesystems/AppleCommon/Structs.cs
index 051447f80..dc741c20b 100644
--- a/Aaru.Filesystems/AppleCommon/Structs.cs
+++ b/Aaru.Filesystems/AppleCommon/Structs.cs
@@ -32,6 +32,8 @@
using System.Runtime.InteropServices;
+// ReSharper disable InconsistentNaming
+
namespace Aaru.Filesystems
{
// Information from Inside Macintosh
diff --git a/Aaru.Filesystems/AppleDOS/AppleDOS.cs b/Aaru.Filesystems/AppleDOS/AppleDOS.cs
index 0a1ee76d6..88013fa94 100644
--- a/Aaru.Filesystems/AppleDOS/AppleDOS.cs
+++ b/Aaru.Filesystems/AppleDOS/AppleDOS.cs
@@ -40,17 +40,16 @@ namespace Aaru.Filesystems
{
public partial class AppleDOS : IReadOnlyFilesystem
{
- bool debug;
- IMediaImage device;
- bool mounted;
- int sectorsPerTrack;
- ulong start;
- ulong totalFileEntries;
- bool track1UsedByFiles;
- bool track2UsedByFiles;
- uint usedSectors;
-
- Vtoc vtoc;
+ bool _debug;
+ IMediaImage _device;
+ bool _mounted;
+ int _sectorsPerTrack;
+ ulong _start;
+ ulong _totalFileEntries;
+ bool _track1UsedByFiles;
+ bool _track2UsedByFiles;
+ uint _usedSectors;
+ Vtoc _vtoc;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
@@ -73,23 +72,23 @@ namespace Aaru.Filesystems
#region Caches
/// Caches track/sector lists
- Dictionary extentCache;
+ Dictionary _extentCache;
/// Caches files
- Dictionary fileCache;
+ Dictionary _fileCache;
/// Caches catalog
- Dictionary catalogCache;
+ Dictionary _catalogCache;
/// Caches file size
- Dictionary fileSizeCache;
+ Dictionary _fileSizeCache;
/// Caches VTOC
- byte[] vtocBlocks;
+ byte[] _vtocBlocks;
/// Caches catalog
- byte[] catalogBlocks;
+ byte[] _catalogBlocks;
/// Caches boot code
- byte[] bootBlocks;
+ byte[] _bootBlocks;
/// Caches file type
- Dictionary fileTypeCache;
+ Dictionary _fileTypeCache;
/// Caches locked files
- List lockedFiles;
+ List _lockedFiles;
#endregion Caches
}
}
\ No newline at end of file
diff --git a/Aaru.Filesystems/AppleDOS/Dir.cs b/Aaru.Filesystems/AppleDOS/Dir.cs
index 700a74f92..2bd41be58 100644
--- a/Aaru.Filesystems/AppleDOS/Dir.cs
+++ b/Aaru.Filesystems/AppleDOS/Dir.cs
@@ -49,7 +49,7 @@ namespace Aaru.Filesystems
{
dest = null;
- return !mounted ? Errno.AccessDenied : Errno.NotSupported;
+ return !_mounted ? Errno.AccessDenied : Errno.NotSupported;
}
///
@@ -60,16 +60,16 @@ namespace Aaru.Filesystems
{
contents = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) &&
string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
return Errno.NotSupported;
- contents = catalogCache.Keys.ToList();
+ contents = _catalogCache.Keys.ToList();
- if(debug)
+ if(_debug)
{
contents.Add("$");
contents.Add("$Boot");
@@ -84,24 +84,24 @@ namespace Aaru.Filesystems
Errno ReadCatalog()
{
var catalogMs = new MemoryStream();
- ulong lba = (ulong)((vtoc.catalogTrack * sectorsPerTrack) + vtoc.catalogSector);
- totalFileEntries = 0;
- catalogCache = new Dictionary();
- fileTypeCache = new Dictionary();
- fileSizeCache = new Dictionary();
- lockedFiles = new List();
+ ulong lba = (ulong)((_vtoc.catalogTrack * _sectorsPerTrack) + _vtoc.catalogSector);
+ _totalFileEntries = 0;
+ _catalogCache = new Dictionary();
+ _fileTypeCache = new Dictionary();
+ _fileSizeCache = new Dictionary();
+ _lockedFiles = new List();
if(lba == 0 ||
- lba > device.Info.Sectors)
+ lba > _device.Info.Sectors)
return Errno.InvalidArgument;
while(lba != 0)
{
- usedSectors++;
- byte[] catSectorB = device.ReadSector(lba);
- totalFileEntries += 7;
+ _usedSectors++;
+ byte[] catSectorB = _device.ReadSector(lba);
+ _totalFileEntries += 7;
- if(debug)
+ if(_debug)
catalogMs.Write(catSectorB, 0, catSectorB.Length);
// Read the catalog sector
@@ -109,8 +109,8 @@ namespace Aaru.Filesystems
foreach(FileEntry entry in catSector.entries.Where(entry => entry.extentTrack > 0))
{
- track1UsedByFiles |= entry.extentTrack == 1;
- track2UsedByFiles |= entry.extentTrack == 2;
+ _track1UsedByFiles |= entry.extentTrack == 1;
+ _track2UsedByFiles |= entry.extentTrack == 2;
byte[] filenameB = new byte[30];
ushort ts = (ushort)((entry.extentTrack << 8) | entry.extentSector);
@@ -121,28 +121,28 @@ namespace Aaru.Filesystems
string filename = StringHandlers.SpacePaddedToString(filenameB, Encoding);
- if(!catalogCache.ContainsKey(filename))
- catalogCache.Add(filename, ts);
+ if(!_catalogCache.ContainsKey(filename))
+ _catalogCache.Add(filename, ts);
- if(!fileTypeCache.ContainsKey(filename))
- fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F));
+ if(!_fileTypeCache.ContainsKey(filename))
+ _fileTypeCache.Add(filename, (byte)(entry.typeAndFlags & 0x7F));
- if(!fileSizeCache.ContainsKey(filename))
- fileSizeCache.Add(filename, entry.length * vtoc.bytesPerSector);
+ if(!_fileSizeCache.ContainsKey(filename))
+ _fileSizeCache.Add(filename, entry.length * _vtoc.bytesPerSector);
if((entry.typeAndFlags & 0x80) == 0x80 &&
- !lockedFiles.Contains(filename))
- lockedFiles.Add(filename);
+ !_lockedFiles.Contains(filename))
+ _lockedFiles.Add(filename);
}
- lba = (ulong)((catSector.trackOfNext * sectorsPerTrack) + catSector.sectorOfNext);
+ lba = (ulong)((catSector.trackOfNext * _sectorsPerTrack) + catSector.sectorOfNext);
- if(lba > device.Info.Sectors)
+ if(lba > _device.Info.Sectors)
break;
}
- if(debug)
- catalogBlocks = catalogMs.ToArray();
+ if(_debug)
+ _catalogBlocks = catalogMs.ToArray();
return Errno.NoError;
}
diff --git a/Aaru.Filesystems/AppleDOS/File.cs b/Aaru.Filesystems/AppleDOS/File.cs
index 243841d24..b8c76de0d 100644
--- a/Aaru.Filesystems/AppleDOS/File.cs
+++ b/Aaru.Filesystems/AppleDOS/File.cs
@@ -46,7 +46,7 @@ namespace Aaru.Filesystems
{
attributes = new FileAttributes();
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -59,18 +59,18 @@ namespace Aaru.Filesystems
string filename = pathElements[0].ToUpperInvariant();
- if(!fileCache.ContainsKey(filename))
+ if(!_fileCache.ContainsKey(filename))
return Errno.NoSuchFile;
attributes = FileAttributes.Extents;
attributes |= FileAttributes.File;
- if(lockedFiles.Contains(filename))
+ if(_lockedFiles.Contains(filename))
attributes |= FileAttributes.ReadOnly;
- if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
+ if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
attributes |= FileAttributes.System;
return Errno.NoError;
@@ -78,7 +78,7 @@ namespace Aaru.Filesystems
public Errno Read(string path, long offset, long size, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -95,25 +95,25 @@ namespace Aaru.Filesystems
if(filename.Length > 30)
return Errno.NameTooLong;
- if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
+ if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
- file = catalogBlocks;
+ file = _catalogBlocks;
else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)
- file = vtocBlocks;
+ file = _vtocBlocks;
else
- file = bootBlocks;
+ file = _bootBlocks;
else
{
- if(!fileCache.TryGetValue(filename, out file))
+ if(!_fileCache.TryGetValue(filename, out file))
{
Errno error = CacheFile(filename);
if(error != Errno.NoError)
return error;
- if(!fileCache.TryGetValue(filename, out file))
+ if(!_fileCache.TryGetValue(filename, out file))
return Errno.InvalidArgument;
}
}
@@ -135,7 +135,7 @@ namespace Aaru.Filesystems
{
stat = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -151,35 +151,35 @@ namespace Aaru.Filesystems
if(filename.Length > 30)
return Errno.NameTooLong;
- if(!fileCache.ContainsKey(filename))
+ if(!_fileCache.ContainsKey(filename))
return Errno.NoSuchFile;
stat = new FileEntryInfo();
- fileSizeCache.TryGetValue(filename, out int filesize);
+ _fileSizeCache.TryGetValue(filename, out int filesize);
GetAttributes(path, out FileAttributes attrs);
- if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
+ if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
{
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
- stat.Length = catalogBlocks.Length;
+ stat.Length = _catalogBlocks.Length;
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
- stat.Length = bootBlocks.Length;
+ stat.Length = _bootBlocks.Length;
else if(string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)
- stat.Length = vtocBlocks.Length;
+ stat.Length = _vtocBlocks.Length;
- stat.Blocks = stat.Length / vtoc.bytesPerSector;
+ stat.Blocks = stat.Length / _vtoc.bytesPerSector;
}
else
{
stat.Length = filesize;
- stat.Blocks = stat.Length / vtoc.bytesPerSector;
+ stat.Blocks = stat.Length / _vtoc.bytesPerSector;
}
stat.Attributes = attrs;
- stat.BlockSize = vtoc.bytesPerSector;
+ stat.BlockSize = _vtoc.bytesPerSector;
stat.Links = 1;
return Errno.NoError;
@@ -190,7 +190,7 @@ namespace Aaru.Filesystems
deviceBlock = 0;
// TODO: Not really important.
- return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
+ return !_mounted ? Errno.AccessDenied : Errno.NotImplemented;
}
Errno CacheFile(string path)
@@ -208,20 +208,20 @@ namespace Aaru.Filesystems
if(filename.Length > 30)
return Errno.NameTooLong;
- if(!catalogCache.TryGetValue(filename, out ushort ts))
+ if(!_catalogCache.TryGetValue(filename, out ushort ts))
return Errno.NoSuchFile;
- ulong lba = (ulong)((((ts & 0xFF00) >> 8) * sectorsPerTrack) + (ts & 0xFF));
+ ulong lba = (ulong)((((ts & 0xFF00) >> 8) * _sectorsPerTrack) + (ts & 0xFF));
var fileMs = new MemoryStream();
var tsListMs = new MemoryStream();
ushort expectedBlock = 0;
while(lba != 0)
{
- usedSectors++;
- byte[] tsSectorB = device.ReadSector(lba);
+ _usedSectors++;
+ byte[] tsSectorB = _device.ReadSector(lba);
- if(debug)
+ if(_debug)
tsListMs.Write(tsSectorB, 0, tsSectorB.Length);
// Read the track/sector list sector
@@ -229,60 +229,60 @@ namespace Aaru.Filesystems
if(tsSector.sectorOffset > expectedBlock)
{
- byte[] hole = new byte[(tsSector.sectorOffset - expectedBlock) * vtoc.bytesPerSector];
+ byte[] hole = new byte[(tsSector.sectorOffset - expectedBlock) * _vtoc.bytesPerSector];
fileMs.Write(hole, 0, hole.Length);
expectedBlock = tsSector.sectorOffset;
}
foreach(TrackSectorListEntry entry in tsSector.entries)
{
- track1UsedByFiles |= entry.track == 1;
- track2UsedByFiles |= entry.track == 2;
- usedSectors++;
+ _track1UsedByFiles |= entry.track == 1;
+ _track2UsedByFiles |= entry.track == 2;
+ _usedSectors++;
- ulong blockLba = (ulong)((entry.track * sectorsPerTrack) + entry.sector);
+ ulong blockLba = (ulong)((entry.track * _sectorsPerTrack) + entry.sector);
if(blockLba == 0)
break;
- byte[] fileBlock = device.ReadSector(blockLba);
+ byte[] fileBlock = _device.ReadSector(blockLba);
fileMs.Write(fileBlock, 0, fileBlock.Length);
expectedBlock++;
}
- lba = (ulong)((tsSector.nextListTrack * sectorsPerTrack) + tsSector.nextListSector);
+ lba = (ulong)((tsSector.nextListTrack * _sectorsPerTrack) + tsSector.nextListSector);
}
- if(fileCache.ContainsKey(filename))
- fileCache.Remove(filename);
+ if(_fileCache.ContainsKey(filename))
+ _fileCache.Remove(filename);
- if(extentCache.ContainsKey(filename))
- extentCache.Remove(filename);
+ if(_extentCache.ContainsKey(filename))
+ _extentCache.Remove(filename);
- fileCache.Add(filename, fileMs.ToArray());
- extentCache.Add(filename, tsListMs.ToArray());
+ _fileCache.Add(filename, fileMs.ToArray());
+ _extentCache.Add(filename, tsListMs.ToArray());
return Errno.NoError;
}
Errno CacheAllFiles()
{
- fileCache = new Dictionary();
- extentCache = new Dictionary();
+ _fileCache = new Dictionary();
+ _extentCache = new Dictionary();
- foreach(Errno error in catalogCache.Keys.Select(CacheFile).Where(error => error != Errno.NoError))
+ foreach(Errno error in _catalogCache.Keys.Select(CacheFile).Where(error => error != Errno.NoError))
return error;
uint tracksOnBoot = 1;
- if(!track1UsedByFiles)
+ if(!_track1UsedByFiles)
tracksOnBoot++;
- if(!track2UsedByFiles)
+ if(!_track2UsedByFiles)
tracksOnBoot++;
- bootBlocks = device.ReadSectors(0, (uint)(tracksOnBoot * sectorsPerTrack));
- usedSectors += (uint)(bootBlocks.Length / vtoc.bytesPerSector);
+ _bootBlocks = _device.ReadSectors(0, (uint)(tracksOnBoot * _sectorsPerTrack));
+ _usedSectors += (uint)(_bootBlocks.Length / _vtoc.bytesPerSector);
return Errno.NoError;
}
diff --git a/Aaru.Filesystems/AppleDOS/Info.cs b/Aaru.Filesystems/AppleDOS/Info.cs
index 0268e6735..fb22206da 100644
--- a/Aaru.Filesystems/AppleDOS/Info.cs
+++ b/Aaru.Filesystems/AppleDOS/Info.cs
@@ -55,10 +55,10 @@ namespace Aaru.Filesystems
int spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
- vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocB);
+ _vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocB);
- return vtoc.catalogSector < spt && vtoc.maxTrackSectorPairsPerSector <= 122 &&
- vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256;
+ return _vtoc.catalogSector < spt && _vtoc.maxTrackSectorPairsPerSector <= 122 &&
+ _vtoc.sectorsPerTrack == spt && _vtoc.bytesPerSector == 256;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -72,22 +72,22 @@ namespace Aaru.Filesystems
spt = imagePlugin.Info.Sectors == 455 ? 13 : 16;
byte[] vtocB = imagePlugin.ReadSector((ulong)(17 * spt));
- vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocB);
+ _vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocB);
sb.AppendLine("Apple DOS File System");
sb.AppendLine();
- sb.AppendFormat("Catalog starts at sector {0} of track {1}", vtoc.catalogSector, vtoc.catalogTrack).
+ sb.AppendFormat("Catalog starts at sector {0} of track {1}", _vtoc.catalogSector, _vtoc.catalogTrack).
AppendLine();
- sb.AppendFormat("File system initialized by DOS release {0}", vtoc.dosRelease).AppendLine();
- sb.AppendFormat("Disk volume number {0}", vtoc.volumeNumber).AppendLine();
- sb.AppendFormat("Sectors allocated at most in track {0}", vtoc.lastAllocatedSector).AppendLine();
- sb.AppendFormat("{0} tracks in volume", vtoc.tracks).AppendLine();
- sb.AppendFormat("{0} sectors per track", vtoc.sectorsPerTrack).AppendLine();
- sb.AppendFormat("{0} bytes per sector", vtoc.bytesPerSector).AppendLine();
+ sb.AppendFormat("File system initialized by DOS release {0}", _vtoc.dosRelease).AppendLine();
+ sb.AppendFormat("Disk volume number {0}", _vtoc.volumeNumber).AppendLine();
+ sb.AppendFormat("Sectors allocated at most in track {0}", _vtoc.lastAllocatedSector).AppendLine();
+ sb.AppendFormat("{0} tracks in volume", _vtoc.tracks).AppendLine();
+ sb.AppendFormat("{0} sectors per track", _vtoc.sectorsPerTrack).AppendLine();
+ sb.AppendFormat("{0} bytes per sector", _vtoc.bytesPerSector).AppendLine();
- sb.AppendFormat("Track allocation is {0}", vtoc.allocationDirection > 0 ? "forward" : "reverse").
+ sb.AppendFormat("Track allocation is {0}", _vtoc.allocationDirection > 0 ? "forward" : "reverse").
AppendLine();
information = sb.ToString();
diff --git a/Aaru.Filesystems/AppleDOS/Super.cs b/Aaru.Filesystems/AppleDOS/Super.cs
index 2f23bf431..28b48be12 100644
--- a/Aaru.Filesystems/AppleDOS/Super.cs
+++ b/Aaru.Filesystems/AppleDOS/Super.cs
@@ -49,41 +49,41 @@ namespace Aaru.Filesystems
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
Dictionary options, string @namespace)
{
- device = imagePlugin;
- start = partition.Start;
+ _device = imagePlugin;
+ _start = partition.Start;
Encoding = encoding ?? new Apple2();
- if(device.Info.Sectors != 455 &&
- device.Info.Sectors != 560)
+ if(_device.Info.Sectors != 455 &&
+ _device.Info.Sectors != 560)
{
AaruConsole.DebugWriteLine("Apple DOS plugin", "Incorrect device size.");
return Errno.InOutError;
}
- if(start > 0)
+ if(_start > 0)
{
AaruConsole.DebugWriteLine("Apple DOS plugin", "Partitions are not supported.");
return Errno.InOutError;
}
- if(device.Info.SectorSize != 256)
+ if(_device.Info.SectorSize != 256)
{
AaruConsole.DebugWriteLine("Apple DOS plugin", "Incorrect sector size.");
return Errno.InOutError;
}
- sectorsPerTrack = device.Info.Sectors == 455 ? 13 : 16;
+ _sectorsPerTrack = _device.Info.Sectors == 455 ? 13 : 16;
// Read the VTOC
- vtocBlocks = device.ReadSector((ulong)(17 * sectorsPerTrack));
- vtoc = Marshal.ByteArrayToStructureLittleEndian(vtocBlocks);
+ _vtocBlocks = _device.ReadSector((ulong)(17 * _sectorsPerTrack));
+ _vtoc = Marshal.ByteArrayToStructureLittleEndian(_vtocBlocks);
- track1UsedByFiles = false;
- track2UsedByFiles = false;
- usedSectors = 1;
+ _track1UsedByFiles = false;
+ _track2UsedByFiles = false;
+ _usedSectors = 1;
Errno error = ReadCatalog();
@@ -107,23 +107,23 @@ namespace Aaru.Filesystems
XmlFsType = new FileSystemType
{
Bootable = true,
- Clusters = device.Info.Sectors,
- ClusterSize = vtoc.bytesPerSector,
- Files = (ulong)catalogCache.Count,
+ Clusters = _device.Info.Sectors,
+ ClusterSize = _vtoc.bytesPerSector,
+ Files = (ulong)_catalogCache.Count,
FilesSpecified = true,
FreeClustersSpecified = true,
Type = "Apple DOS"
};
- XmlFsType.FreeClusters = XmlFsType.Clusters - usedSectors;
+ XmlFsType.FreeClusters = XmlFsType.Clusters - _usedSectors;
if(options == null)
options = GetDefaultOptions();
if(options.TryGetValue("debug", out string debugString))
- bool.TryParse(debugString, out debug);
+ bool.TryParse(debugString, out _debug);
- mounted = true;
+ _mounted = true;
return Errno.NoError;
}
@@ -132,11 +132,11 @@ namespace Aaru.Filesystems
/// Umounts this DOS filesystem
public Errno Unmount()
{
- mounted = false;
- extentCache = null;
- fileCache = null;
- catalogCache = null;
- fileSizeCache = null;
+ _mounted = false;
+ _extentCache = null;
+ _fileCache = null;
+ _catalogCache = null;
+ _fileSizeCache = null;
return Errno.NoError;
}
@@ -148,15 +148,15 @@ namespace Aaru.Filesystems
{
stat = new FileSystemInfo
{
- Blocks = device.Info.Sectors,
+ Blocks = _device.Info.Sectors,
FilenameLength = 30,
- Files = (ulong)catalogCache.Count,
+ Files = (ulong)_catalogCache.Count,
PluginId = Id,
Type = "Apple DOS"
};
- stat.FreeFiles = totalFileEntries - stat.Files;
- stat.FreeBlocks = stat.Blocks - usedSectors;
+ stat.FreeFiles = _totalFileEntries - stat.Files;
+ stat.FreeBlocks = stat.Blocks - _usedSectors;
return Errno.NoError;
}
diff --git a/Aaru.Filesystems/AppleDOS/Xattr.cs b/Aaru.Filesystems/AppleDOS/Xattr.cs
index e076c6c47..333af5c40 100644
--- a/Aaru.Filesystems/AppleDOS/Xattr.cs
+++ b/Aaru.Filesystems/AppleDOS/Xattr.cs
@@ -47,7 +47,7 @@ namespace Aaru.Filesystems
{
xattrs = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -65,17 +65,17 @@ namespace Aaru.Filesystems
xattrs = new List();
- if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) {}
+ if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0)) {}
else
{
- if(!catalogCache.ContainsKey(filename))
+ if(!_catalogCache.ContainsKey(filename))
return Errno.NoSuchFile;
xattrs.Add("com.apple.dos.type");
- if(debug)
+ if(_debug)
xattrs.Add("com.apple.dos.tracksectorlist");
}
@@ -90,7 +90,7 @@ namespace Aaru.Filesystems
/// Buffer.
public Errno GetXattr(string path, string xattr, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -106,17 +106,17 @@ namespace Aaru.Filesystems
if(filename.Length > 30)
return Errno.NameTooLong;
- if(debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
- string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
+ if(_debug && (string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
+ string.Compare(path, "$Vtoc", StringComparison.InvariantCulture) == 0))
return Errno.NoSuchExtendedAttribute;
- if(!catalogCache.ContainsKey(filename))
+ if(!_catalogCache.ContainsKey(filename))
return Errno.NoSuchFile;
if(string.Compare(xattr, "com.apple.dos.type", StringComparison.InvariantCulture) == 0)
{
- if(!fileTypeCache.TryGetValue(filename, out byte type))
+ if(!_fileTypeCache.TryGetValue(filename, out byte type))
return Errno.InvalidArgument;
buf = new byte[1];
@@ -126,10 +126,10 @@ namespace Aaru.Filesystems
}
if(string.Compare(xattr, "com.apple.dos.tracksectorlist", StringComparison.InvariantCulture) != 0 ||
- !debug)
+ !_debug)
return Errno.NoSuchExtendedAttribute;
- if(!extentCache.TryGetValue(filename, out byte[] ts))
+ if(!_extentCache.TryGetValue(filename, out byte[] ts))
return Errno.InvalidArgument;
buf = new byte[ts.Length];
diff --git a/Aaru.Filesystems/AppleHFS/Consts.cs b/Aaru.Filesystems/AppleHFS/Consts.cs
index 0bdbfc23c..a68c2a057 100644
--- a/Aaru.Filesystems/AppleHFS/Consts.cs
+++ b/Aaru.Filesystems/AppleHFS/Consts.cs
@@ -32,6 +32,8 @@
using System.Diagnostics.CodeAnalysis;
+// ReSharper disable InconsistentNaming
+
namespace Aaru.Filesystems
{
// Information from Inside Macintosh
diff --git a/Aaru.Filesystems/AppleHFS/Enums.cs b/Aaru.Filesystems/AppleHFS/Enums.cs
index eaa693e5d..6fd32edc9 100644
--- a/Aaru.Filesystems/AppleHFS/Enums.cs
+++ b/Aaru.Filesystems/AppleHFS/Enums.cs
@@ -30,6 +30,8 @@
// Copyright © 2011-2020 Natalia Portillo
// ****************************************************************************/
+// ReSharper disable InconsistentNaming
+
namespace Aaru.Filesystems
{
public partial class AppleHFS
diff --git a/Aaru.Filesystems/AppleMFS/AppleMFS.cs b/Aaru.Filesystems/AppleMFS/AppleMFS.cs
index 96ba482d5..76d4ae83c 100644
--- a/Aaru.Filesystems/AppleMFS/AppleMFS.cs
+++ b/Aaru.Filesystems/AppleMFS/AppleMFS.cs
@@ -41,24 +41,24 @@ namespace Aaru.Filesystems
// Information from Inside Macintosh Volume II
public partial class AppleMFS : IReadOnlyFilesystem
{
- bool mounted;
- bool debug;
- IMediaImage device;
- ulong partitionStart;
- Dictionary idToFilename;
- Dictionary idToEntry;
- Dictionary filenameToId;
- MasterDirectoryBlock volMDB;
- byte[] bootBlocks;
- byte[] mdbBlocks;
- byte[] directoryBlocks;
- byte[] blockMapBytes;
- uint[] blockMap;
- int sectorsPerBlock;
- byte[] bootTags;
- byte[] mdbTags;
- byte[] directoryTags;
- byte[] bitmapTags;
+ bool _mounted;
+ bool _debug;
+ IMediaImage _device;
+ ulong _partitionStart;
+ Dictionary _idToFilename;
+ Dictionary _idToEntry;
+ Dictionary _filenameToId;
+ MasterDirectoryBlock _volMdb;
+ byte[] _bootBlocks;
+ byte[] _mdbBlocks;
+ byte[] _directoryBlocks;
+ byte[] _blockMapBytes;
+ uint[] _blockMap;
+ int _sectorsPerBlock;
+ byte[] _bootTags;
+ byte[] _mdbTags;
+ byte[] _directoryTags;
+ byte[] _bitmapTags;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Apple Macintosh File System";
diff --git a/Aaru.Filesystems/AppleMFS/Dir.cs b/Aaru.Filesystems/AppleMFS/Dir.cs
index 652ffbfc3..09140cd5b 100644
--- a/Aaru.Filesystems/AppleMFS/Dir.cs
+++ b/Aaru.Filesystems/AppleMFS/Dir.cs
@@ -46,22 +46,22 @@ namespace Aaru.Filesystems
{
contents = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) &&
string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
return Errno.NotSupported;
- contents = idToFilename.Select(kvp => kvp.Value).ToList();
+ contents = _idToFilename.Select(kvp => kvp.Value).ToList();
- if(debug)
+ if(_debug)
{
contents.Add("$");
contents.Add("$Bitmap");
contents.Add("$MDB");
- if(bootBlocks != null)
+ if(_bootBlocks != null)
contents.Add("$Boot");
}
@@ -72,54 +72,54 @@ namespace Aaru.Filesystems
bool FillDirectory()
{
- idToFilename = new Dictionary();
- idToEntry = new Dictionary();
- filenameToId = new Dictionary();
+ _idToFilename = new Dictionary();
+ _idToEntry = new Dictionary();
+ _filenameToId = new Dictionary();
int offset = 0;
- while(offset + 51 < directoryBlocks.Length)
+ while(offset + 51 < _directoryBlocks.Length)
{
var entry = new FileEntry
{
- flFlags = (FileFlags)directoryBlocks[offset + 0]
+ flFlags = (FileFlags)_directoryBlocks[offset + 0]
};
if(!entry.flFlags.HasFlag(FileFlags.Used))
break;
- entry.flTyp = directoryBlocks[offset + 1];
+ entry.flTyp = _directoryBlocks[offset + 1];
entry.flUsrWds =
- Marshal.ByteArrayToStructureBigEndian(directoryBlocks, offset + 2, 16);
+ Marshal.ByteArrayToStructureBigEndian(_directoryBlocks, offset + 2, 16);
- entry.flFlNum = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 18);
- entry.flStBlk = BigEndianBitConverter.ToUInt16(directoryBlocks, offset + 22);
- entry.flLgLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 24);
- entry.flPyLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 28);
- entry.flRStBlk = BigEndianBitConverter.ToUInt16(directoryBlocks, offset + 32);
- entry.flRLgLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 34);
- entry.flRPyLen = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 38);
- entry.flCrDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 42);
- entry.flMdDat = BigEndianBitConverter.ToUInt32(directoryBlocks, offset + 46);
- entry.flNam = new byte[directoryBlocks[offset + 50] + 1];
- Array.Copy(directoryBlocks, offset + 50, entry.flNam, 0, entry.flNam.Length);
+ entry.flFlNum = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 18);
+ entry.flStBlk = BigEndianBitConverter.ToUInt16(_directoryBlocks, offset + 22);
+ entry.flLgLen = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 24);
+ entry.flPyLen = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 28);
+ entry.flRStBlk = BigEndianBitConverter.ToUInt16(_directoryBlocks, offset + 32);
+ entry.flRLgLen = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 34);
+ entry.flRPyLen = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 38);
+ entry.flCrDat = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 42);
+ entry.flMdDat = BigEndianBitConverter.ToUInt32(_directoryBlocks, offset + 46);
+ entry.flNam = new byte[_directoryBlocks[offset + 50] + 1];
+ Array.Copy(_directoryBlocks, offset + 50, entry.flNam, 0, entry.flNam.Length);
string lowerFilename = StringHandlers.
PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':');
- if(entry.flFlags.HasFlag(FileFlags.Used) &&
- !idToFilename.ContainsKey(entry.flFlNum) &&
- !idToEntry.ContainsKey(entry.flFlNum) &&
- !filenameToId.ContainsKey(lowerFilename) &&
+ if(entry.flFlags.HasFlag(FileFlags.Used) &&
+ !_idToFilename.ContainsKey(entry.flFlNum) &&
+ !_idToEntry.ContainsKey(entry.flFlNum) &&
+ !_filenameToId.ContainsKey(lowerFilename) &&
entry.flFlNum > 0)
{
- idToEntry.Add(entry.flFlNum, entry);
+ _idToEntry.Add(entry.flFlNum, entry);
- idToFilename.Add(entry.flFlNum,
- StringHandlers.PascalToString(entry.flNam, Encoding).Replace('/', ':'));
+ _idToFilename.Add(entry.flFlNum,
+ StringHandlers.PascalToString(entry.flNam, Encoding).Replace('/', ':'));
- filenameToId.Add(lowerFilename, entry.flFlNum);
+ _filenameToId.Add(lowerFilename, entry.flFlNum);
AaruConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlags = {0}", entry.flFlags);
AaruConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flTyp = {0}", entry.flTyp);
diff --git a/Aaru.Filesystems/AppleMFS/File.cs b/Aaru.Filesystems/AppleMFS/File.cs
index cd0df1e64..84a0d59af 100644
--- a/Aaru.Filesystems/AppleMFS/File.cs
+++ b/Aaru.Filesystems/AppleMFS/File.cs
@@ -47,7 +47,7 @@ namespace Aaru.Filesystems
{
deviceBlock = new long();
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -60,13 +60,13 @@ namespace Aaru.Filesystems
path = pathElements[0];
- if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
+ if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
- if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
+ if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
return Errno.NoSuchFile;
- if(fileBlock > entry.flPyLen / volMDB.drAlBlkSiz)
+ if(fileBlock > entry.flPyLen / _volMdb.drAlBlkSiz)
return Errno.InvalidArgument;
uint nextBlock = entry.flStBlk;
@@ -76,16 +76,16 @@ namespace Aaru.Filesystems
{
if(relBlock == fileBlock)
{
- deviceBlock = ((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + (long)partitionStart;
+ deviceBlock = ((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + (long)_partitionStart;
return Errno.NoError;
}
- if(blockMap[nextBlock] == BMAP_FREE ||
- blockMap[nextBlock] == BMAP_LAST)
+ if(_blockMap[nextBlock] == BMAP_FREE ||
+ _blockMap[nextBlock] == BMAP_LAST)
break;
- nextBlock = blockMap[nextBlock];
+ nextBlock = _blockMap[nextBlock];
relBlock++;
}
@@ -96,7 +96,7 @@ namespace Aaru.Filesystems
{
attributes = new FileAttributes();
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -109,10 +109,10 @@ namespace Aaru.Filesystems
path = pathElements[0];
- if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
+ if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
- if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
+ if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
return Errno.NoSuchFile;
if(entry.flUsrWds.fdFlags.HasFlag(AppleCommon.FinderFlags.kIsAlias))
@@ -157,22 +157,22 @@ namespace Aaru.Filesystems
public Errno Read(string path, long offset, long size, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
byte[] file;
Errno error = Errno.NoError;
- if(debug && string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
- file = directoryBlocks;
- else if(debug &&
+ if(_debug && string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
+ file = _directoryBlocks;
+ else if(_debug &&
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 &&
- bootBlocks != null)
- file = bootBlocks;
- else if(debug && string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
- file = blockMapBytes;
- else if(debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
- file = mdbBlocks;
+ _bootBlocks != null)
+ file = _bootBlocks;
+ else if(_debug && string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
+ file = _blockMapBytes;
+ else if(_debug && string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
+ file = _mdbBlocks;
else
error = ReadFile(path, out file, false, false);
@@ -203,7 +203,7 @@ namespace Aaru.Filesystems
{
stat = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -216,7 +216,7 @@ namespace Aaru.Filesystems
path = pathElements[0];
- if(debug)
+ if(_debug)
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
@@ -224,7 +224,7 @@ namespace Aaru.Filesystems
{
stat = new FileEntryInfo
{
- BlockSize = device.Info.SectorSize,
+ BlockSize = _device.Info.SectorSize,
Inode = 0,
Links = 1,
Attributes = FileAttributes.System
@@ -232,26 +232,28 @@ namespace Aaru.Filesystems
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
{
- stat.Blocks = (directoryBlocks.Length / stat.BlockSize) +
- (directoryBlocks.Length % stat.BlockSize);
+ stat.Blocks = (_directoryBlocks.Length / stat.BlockSize) +
+ (_directoryBlocks.Length % stat.BlockSize);
- stat.Length = directoryBlocks.Length;
+ stat.Length = _directoryBlocks.Length;
}
else if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
{
- stat.Blocks = (blockMapBytes.Length / stat.BlockSize) + (blockMapBytes.Length % stat.BlockSize);
- stat.Length = blockMapBytes.Length;
+ stat.Blocks = (_blockMapBytes.Length / stat.BlockSize) +
+ (_blockMapBytes.Length % stat.BlockSize);
+
+ stat.Length = _blockMapBytes.Length;
}
else if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 &&
- bootBlocks != null)
+ _bootBlocks != null)
{
- stat.Blocks = (bootBlocks.Length / stat.BlockSize) + (bootBlocks.Length % stat.BlockSize);
- stat.Length = bootBlocks.Length;
+ stat.Blocks = (_bootBlocks.Length / stat.BlockSize) + (_bootBlocks.Length % stat.BlockSize);
+ stat.Length = _bootBlocks.Length;
}
else if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
{
- stat.Blocks = (mdbBlocks.Length / stat.BlockSize) + (mdbBlocks.Length % stat.BlockSize);
- stat.Length = mdbBlocks.Length;
+ stat.Blocks = (_mdbBlocks.Length / stat.BlockSize) + (_mdbBlocks.Length % stat.BlockSize);
+ stat.Length = _mdbBlocks.Length;
}
else
return Errno.InvalidArgument;
@@ -259,10 +261,10 @@ namespace Aaru.Filesystems
return Errno.NoError;
}
- if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
+ if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
- if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
+ if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
return Errno.NoSuchFile;
Errno error = GetAttributes(path, out FileAttributes attr);
@@ -273,8 +275,8 @@ namespace Aaru.Filesystems
stat = new FileEntryInfo
{
Attributes = attr,
- Blocks = entry.flLgLen / volMDB.drAlBlkSiz,
- BlockSize = volMDB.drAlBlkSiz,
+ Blocks = entry.flLgLen / _volMdb.drAlBlkSiz,
+ BlockSize = _volMdb.drAlBlkSiz,
CreationTime = DateHandlers.MacToDateTime(entry.flCrDat),
Inode = entry.flFlNum,
LastWriteTime = DateHandlers.MacToDateTime(entry.flMdDat),
@@ -296,7 +298,7 @@ namespace Aaru.Filesystems
{
buf = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -309,10 +311,10 @@ namespace Aaru.Filesystems
path = pathElements[0];
- if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
+ if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
- if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
+ if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
return Errno.NoSuchFile;
uint nextBlock;
@@ -348,23 +350,25 @@ namespace Aaru.Filesystems
if(tags)
sectors =
- device.ReadSectorsTag((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart,
- (uint)sectorsPerBlock, SectorTagType.AppleSectorTag);
+ _device.
+ ReadSectorsTag((ulong)((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + _partitionStart,
+ (uint)_sectorsPerBlock, SectorTagType.AppleSectorTag);
else
sectors =
- device.ReadSectors((ulong)((nextBlock - 2) * sectorsPerBlock) + volMDB.drAlBlSt + partitionStart,
- (uint)sectorsPerBlock);
+ _device.
+ ReadSectors((ulong)((nextBlock - 2) * _sectorsPerBlock) + _volMdb.drAlBlSt + _partitionStart,
+ (uint)_sectorsPerBlock);
ms.Write(sectors, 0, sectors.Length);
- if(blockMap[nextBlock] == BMAP_FREE)
+ if(_blockMap[nextBlock] == BMAP_FREE)
{
AaruConsole.ErrorWriteLine("File truncated at block {0}", nextBlock);
break;
}
- nextBlock = blockMap[nextBlock];
+ nextBlock = _blockMap[nextBlock];
} while(nextBlock > BMAP_LAST);
if(tags)
diff --git a/Aaru.Filesystems/AppleMFS/Super.cs b/Aaru.Filesystems/AppleMFS/Super.cs
index 6927fb959..7b38ea27f 100644
--- a/Aaru.Filesystems/AppleMFS/Super.cs
+++ b/Aaru.Filesystems/AppleMFS/Super.cs
@@ -45,162 +45,163 @@ namespace Aaru.Filesystems
// Information from Inside Macintosh Volume II
public partial class AppleMFS
{
+ const int BYTES_BEFORE_BLOCK_MAP = 64;
+
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
Dictionary options, string @namespace)
{
- device = imagePlugin;
- partitionStart = partition.Start;
- Encoding = encoding ?? Encoding.GetEncoding("macintosh");
+ _device = imagePlugin;
+ _partitionStart = partition.Start;
+ Encoding = encoding ?? Encoding.GetEncoding("macintosh");
if(options == null)
options = GetDefaultOptions();
if(options.TryGetValue("debug", out string debugString))
- bool.TryParse(debugString, out debug);
+ bool.TryParse(debugString, out _debug);
- volMDB = new MasterDirectoryBlock();
+ _volMdb = new MasterDirectoryBlock();
- mdbBlocks = device.ReadSector(2 + partitionStart);
- bootBlocks = device.ReadSector(0 + partitionStart);
+ _mdbBlocks = _device.ReadSector(2 + _partitionStart);
+ _bootBlocks = _device.ReadSector(0 + _partitionStart);
- volMDB.drSigWord = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x000);
+ _volMdb.drSigWord = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x000);
- if(volMDB.drSigWord != MFS_MAGIC)
+ if(_volMdb.drSigWord != MFS_MAGIC)
return Errno.InvalidArgument;
- volMDB.drCrDate = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x002);
- volMDB.drLsBkUp = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x006);
- volMDB.drAtrb = (AppleCommon.VolumeAttributes)BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00A);
- volMDB.drNmFls = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00C);
- volMDB.drDirSt = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x00E);
- volMDB.drBlLen = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x010);
- volMDB.drNmAlBlks = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x012);
- volMDB.drAlBlkSiz = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x014);
- volMDB.drClpSiz = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x018);
- volMDB.drAlBlSt = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x01C);
- volMDB.drNxtFNum = BigEndianBitConverter.ToUInt32(mdbBlocks, 0x01E);
- volMDB.drFreeBks = BigEndianBitConverter.ToUInt16(mdbBlocks, 0x022);
- volMDB.drVNSiz = mdbBlocks[0x024];
- byte[] variableSize = new byte[volMDB.drVNSiz + 1];
- Array.Copy(mdbBlocks, 0x024, variableSize, 0, volMDB.drVNSiz + 1);
- volMDB.drVN = StringHandlers.PascalToString(variableSize, Encoding);
+ _volMdb.drCrDate = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x002);
+ _volMdb.drLsBkUp = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x006);
+ _volMdb.drAtrb = (AppleCommon.VolumeAttributes)BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x00A);
+ _volMdb.drNmFls = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x00C);
+ _volMdb.drDirSt = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x00E);
+ _volMdb.drBlLen = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x010);
+ _volMdb.drNmAlBlks = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x012);
+ _volMdb.drAlBlkSiz = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x014);
+ _volMdb.drClpSiz = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x018);
+ _volMdb.drAlBlSt = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x01C);
+ _volMdb.drNxtFNum = BigEndianBitConverter.ToUInt32(_mdbBlocks, 0x01E);
+ _volMdb.drFreeBks = BigEndianBitConverter.ToUInt16(_mdbBlocks, 0x022);
+ _volMdb.drVNSiz = _mdbBlocks[0x024];
+ byte[] variableSize = new byte[_volMdb.drVNSiz + 1];
+ Array.Copy(_mdbBlocks, 0x024, variableSize, 0, _volMdb.drVNSiz + 1);
+ _volMdb.drVN = StringHandlers.PascalToString(variableSize, Encoding);
- directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen);
- int bytesInBlockMap = ((volMDB.drNmAlBlks * 12) / 8) + ((volMDB.drNmAlBlks * 12) % 8);
- const int BYTES_BEFORE_BLOCK_MAP = 64;
- int bytesInWholeMdb = bytesInBlockMap + BYTES_BEFORE_BLOCK_MAP;
+ _directoryBlocks = _device.ReadSectors(_volMdb.drDirSt + _partitionStart, _volMdb.drBlLen);
+ int bytesInBlockMap = ((_volMdb.drNmAlBlks * 12) / 8) + ((_volMdb.drNmAlBlks * 12) % 8);
+ int bytesInWholeMdb = bytesInBlockMap + BYTES_BEFORE_BLOCK_MAP;
- int sectorsInWholeMdb = (bytesInWholeMdb / (int)device.Info.SectorSize) +
- (bytesInWholeMdb % (int)device.Info.SectorSize);
+ int sectorsInWholeMdb = (bytesInWholeMdb / (int)_device.Info.SectorSize) +
+ (bytesInWholeMdb % (int)_device.Info.SectorSize);
- byte[] wholeMdb = device.ReadSectors(partitionStart + 2, (uint)sectorsInWholeMdb);
- blockMapBytes = new byte[bytesInBlockMap];
- Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, blockMapBytes, 0, blockMapBytes.Length);
+ byte[] wholeMdb = _device.ReadSectors(_partitionStart + 2, (uint)sectorsInWholeMdb);
+ _blockMapBytes = new byte[bytesInBlockMap];
+ Array.Copy(wholeMdb, BYTES_BEFORE_BLOCK_MAP, _blockMapBytes, 0, _blockMapBytes.Length);
int offset = 0;
- blockMap = new uint[volMDB.drNmAlBlks + 2 + 1];
+ _blockMap = new uint[_volMdb.drNmAlBlks + 2 + 1];
- for(int i = 2; i < volMDB.drNmAlBlks + 2; i += 8)
+ for(int i = 2; i < _volMdb.drNmAlBlks + 2; i += 8)
{
uint tmp1 = 0;
uint tmp2 = 0;
uint tmp3 = 0;
- if(offset + 4 <= blockMapBytes.Length)
- tmp1 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset);
+ if(offset + 4 <= _blockMapBytes.Length)
+ tmp1 = BigEndianBitConverter.ToUInt32(_blockMapBytes, offset);
- if(offset + 4 + 4 <= blockMapBytes.Length)
- tmp2 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 4);
+ if(offset + 4 + 4 <= _blockMapBytes.Length)
+ tmp2 = BigEndianBitConverter.ToUInt32(_blockMapBytes, offset + 4);
- if(offset + 8 + 4 <= blockMapBytes.Length)
- tmp3 = BigEndianBitConverter.ToUInt32(blockMapBytes, offset + 8);
+ if(offset + 8 + 4 <= _blockMapBytes.Length)
+ tmp3 = BigEndianBitConverter.ToUInt32(_blockMapBytes, offset + 8);
- if(i < blockMap.Length)
- blockMap[i] = (tmp1 & 0xFFF00000) >> 20;
+ if(i < _blockMap.Length)
+ _blockMap[i] = (tmp1 & 0xFFF00000) >> 20;
- if(i + 2 < blockMap.Length)
- blockMap[i + 1] = (tmp1 & 0xFFF00) >> 8;
+ if(i + 2 < _blockMap.Length)
+ _blockMap[i + 1] = (tmp1 & 0xFFF00) >> 8;
- if(i + 3 < blockMap.Length)
- blockMap[i + 2] = ((tmp1 & 0xFF) << 4) + ((tmp2 & 0xF0000000) >> 28);
+ if(i + 3 < _blockMap.Length)
+ _blockMap[i + 2] = ((tmp1 & 0xFF) << 4) + ((tmp2 & 0xF0000000) >> 28);
- if(i + 4 < blockMap.Length)
- blockMap[i + 3] = (tmp2 & 0xFFF0000) >> 16;
+ if(i + 4 < _blockMap.Length)
+ _blockMap[i + 3] = (tmp2 & 0xFFF0000) >> 16;
- if(i + 5 < blockMap.Length)
- blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4;
+ if(i + 5 < _blockMap.Length)
+ _blockMap[i + 4] = (tmp2 & 0xFFF0) >> 4;
- if(i + 6 < blockMap.Length)
- blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24);
+ if(i + 6 < _blockMap.Length)
+ _blockMap[i + 5] = ((tmp2 & 0xF) << 8) + ((tmp3 & 0xFF000000) >> 24);
- if(i + 7 < blockMap.Length)
- blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12;
+ if(i + 7 < _blockMap.Length)
+ _blockMap[i + 6] = (tmp3 & 0xFFF000) >> 12;
- if(i + 8 < blockMap.Length)
- blockMap[i + 7] = tmp3 & 0xFFF;
+ if(i + 8 < _blockMap.Length)
+ _blockMap[i + 7] = tmp3 & 0xFFF;
offset += 12;
}
- if(device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
+ if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
{
- mdbTags = device.ReadSectorTag(2 + partitionStart, SectorTagType.AppleSectorTag);
- bootTags = device.ReadSectorTag(0 + partitionStart, SectorTagType.AppleSectorTag);
+ _mdbTags = _device.ReadSectorTag(2 + _partitionStart, SectorTagType.AppleSectorTag);
+ _bootTags = _device.ReadSectorTag(0 + _partitionStart, SectorTagType.AppleSectorTag);
- directoryTags = device.ReadSectorsTag(volMDB.drDirSt + partitionStart, volMDB.drBlLen,
- SectorTagType.AppleSectorTag);
+ _directoryTags = _device.ReadSectorsTag(_volMdb.drDirSt + _partitionStart, _volMdb.drBlLen,
+ SectorTagType.AppleSectorTag);
- bitmapTags = device.ReadSectorsTag(partitionStart + 2, (uint)sectorsInWholeMdb,
- SectorTagType.AppleSectorTag);
+ _bitmapTags = _device.ReadSectorsTag(_partitionStart + 2, (uint)sectorsInWholeMdb,
+ SectorTagType.AppleSectorTag);
}
- sectorsPerBlock = (int)(volMDB.drAlBlkSiz / device.Info.SectorSize);
+ _sectorsPerBlock = (int)(_volMdb.drAlBlkSiz / _device.Info.SectorSize);
if(!FillDirectory())
return Errno.InvalidArgument;
- mounted = true;
+ _mounted = true;
- ushort bbSig = BigEndianBitConverter.ToUInt16(bootBlocks, 0x000);
+ ushort bbSig = BigEndianBitConverter.ToUInt16(_bootBlocks, 0x000);
if(bbSig != AppleCommon.BB_MAGIC)
- bootBlocks = null;
+ _bootBlocks = null;
XmlFsType = new FileSystemType();
- if(volMDB.drLsBkUp > 0)
+ if(_volMdb.drLsBkUp > 0)
{
- XmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
+ XmlFsType.BackupDate = DateHandlers.MacToDateTime(_volMdb.drLsBkUp);
XmlFsType.BackupDateSpecified = true;
}
XmlFsType.Bootable = bbSig == AppleCommon.BB_MAGIC;
- XmlFsType.Clusters = volMDB.drNmAlBlks;
- XmlFsType.ClusterSize = volMDB.drAlBlkSiz;
+ XmlFsType.Clusters = _volMdb.drNmAlBlks;
+ XmlFsType.ClusterSize = _volMdb.drAlBlkSiz;
- if(volMDB.drCrDate > 0)
+ if(_volMdb.drCrDate > 0)
{
- XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
+ XmlFsType.CreationDate = DateHandlers.MacToDateTime(_volMdb.drCrDate);
XmlFsType.CreationDateSpecified = true;
}
- XmlFsType.Files = volMDB.drNmFls;
+ XmlFsType.Files = _volMdb.drNmFls;
XmlFsType.FilesSpecified = true;
- XmlFsType.FreeClusters = volMDB.drFreeBks;
+ XmlFsType.FreeClusters = _volMdb.drFreeBks;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Type = "MFS";
- XmlFsType.VolumeName = volMDB.drVN;
+ XmlFsType.VolumeName = _volMdb.drVN;
return Errno.NoError;
}
public Errno Unmount()
{
- mounted = false;
- idToFilename = null;
- idToEntry = null;
- filenameToId = null;
- bootBlocks = null;
+ _mounted = false;
+ _idToFilename = null;
+ _idToEntry = null;
+ _filenameToId = null;
+ _bootBlocks = null;
return Errno.NoError;
}
@@ -209,10 +210,10 @@ namespace Aaru.Filesystems
{
stat = new FileSystemInfo
{
- Blocks = volMDB.drNmAlBlks,
+ Blocks = _volMdb.drNmAlBlks,
FilenameLength = 255,
- Files = volMDB.drNmFls,
- FreeBlocks = volMDB.drFreeBks,
+ Files = _volMdb.drNmFls,
+ FreeBlocks = _volMdb.drFreeBks,
PluginId = Id,
Type = "Apple MFS"
};
diff --git a/Aaru.Filesystems/AppleMFS/Xattr.cs b/Aaru.Filesystems/AppleMFS/Xattr.cs
index cd2cbd0aa..c55b998b6 100644
--- a/Aaru.Filesystems/AppleMFS/Xattr.cs
+++ b/Aaru.Filesystems/AppleMFS/Xattr.cs
@@ -46,7 +46,7 @@ namespace Aaru.Filesystems
{
xattrs = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -61,36 +61,36 @@ namespace Aaru.Filesystems
xattrs = new List();
- if(debug)
+ if(_debug)
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
{
- if(device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
+ if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
xattrs.Add("com.apple.macintosh.tags");
return Errno.NoError;
}
- if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
+ if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
- if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
+ if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
return Errno.NoSuchFile;
if(entry.flRLgLen > 0)
{
xattrs.Add("com.apple.ResourceFork");
- if(debug && device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
+ if(_debug && _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag))
xattrs.Add("com.apple.ResourceFork.tags");
}
xattrs.Add("com.apple.FinderInfo");
- if(debug &&
- device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) &&
+ if(_debug &&
+ _device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) &&
entry.flLgLen > 0)
xattrs.Add("com.apple.macintosh.tags");
@@ -101,7 +101,7 @@ namespace Aaru.Filesystems
public Errno GetXattr(string path, string xattr, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -114,42 +114,42 @@ namespace Aaru.Filesystems
path = pathElements[0];
- if(debug)
+ if(_debug)
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0 ||
string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
- if(device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) &&
+ if(_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) &&
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) == 0)
{
if(string.Compare(path, "$", StringComparison.InvariantCulture) == 0)
{
- buf = new byte[directoryTags.Length];
- Array.Copy(directoryTags, 0, buf, 0, buf.Length);
+ buf = new byte[_directoryTags.Length];
+ Array.Copy(_directoryTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
if(string.Compare(path, "$Bitmap", StringComparison.InvariantCulture) == 0)
{
- buf = new byte[bitmapTags.Length];
- Array.Copy(bitmapTags, 0, buf, 0, buf.Length);
+ buf = new byte[_bitmapTags.Length];
+ Array.Copy(_bitmapTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
if(string.Compare(path, "$Boot", StringComparison.InvariantCulture) == 0)
{
- buf = new byte[bootTags.Length];
- Array.Copy(bootTags, 0, buf, 0, buf.Length);
+ buf = new byte[_bootTags.Length];
+ Array.Copy(_bootTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
if(string.Compare(path, "$MDB", StringComparison.InvariantCulture) == 0)
{
- buf = new byte[mdbTags.Length];
- Array.Copy(mdbTags, 0, buf, 0, buf.Length);
+ buf = new byte[_mdbTags.Length];
+ Array.Copy(_mdbTags, 0, buf, 0, buf.Length);
return Errno.NoError;
}
@@ -159,10 +159,10 @@ namespace Aaru.Filesystems
Errno error;
- if(!filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
+ if(!_filenameToId.TryGetValue(path.ToLowerInvariant(), out uint fileId))
return Errno.NoSuchFile;
- if(!idToEntry.TryGetValue(fileId, out FileEntry entry))
+ if(!_idToEntry.TryGetValue(fileId, out FileEntry entry))
return Errno.NoSuchFile;
if(entry.flRLgLen > 0 &&
@@ -188,8 +188,8 @@ namespace Aaru.Filesystems
return Errno.NoError;
}
- if(!debug ||
- !device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) ||
+ if(!_debug ||
+ !_device.Info.ReadableSectorTags.Contains(SectorTagType.AppleSectorTag) ||
string.Compare(xattr, "com.apple.macintosh.tags", StringComparison.InvariantCulture) != 0)
return Errno.NoSuchExtendedAttribute;
diff --git a/Aaru.Filesystems/AtheOS.cs b/Aaru.Filesystems/AtheOS.cs
index 476acaab7..ed4c3777b 100644
--- a/Aaru.Filesystems/AtheOS.cs
+++ b/Aaru.Filesystems/AtheOS.cs
@@ -104,7 +104,7 @@ namespace Aaru.Filesystems
byte[] sbSector = new byte[AFS_SUPERBLOCK_SIZE];
Array.Copy(tmp, offset, sbSector, 0, AFS_SUPERBLOCK_SIZE);
- AtheosSuperBlock afsSb = Marshal.ByteArrayToStructureLittleEndian(sbSector);
+ SuperBlock afsSb = Marshal.ByteArrayToStructureLittleEndian(sbSector);
sb.AppendLine("Atheos filesystem");
@@ -168,7 +168,7 @@ namespace Aaru.Filesystems
/// Be superblock
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct AtheosSuperBlock
+ struct SuperBlock
{
/// 0x000, Volume name, 32 bytes
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
diff --git a/Aaru.Filesystems/BFS.cs b/Aaru.Filesystems/BFS.cs
index 33f17e518..f73b497e4 100644
--- a/Aaru.Filesystems/BFS.cs
+++ b/Aaru.Filesystems/BFS.cs
@@ -106,7 +106,7 @@ namespace Aaru.Filesystems
var sb = new StringBuilder();
- var besb = new BeSuperBlock();
+ var besb = new SuperBlock();
byte[] sbSector = imagePlugin.ReadSector(0 + partition.Start);
@@ -145,9 +145,9 @@ namespace Aaru.Filesystems
}
if(littleEndian)
- besb = Marshal.ByteArrayToStructureLittleEndian(sbSector);
+ besb = Marshal.ByteArrayToStructureLittleEndian(sbSector);
else
- besb = Marshal.ByteArrayToStructureBigEndian(sbSector);
+ besb = Marshal.ByteArrayToStructureBigEndian(sbSector);
sb.AppendLine(littleEndian ? "Little-endian BeFS" : "Big-endian BeFS");
@@ -239,7 +239,7 @@ namespace Aaru.Filesystems
/// Be superblock
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct BeSuperBlock
+ struct SuperBlock
{
/// 0x000, Volume name, 32 bytes
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
diff --git a/Aaru.Filesystems/CBM.cs b/Aaru.Filesystems/CBM.cs
index d20271b8c..9081a9764 100644
--- a/Aaru.Filesystems/CBM.cs
+++ b/Aaru.Filesystems/CBM.cs
@@ -70,7 +70,7 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.Sectors == 3200)
{
sector = imagePlugin.ReadSector(1560);
- CommodoreHeader cbmHdr = Marshal.ByteArrayToStructureLittleEndian(sector);
+ Header cbmHdr = Marshal.ByteArrayToStructureLittleEndian(sector);
if(cbmHdr.diskDosVersion == 0x44 &&
cbmHdr.dosVersion == 0x33 &&
@@ -80,7 +80,7 @@ namespace Aaru.Filesystems
else
{
sector = imagePlugin.ReadSector(357);
- CommodoreBam cbmBam = Marshal.ByteArrayToStructureLittleEndian(sector);
+ BAM cbmBam = Marshal.ByteArrayToStructureLittleEndian(sector);
if(cbmBam.dosVersion == 0x41 &&
(cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) &&
@@ -112,7 +112,7 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.Sectors == 3200)
{
sector = imagePlugin.ReadSector(1560);
- CommodoreHeader cbmHdr = Marshal.ByteArrayToStructureLittleEndian(sector);
+ Header cbmHdr = Marshal.ByteArrayToStructureLittleEndian(sector);
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack,
cbmHdr.directorySector).AppendLine();
@@ -143,7 +143,7 @@ namespace Aaru.Filesystems
else
{
sector = imagePlugin.ReadSector(357);
- CommodoreBam cbmBam = Marshal.ByteArrayToStructureLittleEndian(sector);
+ BAM cbmBam = Marshal.ByteArrayToStructureLittleEndian(sector);
sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack,
cbmBam.directorySector).AppendLine();
@@ -170,7 +170,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct CommodoreBam
+ struct BAM
{
/// Track where directory starts
public readonly byte directoryTrack;
@@ -213,7 +213,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct CommodoreHeader
+ struct Header
{
/// Track where directory starts
public readonly byte directoryTrack;
diff --git a/Aaru.Filesystems/CPM/CPM.cs b/Aaru.Filesystems/CPM/CPM.cs
index 76fcb2e27..9fb59226b 100644
--- a/Aaru.Filesystems/CPM/CPM.cs
+++ b/Aaru.Filesystems/CPM/CPM.cs
@@ -42,42 +42,42 @@ namespace Aaru.Filesystems
internal partial class CPM : IReadOnlyFilesystem
{
/// True if thinks this is a CP/M filesystem
- bool cpmFound;
+ bool _cpmFound;
/// Cached
- FileSystemInfo cpmStat;
+ FileSystemInfo _cpmStat;
/// Cached file passwords, decoded
- Dictionary decodedPasswordCache;
+ Dictionary _decodedPasswordCache;
/// Stores all known CP/M disk definitions
- CpmDefinitions definitions;
- IMediaImage device;
+ CpmDefinitions _definitions;
+ IMediaImage _device;
/// Cached directory listing
- List dirList;
+ List _dirList;
/// CP/M disc parameter block (on-memory)
- DiscParameterBlock dpb;
+ DiscParameterBlock _dpb;
/// Cached file data
- Dictionary fileCache;
+ Dictionary _fileCache;
/// The volume label, if the CP/M filesystem contains one
- string label;
+ string _label;
/// Timestamp in volume label for creation
- byte[] labelCreationDate;
+ byte[] _labelCreationDate;
/// Timestamp in volume label for update
- byte[] labelUpdateDate;
- bool mounted;
+ byte[] _labelUpdateDate;
+ bool _mounted;
/// Cached file passwords
- Dictionary passwordCache;
+ Dictionary _passwordCache;
/// Sector deinterleaving mask
- int[] sectorMask;
+ int[] _sectorMask;
/// True if there are CP/M 3 timestamps
- bool standardTimestamps;
+ bool _standardTimestamps;
/// Cached file
- Dictionary statCache;
+ Dictionary _statCache;
/// True if there are timestamps in Z80DOS or DOS+ format
- bool thirdPartyTimestamps;
+ bool _thirdPartyTimestamps;
/// If thinks this is a CP/M filesystem, this is the definition for it
- CpmDefinition workingDefinition;
+ CpmDefinition _workingDefinition;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
diff --git a/Aaru.Filesystems/CPM/Consts.cs b/Aaru.Filesystems/CPM/Consts.cs
index ec5ad6450..f8a60b893 100644
--- a/Aaru.Filesystems/CPM/Consts.cs
+++ b/Aaru.Filesystems/CPM/Consts.cs
@@ -30,6 +30,8 @@
// Copyright © 2011-2020 Natalia Portillo
// ****************************************************************************/
+// ReSharper disable InconsistentNaming
+
namespace Aaru.Filesystems
{
internal partial class CPM
diff --git a/Aaru.Filesystems/CPM/Definitions.cs b/Aaru.Filesystems/CPM/Definitions.cs
index a5d4176ca..72a41fc12 100644
--- a/Aaru.Filesystems/CPM/Definitions.cs
+++ b/Aaru.Filesystems/CPM/Definitions.cs
@@ -52,10 +52,10 @@ namespace Aaru.Filesystems
throw new InvalidOperationException());
var defsSerializer = new XmlSerializer(typeof(CpmDefinitions));
- definitions = (CpmDefinitions)defsSerializer.Deserialize(defsReader);
+ _definitions = (CpmDefinitions)defsSerializer.Deserialize(defsReader);
// Patch definitions
- foreach(CpmDefinition def in definitions.definitions)
+ foreach(CpmDefinition def in _definitions.definitions)
{
if(def.side1 == null)
{
diff --git a/Aaru.Filesystems/CPM/Dir.cs b/Aaru.Filesystems/CPM/Dir.cs
index 6536536ca..0b8949707 100644
--- a/Aaru.Filesystems/CPM/Dir.cs
+++ b/Aaru.Filesystems/CPM/Dir.cs
@@ -44,14 +44,14 @@ namespace Aaru.Filesystems
{
contents = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
if(!string.IsNullOrEmpty(path) &&
string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
return Errno.NotSupported;
- contents = new List(dirList);
+ contents = new List(_dirList);
return Errno.NoError;
}
@@ -103,17 +103,17 @@ namespace Aaru.Filesystems
entry.extension[e] != 0x00)
return false;
- label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim();
- labelCreationDate = new byte[4];
- labelUpdateDate = new byte[4];
- Array.Copy(directory, off + 24, labelCreationDate, 0, 4);
- Array.Copy(directory, off + 28, labelUpdateDate, 0, 4);
+ _label = Encoding.ASCII.GetString(directory, off + 1, 11).Trim();
+ _labelCreationDate = new byte[4];
+ _labelUpdateDate = new byte[4];
+ Array.Copy(directory, off + 24, _labelCreationDate, 0, 4);
+ Array.Copy(directory, off + 28, _labelUpdateDate, 0, 4);
}
else if(entry.statusUser == 0x21)
if(directory[off + 1] == 0x00)
- thirdPartyTimestamps = true;
+ _thirdPartyTimestamps = true;
else
- standardTimestamps |= directory[off + 21] == 0x00 && directory[off + 31] == 0x00;
+ _standardTimestamps |= directory[off + 21] == 0x00 && directory[off + 31] == 0x00;
}
return fileCount > 0;
diff --git a/Aaru.Filesystems/CPM/File.cs b/Aaru.Filesystems/CPM/File.cs
index b2b07952b..763fd0426 100644
--- a/Aaru.Filesystems/CPM/File.cs
+++ b/Aaru.Filesystems/CPM/File.cs
@@ -42,7 +42,7 @@ namespace Aaru.Filesystems
{
attributes = new FileAttributes();
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -62,7 +62,7 @@ namespace Aaru.Filesystems
return Errno.NoError;
}
- if(!statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out FileEntryInfo fInfo))
+ if(!_statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out FileEntryInfo fInfo))
return Errno.NoSuchFile;
attributes = fInfo.Attributes;
@@ -75,12 +75,12 @@ namespace Aaru.Filesystems
{
deviceBlock = 0;
- return !mounted ? Errno.AccessDenied : Errno.NotImplemented;
+ return !_mounted ? Errno.AccessDenied : Errno.NotImplemented;
}
public Errno Read(string path, long offset, long size, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
if(size == 0)
@@ -101,7 +101,7 @@ namespace Aaru.Filesystems
if(pathElements.Length != 1)
return Errno.NotSupported;
- if(!fileCache.TryGetValue(pathElements[0].ToUpperInvariant(), out byte[] file))
+ if(!_fileCache.TryGetValue(pathElements[0].ToUpperInvariant(), out byte[] file))
return Errno.NoSuchFile;
if(offset >= file.Length)
@@ -120,14 +120,14 @@ namespace Aaru.Filesystems
{
dest = null;
- return !mounted ? Errno.AccessDenied : Errno.NotSupported;
+ return !_mounted ? Errno.AccessDenied : Errno.NotSupported;
}
public Errno Stat(string path, out FileEntryInfo stat)
{
stat = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -140,7 +140,7 @@ namespace Aaru.Filesystems
if(!string.IsNullOrEmpty(path) &&
string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
- return statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat) ? Errno.NoError
+ return _statCache.TryGetValue(pathElements[0].ToUpperInvariant(), out stat) ? Errno.NoError
: Errno.NoSuchFile;
stat = new FileEntryInfo
@@ -149,11 +149,11 @@ namespace Aaru.Filesystems
BlockSize = XmlFsType.ClusterSize
};
- if(labelCreationDate != null)
- stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate);
+ if(_labelCreationDate != null)
+ stat.CreationTime = DateHandlers.CpmToDateTime(_labelCreationDate);
- if(labelUpdateDate != null)
- stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate);
+ if(_labelUpdateDate != null)
+ stat.StatusChangeTime = DateHandlers.CpmToDateTime(_labelUpdateDate);
return Errno.NoError;
}
diff --git a/Aaru.Filesystems/CPM/Info.cs b/Aaru.Filesystems/CPM/Info.cs
index 36fc5f6bb..42c0de303 100644
--- a/Aaru.Filesystems/CPM/Info.cs
+++ b/Aaru.Filesystems/CPM/Info.cs
@@ -162,11 +162,11 @@ namespace Aaru.Filesystems
ulong sectorSize;
ulong firstDirectorySector;
byte[] directory = null;
- workingDefinition = null;
- label = null;
+ _workingDefinition = null;
+ _label = null;
// Try Amstrad superblock
- if(!cpmFound)
+ if(!_cpmFound)
{
// Read CHS = {0,0,1}
sector = imagePlugin.ReadSector(0 + partition.Start);
@@ -200,63 +200,63 @@ namespace Aaru.Filesystems
if(sectorSize == imagePlugin.Info.SectorSize &&
sectorCount == imagePlugin.Info.Sectors)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector = (ulong)(amsSb.off * amsSb.spt);
// Build a DiscParameterBlock
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = sectorCount == 1440 ? (byte)0xF0 : (byte)0xC0,
spt = amsSb.spt,
bsh = amsSb.bsh
};
- for(int i = 0; i < dpb.bsh; i++)
- dpb.blm += (byte)Math.Pow(2, i);
+ for(int i = 0; i < _dpb.bsh; i++)
+ _dpb.blm += (byte)Math.Pow(2, i);
if(sectorCount >= 1440)
{
- dpb.cks = 0x40;
- dpb.drm = 0xFF;
+ _dpb.cks = 0x40;
+ _dpb.drm = 0xFF;
}
else
{
- dpb.cks = 0x10;
- dpb.drm = 0x3F;
+ _dpb.cks = 0x10;
+ _dpb.drm = 0x3F;
}
- dpb.dsm = 0; // I don't care
- dpb.exm = sectorCount == 2880 ? (byte)1 : (byte)0;
- dpb.off = amsSb.off;
- dpb.psh = amsSb.psh;
+ _dpb.dsm = 0; // I don't care
+ _dpb.exm = sectorCount == 2880 ? (byte)1 : (byte)0;
+ _dpb.off = amsSb.off;
+ _dpb.psh = amsSb.psh;
- for(int i = 0; i < dpb.psh; i++)
- dpb.phm += (byte)Math.Pow(2, i);
+ for(int i = 0; i < _dpb.psh; i++)
+ _dpb.phm += (byte)Math.Pow(2, i);
- dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128));
- uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize);
+ _dpb.spt = (ushort)(amsSb.spt * (sectorSize / 128));
+ uint directoryLength = (uint)((((ulong)_dpb.drm + 1) * 32) / sectorSize);
directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start,
directoryLength);
// Build a CP/M disk definition
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = amsSb.tps,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "Amstrad PCW superblock",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = amsSb.spt,
side1 = new Side
{
@@ -266,40 +266,40 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < amsSb.spt; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
if(amsSb.format == 2)
{
switch(amsSb.sidedness & 0x02)
{
case 1:
- workingDefinition.order = "SIDES";
+ _workingDefinition.order = "SIDES";
break;
case 2:
- workingDefinition.order = "CYLINDERS";
+ _workingDefinition.order = "CYLINDERS";
break;
default:
- workingDefinition.order = null;
+ _workingDefinition.order = null;
break;
}
- workingDefinition.side2 = new Side
+ _workingDefinition.side2 = new Side
{
sideId = 1,
sectorIds = new int[amsSb.spt]
};
for(int si = 0; si < amsSb.spt; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
else
- workingDefinition.order = null;
+ _workingDefinition.order = null;
- workingDefinition.skew = 2;
- workingDefinition.sofs = 0;
+ _workingDefinition.skew = 2;
+ _workingDefinition.sofs = 0;
AaruConsole.DebugWriteLine("CP/M Plugin", "Found Amstrad superblock.");
}
@@ -307,7 +307,7 @@ namespace Aaru.Filesystems
}
// Try CP/M-86 superblock for hard disks
- if(!cpmFound)
+ if(!_cpmFound)
{
// Read CHS = {0,0,4}
sector = imagePlugin.ReadSector(3 + partition.Start);
@@ -336,11 +336,11 @@ namespace Aaru.Filesystems
startingSector == partition.Start &&
sectorsInPartition + partition.Start <= partition.End)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector = (ulong)(hddSb.off * hddSb.sectorsPerTrack);
// Build a DiscParameterBlock
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = (byte)hddSb.al0,
al1 = (byte)hddSb.al1,
@@ -360,7 +360,7 @@ namespace Aaru.Filesystems
spt = hddSb.spt
};
- uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / sectorSize);
+ uint directoryLength = (uint)((((ulong)_dpb.drm + 1) * 32) / sectorSize);
directory = imagePlugin.ReadSectors(firstDirectorySector + partition.Start,
directoryLength);
@@ -368,23 +368,23 @@ namespace Aaru.Filesystems
AaruConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 hard disk superblock.");
// Build a CP/M disk definition
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "HIGH",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = hddSb.cylinders,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 hard disk superblock",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = hddSb.sectorsPerTrack,
side1 = new Side
{
@@ -402,16 +402,16 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < hddSb.sectorsPerTrack; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < hddSb.spt; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
}
}
// Try CP/M-86 format ID for floppies
- if(!cpmFound)
+ if(!_cpmFound)
{
// Read CHS = {0,0,1}
sector = imagePlugin.ReadSector(0 + partition.Start);
@@ -441,10 +441,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 320)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 8;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0xC0,
al1 = 0,
@@ -460,23 +460,23 @@ namespace Aaru.Filesystems
spt = 8 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 40,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 8,
side1 = new Side
{
@@ -488,7 +488,7 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 8; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
}
break;
@@ -496,10 +496,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 640)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 16;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0x80,
al1 = 0,
@@ -515,23 +515,23 @@ namespace Aaru.Filesystems
spt = 8 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 40,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 8,
side1 = new Side
{
@@ -549,10 +549,10 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 8; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < 8; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
break;
@@ -562,10 +562,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 720)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 36;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0x80,
al1 = 0,
@@ -581,23 +581,23 @@ namespace Aaru.Filesystems
spt = 9 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 40,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 9,
side1 = new Side
{
@@ -615,10 +615,10 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 9; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < 9; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
break;
@@ -627,10 +627,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 1440)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 36;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0xF0,
al1 = 0,
@@ -646,23 +646,23 @@ namespace Aaru.Filesystems
spt = 9 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 80,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 9,
side1 = new Side
{
@@ -680,10 +680,10 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 9; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < 9; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
break;
@@ -691,10 +691,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 1440)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 18;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0xF0,
al1 = 0,
@@ -710,23 +710,23 @@ namespace Aaru.Filesystems
spt = 9 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 80,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 9,
side1 = new Side
{
@@ -744,10 +744,10 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 9; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < 9; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
break;
@@ -755,10 +755,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 2400)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 30;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0xC0,
al1 = 0,
@@ -774,23 +774,23 @@ namespace Aaru.Filesystems
spt = 15 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "HIGH",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 80,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 15,
side1 = new Side
{
@@ -808,10 +808,10 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 15; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < 15; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
break;
@@ -819,10 +819,10 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize == 512 &&
imagePlugin.Info.Sectors == 2880)
{
- cpmFound = true;
+ _cpmFound = true;
firstDirectorySector86 = 36;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = 0xC0,
al1 = 0,
@@ -838,23 +838,23 @@ namespace Aaru.Filesystems
spt = 18 * 4
};
- workingDefinition = new CpmDefinition
+ _workingDefinition = new CpmDefinition
{
- al0 = dpb.al0,
- al1 = dpb.al1,
+ al0 = _dpb.al0,
+ al1 = _dpb.al1,
bitrate = "LOW",
- blm = dpb.blm,
- bsh = dpb.bsh,
+ blm = _dpb.blm,
+ bsh = _dpb.bsh,
bytesPerSector = 512,
cylinders = 80,
- drm = dpb.drm,
- dsm = dpb.dsm,
+ drm = _dpb.drm,
+ dsm = _dpb.dsm,
encoding = "MFM",
evenOdd = false,
- exm = dpb.exm,
+ exm = _dpb.exm,
label = null,
comment = "CP/M-86 floppy identifier",
- ofs = dpb.off,
+ ofs = _dpb.off,
sectorsPerTrack = 18,
side1 = new Side
{
@@ -872,25 +872,25 @@ namespace Aaru.Filesystems
};
for(int si = 0; si < 18; si++)
- workingDefinition.side1.sectorIds[si] = si + 1;
+ _workingDefinition.side1.sectorIds[si] = si + 1;
for(int si = 0; si < 18; si++)
- workingDefinition.side2.sectorIds[si] = si + 1;
+ _workingDefinition.side2.sectorIds[si] = si + 1;
}
break;
}
- if(cpmFound)
+ if(_cpmFound)
{
- uint directoryLength = (uint)((((ulong)dpb.drm + 1) * 32) / imagePlugin.Info.SectorSize);
+ uint directoryLength = (uint)((((ulong)_dpb.drm + 1) * 32) / imagePlugin.Info.SectorSize);
directory = imagePlugin.ReadSectors(firstDirectorySector86 + partition.Start, directoryLength);
AaruConsole.DebugWriteLine("CP/M Plugin", "Found CP/M-86 floppy identifier.");
}
}
// One of the few CP/M filesystem marks has been found, try for correcteness checking the whole directory
- if(cpmFound)
+ if(_cpmFound)
{
if(CheckDir(directory))
{
@@ -899,22 +899,22 @@ namespace Aaru.Filesystems
return true;
}
- cpmFound = false;
+ _cpmFound = false;
}
// Try all definitions
- if(!cpmFound)
+ if(!_cpmFound)
{
// Load all definitions
AaruConsole.DebugWriteLine("CP/M Plugin", "Trying to load definitions.");
- if(LoadDefinitions() &&
- definitions?.definitions != null &&
- definitions.definitions.Count > 0)
+ if(LoadDefinitions() &&
+ _definitions?.definitions != null &&
+ _definitions.definitions.Count > 0)
{
AaruConsole.DebugWriteLine("CP/M Plugin", "Trying all known definitions.");
- foreach(CpmDefinition def in from def in definitions.definitions let sectors =
+ foreach(CpmDefinition def in from def in _definitions.definitions let sectors =
(ulong)(def.cylinders * def.sides * def.sectorsPerTrack)
where sectors == imagePlugin.Info.Sectors &&
def.bytesPerSector == imagePlugin.Info.SectorSize select def)
@@ -932,24 +932,24 @@ namespace Aaru.Filesystems
if(def.sides == 1)
{
- sectorMask = new int[def.side1.sectorIds.Length];
+ _sectorMask = new int[def.side1.sectorIds.Length];
- for(int m = 0; m < sectorMask.Length; m++)
- sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
+ for(int m = 0; m < _sectorMask.Length; m++)
+ _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
}
else
{
// Head changes after every track
if(string.Compare(def.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
{
- sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length];
+ _sectorMask = new int[def.side1.sectorIds.Length + def.side2.sectorIds.Length];
for(int m = 0; m < def.side1.sectorIds.Length; m++)
- sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
+ _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
// Skip first track (first side)
for(int m = 0; m < def.side2.sectorIds.Length; m++)
- sectorMask[m + def.side1.sectorIds.Length] =
+ _sectorMask[m + def.side1.sectorIds.Length] =
(def.side2.sectorIds[m] - def.side2.sectorIds[0]) +
def.side1.sectorIds.Length;
}
@@ -959,11 +959,11 @@ namespace Aaru.Filesystems
StringComparison.InvariantCultureIgnoreCase) == 0)
{
for(int m = 0; m < def.side1.sectorIds.Length; m++)
- sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
+ _sectorMask[m] = def.side1.sectorIds[m] - def.side1.sectorIds[0];
// Skip first track (first side) and first track (second side)
for(int m = 0; m < def.side1.sectorIds.Length; m++)
- sectorMask[m + def.side1.sectorIds.Length] =
+ _sectorMask[m + def.side1.sectorIds.Length] =
(def.side1.sectorIds[m] - def.side1.sectorIds[0]) +
def.side1.sectorIds.Length + def.side2.sectorIds.Length;
}
@@ -1004,8 +1004,8 @@ namespace Aaru.Filesystems
{
byte[] dirSector =
imagePlugin.ReadSector((ulong)((int)offset + (int)partition.Start +
- ((p / sectorMask.Length) * sectorMask.Length) +
- sectorMask[p % sectorMask.Length]));
+ ((p / _sectorMask.Length) * _sectorMask.Length) +
+ _sectorMask[p % _sectorMask.Length]));
ms.Write(dirSector, 0, dirSector.Length);
}
@@ -1028,9 +1028,9 @@ namespace Aaru.Filesystems
def.comment);
// Build a Disc Parameter Block
- workingDefinition = def;
+ _workingDefinition = def;
- dpb = new DiscParameterBlock
+ _dpb = new DiscParameterBlock
{
al0 = (byte)def.al0,
al1 = (byte)def.al1,
@@ -1049,72 +1049,72 @@ namespace Aaru.Filesystems
switch(def.bytesPerSector)
{
case 128:
- dpb.psh = 0;
- dpb.phm = 0;
+ _dpb.psh = 0;
+ _dpb.phm = 0;
break;
case 256:
- dpb.psh = 1;
- dpb.phm = 1;
+ _dpb.psh = 1;
+ _dpb.phm = 1;
break;
case 512:
- dpb.psh = 2;
- dpb.phm = 3;
+ _dpb.psh = 2;
+ _dpb.phm = 3;
break;
case 1024:
- dpb.psh = 3;
- dpb.phm = 7;
+ _dpb.psh = 3;
+ _dpb.phm = 7;
break;
case 2048:
- dpb.psh = 4;
- dpb.phm = 15;
+ _dpb.psh = 4;
+ _dpb.phm = 15;
break;
case 4096:
- dpb.psh = 5;
- dpb.phm = 31;
+ _dpb.psh = 5;
+ _dpb.phm = 31;
break;
case 8192:
- dpb.psh = 6;
- dpb.phm = 63;
+ _dpb.psh = 6;
+ _dpb.phm = 63;
break;
case 16384:
- dpb.psh = 7;
- dpb.phm = 127;
+ _dpb.psh = 7;
+ _dpb.phm = 127;
break;
case 32768:
- dpb.psh = 8;
- dpb.phm = 255;
+ _dpb.psh = 8;
+ _dpb.phm = 255;
break;
}
- cpmFound = true;
- workingDefinition = def;
+ _cpmFound = true;
+ _workingDefinition = def;
return true;
}
- label = null;
- labelCreationDate = null;
- labelUpdateDate = null;
+ _label = null;
+ _labelCreationDate = null;
+ _labelUpdateDate = null;
}
}
}
// Clear class variables
- cpmFound = false;
- workingDefinition = null;
- dpb = null;
- label = null;
- standardTimestamps = false;
- thirdPartyTimestamps = false;
+ _cpmFound = false;
+ _workingDefinition = null;
+ _dpb = null;
+ _label = null;
+ _standardTimestamps = false;
+ _thirdPartyTimestamps = false;
return false;
}
@@ -1133,51 +1133,51 @@ namespace Aaru.Filesystems
// As the identification is so complex, just call Identify() and relay on its findings
if(!Identify(imagePlugin, partition) ||
- !cpmFound ||
- workingDefinition == null ||
- dpb == null)
+ !_cpmFound ||
+ _workingDefinition == null ||
+ _dpb == null)
return;
var sb = new StringBuilder();
sb.AppendLine("CP/M filesystem");
- if(!string.IsNullOrEmpty(workingDefinition.comment))
- sb.AppendFormat("Identified as {0}", workingDefinition.comment).AppendLine();
+ if(!string.IsNullOrEmpty(_workingDefinition.comment))
+ sb.AppendFormat("Identified as {0}", _workingDefinition.comment).AppendLine();
- sb.AppendFormat("Volume block is {0} bytes", 128 << dpb.bsh).AppendLine();
+ sb.AppendFormat("Volume block is {0} bytes", 128 << _dpb.bsh).AppendLine();
- if(dpb.dsm > 0)
- sb.AppendFormat("Volume contains {0} blocks ({1} bytes)", dpb.dsm, dpb.dsm * (128 << dpb.bsh)).
+ if(_dpb.dsm > 0)
+ sb.AppendFormat("Volume contains {0} blocks ({1} bytes)", _dpb.dsm, _dpb.dsm * (128 << _dpb.bsh)).
AppendLine();
- sb.AppendFormat("Volume contains {0} directory entries", dpb.drm + 1).AppendLine();
+ sb.AppendFormat("Volume contains {0} directory entries", _dpb.drm + 1).AppendLine();
- if(workingDefinition.sofs > 0)
- sb.AppendFormat("Volume reserves {0} sectors for system", workingDefinition.sofs).AppendLine();
+ if(_workingDefinition.sofs > 0)
+ sb.AppendFormat("Volume reserves {0} sectors for system", _workingDefinition.sofs).AppendLine();
else
sb.AppendFormat("Volume reserves {1} tracks ({0} sectors) for system",
- workingDefinition.ofs * workingDefinition.sectorsPerTrack, workingDefinition.ofs).
+ _workingDefinition.ofs * _workingDefinition.sectorsPerTrack, _workingDefinition.ofs).
AppendLine();
- if(workingDefinition.side1.sectorIds.Length >= 2)
+ if(_workingDefinition.side1.sectorIds.Length >= 2)
{
- int interleaveSide1 = workingDefinition.side1.sectorIds[1] - workingDefinition.side1.sectorIds[0];
+ int interleaveSide1 = _workingDefinition.side1.sectorIds[1] - _workingDefinition.side1.sectorIds[0];
if(interleaveSide1 > 1)
sb.AppendFormat("Side 0 uses {0}:1 software interleaving", interleaveSide1).AppendLine();
}
- if(workingDefinition.sides == 2)
+ if(_workingDefinition.sides == 2)
{
- if(workingDefinition.side2.sectorIds.Length >= 2)
+ if(_workingDefinition.side2.sectorIds.Length >= 2)
{
- int interleaveSide2 = workingDefinition.side2.sectorIds[1] - workingDefinition.side2.sectorIds[0];
+ int interleaveSide2 = _workingDefinition.side2.sectorIds[1] - _workingDefinition.side2.sectorIds[0];
if(interleaveSide2 > 1)
sb.AppendFormat("Side 1 uses {0}:1 software interleaving", interleaveSide2).AppendLine();
}
- switch(workingDefinition.order)
+ switch(_workingDefinition.order)
{
case "SIDES":
sb.AppendLine("Head changes after each whole track");
@@ -1188,62 +1188,62 @@ namespace Aaru.Filesystems
break;
default:
- sb.AppendFormat("Unknown how {0} side ordering works", workingDefinition.order).AppendLine();
+ sb.AppendFormat("Unknown how {0} side ordering works", _workingDefinition.order).AppendLine();
break;
}
}
- if(workingDefinition.skew > 0)
- sb.AppendFormat("Device uses {0}:1 hardware interleaving", workingDefinition.skew).AppendLine();
+ if(_workingDefinition.skew > 0)
+ sb.AppendFormat("Device uses {0}:1 hardware interleaving", _workingDefinition.skew).AppendLine();
- if(workingDefinition.sofs > 0)
- sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H SOFS {7}", dpb.bsh,
- dpb.blm, dpb.exm, dpb.dsm, dpb.drm, dpb.al0, dpb.al1, workingDefinition.sofs).
+ if(_workingDefinition.sofs > 0)
+ sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H SOFS {7}", _dpb.bsh,
+ _dpb.blm, _dpb.exm, _dpb.dsm, _dpb.drm, _dpb.al0, _dpb.al1, _workingDefinition.sofs).
AppendLine();
else
- sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H OFS {7}", dpb.bsh,
- dpb.blm, dpb.exm, dpb.dsm, dpb.drm, dpb.al0, dpb.al1, workingDefinition.ofs).
+ sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H OFS {7}", _dpb.bsh,
+ _dpb.blm, _dpb.exm, _dpb.dsm, _dpb.drm, _dpb.al0, _dpb.al1, _workingDefinition.ofs).
AppendLine();
- if(label != null)
- sb.AppendFormat("Volume label {0}", label).AppendLine();
+ if(_label != null)
+ sb.AppendFormat("Volume label {0}", _label).AppendLine();
- if(standardTimestamps)
+ if(_standardTimestamps)
sb.AppendLine("Volume uses standard CP/M timestamps");
- if(thirdPartyTimestamps)
+ if(_thirdPartyTimestamps)
sb.AppendLine("Volume uses third party timestamps");
- if(labelCreationDate != null)
- sb.AppendFormat("Volume created on {0}", DateHandlers.CpmToDateTime(labelCreationDate)).AppendLine();
+ if(_labelCreationDate != null)
+ sb.AppendFormat("Volume created on {0}", DateHandlers.CpmToDateTime(_labelCreationDate)).AppendLine();
- if(labelUpdateDate != null)
- sb.AppendFormat("Volume updated on {0}", DateHandlers.CpmToDateTime(labelUpdateDate)).AppendLine();
+ if(_labelUpdateDate != null)
+ sb.AppendFormat("Volume updated on {0}", DateHandlers.CpmToDateTime(_labelUpdateDate)).AppendLine();
XmlFsType = new FileSystemType();
- XmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0;
- XmlFsType.ClusterSize = (uint)(128 << dpb.bsh);
+ XmlFsType.Bootable |= _workingDefinition.sofs > 0 || _workingDefinition.ofs > 0;
+ XmlFsType.ClusterSize = (uint)(128 << _dpb.bsh);
- if(dpb.dsm > 0)
- XmlFsType.Clusters = dpb.dsm;
+ if(_dpb.dsm > 0)
+ XmlFsType.Clusters = _dpb.dsm;
else
XmlFsType.Clusters = partition.End - partition.Start;
- if(labelCreationDate != null)
+ if(_labelCreationDate != null)
{
- XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
+ XmlFsType.CreationDate = DateHandlers.CpmToDateTime(_labelCreationDate);
XmlFsType.CreationDateSpecified = true;
}
- if(labelUpdateDate != null)
+ if(_labelUpdateDate != null)
{
- XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
+ XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(_labelUpdateDate);
XmlFsType.ModificationDateSpecified = true;
}
XmlFsType.Type = "CP/M";
- XmlFsType.VolumeName = label;
+ XmlFsType.VolumeName = _label;
information = sb.ToString();
}
diff --git a/Aaru.Filesystems/CPM/Super.cs b/Aaru.Filesystems/CPM/Super.cs
index 514ae0756..f5c3bd6c4 100644
--- a/Aaru.Filesystems/CPM/Super.cs
+++ b/Aaru.Filesystems/CPM/Super.cs
@@ -53,54 +53,54 @@ namespace Aaru.Filesystems
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
Dictionary options, string @namespace)
{
- device = imagePlugin;
+ _device = imagePlugin;
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
// As the identification is so complex, just call Identify() and relay on its findings
- if(!Identify(device, partition) ||
- !cpmFound ||
- workingDefinition == null ||
- dpb == null)
+ if(!Identify(_device, partition) ||
+ !_cpmFound ||
+ _workingDefinition == null ||
+ _dpb == null)
return Errno.InvalidArgument;
// Build the software interleaving sector mask
- if(workingDefinition.sides == 1)
+ if(_workingDefinition.sides == 1)
{
- sectorMask = new int[workingDefinition.side1.sectorIds.Length];
+ _sectorMask = new int[_workingDefinition.side1.sectorIds.Length];
- for(int m = 0; m < sectorMask.Length; m++)
- sectorMask[m] = workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0];
+ for(int m = 0; m < _sectorMask.Length; m++)
+ _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0];
}
else
{
// Head changes after every track
- if(string.Compare(workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
+ if(string.Compare(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
{
- sectorMask = new int[workingDefinition.side1.sectorIds.Length +
- workingDefinition.side2.sectorIds.Length];
+ _sectorMask = new int[_workingDefinition.side1.sectorIds.Length +
+ _workingDefinition.side2.sectorIds.Length];
- for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++)
- sectorMask[m] = workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0];
+ for(int m = 0; m < _workingDefinition.side1.sectorIds.Length; m++)
+ _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0];
// Skip first track (first side)
- for(int m = 0; m < workingDefinition.side2.sectorIds.Length; m++)
- sectorMask[m + workingDefinition.side1.sectorIds.Length] =
- (workingDefinition.side2.sectorIds[m] - workingDefinition.side2.sectorIds[0]) +
- workingDefinition.side1.sectorIds.Length;
+ for(int m = 0; m < _workingDefinition.side2.sectorIds.Length; m++)
+ _sectorMask[m + _workingDefinition.side1.sectorIds.Length] =
+ (_workingDefinition.side2.sectorIds[m] - _workingDefinition.side2.sectorIds[0]) +
+ _workingDefinition.side1.sectorIds.Length;
}
// Head changes after whole side
- else if(string.Compare(workingDefinition.order, "CYLINDERS",
+ else if(string.Compare(_workingDefinition.order, "CYLINDERS",
StringComparison.InvariantCultureIgnoreCase) == 0)
{
- for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++)
- sectorMask[m] = workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0];
+ for(int m = 0; m < _workingDefinition.side1.sectorIds.Length; m++)
+ _sectorMask[m] = _workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0];
// Skip first track (first side) and first track (second side)
- for(int m = 0; m < workingDefinition.side1.sectorIds.Length; m++)
- sectorMask[m + workingDefinition.side1.sectorIds.Length] =
- (workingDefinition.side1.sectorIds[m] - workingDefinition.side1.sectorIds[0]) +
- workingDefinition.side1.sectorIds.Length + workingDefinition.side2.sectorIds.Length;
+ for(int m = 0; m < _workingDefinition.side1.sectorIds.Length; m++)
+ _sectorMask[m + _workingDefinition.side1.sectorIds.Length] =
+ (_workingDefinition.side1.sectorIds[m] - _workingDefinition.side1.sectorIds[0]) +
+ _workingDefinition.side1.sectorIds.Length + _workingDefinition.side2.sectorIds.Length;
// TODO: Implement CYLINDERS ordering
AaruConsole.DebugWriteLine("CP/M Plugin", "CYLINDERS ordering not yet implemented.");
@@ -109,7 +109,7 @@ namespace Aaru.Filesystems
}
// TODO: Implement COLUMBIA ordering
- else if(string.Compare(workingDefinition.order, "COLUMBIA",
+ else if(string.Compare(_workingDefinition.order, "COLUMBIA",
StringComparison.InvariantCultureIgnoreCase) == 0)
{
AaruConsole.DebugWriteLine("CP/M Plugin",
@@ -119,8 +119,8 @@ namespace Aaru.Filesystems
}
// TODO: Implement EAGLE ordering
- else if(string.Compare(workingDefinition.order, "EAGLE", StringComparison.InvariantCultureIgnoreCase) ==
- 0)
+ else if(string.Compare(_workingDefinition.order, "EAGLE",
+ StringComparison.InvariantCultureIgnoreCase) == 0)
{
AaruConsole.DebugWriteLine("CP/M Plugin",
"Don't know how to handle EAGLE ordering, not proceeding with this definition.");
@@ -131,7 +131,7 @@ namespace Aaru.Filesystems
{
AaruConsole.DebugWriteLine("CP/M Plugin",
"Unknown order type \"{0}\", not proceeding with this definition.",
- workingDefinition.order);
+ _workingDefinition.order);
return Errno.NotSupported;
}
@@ -140,18 +140,19 @@ namespace Aaru.Filesystems
// Deinterleave whole volume
Dictionary deinterleavedSectors = new Dictionary();
- if(workingDefinition.sides == 1 ||
- string.Compare(workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
+ if(_workingDefinition.sides == 1 ||
+ string.Compare(_workingDefinition.order, "SIDES", StringComparison.InvariantCultureIgnoreCase) == 0)
{
AaruConsole.DebugWriteLine("CP/M Plugin", "Deinterleaving whole volume.");
for(int p = 0; p <= (int)(partition.End - partition.Start); p++)
{
byte[] readSector =
- device.ReadSector((ulong)((int)partition.Start + ((p / sectorMask.Length) * sectorMask.Length) +
- sectorMask[p % sectorMask.Length]));
+ _device.ReadSector((ulong)((int)partition.Start +
+ ((p / _sectorMask.Length) * _sectorMask.Length) +
+ _sectorMask[p % _sectorMask.Length]));
- if(workingDefinition.complement)
+ if(_workingDefinition.complement)
for(int b = 0; b < readSector.Length; b++)
readSector[b] = (byte)(~readSector[b] & 0xFF);
@@ -159,7 +160,7 @@ namespace Aaru.Filesystems
}
}
- int blockSize = 128 << dpb.bsh;
+ int blockSize = 128 << _dpb.bsh;
var blockMs = new MemoryStream();
ulong blockNo = 0;
int sectorsPerBlock = 0;
@@ -203,12 +204,12 @@ namespace Aaru.Filesystems
AaruConsole.DebugWriteLine("CP/M Plugin", "Reading directory.");
int dirOff;
- int dirSectors = ((dpb.drm + 1) * 32) / workingDefinition.bytesPerSector;
+ int dirSectors = ((_dpb.drm + 1) * 32) / _workingDefinition.bytesPerSector;
- if(workingDefinition.sofs > 0)
- dirOff = workingDefinition.sofs;
+ if(_workingDefinition.sofs > 0)
+ dirOff = _workingDefinition.sofs;
else
- dirOff = workingDefinition.ofs * workingDefinition.sectorsPerTrack;
+ dirOff = _workingDefinition.ofs * _workingDefinition.sectorsPerTrack;
// Read the whole directory blocks
var dirMs = new MemoryStream();
@@ -232,13 +233,13 @@ namespace Aaru.Filesystems
Dictionary>> fileExtents =
new Dictionary>>();
- statCache = new Dictionary();
- cpmStat = new FileSystemInfo();
+ _statCache = new Dictionary();
+ _cpmStat = new FileSystemInfo();
bool atime = false;
- dirList = new List();
- labelCreationDate = null;
- labelUpdateDate = null;
- passwordCache = new Dictionary();
+ _dirList = new List();
+ _labelCreationDate = null;
+ _labelUpdateDate = null;
+ _passwordCache = new Dictionary();
AaruConsole.DebugWriteLine("CP/M Plugin", "Traversing directory.");
@@ -286,11 +287,11 @@ namespace Aaru.Filesystems
if(!string.IsNullOrEmpty(extension))
filename = filename + "." + extension;
- int entryNo = ((32 * entry.extentCounter) + entry.extentCounterHigh) / (dpb.exm + 1);
+ int entryNo = ((32 * entry.extentCounter) + entry.extentCounterHigh) / (_dpb.exm + 1);
// Do we have a stat for the file already?
- if(statCache.TryGetValue(filename, out FileEntryInfo fInfo))
- statCache.Remove(filename);
+ if(_statCache.TryGetValue(filename, out FileEntryInfo fInfo))
+ _statCache.Remove(filename);
else
fInfo = new FileEntryInfo
{
@@ -331,11 +332,11 @@ namespace Aaru.Filesystems
fInfo.UID = (ulong)user;
extentBlocks.Add(entryNo, blocks);
fileExtents.Add(filename, extentBlocks);
- statCache.Add(filename, fInfo);
+ _statCache.Add(filename, fInfo);
// Add the file to the directory listing
- if(!dirList.Contains(filename))
- dirList.Add(filename);
+ if(!_dirList.Contains(filename))
+ _dirList.Add(filename);
// Count entries 3 by 3 for timestamps
switch(dirCnt % 3)
@@ -395,11 +396,11 @@ namespace Aaru.Filesystems
if(!string.IsNullOrEmpty(extension))
filename = filename + "." + extension;
- int entryNo = ((32 * entry.extentCounterHigh) + entry.extentCounter) / (dpb.exm + 1);
+ int entryNo = ((32 * entry.extentCounterHigh) + entry.extentCounter) / (_dpb.exm + 1);
// Do we have a stat for the file already?
- if(statCache.TryGetValue(filename, out FileEntryInfo fInfo))
- statCache.Remove(filename);
+ if(_statCache.TryGetValue(filename, out FileEntryInfo fInfo))
+ _statCache.Remove(filename);
else
fInfo = new FileEntryInfo
{
@@ -440,11 +441,11 @@ namespace Aaru.Filesystems
fInfo.UID = (ulong)user;
extentBlocks.Add(entryNo, blocks);
fileExtents.Add(filename, extentBlocks);
- statCache.Add(filename, fInfo);
+ _statCache.Add(filename, fInfo);
// Add the file to the directory listing
- if(!dirList.Contains(filename))
- dirList.Add(filename);
+ if(!_dirList.Contains(filename))
+ _dirList.Add(filename);
// Count entries 3 by 3 for timestamps
switch(dirCnt % 3)
@@ -491,13 +492,13 @@ namespace Aaru.Filesystems
filename = filename + "." + extension;
// Do not repeat passwords
- if(passwordCache.ContainsKey(filename))
- passwordCache.Remove(filename);
+ if(_passwordCache.ContainsKey(filename))
+ _passwordCache.Remove(filename);
// Copy whole password entry
byte[] tmp = new byte[32];
Array.Copy(directory, dOff, tmp, 0, 32);
- passwordCache.Add(filename, tmp);
+ _passwordCache.Add(filename, tmp);
// Count entries 3 by 3 for timestamps
switch(dirCnt % 3)
@@ -531,11 +532,11 @@ namespace Aaru.Filesystems
// access time
atime |= (labelEntry.flags & 0x40) == 0x40;
- label = Encoding.ASCII.GetString(directory, dOff + 1, 11).Trim();
- labelCreationDate = new byte[4];
- labelUpdateDate = new byte[4];
- Array.Copy(directory, dOff + 24, labelCreationDate, 0, 4);
- Array.Copy(directory, dOff + 28, labelUpdateDate, 0, 4);
+ _label = Encoding.ASCII.GetString(directory, dOff + 1, 11).Trim();
+ _labelCreationDate = new byte[4];
+ _labelUpdateDate = new byte[4];
+ Array.Copy(directory, dOff + 24, _labelCreationDate, 0, 4);
+ Array.Copy(directory, dOff + 28, _labelUpdateDate, 0, 4);
// Count entries 3 by 3 for timestamps
switch(dirCnt % 3)
@@ -571,8 +572,8 @@ namespace Aaru.Filesystems
// Entry contains timestamps for last 3 entries, whatever the kind they are.
if(!string.IsNullOrEmpty(file1))
{
- if(statCache.TryGetValue(file1, out fInfo))
- statCache.Remove(file1);
+ if(_statCache.TryGetValue(file1, out fInfo))
+ _statCache.Remove(file1);
else
fInfo = new FileEntryInfo();
@@ -583,13 +584,13 @@ namespace Aaru.Filesystems
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(dateEntry.date2);
- statCache.Add(file1, fInfo);
+ _statCache.Add(file1, fInfo);
}
if(!string.IsNullOrEmpty(file2))
{
- if(statCache.TryGetValue(file2, out fInfo))
- statCache.Remove(file2);
+ if(_statCache.TryGetValue(file2, out fInfo))
+ _statCache.Remove(file2);
else
fInfo = new FileEntryInfo();
@@ -600,13 +601,13 @@ namespace Aaru.Filesystems
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(dateEntry.date4);
- statCache.Add(file2, fInfo);
+ _statCache.Add(file2, fInfo);
}
if(!string.IsNullOrEmpty(file3))
{
- if(statCache.TryGetValue(file3, out fInfo))
- statCache.Remove(file3);
+ if(_statCache.TryGetValue(file3, out fInfo))
+ _statCache.Remove(file3);
else
fInfo = new FileEntryInfo();
@@ -617,7 +618,7 @@ namespace Aaru.Filesystems
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(dateEntry.date6);
- statCache.Add(file3, fInfo);
+ _statCache.Add(file3, fInfo);
}
file1 = null;
@@ -637,8 +638,8 @@ namespace Aaru.Filesystems
// Entry contains timestamps for last 3 entries, whatever the kind they are.
if(!string.IsNullOrEmpty(file1))
{
- if(statCache.TryGetValue(file1, out fInfo))
- statCache.Remove(file1);
+ if(_statCache.TryGetValue(file1, out fInfo))
+ _statCache.Remove(file1);
else
fInfo = new FileEntryInfo();
@@ -650,13 +651,13 @@ namespace Aaru.Filesystems
fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify1);
- statCache.Add(file1, fInfo);
+ _statCache.Add(file1, fInfo);
}
if(!string.IsNullOrEmpty(file2))
{
- if(statCache.TryGetValue(file2, out fInfo))
- statCache.Remove(file2);
+ if(_statCache.TryGetValue(file2, out fInfo))
+ _statCache.Remove(file2);
else
fInfo = new FileEntryInfo();
@@ -668,13 +669,13 @@ namespace Aaru.Filesystems
fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify2);
- statCache.Add(file2, fInfo);
+ _statCache.Add(file2, fInfo);
}
if(!string.IsNullOrEmpty(file3))
{
- if(statCache.TryGetValue(file1, out fInfo))
- statCache.Remove(file3);
+ if(_statCache.TryGetValue(file1, out fInfo))
+ _statCache.Remove(file3);
else
fInfo = new FileEntryInfo();
@@ -686,7 +687,7 @@ namespace Aaru.Filesystems
fInfo.CreationTime = DateHandlers.CpmToDateTime(ctime);
fInfo.LastWriteTime = DateHandlers.CpmToDateTime(trdPartyDateEntry.modify3);
- statCache.Add(file3, fInfo);
+ _statCache.Add(file3, fInfo);
}
file1 = null;
@@ -702,14 +703,14 @@ namespace Aaru.Filesystems
// this should not be a problem
AaruConsole.DebugWriteLine("CP/M Plugin", "Reading files.");
long usedBlocks = 0;
- fileCache = new Dictionary();
+ _fileCache = new Dictionary();
- foreach(string filename in dirList)
+ foreach(string filename in _dirList)
{
var fileMs = new MemoryStream();
- if(statCache.TryGetValue(filename, out FileEntryInfo fInfo))
- statCache.Remove(filename);
+ if(_statCache.TryGetValue(filename, out FileEntryInfo fInfo))
+ _statCache.Remove(filename);
fInfo.Blocks = 0;
@@ -731,18 +732,18 @@ namespace Aaru.Filesystems
fInfo.Attributes |= FileAttributes.Extents;
fInfo.BlockSize = blockSize;
fInfo.Length = fileMs.Length;
- cpmStat.Files++;
+ _cpmStat.Files++;
usedBlocks += fInfo.Blocks;
- statCache.Add(filename, fInfo);
- fileCache.Add(filename, fileMs.ToArray());
+ _statCache.Add(filename, fInfo);
+ _fileCache.Add(filename, fileMs.ToArray());
}
- decodedPasswordCache = new Dictionary();
+ _decodedPasswordCache = new Dictionary();
// For each stored password, store a decoded version of it
- if(passwordCache.Count > 0)
- foreach(KeyValuePair kvp in passwordCache)
+ if(_passwordCache.Count > 0)
+ foreach(KeyValuePair kvp in _passwordCache)
{
byte[] tmp = new byte[8];
Array.Copy(kvp.Value, 16, tmp, 0, 8);
@@ -750,45 +751,45 @@ namespace Aaru.Filesystems
for(int t = 0; t < 8; t++)
tmp[t] ^= kvp.Value[13];
- decodedPasswordCache.Add(kvp.Key, tmp);
+ _decodedPasswordCache.Add(kvp.Key, tmp);
}
// Generate statfs.
- cpmStat.Blocks = (ulong)(dpb.dsm + 1);
- cpmStat.FilenameLength = 11;
- cpmStat.Files = (ulong)fileCache.Count;
- cpmStat.FreeBlocks = cpmStat.Blocks - (ulong)usedBlocks;
- cpmStat.PluginId = Id;
- cpmStat.Type = "CP/M filesystem";
+ _cpmStat.Blocks = (ulong)(_dpb.dsm + 1);
+ _cpmStat.FilenameLength = 11;
+ _cpmStat.Files = (ulong)_fileCache.Count;
+ _cpmStat.FreeBlocks = _cpmStat.Blocks - (ulong)usedBlocks;
+ _cpmStat.PluginId = Id;
+ _cpmStat.Type = "CP/M filesystem";
// Generate XML info
XmlFsType = new FileSystemType
{
- Clusters = cpmStat.Blocks,
+ Clusters = _cpmStat.Blocks,
ClusterSize = (uint)blockSize,
- Files = (ulong)fileCache.Count,
+ Files = (ulong)_fileCache.Count,
FilesSpecified = true,
- FreeClusters = cpmStat.FreeBlocks,
+ FreeClusters = _cpmStat.FreeBlocks,
FreeClustersSpecified = true,
Type = "CP/M filesystem"
};
- if(labelCreationDate != null)
+ if(_labelCreationDate != null)
{
- XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
+ XmlFsType.CreationDate = DateHandlers.CpmToDateTime(_labelCreationDate);
XmlFsType.CreationDateSpecified = true;
}
- if(labelUpdateDate != null)
+ if(_labelUpdateDate != null)
{
- XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
+ XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(_labelUpdateDate);
XmlFsType.ModificationDateSpecified = true;
}
- if(!string.IsNullOrEmpty(label))
- XmlFsType.VolumeName = label;
+ if(!string.IsNullOrEmpty(_label))
+ XmlFsType.VolumeName = _label;
- mounted = true;
+ _mounted = true;
return Errno.NoError;
}
@@ -800,27 +801,27 @@ namespace Aaru.Filesystems
{
stat = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
- stat = cpmStat;
+ stat = _cpmStat;
return Errno.NoError;
}
public Errno Unmount()
{
- mounted = false;
- definitions = null;
- cpmFound = false;
- workingDefinition = null;
- dpb = null;
- sectorMask = null;
- label = null;
- thirdPartyTimestamps = false;
- standardTimestamps = false;
- labelCreationDate = null;
- labelUpdateDate = null;
+ _mounted = false;
+ _definitions = null;
+ _cpmFound = false;
+ _workingDefinition = null;
+ _dpb = null;
+ _sectorMask = null;
+ _label = null;
+ _thirdPartyTimestamps = false;
+ _standardTimestamps = false;
+ _labelCreationDate = null;
+ _labelUpdateDate = null;
return Errno.NoError;
}
diff --git a/Aaru.Filesystems/CPM/Xattr.cs b/Aaru.Filesystems/CPM/Xattr.cs
index fe2a97064..f2e8d3907 100644
--- a/Aaru.Filesystems/CPM/Xattr.cs
+++ b/Aaru.Filesystems/CPM/Xattr.cs
@@ -46,7 +46,7 @@ namespace Aaru.Filesystems
/// Buffer.
public Errno GetXattr(string path, string xattr, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -57,17 +57,17 @@ namespace Aaru.Filesystems
if(pathElements.Length != 1)
return Errno.NotSupported;
- if(!fileCache.ContainsKey(pathElements[0].ToUpperInvariant()))
+ if(!_fileCache.ContainsKey(pathElements[0].ToUpperInvariant()))
return Errno.NoSuchFile;
if(string.Compare(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture) == 0)
- if(!passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf))
+ if(!_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf))
return Errno.NoError;
if(string.Compare(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture) != 0)
return Errno.NoSuchExtendedAttribute;
- return !passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf) ? Errno.NoError
+ return !_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf) ? Errno.NoError
: Errno.NoSuchExtendedAttribute;
}
@@ -80,7 +80,7 @@ namespace Aaru.Filesystems
{
xattrs = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
string[] pathElements = path.Split(new[]
@@ -91,15 +91,15 @@ namespace Aaru.Filesystems
if(pathElements.Length != 1)
return Errno.NotSupported;
- if(!fileCache.ContainsKey(pathElements[0].ToUpperInvariant()))
+ if(!_fileCache.ContainsKey(pathElements[0].ToUpperInvariant()))
return Errno.NoSuchFile;
xattrs = new List();
- if(passwordCache.ContainsKey(pathElements[0].ToUpperInvariant()))
+ if(_passwordCache.ContainsKey(pathElements[0].ToUpperInvariant()))
xattrs.Add("com.caldera.cpm.password");
- if(decodedPasswordCache.ContainsKey(pathElements[0].ToUpperInvariant()))
+ if(_decodedPasswordCache.ContainsKey(pathElements[0].ToUpperInvariant()))
xattrs.Add("com.caldera.cpm.password.text");
return Errno.NoError;
diff --git a/Aaru.Filesystems/Cram.cs b/Aaru.Filesystems/Cram.cs
index a32b44016..2547746a3 100644
--- a/Aaru.Filesystems/Cram.cs
+++ b/Aaru.Filesystems/Cram.cs
@@ -76,17 +76,17 @@ namespace Aaru.Filesystems
byte[] sector = imagePlugin.ReadSector(partition.Start);
uint magic = BitConverter.ToUInt32(sector, 0x00);
- var crSb = new CramSuperBlock();
+ var crSb = new SuperBlock();
bool littleEndian = true;
switch(magic)
{
case CRAM_MAGIC:
- crSb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ crSb = Marshal.ByteArrayToStructureLittleEndian(sector);
break;
case CRAM_CIGAM:
- crSb = Marshal.ByteArrayToStructureBigEndian(sector);
+ crSb = Marshal.ByteArrayToStructureBigEndian(sector);
littleEndian = false;
break;
@@ -123,7 +123,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
- struct CramSuperBlock
+ struct SuperBlock
{
public readonly uint magic;
public readonly uint size;
diff --git a/Aaru.Filesystems/ECMA67.cs b/Aaru.Filesystems/ECMA67.cs
index 850d1c81a..9e2242314 100644
--- a/Aaru.Filesystems/ECMA67.cs
+++ b/Aaru.Filesystems/ECMA67.cs
@@ -43,7 +43,7 @@ namespace Aaru.Filesystems
{
public class ECMA67 : IFilesystem
{
- readonly byte[] ecma67_magic =
+ readonly byte[] _magic =
{
0x56, 0x4F, 0x4C
};
@@ -69,7 +69,7 @@ namespace Aaru.Filesystems
VolumeLabel vol = Marshal.ByteArrayToStructureLittleEndian(sector);
- return ecma67_magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31;
+ return _magic.SequenceEqual(vol.labelIdentifier) && vol.labelNumber == 1 && vol.recordLength == 0x31;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
diff --git a/Aaru.Filesystems/EFS.cs b/Aaru.Filesystems/EFS.cs
index c658cb832..2c7093f49 100644
--- a/Aaru.Filesystems/EFS.cs
+++ b/Aaru.Filesystems/EFS.cs
@@ -63,48 +63,48 @@ namespace Aaru.Filesystems
// Misaligned
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc)
{
- uint sbSize = (uint)((Marshal.SizeOf() + 0x200) / imagePlugin.Info.SectorSize);
+ uint sbSize = (uint)((Marshal.SizeOf() + 0x200) / imagePlugin.Info.SectorSize);
- if((Marshal.SizeOf() + 0x200) % imagePlugin.Info.SectorSize != 0)
+ if((Marshal.SizeOf() + 0x200) % imagePlugin.Info.SectorSize != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
- if(sector.Length < Marshal.SizeOf())
+ if(sector.Length < Marshal.SizeOf())
return false;
- byte[] sbpiece = new byte[Marshal.SizeOf()];
+ byte[] sbpiece = new byte[Marshal.SizeOf()];
- Array.Copy(sector, 0x200, sbpiece, 0, Marshal.SizeOf());
+ Array.Copy(sector, 0x200, sbpiece, 0, Marshal.SizeOf());
- EFS_Superblock efsSb = Marshal.ByteArrayToStructureBigEndian(sbpiece);
+ Superblock sb = Marshal.ByteArrayToStructureBigEndian(sbpiece);
AaruConsole.DebugWriteLine("EFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})",
- 0x200, efsSb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW);
+ 0x200, sb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW);
- if(efsSb.sb_magic == EFS_MAGIC ||
- efsSb.sb_magic == EFS_MAGIC_NEW)
+ if(sb.sb_magic == EFS_MAGIC ||
+ sb.sb_magic == EFS_MAGIC_NEW)
return true;
}
else
{
- uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
+ uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
- if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
+ if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start + 1, sbSize);
- if(sector.Length < Marshal.SizeOf())
+ if(sector.Length < Marshal.SizeOf())
return false;
- EFS_Superblock efsSb = Marshal.ByteArrayToStructureBigEndian(sector);
+ Superblock sb = Marshal.ByteArrayToStructureBigEndian(sector);
AaruConsole.DebugWriteLine("EFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 1,
- efsSb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW);
+ sb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW);
- if(efsSb.sb_magic == EFS_MAGIC ||
- efsSb.sb_magic == EFS_MAGIC_NEW)
+ if(sb.sb_magic == EFS_MAGIC ||
+ sb.sb_magic == EFS_MAGIC_NEW)
return true;
}
@@ -120,43 +120,43 @@ namespace Aaru.Filesystems
if(imagePlugin.Info.SectorSize < 512)
return;
- var efsSb = new EFS_Superblock();
+ var efsSb = new Superblock();
// Misaligned
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc)
{
- uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize);
+ uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize);
- if((Marshal.SizeOf() + 0x400) % imagePlugin.Info.SectorSize != 0)
+ if((Marshal.SizeOf() + 0x400) % imagePlugin.Info.SectorSize != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start, sbSize);
- if(sector.Length < Marshal.SizeOf())
+ if(sector.Length < Marshal.SizeOf())
return;
- byte[] sbpiece = new byte[Marshal.SizeOf()];
+ byte[] sbpiece = new byte[Marshal.SizeOf()];
- Array.Copy(sector, 0x200, sbpiece, 0, Marshal.SizeOf());
+ Array.Copy(sector, 0x200, sbpiece, 0, Marshal.SizeOf());
- efsSb = Marshal.ByteArrayToStructureBigEndian(sbpiece);
+ efsSb = Marshal.ByteArrayToStructureBigEndian(sbpiece);
AaruConsole.DebugWriteLine("EFS plugin", "magic at 0x{0:X3} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})",
0x200, efsSb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW);
}
else
{
- uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
+ uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
- if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
+ if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start + 1, sbSize);
- if(sector.Length < Marshal.SizeOf())
+ if(sector.Length < Marshal.SizeOf())
return;
- efsSb = Marshal.ByteArrayToStructureBigEndian(sector);
+ efsSb = Marshal.ByteArrayToStructureBigEndian(sector);
AaruConsole.DebugWriteLine("EFS plugin", "magic at {0} = 0x{1:X8} (expected 0x{2:X8} or 0x{3:X8})", 1,
efsSb.sb_magic, EFS_MAGIC, EFS_MAGIC_NEW);
@@ -219,7 +219,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "InconsistentNaming")]
- struct EFS_Superblock
+ struct Superblock
{
/* 0: fs size incl. bb 0 (in bb) */
public readonly int sb_size;
diff --git a/Aaru.Filesystems/F2FS.cs b/Aaru.Filesystems/F2FS.cs
index 96d1b32d0..4044f7c94 100644
--- a/Aaru.Filesystems/F2FS.cs
+++ b/Aaru.Filesystems/F2FS.cs
@@ -68,9 +68,9 @@ namespace Aaru.Filesystems
if(sbAddr == 0)
sbAddr = 1;
- uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
+ uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
- if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
+ if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
sbSize++;
if(partition.Start + sbAddr >= partition.End)
@@ -78,12 +78,12 @@ namespace Aaru.Filesystems
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
- if(sector.Length < Marshal.SizeOf())
+ if(sector.Length < Marshal.SizeOf())
return false;
- F2FS_Superblock f2fsSb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ Superblock sb = Marshal.ByteArrayToStructureLittleEndian(sector);
- return f2fsSb.magic == F2FS_MAGIC;
+ return sb.magic == F2FS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
@@ -101,17 +101,17 @@ namespace Aaru.Filesystems
if(sbAddr == 0)
sbAddr = 1;
- uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
+ uint sbSize = (uint)(Marshal.SizeOf() / imagePlugin.Info.SectorSize);
- if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
+ if(Marshal.SizeOf() % imagePlugin.Info.SectorSize != 0)
sbSize++;
byte[] sector = imagePlugin.ReadSectors(partition.Start + sbAddr, sbSize);
- if(sector.Length < Marshal.SizeOf())
+ if(sector.Length < Marshal.SizeOf())
return;
- F2FS_Superblock f2fsSb = Marshal.ByteArrayToStructureLittleEndian(sector);
+ Superblock f2fsSb = Marshal.ByteArrayToStructureLittleEndian(sector);
if(f2fsSb.magic != F2FS_MAGIC)
return;
@@ -158,7 +158,7 @@ namespace Aaru.Filesystems
}
[StructLayout(LayoutKind.Sequential, Pack = 1), SuppressMessage("ReSharper", "InconsistentNaming")]
- struct F2FS_Superblock
+ struct Superblock
{
public readonly uint magic;
public readonly ushort major_ver;
diff --git a/Aaru.Filesystems/FAT/Consts.cs b/Aaru.Filesystems/FAT/Consts.cs
index 2a110d299..b6c44371d 100644
--- a/Aaru.Filesystems/FAT/Consts.cs
+++ b/Aaru.Filesystems/FAT/Consts.cs
@@ -78,7 +78,7 @@ namespace Aaru.Filesystems
const ushort EAT_ASN1 = 0xFFDD;
const string FAT32_EA_TAIL = " EA. SF";
- readonly (string hash, string name)[] knownBootHashes =
+ readonly (string hash, string name)[] _knownBootHashes =
{
("b639b4d5b25f63560e3b34a3a0feb732aa65486f", "Amstrad MS-DOS 3.20 (8-sector floppy)"),
("9311151f13f7611b1431593da05ddd3153370574", "Amstrad MS-DOS 3.20 (Spanish)"),
diff --git a/Aaru.Filesystems/FAT/Dir.cs b/Aaru.Filesystems/FAT/Dir.cs
index b83c122fb..03b4f29fa 100644
--- a/Aaru.Filesystems/FAT/Dir.cs
+++ b/Aaru.Filesystems/FAT/Dir.cs
@@ -61,21 +61,21 @@ namespace Aaru.Filesystems
{
contents = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
if(string.IsNullOrWhiteSpace(path) ||
path == "/")
{
- contents = rootDirectoryCache.Keys.ToList();
+ contents = _rootDirectoryCache.Keys.ToList();
return Errno.NoError;
}
- string cutPath = path.StartsWith("/", StringComparison.Ordinal) ? path.Substring(1).ToLower(cultureInfo)
- : path.ToLower(cultureInfo);
+ string cutPath = path.StartsWith("/", StringComparison.Ordinal) ? path.Substring(1).ToLower(_cultureInfo)
+ : path.ToLower(_cultureInfo);
- if(directoryCache.TryGetValue(cutPath, out Dictionary currentDirectory))
+ if(_directoryCache.TryGetValue(cutPath, out Dictionary currentDirectory))
{
contents = currentDirectory.Keys.ToList();
@@ -88,7 +88,7 @@ namespace Aaru.Filesystems
}, StringSplitOptions.RemoveEmptyEntries);
KeyValuePair entry =
- rootDirectoryCache.FirstOrDefault(t => t.Key.ToLower(cultureInfo) == pieces[0]);
+ _rootDirectoryCache.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[0]);
if(string.IsNullOrEmpty(entry.Key))
return Errno.NoSuchFile;
@@ -98,11 +98,11 @@ namespace Aaru.Filesystems
string currentPath = pieces[0];
- currentDirectory = rootDirectoryCache;
+ currentDirectory = _rootDirectoryCache;
for(int p = 0; p < pieces.Length; p++)
{
- entry = currentDirectory.FirstOrDefault(t => t.Key.ToLower(cultureInfo) == pieces[p]);
+ entry = currentDirectory.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[p]);
if(string.IsNullOrEmpty(entry.Key))
return Errno.NoSuchFile;
@@ -113,10 +113,10 @@ namespace Aaru.Filesystems
currentPath = p == 0 ? pieces[0] : $"{currentPath}/{pieces[p]}";
uint currentCluster = entry.Value.Dirent.start_cluster;
- if(fat32)
+ if(_fat32)
currentCluster += (uint)(entry.Value.Dirent.ea_handle << 16);
- if(directoryCache.TryGetValue(currentPath, out currentDirectory))
+ if(_directoryCache.TryGetValue(currentPath, out currentDirectory))
continue;
uint[] clusters = GetClusters(currentCluster);
@@ -124,14 +124,14 @@ namespace Aaru.Filesystems
if(clusters is null)
return Errno.InvalidArgument;
- byte[] directoryBuffer = new byte[bytesPerCluster * clusters.Length];
+ byte[] directoryBuffer = new byte[_bytesPerCluster * clusters.Length];
for(int i = 0; i < clusters.Length; i++)
{
- byte[] buffer = image.ReadSectors(firstClusterSector + (clusters[i] * sectorsPerCluster),
- sectorsPerCluster);
+ byte[] buffer = _image.ReadSectors(_firstClusterSector + (clusters[i] * _sectorsPerCluster),
+ _sectorsPerCluster);
- Array.Copy(buffer, 0, directoryBuffer, i * bytesPerCluster, bytesPerCluster);
+ Array.Copy(buffer, 0, directoryBuffer, i * _bytesPerCluster, _bytesPerCluster);
}
currentDirectory = new Dictionary();
@@ -149,8 +149,8 @@ namespace Aaru.Filesystems
if(dirent.attributes.HasFlag(FatAttributes.LFN))
{
- if(@namespace != Namespace.Lfn &&
- @namespace != Namespace.Ecs)
+ if(_namespace != Namespace.Lfn &&
+ _namespace != Namespace.Ecs)
continue;
LfnEntry lfnEntry =
@@ -210,7 +210,7 @@ namespace Aaru.Filesystems
Dirent = dirent
};
- if((@namespace == Namespace.Lfn || @namespace == Namespace.Ecs) &&
+ if((_namespace == Namespace.Lfn || _namespace == Namespace.Ecs) &&
lastLfnName != null)
{
byte calculatedLfnChecksum = LfnChecksum(dirent.filename, dirent.extension);
@@ -231,7 +231,7 @@ namespace Aaru.Filesystems
string name = Encoding.GetString(dirent.filename).TrimEnd();
string extension = Encoding.GetString(dirent.extension).TrimEnd();
- if(@namespace == Namespace.Nt)
+ if(_namespace == Namespace.Nt)
{
if(dirent.caseinfo.HasFlag(CaseInfo.LowerCaseExtension))
extension = extension.ToLower(CultureInfo.CurrentCulture);
@@ -245,7 +245,7 @@ namespace Aaru.Filesystems
else
filename = name;
- if(@namespace == Namespace.Human)
+ if(_namespace == Namespace.Human)
{
HumanDirectoryEntry humanEntry =
Marshal.ByteArrayToStructureLittleEndian(directoryBuffer, pos,
@@ -275,9 +275,9 @@ namespace Aaru.Filesystems
}
// Check OS/2 .LONGNAME
- if(eaCache != null &&
- (@namespace == Namespace.Os2 || @namespace == Namespace.Ecs) &&
- !fat32)
+ if(_eaCache != null &&
+ (_namespace == Namespace.Os2 || _namespace == Namespace.Ecs) &&
+ !_fat32)
{
List> filesWithEas =
currentDirectory.Where(t => t.Value.Dirent.ea_handle != 0).ToList();
@@ -319,14 +319,14 @@ namespace Aaru.Filesystems
}
// Check FAT32.IFS EAs
- if(fat32 || debug)
+ if(_fat32 || _debug)
{
List> fat32EaSidecars = currentDirectory.
Where(t =>
t.Key.
EndsWith(FAT32_EA_TAIL,
true,
- cultureInfo)).
+ _cultureInfo)).
ToList();
foreach(KeyValuePair sidecar in fat32EaSidecars)
@@ -338,7 +338,7 @@ namespace Aaru.Filesystems
continue;
// If not in debug mode we will consider the lack of EA bitflags to mean the EAs are corrupted or not real
- if(!debug)
+ if(!_debug)
if(!fileWithEa.Dirent.caseinfo.HasFlag(CaseInfo.NormalEaOld) &&
!fileWithEa.Dirent.caseinfo.HasFlag(CaseInfo.CriticalEa) &&
!fileWithEa.Dirent.caseinfo.HasFlag(CaseInfo.NormalEa) &&
@@ -347,12 +347,12 @@ namespace Aaru.Filesystems
fileWithEa.Fat32Ea = sidecar.Value.Dirent;
- if(!debug)
+ if(!_debug)
currentDirectory.Remove(sidecar.Key);
}
}
- directoryCache.Add(currentPath, currentDirectory);
+ _directoryCache.Add(currentPath, currentDirectory);
}
contents = currentDirectory?.Keys.ToList();
diff --git a/Aaru.Filesystems/FAT/FAT.cs b/Aaru.Filesystems/FAT/FAT.cs
index 2ce9522df..1fdc4cacd 100644
--- a/Aaru.Filesystems/FAT/FAT.cs
+++ b/Aaru.Filesystems/FAT/FAT.cs
@@ -44,26 +44,26 @@ namespace Aaru.Filesystems
// X68K uses cdate/adate from direntry for extending filename
public partial class FAT : IReadOnlyFilesystem
{
- uint bytesPerCluster;
- byte[] cachedEaData;
- CultureInfo cultureInfo;
- bool debug;
- Dictionary> directoryCache;
- DirectoryEntry eaDirEntry;
- bool fat12;
- bool fat16;
- bool fat32;
- ushort[] fatEntries;
- ulong fatFirstSector;
- ulong firstClusterSector;
- bool mounted;
- Namespace @namespace;
- uint reservedSectors;
- Dictionary rootDirectoryCache;
- uint sectorsPerCluster;
- uint sectorsPerFat;
- FileSystemInfo statfs;
- bool useFirstFat;
+ uint _bytesPerCluster;
+ byte[] _cachedEaData;
+ CultureInfo _cultureInfo;
+ bool _debug;
+ Dictionary> _directoryCache;
+ DirectoryEntry _eaDirEntry;
+ bool _fat12;
+ bool _fat16;
+ bool _fat32;
+ ushort[] _fatEntries;
+ ulong _fatFirstSector;
+ ulong _firstClusterSector;
+ bool _mounted;
+ Namespace _namespace;
+ uint _reservedSectors;
+ Dictionary _rootDirectoryCache;
+ uint _sectorsPerCluster;
+ uint _sectorsPerFat;
+ FileSystemInfo _statfs;
+ bool _useFirstFat;
public FileSystemType XmlFsType { get; private set; }
diff --git a/Aaru.Filesystems/FAT/File.cs b/Aaru.Filesystems/FAT/File.cs
index f5b84787b..01dd59bfe 100644
--- a/Aaru.Filesystems/FAT/File.cs
+++ b/Aaru.Filesystems/FAT/File.cs
@@ -46,7 +46,7 @@ namespace Aaru.Filesystems
{
deviceBlock = 0;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
Errno err = Stat(path, out FileEntryInfo stat);
@@ -55,7 +55,7 @@ namespace Aaru.Filesystems
return err;
if(stat.Attributes.HasFlag(FileAttributes.Directory) &&
- !debug)
+ !_debug)
return Errno.IsDirectory;
uint[] clusters = GetClusters((uint)stat.Inode);
@@ -63,7 +63,7 @@ namespace Aaru.Filesystems
if(fileBlock >= clusters.Length)
return Errno.InvalidArgument;
- deviceBlock = (long)(firstClusterSector + (clusters[fileBlock] * sectorsPerCluster));
+ deviceBlock = (long)(_firstClusterSector + (clusters[fileBlock] * _sectorsPerCluster));
return Errno.NoError;
}
@@ -72,7 +72,7 @@ namespace Aaru.Filesystems
{
attributes = new FileAttributes();
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
Errno err = Stat(path, out FileEntryInfo stat);
@@ -87,7 +87,7 @@ namespace Aaru.Filesystems
public Errno Read(string path, long offset, long size, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
Errno err = Stat(path, out FileEntryInfo stat);
@@ -96,7 +96,7 @@ namespace Aaru.Filesystems
return err;
if(stat.Attributes.HasFlag(FileAttributes.Directory) &&
- !debug)
+ !_debug)
return Errno.IsDirectory;
if(offset >= stat.Length)
@@ -107,11 +107,11 @@ namespace Aaru.Filesystems
uint[] clusters = GetClusters((uint)stat.Inode);
- long firstCluster = offset / bytesPerCluster;
- long offsetInCluster = offset % bytesPerCluster;
- long sizeInClusters = (size + offsetInCluster) / bytesPerCluster;
+ long firstCluster = offset / _bytesPerCluster;
+ long offsetInCluster = offset % _bytesPerCluster;
+ long sizeInClusters = (size + offsetInCluster) / _bytesPerCluster;
- if((size + offsetInCluster) % bytesPerCluster > 0)
+ if((size + offsetInCluster) % _bytesPerCluster > 0)
sizeInClusters++;
var ms = new MemoryStream();
@@ -121,8 +121,9 @@ namespace Aaru.Filesystems
if(i + firstCluster >= clusters.Length)
return Errno.InvalidArgument;
- byte[] buffer = image.ReadSectors(firstClusterSector + (clusters[i + firstCluster] * sectorsPerCluster),
- sectorsPerCluster);
+ byte[] buffer =
+ _image.ReadSectors(_firstClusterSector + (clusters[i + firstCluster] * _sectorsPerCluster),
+ _sectorsPerCluster);
ms.Write(buffer, 0, buffer.Length);
}
@@ -138,7 +139,7 @@ namespace Aaru.Filesystems
{
stat = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
Errno err = GetFileEntry(path, out CompleteDirectoryEntry completeEntry);
@@ -151,28 +152,28 @@ namespace Aaru.Filesystems
stat = new FileEntryInfo
{
Attributes = new FileAttributes(),
- Blocks = entry.size / bytesPerCluster,
- BlockSize = bytesPerCluster,
+ Blocks = entry.size / _bytesPerCluster,
+ BlockSize = _bytesPerCluster,
Length = entry.size,
- Inode = (ulong)(fat32 ? (entry.ea_handle << 16) + entry.start_cluster : entry.start_cluster),
+ Inode = (ulong)(_fat32 ? (entry.ea_handle << 16) + entry.start_cluster : entry.start_cluster),
Links = 1,
CreationTime = DateHandlers.DosToDateTime(entry.cdate, entry.ctime)
};
- if(@namespace != Namespace.Human)
+ if(_namespace != Namespace.Human)
{
stat.LastWriteTime = DateHandlers.DosToDateTime(entry.mdate, entry.mtime);
stat.CreationTime = stat.CreationTime?.AddMilliseconds(entry.ctime_ms * 10);
}
- if(entry.size % bytesPerCluster > 0)
+ if(entry.size % _bytesPerCluster > 0)
stat.Blocks++;
if(entry.attributes.HasFlag(FatAttributes.Subdirectory))
{
stat.Attributes |= FileAttributes.Directory;
- stat.Blocks = fat32 ? GetClusters((uint)((entry.ea_handle << 16) + entry.start_cluster)).Length
+ stat.Blocks = _fat32 ? GetClusters((uint)((entry.ea_handle << 16) + entry.start_cluster)).Length
: GetClusters(entry.start_cluster).Length;
stat.Length = stat.Blocks * stat.BlockSize;
@@ -208,13 +209,15 @@ namespace Aaru.Filesystems
uint nextCluster = startCluster;
- ulong nextSector = (nextCluster / fatEntriesPerSector) + fatFirstSector + (useFirstFat ? 0 : sectorsPerFat);
- int nextEntry = (int)(nextCluster % fatEntriesPerSector);
+ ulong nextSector = (nextCluster / _fatEntriesPerSector) + _fatFirstSector +
+ (_useFirstFat ? 0 : _sectorsPerFat);
+
+ int nextEntry = (int)(nextCluster % _fatEntriesPerSector);
ulong currentSector = nextSector;
- byte[] fatData = image.ReadSector(currentSector);
+ byte[] fatData = _image.ReadSector(currentSector);
- if(fat32)
+ if(_fat32)
while((nextCluster & FAT32_MASK) > 0 &&
(nextCluster & FAT32_MASK) <= FAT32_FORMATTED)
{
@@ -222,30 +225,30 @@ namespace Aaru.Filesystems
if(currentSector != nextSector)
{
- fatData = image.ReadSector(nextSector);
+ fatData = _image.ReadSector(nextSector);
currentSector = nextSector;
}
nextCluster = BitConverter.ToUInt32(fatData, nextEntry * 4);
- nextSector = (nextCluster / fatEntriesPerSector) + fatFirstSector +
- (useFirstFat ? 0 : sectorsPerFat);
+ nextSector = (nextCluster / _fatEntriesPerSector) + _fatFirstSector +
+ (_useFirstFat ? 0 : _sectorsPerFat);
- nextEntry = (int)(nextCluster % fatEntriesPerSector);
+ nextEntry = (int)(nextCluster % _fatEntriesPerSector);
}
- else if(fat16)
+ else if(_fat16)
while(nextCluster > 0 &&
nextCluster <= FAT16_FORMATTED)
{
clusters.Add(nextCluster);
- nextCluster = fatEntries[nextCluster];
+ nextCluster = _fatEntries[nextCluster];
}
else
while(nextCluster > 0 &&
nextCluster <= FAT12_FORMATTED)
{
clusters.Add(nextCluster);
- nextCluster = fatEntries[nextCluster];
+ nextCluster = _fatEntries[nextCluster];
}
return clusters.ToArray();
@@ -255,7 +258,8 @@ namespace Aaru.Filesystems
{
entry = null;
- string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(cultureInfo) : path.ToLower(cultureInfo);
+ string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(_cultureInfo)
+ : path.ToLower(_cultureInfo);
string[] pieces = cutPath.Split(new[]
{
@@ -267,7 +271,7 @@ namespace Aaru.Filesystems
string parentPath = string.Join("/", pieces, 0, pieces.Length - 1);
- if(!directoryCache.TryGetValue(parentPath, out _))
+ if(!_directoryCache.TryGetValue(parentPath, out _))
{
Errno err = ReadDir(parentPath, out _);
@@ -278,12 +282,12 @@ namespace Aaru.Filesystems
Dictionary parent;
if(pieces.Length == 1)
- parent = rootDirectoryCache;
- else if(!directoryCache.TryGetValue(parentPath, out parent))
+ parent = _rootDirectoryCache;
+ else if(!_directoryCache.TryGetValue(parentPath, out parent))
return Errno.InvalidArgument;
KeyValuePair dirent =
- parent.FirstOrDefault(t => t.Key.ToLower(cultureInfo) == pieces[^1]);
+ parent.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[^1]);
if(string.IsNullOrEmpty(dirent.Key))
return Errno.NoSuchFile;
diff --git a/Aaru.Filesystems/FAT/Info.cs b/Aaru.Filesystems/FAT/Info.cs
index c6a1563e0..ce9fecf8f 100644
--- a/Aaru.Filesystems/FAT/Info.cs
+++ b/Aaru.Filesystems/FAT/Info.cs
@@ -1006,7 +1006,7 @@ namespace Aaru.Filesystems
sb.AppendLine("Volume is bootable");
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
- string bootName = knownBootHashes.FirstOrDefault(t => t.hash == bootChk).name;
+ string bootName = _knownBootHashes.FirstOrDefault(t => t.hash == bootChk).name;
if(string.IsNullOrWhiteSpace(bootName))
sb.AppendLine("Unknown boot code.");
diff --git a/Aaru.Filesystems/FAT/Structs.cs b/Aaru.Filesystems/FAT/Structs.cs
index 4666686bc..d91f00255 100644
--- a/Aaru.Filesystems/FAT/Structs.cs
+++ b/Aaru.Filesystems/FAT/Structs.cs
@@ -949,6 +949,7 @@ namespace Aaru.Filesystems
public readonly byte[] name;
}
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
enum UmsdosFlags : byte
{
/// Never show this entry in directory search
diff --git a/Aaru.Filesystems/FAT/Super.cs b/Aaru.Filesystems/FAT/Super.cs
index e6e00686a..52e66052f 100644
--- a/Aaru.Filesystems/FAT/Super.cs
+++ b/Aaru.Filesystems/FAT/Super.cs
@@ -51,9 +51,8 @@ namespace Aaru.Filesystems
{
public partial class FAT
{
- uint fatEntriesPerSector;
-
- IMediaImage image;
+ uint _fatEntriesPerSector;
+ IMediaImage _image;
///
public Errno Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
@@ -65,7 +64,7 @@ namespace Aaru.Filesystems
options = GetDefaultOptions();
if(options.TryGetValue("debug", out string debugString))
- bool.TryParse(debugString, out debug);
+ bool.TryParse(debugString, out _debug);
// Default namespace
if(@namespace is null)
@@ -74,27 +73,27 @@ namespace Aaru.Filesystems
switch(@namespace.ToLowerInvariant())
{
case "dos":
- this.@namespace = Namespace.Dos;
+ _namespace = Namespace.Dos;
break;
case "nt":
- this.@namespace = Namespace.Nt;
+ _namespace = Namespace.Nt;
break;
case "os2":
- this.@namespace = Namespace.Os2;
+ _namespace = Namespace.Os2;
break;
case "ecs":
- this.@namespace = Namespace.Ecs;
+ _namespace = Namespace.Ecs;
break;
case "lfn":
- this.@namespace = Namespace.Lfn;
+ _namespace = Namespace.Lfn;
break;
case "human":
- this.@namespace = Namespace.Human;
+ _namespace = Namespace.Human;
break;
default: return Errno.InvalidArgument;
@@ -110,13 +109,13 @@ namespace Aaru.Filesystems
out HumanParameterBlock humanBpb, out AtariParameterBlock atariBpb,
out byte minBootNearJump, out bool andosOemCorrect, out bool bootable);
- fat12 = false;
- fat16 = false;
- fat32 = false;
- useFirstFat = true;
+ _fat12 = false;
+ _fat16 = false;
+ _fat32 = false;
+ _useFirstFat = true;
XmlFsType.Bootable = bootable;
- statfs = new FileSystemInfo
+ _statfs = new FileSystemInfo
{
Blocks = XmlFsType.Clusters,
FilenameLength = 11,
@@ -139,13 +138,13 @@ namespace Aaru.Filesystems
case BpbKind.Hardcoded:
case BpbKind.Msx:
case BpbKind.Apricot:
- fat12 = true;
+ _fat12 = true;
break;
case BpbKind.ShortFat32:
case BpbKind.LongFat32:
{
- fat32 = true;
+ _fat32 = true;
Fat32ParameterBlock fat32Bpb =
Marshal.ByteArrayToStructureLittleEndian(bpbSector);
@@ -171,9 +170,9 @@ namespace Aaru.Filesystems
(fat32Bpb.oem_name[5] != 0x49 || fat32Bpb.oem_name[6] != 0x48 || fat32Bpb.oem_name[7] != 0x43))
XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name);
- sectorsPerCluster = fat32Bpb.spc;
+ _sectorsPerCluster = fat32Bpb.spc;
XmlFsType.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc);
- reservedSectors = fat32Bpb.rsectors;
+ _reservedSectors = fat32Bpb.rsectors;
if(fat32Bpb.big_sectors == 0 &&
fat32Bpb.signature == 0x28)
@@ -181,10 +180,10 @@ namespace Aaru.Filesystems
else
XmlFsType.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc;
- sectorsPerFat = fat32Bpb.big_spfat;
+ _sectorsPerFat = fat32Bpb.big_spfat;
XmlFsType.VolumeSerial = $"{fat32Bpb.serial_no:X8}";
- statfs.Id = new FileSystemId
+ _statfs.Id = new FileSystemId
{
IsInt = true,
Serial32 = fat32Bpb.serial_no
@@ -195,7 +194,7 @@ namespace Aaru.Filesystems
XmlFsType.Dirty = true;
if((fat32Bpb.mirror_flags & 0x80) == 0x80)
- useFirstFat = (fat32Bpb.mirror_flags & 0xF) != 1;
+ _useFirstFat = (fat32Bpb.mirror_flags & 0xF) != 1;
if(fat32Bpb.signature == 0x29)
XmlFsType.VolumeName = Encoding.ASCII.GetString(fat32Bpb.volume_label);
@@ -209,12 +208,12 @@ namespace Aaru.Filesystems
BitConverter.ToUInt16(fat32Bpb.jump, 1) <= 0x1FC);
sectorsPerRealSector = fat32Bpb.bps / imagePlugin.Info.SectorSize;
- sectorsPerCluster *= sectorsPerRealSector;
+ _sectorsPerCluster *= sectorsPerRealSector;
// First root directory sector
- firstClusterSector =
+ _firstClusterSector =
((ulong)((fat32Bpb.big_spfat * fat32Bpb.fats_no) + fat32Bpb.rsectors) * sectorsPerRealSector) -
- (2 * sectorsPerCluster);
+ (2 * _sectorsPerCluster);
if(fat32Bpb.fsinfo_sector + partition.Start <= partition.End)
{
@@ -252,10 +251,10 @@ namespace Aaru.Filesystems
case BpbKind.Human:
// If not debug set Human68k namespace and ShiftJIS codepage as defaults
- if(!debug)
+ if(!_debug)
{
- this.@namespace = Namespace.Human;
- encoding = Encoding.GetEncoding("shift_jis");
+ _namespace = Namespace.Human;
+ encoding = Encoding.GetEncoding("shift_jis");
}
XmlFsType.Bootable = true;
@@ -268,7 +267,7 @@ namespace Aaru.Filesystems
ulong firstRootSector = 0;
- if(!fat32)
+ if(!_fat32)
{
// This is to support FAT partitions on hybrid ISO/USB images
if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc)
@@ -288,8 +287,8 @@ namespace Aaru.Filesystems
// However nothing prevents this to happen
// If first file on disk uses only one cluster there is absolutely no way to differentiate between FAT12 and FAT16,
// so let's hope implementations use common sense?
- if(!fat12 &&
- !fat16)
+ if(!_fat12 &&
+ !_fat16)
{
ulong clusters;
@@ -299,14 +298,14 @@ namespace Aaru.Filesystems
clusters = fakeBpb.spc == 0 ? fakeBpb.sectors : (ulong)fakeBpb.sectors / fakeBpb.spc;
if(clusters < 4089)
- fat12 = true;
+ _fat12 = true;
else
- fat16 = true;
+ _fat16 = true;
}
- if(fat12)
+ if(_fat12)
XmlFsType.Type = "FAT12";
- else if(fat16)
+ else if(_fat16)
XmlFsType.Type = "FAT16";
if(bpbKind == BpbKind.Atari)
@@ -318,7 +317,7 @@ namespace Aaru.Filesystems
XmlFsType.VolumeSerial =
$"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{atariBpb.serial_no[2]:X2}";
- statfs.Id = new FileSystemId
+ _statfs.Id = new FileSystemId
{
IsInt = true,
Serial32 = (uint)((atariBpb.serial_no[0] << 16) + (atariBpb.serial_no[1] << 8) +
@@ -379,7 +378,7 @@ namespace Aaru.Filesystems
{
XmlFsType.VolumeSerial = $"{fakeBpb.serial_no:X8}";
- statfs.Id = new FileSystemId
+ _statfs.Id = new FileSystemId
{
IsInt = true,
Serial32 = fakeBpb.serial_no
@@ -396,10 +395,10 @@ namespace Aaru.Filesystems
else
XmlFsType.Clusters = humanBpb.clusters == 0 ? humanBpb.big_clusters : humanBpb.clusters;
- sectorsPerCluster = fakeBpb.spc;
+ _sectorsPerCluster = fakeBpb.spc;
XmlFsType.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc);
- reservedSectors = fakeBpb.rsectors;
- sectorsPerFat = fakeBpb.spfat;
+ _reservedSectors = fakeBpb.rsectors;
+ _sectorsPerFat = fakeBpb.spfat;
if(fakeBpb.signature == 0x28 ||
fakeBpb.signature == 0x29 ||
@@ -435,29 +434,29 @@ namespace Aaru.Filesystems
sectorsForRootDirectory = (uint)((fakeBpb.root_ent * 32) / imagePlugin.Info.SectorSize);
sectorsPerRealSector = fakeBpb.bps / imagePlugin.Info.SectorSize;
- sectorsPerCluster *= sectorsPerRealSector;
+ _sectorsPerCluster *= sectorsPerRealSector;
}
- firstClusterSector += partition.Start;
+ _firstClusterSector += partition.Start;
- image = imagePlugin;
+ _image = imagePlugin;
- if(fat32)
- fatEntriesPerSector = imagePlugin.Info.SectorSize / 4;
- else if(fat16)
- fatEntriesPerSector = imagePlugin.Info.SectorSize / 2;
+ if(_fat32)
+ _fatEntriesPerSector = imagePlugin.Info.SectorSize / 4;
+ else if(_fat16)
+ _fatEntriesPerSector = imagePlugin.Info.SectorSize / 2;
else
- fatEntriesPerSector = (imagePlugin.Info.SectorSize * 2) / 3;
+ _fatEntriesPerSector = (imagePlugin.Info.SectorSize * 2) / 3;
- fatFirstSector = partition.Start + (reservedSectors * sectorsPerRealSector);
+ _fatFirstSector = partition.Start + (_reservedSectors * sectorsPerRealSector);
- rootDirectoryCache = new Dictionary();
+ _rootDirectoryCache = new Dictionary();
byte[] rootDirectory = null;
- if(!fat32)
+ if(!_fat32)
{
- firstClusterSector = (firstRootSector + sectorsForRootDirectory) - (sectorsPerCluster * 2);
- rootDirectory = imagePlugin.ReadSectors(firstRootSector, sectorsForRootDirectory);
+ _firstClusterSector = (firstRootSector + sectorsForRootDirectory) - (_sectorsPerCluster * 2);
+ rootDirectory = imagePlugin.ReadSectors(firstRootSector, sectorsForRootDirectory);
if(bpbKind == BpbKind.DecRainbow)
{
@@ -483,7 +482,8 @@ namespace Aaru.Filesystems
foreach(uint cluster in rootDirectoryClusters)
{
byte[] buffer =
- imagePlugin.ReadSectors(firstClusterSector + (cluster * sectorsPerCluster), sectorsPerCluster);
+ imagePlugin.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster),
+ _sectorsPerCluster);
rootMs.Write(buffer, 0, buffer.Length);
}
@@ -491,8 +491,8 @@ namespace Aaru.Filesystems
rootDirectory = rootMs.ToArray();
// OS/2 FAT32.IFS uses LFN instead of .LONGNAME
- if(this.@namespace == Namespace.Os2)
- this.@namespace = Namespace.Os2;
+ if(_namespace == Namespace.Os2)
+ _namespace = Namespace.Os2;
}
if(rootDirectory is null)
@@ -512,8 +512,8 @@ namespace Aaru.Filesystems
if(entry.attributes.HasFlag(FatAttributes.LFN))
{
- if(this.@namespace != Namespace.Lfn &&
- this.@namespace != Namespace.Ecs)
+ if(_namespace != Namespace.Lfn &&
+ _namespace != Namespace.Ecs)
continue;
LfnEntry lfnEntry =
@@ -574,7 +574,7 @@ namespace Aaru.Filesystems
if(!string.IsNullOrEmpty(volname))
XmlFsType.VolumeName =
- entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) && this.@namespace == Namespace.Nt
+ entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) && _namespace == Namespace.Nt
? volname.ToLower() : volname;
if(entry.ctime > 0 &&
@@ -603,7 +603,7 @@ namespace Aaru.Filesystems
Dirent = entry
};
- if((this.@namespace == Namespace.Lfn || this.@namespace == Namespace.Ecs) &&
+ if((_namespace == Namespace.Lfn || _namespace == Namespace.Ecs) &&
lastLfnName != null)
{
byte calculatedLfnChecksum = LfnChecksum(entry.filename, entry.extension);
@@ -624,7 +624,7 @@ namespace Aaru.Filesystems
string name = Encoding.GetString(entry.filename).TrimEnd();
string extension = Encoding.GetString(entry.extension).TrimEnd();
- if(this.@namespace == Namespace.Nt)
+ if(_namespace == Namespace.Nt)
{
if(entry.caseinfo.HasFlag(CaseInfo.LowerCaseExtension))
extension = extension.ToLower(CultureInfo.CurrentCulture);
@@ -640,7 +640,7 @@ namespace Aaru.Filesystems
completeEntry.Shortname = filename;
- if(this.@namespace == Namespace.Human)
+ if(_namespace == Namespace.Human)
{
HumanDirectoryEntry humanEntry =
Marshal.ByteArrayToStructureLittleEndian(rootDirectory, i,
@@ -662,39 +662,39 @@ namespace Aaru.Filesystems
completeEntry.HumanName = filename;
}
- if(!fat32 &&
+ if(!_fat32 &&
filename == "EA DATA. SF")
{
- eaDirEntry = entry;
+ _eaDirEntry = entry;
lastLfnName = null;
lastLfnChecksum = 0;
- if(debug)
- rootDirectoryCache[completeEntry.ToString()] = completeEntry;
+ if(_debug)
+ _rootDirectoryCache[completeEntry.ToString()] = completeEntry;
continue;
}
- rootDirectoryCache[completeEntry.ToString()] = completeEntry;
- lastLfnName = null;
- lastLfnChecksum = 0;
+ _rootDirectoryCache[completeEntry.ToString()] = completeEntry;
+ lastLfnName = null;
+ lastLfnChecksum = 0;
}
XmlFsType.VolumeName = XmlFsType.VolumeName?.Trim();
- statfs.Blocks = XmlFsType.Clusters;
+ _statfs.Blocks = XmlFsType.Clusters;
switch(bpbKind)
{
case BpbKind.Hardcoded:
- statfs.Type = $"Microsoft FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"Microsoft FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Atari:
- statfs.Type = $"Atari FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"Atari FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Msx:
- statfs.Type = $"MSX FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"MSX FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Dos2:
@@ -703,89 +703,89 @@ namespace Aaru.Filesystems
case BpbKind.Dos33:
case BpbKind.ShortExtended:
case BpbKind.Extended:
- statfs.Type = $"Microsoft FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"Microsoft FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.ShortFat32:
case BpbKind.LongFat32:
- statfs.Type = XmlFsType.Type == "FAT+" ? "FAT+" : "Microsoft FAT32";
+ _statfs.Type = XmlFsType.Type == "FAT+" ? "FAT+" : "Microsoft FAT32";
break;
case BpbKind.Andos:
- statfs.Type = $"ANDOS FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"ANDOS FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Apricot:
- statfs.Type = $"Apricot FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"Apricot FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.DecRainbow:
- statfs.Type = $"DEC FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"DEC FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Human:
- statfs.Type = $"Human68k FAT{(fat16 ? "16" : "12")}";
+ _statfs.Type = $"Human68k FAT{(_fat16 ? "16" : "12")}";
break;
default: throw new ArgumentOutOfRangeException();
}
- bytesPerCluster = sectorsPerCluster * imagePlugin.Info.SectorSize;
+ _bytesPerCluster = _sectorsPerCluster * imagePlugin.Info.SectorSize;
- if(fat12)
+ if(_fat12)
{
byte[] fatBytes =
- imagePlugin.ReadSectors(fatFirstSector + (useFirstFat ? 0 : sectorsPerFat), sectorsPerFat);
+ imagePlugin.ReadSectors(_fatFirstSector + (_useFirstFat ? 0 : _sectorsPerFat), _sectorsPerFat);
- fatEntries = new ushort[statfs.Blocks];
+ _fatEntries = new ushort[_statfs.Blocks];
int pos = 0;
- for(int i = 0; i + 3 < fatBytes.Length && pos < fatEntries.Length; i += 3)
+ for(int i = 0; i + 3 < fatBytes.Length && pos < _fatEntries.Length; i += 3)
{
- fatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF) << 8) + fatBytes[i + 0]);
- fatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF0) >> 4) + (fatBytes[i + 2] << 4));
+ _fatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF) << 8) + fatBytes[i + 0]);
+ _fatEntries[pos++] = (ushort)(((fatBytes[i + 1] & 0xF0) >> 4) + (fatBytes[i + 2] << 4));
}
}
- else if(fat16)
+ else if(_fat16)
{
AaruConsole.DebugWriteLine("FAT plugin", "Reading FAT16");
byte[] fatBytes =
- imagePlugin.ReadSectors(fatFirstSector + (useFirstFat ? 0 : sectorsPerFat), sectorsPerFat);
+ imagePlugin.ReadSectors(_fatFirstSector + (_useFirstFat ? 0 : _sectorsPerFat), _sectorsPerFat);
AaruConsole.DebugWriteLine("FAT plugin", "Casting FAT");
- fatEntries = MemoryMarshal.Cast(fatBytes).ToArray();
+ _fatEntries = MemoryMarshal.Cast(fatBytes).ToArray();
}
// TODO: Check how this affects international filenames
- cultureInfo = new CultureInfo("en-US", false);
- directoryCache = new Dictionary>();
+ _cultureInfo = new CultureInfo("en-US", false);
+ _directoryCache = new Dictionary>();
// Check it is really an OS/2 EA file
- if(eaDirEntry.start_cluster != 0)
+ if(_eaDirEntry.start_cluster != 0)
{
CacheEaData();
- ushort eamagic = BitConverter.ToUInt16(cachedEaData, 0);
+ ushort eamagic = BitConverter.ToUInt16(_cachedEaData, 0);
if(eamagic != EADATA_MAGIC)
{
- eaDirEntry = new DirectoryEntry();
- cachedEaData = null;
+ _eaDirEntry = new DirectoryEntry();
+ _cachedEaData = null;
}
else
- eaCache = new Dictionary>();
+ _eaCache = new Dictionary>();
}
- else if(fat32)
- eaCache = new Dictionary>();
+ else if(_fat32)
+ _eaCache = new Dictionary>();
// Check OS/2 .LONGNAME
- if(eaCache != null &&
- (this.@namespace == Namespace.Os2 || this.@namespace == Namespace.Ecs) &&
- !fat32)
+ if(_eaCache != null &&
+ (_namespace == Namespace.Os2 || _namespace == Namespace.Ecs) &&
+ !_fat32)
{
List> rootFilesWithEas =
- rootDirectoryCache.Where(t => t.Value.Dirent.ea_handle != 0).ToList();
+ _rootDirectoryCache.Where(t => t.Value.Dirent.ea_handle != 0).ToList();
foreach(KeyValuePair fileWithEa in rootFilesWithEas)
{
@@ -818,32 +818,32 @@ namespace Aaru.Filesystems
longname = longname.Replace('/', '\u2215');
fileWithEa.Value.Longname = longname;
- rootDirectoryCache.Remove(fileWithEa.Key);
- rootDirectoryCache[fileWithEa.Value.ToString()] = fileWithEa.Value;
+ _rootDirectoryCache.Remove(fileWithEa.Key);
+ _rootDirectoryCache[fileWithEa.Value.ToString()] = fileWithEa.Value;
}
}
// Check FAT32.IFS EAs
- if(fat32 || debug)
+ if(_fat32 || _debug)
{
- List> fat32EaSidecars = rootDirectoryCache.
+ List> fat32EaSidecars = _rootDirectoryCache.
Where(t =>
t.Key.
EndsWith(FAT32_EA_TAIL,
true,
- cultureInfo)).
+ _cultureInfo)).
ToList();
foreach(KeyValuePair sidecar in fat32EaSidecars)
{
// No real file this sidecar accompanies
- if(!rootDirectoryCache.
+ if(!_rootDirectoryCache.
TryGetValue(sidecar.Key.Substring(0, sidecar.Key.Length - FAT32_EA_TAIL.Length),
out CompleteDirectoryEntry fileWithEa))
continue;
// If not in debug mode we will consider the lack of EA bitflags to mean the EAs are corrupted or not real
- if(!debug)
+ if(!_debug)
if(!fileWithEa.Dirent.caseinfo.HasFlag(CaseInfo.NormalEaOld) &&
!fileWithEa.Dirent.caseinfo.HasFlag(CaseInfo.CriticalEa) &&
!fileWithEa.Dirent.caseinfo.HasFlag(CaseInfo.NormalEa) &&
@@ -852,12 +852,12 @@ namespace Aaru.Filesystems
fileWithEa.Fat32Ea = sidecar.Value.Dirent;
- if(!debug)
- rootDirectoryCache.Remove(sidecar.Key);
+ if(!_debug)
+ _rootDirectoryCache.Remove(sidecar.Key);
}
}
- mounted = true;
+ _mounted = true;
return Errno.NoError;
}
@@ -865,11 +865,11 @@ namespace Aaru.Filesystems
///
public Errno Unmount()
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
- mounted = false;
- fatEntries = null;
+ _mounted = false;
+ _fatEntries = null;
return Errno.NoError;
}
@@ -879,10 +879,10 @@ namespace Aaru.Filesystems
{
stat = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
- stat = statfs.ShallowCopy();
+ stat = _statfs.ShallowCopy();
return Errno.NoError;
}
diff --git a/Aaru.Filesystems/FAT/Xattr.cs b/Aaru.Filesystems/FAT/Xattr.cs
index 2c4532b8c..a68e6eea3 100644
--- a/Aaru.Filesystems/FAT/Xattr.cs
+++ b/Aaru.Filesystems/FAT/Xattr.cs
@@ -42,25 +42,25 @@ namespace Aaru.Filesystems
{
public partial class FAT
{
- Dictionary> eaCache;
+ Dictionary> _eaCache;
///
public Errno ListXAttr(string path, out List xattrs)
{
xattrs = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
// No other xattr recognized yet
- if(cachedEaData is null &&
- !fat32)
+ if(_cachedEaData is null &&
+ !_fat32)
return Errno.NotSupported;
if(path[0] == '/')
path = path.Substring(1);
- if(eaCache.TryGetValue(path.ToLower(cultureInfo), out Dictionary eas))
+ if(_eaCache.TryGetValue(path.ToLower(_cultureInfo), out Dictionary eas))
{
xattrs = eas.Keys.ToList();
@@ -75,7 +75,7 @@ namespace Aaru.Filesystems
xattrs = new List();
- if(!fat32)
+ if(!_fat32)
{
if(entry.Dirent.ea_handle == 0)
return Errno.NoError;
@@ -93,7 +93,7 @@ namespace Aaru.Filesystems
if(eas is null)
return Errno.NoError;
- eaCache.Add(path.ToLower(cultureInfo), eas);
+ _eaCache.Add(path.ToLower(_cultureInfo), eas);
xattrs = eas.Keys.ToList();
return Errno.NoError;
@@ -102,7 +102,7 @@ namespace Aaru.Filesystems
///
public Errno GetXattr(string path, string xattr, ref byte[] buf)
{
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
Errno err = ListXAttr(path, out List xattrs);
@@ -113,13 +113,13 @@ namespace Aaru.Filesystems
if(path[0] == '/')
path = path.Substring(1);
- if(!xattrs.Contains(xattr.ToLower(cultureInfo)))
+ if(!xattrs.Contains(xattr.ToLower(_cultureInfo)))
return Errno.NoSuchExtendedAttribute;
- if(!eaCache.TryGetValue(path.ToLower(cultureInfo), out Dictionary eas))
+ if(!_eaCache.TryGetValue(path.ToLower(_cultureInfo), out Dictionary eas))
return Errno.InvalidArgument;
- if(!eas.TryGetValue(xattr.ToLower(cultureInfo), out byte[] data))
+ if(!eas.TryGetValue(xattr.ToLower(_cultureInfo), out byte[] data))
return Errno.InvalidArgument;
buf = new byte[data.Length];
@@ -136,7 +136,7 @@ namespace Aaru.Filesystems
foreach(uint cluster in rootDirectoryClusters)
{
byte[] buffer =
- image.ReadSectors(firstClusterSector + (cluster * sectorsPerCluster), sectorsPerCluster);
+ _image.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster), _sectorsPerCluster);
eaMs.Write(buffer, 0, buffer.Length);
}
@@ -157,9 +157,9 @@ namespace Aaru.Filesystems
int aIndex = eaHandle >> 7;
// First 0x20 bytes are the magic number and unused words
- ushort a = BitConverter.ToUInt16(cachedEaData, (aIndex * 2) + 0x20);
+ ushort a = BitConverter.ToUInt16(_cachedEaData, (aIndex * 2) + 0x20);
- ushort b = BitConverter.ToUInt16(cachedEaData, (eaHandle * 2) + 0x200);
+ ushort b = BitConverter.ToUInt16(_cachedEaData, (eaHandle * 2) + 0x200);
uint eaCluster = (uint)(a + b);
@@ -167,17 +167,19 @@ namespace Aaru.Filesystems
return null;
EaHeader header =
- Marshal.ByteArrayToStructureLittleEndian(cachedEaData, (int)(eaCluster * bytesPerCluster),
+ Marshal.ByteArrayToStructureLittleEndian(_cachedEaData, (int)(eaCluster * _bytesPerCluster),
Marshal.SizeOf());
if(header.magic != 0x4145)
return null;
- uint eaLen = BitConverter.ToUInt32(cachedEaData,
- (int)(eaCluster * bytesPerCluster) + Marshal.SizeOf());
+ uint eaLen = BitConverter.ToUInt32(_cachedEaData,
+ (int)(eaCluster * _bytesPerCluster) + Marshal.SizeOf());
byte[] eaData = new byte[eaLen];
- Array.Copy(cachedEaData, (int)(eaCluster * bytesPerCluster) + Marshal.SizeOf(), eaData, 0, eaLen);
+
+ Array.Copy(_cachedEaData, (int)(eaCluster * _bytesPerCluster) + Marshal.SizeOf(), eaData, 0,
+ eaLen);
return GetEas(eaData);
}
@@ -190,7 +192,7 @@ namespace Aaru.Filesystems
Dictionary eas = new Dictionary();
- if(debug)
+ if(_debug)
eas.Add("com.microsoft.os2.fea", eaData);
int pos = 4;
@@ -228,17 +230,17 @@ namespace Aaru.Filesystems
void CacheEaData()
{
- if(eaDirEntry.start_cluster == 0)
+ if(_eaDirEntry.start_cluster == 0)
return;
var eaDataMs = new MemoryStream();
- foreach(byte[] buffer in GetClusters(eaDirEntry.start_cluster).
- Select(cluster => image.ReadSectors(firstClusterSector + (cluster * sectorsPerCluster),
- sectorsPerCluster)))
+ foreach(byte[] buffer in GetClusters(_eaDirEntry.start_cluster).
+ Select(cluster => _image.ReadSectors(_firstClusterSector + (cluster * _sectorsPerCluster),
+ _sectorsPerCluster)))
eaDataMs.Write(buffer, 0, buffer.Length);
- cachedEaData = eaDataMs.ToArray();
+ _cachedEaData = eaDataMs.ToArray();
}
}
}
\ No newline at end of file
diff --git a/Aaru.Filesystems/FATX/Dir.cs b/Aaru.Filesystems/FATX/Dir.cs
index 4a30f0773..77a60e2ba 100644
--- a/Aaru.Filesystems/FATX/Dir.cs
+++ b/Aaru.Filesystems/FATX/Dir.cs
@@ -44,20 +44,21 @@ namespace Aaru.Filesystems
{
contents = null;
- if(!mounted)
+ if(!_mounted)
return Errno.AccessDenied;
if(string.IsNullOrWhiteSpace(path) ||
path == "/")
{
- contents = rootDirectory.Keys.ToList();
+ contents = _rootDirectory.Keys.ToList();
return Errno.NoError;
}
- string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(cultureInfo) : path.ToLower(cultureInfo);
+ string cutPath = path.StartsWith("/") ? path.Substring(1).ToLower(_cultureInfo)
+ : path.ToLower(_cultureInfo);
- if(directoryCache.TryGetValue(cutPath, out Dictionary currentDirectory))
+ if(_directoryCache.TryGetValue(cutPath, out Dictionary currentDirectory))
{
contents = currentDirectory.Keys.ToList();
@@ -70,7 +71,7 @@ namespace Aaru.Filesystems
}, StringSplitOptions.RemoveEmptyEntries);
KeyValuePair entry =
- rootDirectory.FirstOrDefault(t => t.Key.ToLower(cultureInfo) == pieces[0]);
+ _rootDirectory.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[0]);
if(string.IsNullOrEmpty(entry.Key))
return Errno.NoSuchFile;
@@ -80,11 +81,11 @@ namespace Aaru.Filesystems
string currentPath = pieces[0];
- currentDirectory = rootDirectory;
+ currentDirectory = _rootDirectory;
for(int p = 0; p < pieces.Length; p++)
{
- entry = currentDirectory.FirstOrDefault(t => t.Key.ToLower(cultureInfo) == pieces[p]);
+ entry = currentDirectory.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[p]);
if(string.IsNullOrEmpty(entry.Key))
return Errno.NoSuchFile;
@@ -95,7 +96,7 @@ namespace Aaru.Filesystems
currentPath = p == 0 ? pieces[0] : $"{currentPath}/{pieces[p]}";
uint currentCluster = entry.Value.firstCluster;
- if(directoryCache.TryGetValue(currentPath, out currentDirectory))
+ if(_directoryCache.TryGetValue(currentPath, out currentDirectory))
continue;
uint[] clusters = GetClusters(currentCluster);
@@ -103,15 +104,15 @@ namespace Aaru.Filesystems
if(clusters is null)
return Errno.InvalidArgument;
- byte[] directoryBuffer = new byte[bytesPerCluster * clusters.Length];
+ byte[] directoryBuffer = new byte[_bytesPerCluster * clusters.Length];
for(int i = 0; i < clusters.Length; i++)
{
byte[] buffer =
- imagePlugin.ReadSectors(firstClusterSector + ((clusters[i] - 1) * sectorsPerCluster),
- sectorsPerCluster);
+ _imagePlugin.ReadSectors(_firstClusterSector + ((clusters[i] - 1) * _sectorsPerCluster),
+ _sectorsPerCluster);
- Array.Copy(buffer, 0, directoryBuffer, i * bytesPerCluster, bytesPerCluster);
+ Array.Copy(buffer, 0, directoryBuffer, i * _bytesPerCluster, _bytesPerCluster);
}
currentDirectory = new Dictionary();
@@ -120,7 +121,7 @@ namespace Aaru.Filesystems
while(pos < directoryBuffer.Length)
{
- DirectoryEntry dirent = littleEndian
+ DirectoryEntry dirent = _littleEndian
? Marshal.
ByteArrayToStructureLittleEndian(directoryBuffer, pos, Marshal.SizeOf())
@@ -146,7 +147,7 @@ namespace Aaru.Filesystems
currentDirectory.Add(filename, dirent);
}
- directoryCache.Add(currentPath, currentDirectory);
+ _directoryCache.Add(currentPath, currentDirectory);
}
contents = currentDirectory?.Keys.ToList();
diff --git a/Aaru.Filesystems/FATX/FATX.cs b/Aaru.Filesystems/FATX/FATX.cs
index 993ff5792..5ed24f398 100644
--- a/Aaru.Filesystems/FATX/FATX.cs
+++ b/Aaru.Filesystems/FATX/FATX.cs
@@ -42,21 +42,21 @@ namespace Aaru.Filesystems
{
public partial class XboxFatPlugin : IReadOnlyFilesystem
{
- uint bytesPerCluster;
- CultureInfo cultureInfo;
- bool debug;
- Dictionary