Naming fixes.

This commit is contained in:
2020-07-20 21:11:32 +01:00
parent c58c0fd1f8
commit 6220425ac6
525 changed files with 15675 additions and 15524 deletions

View File

@@ -40,12 +40,12 @@ namespace Aaru.DiscImages
{
public partial class Anex86 : IWritableImage
{
IFilter anexImageFilter;
Anex86Header fdihdr;
ImageInfo imageInfo;
FileStream writingStream;
IFilter _anexImageFilter;
Anex86Header _fdihdr;
ImageInfo _imageInfo;
FileStream _writingStream;
public Anex86() => imageInfo = new ImageInfo
public Anex86() => _imageInfo = new ImageInfo
{
ReadableSectorTags = new List<SectorTagType>(),
ReadableMediaTags = new List<MediaTagType>(),

View File

@@ -50,19 +50,19 @@ namespace Aaru.DiscImages
byte[] hdrB = new byte[Marshal.SizeOf<Anex86Header>()];
stream.Read(hdrB, 0, hdrB.Length);
fdihdr = Marshal.SpanToStructureLittleEndian<Anex86Header>(hdrB);
_fdihdr = Marshal.SpanToStructureLittleEndian<Anex86Header>(hdrB);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.unknown = {0}", fdihdr.unknown);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hddtype = {0}", fdihdr.hddtype);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hdrSize = {0}", fdihdr.hdrSize);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.dskSize = {0}", fdihdr.dskSize);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.bps = {0}", fdihdr.bps);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.spt = {0}", fdihdr.spt);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.heads = {0}", fdihdr.heads);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.cylinders = {0}", fdihdr.cylinders);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.unknown = {0}", _fdihdr.unknown);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hddtype = {0}", _fdihdr.hddtype);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.hdrSize = {0}", _fdihdr.hdrSize);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.dskSize = {0}", _fdihdr.dskSize);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.bps = {0}", _fdihdr.bps);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.spt = {0}", _fdihdr.spt);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.heads = {0}", _fdihdr.heads);
AaruConsole.DebugWriteLine("Anex86 plugin", "fdihdr.cylinders = {0}", _fdihdr.cylinders);
return stream.Length == fdihdr.hdrSize + fdihdr.dskSize &&
fdihdr.dskSize == fdihdr.bps * fdihdr.spt * fdihdr.heads * fdihdr.cylinders;
return stream.Length == _fdihdr.hdrSize + _fdihdr.dskSize &&
_fdihdr.dskSize == _fdihdr.bps * _fdihdr.spt * _fdihdr.heads * _fdihdr.cylinders;
}
}
}

View File

@@ -41,7 +41,7 @@ namespace Aaru.DiscImages
{
public partial class Anex86
{
public ImageInfo Info => imageInfo;
public ImageInfo Info => _imageInfo;
public string Name => "Anex86 Disk Image";
public Guid Id => new Guid("0410003E-6E7B-40E6-9328-BA5651ADF6B7");

View File

@@ -53,29 +53,29 @@ namespace Aaru.DiscImages
byte[] hdrB = new byte[Marshal.SizeOf<Anex86Header>()];
stream.Read(hdrB, 0, hdrB.Length);
fdihdr = Marshal.SpanToStructureLittleEndian<Anex86Header>(hdrB);
_fdihdr = Marshal.SpanToStructureLittleEndian<Anex86Header>(hdrB);
imageInfo.MediaType = Geometry.GetMediaType(((ushort)fdihdr.cylinders, (byte)fdihdr.heads,
(ushort)fdihdr.spt, (uint)fdihdr.bps, MediaEncoding.MFM,
false));
_imageInfo.MediaType = Geometry.GetMediaType(((ushort)_fdihdr.cylinders, (byte)_fdihdr.heads,
(ushort)_fdihdr.spt, (uint)_fdihdr.bps, MediaEncoding.MFM,
false));
if(imageInfo.MediaType == MediaType.Unknown)
imageInfo.MediaType = MediaType.GENERIC_HDD;
if(_imageInfo.MediaType == MediaType.Unknown)
_imageInfo.MediaType = MediaType.GENERIC_HDD;
AaruConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", imageInfo.MediaType);
AaruConsole.DebugWriteLine("Anex86 plugin", "MediaType: {0}", _imageInfo.MediaType);
imageInfo.ImageSize = (ulong)fdihdr.dskSize;
imageInfo.CreationTime = imageFilter.GetCreationTime();
imageInfo.LastModificationTime = imageFilter.GetLastWriteTime();
imageInfo.MediaTitle = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
imageInfo.Sectors = (ulong)(fdihdr.cylinders * fdihdr.heads * fdihdr.spt);
imageInfo.XmlMediaType = XmlMediaType.BlockMedia;
imageInfo.SectorSize = (uint)fdihdr.bps;
imageInfo.Cylinders = (uint)fdihdr.cylinders;
imageInfo.Heads = (uint)fdihdr.heads;
imageInfo.SectorsPerTrack = (uint)fdihdr.spt;
_imageInfo.ImageSize = (ulong)_fdihdr.dskSize;
_imageInfo.CreationTime = imageFilter.GetCreationTime();
_imageInfo.LastModificationTime = imageFilter.GetLastWriteTime();
_imageInfo.MediaTitle = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
_imageInfo.Sectors = (ulong)(_fdihdr.cylinders * _fdihdr.heads * _fdihdr.spt);
_imageInfo.XmlMediaType = XmlMediaType.BlockMedia;
_imageInfo.SectorSize = (uint)_fdihdr.bps;
_imageInfo.Cylinders = (uint)_fdihdr.cylinders;
_imageInfo.Heads = (uint)_fdihdr.heads;
_imageInfo.SectorsPerTrack = (uint)_fdihdr.spt;
anexImageFilter = imageFilter;
_anexImageFilter = imageFilter;
return true;
}
@@ -84,19 +84,19 @@ namespace Aaru.DiscImages
public byte[] ReadSectors(ulong sectorAddress, uint length)
{
if(sectorAddress > imageInfo.Sectors - 1)
if(sectorAddress > _imageInfo.Sectors - 1)
throw new ArgumentOutOfRangeException(nameof(sectorAddress), "Sector address not found");
if(sectorAddress + length > imageInfo.Sectors)
if(sectorAddress + length > _imageInfo.Sectors)
throw new ArgumentOutOfRangeException(nameof(length), "Requested more sectors than available");
byte[] buffer = new byte[length * imageInfo.SectorSize];
byte[] buffer = new byte[length * _imageInfo.SectorSize];
Stream stream = anexImageFilter.GetDataForkStream();
Stream stream = _anexImageFilter.GetDataForkStream();
stream.Seek((long)((ulong)fdihdr.hdrSize + (sectorAddress * imageInfo.SectorSize)), SeekOrigin.Begin);
stream.Seek((long)((ulong)_fdihdr.hdrSize + (sectorAddress * _imageInfo.SectorSize)), SeekOrigin.Begin);
stream.Read(buffer, 0, (int)(length * imageInfo.SectorSize));
stream.Read(buffer, 0, (int)(length * _imageInfo.SectorSize));
return buffer;
}

View File

@@ -69,7 +69,7 @@ namespace Aaru.DiscImages
return false;
}
imageInfo = new ImageInfo
_imageInfo = new ImageInfo
{
MediaType = mediaType,
SectorSize = sectorSize,
@@ -78,7 +78,7 @@ namespace Aaru.DiscImages
try
{
writingStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
_writingStream = new FileStream(path, FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
}
catch(IOException e)
{
@@ -87,7 +87,7 @@ namespace Aaru.DiscImages
return false;
}
fdihdr = new Anex86Header
_fdihdr = new Anex86Header
{
hdrSize = 4096,
dskSize = (int)(sectors * sectorSize),
@@ -116,22 +116,22 @@ namespace Aaru.DiscImages
return false;
}
if(data.Length != imageInfo.SectorSize)
if(data.Length != _imageInfo.SectorSize)
{
ErrorMessage = "Incorrect data size";
return false;
}
if(sectorAddress >= imageInfo.Sectors)
if(sectorAddress >= _imageInfo.Sectors)
{
ErrorMessage = "Tried to write past image size";
return false;
}
writingStream.Seek((long)(4096 + (sectorAddress * imageInfo.SectorSize)), SeekOrigin.Begin);
writingStream.Write(data, 0, data.Length);
_writingStream.Seek((long)(4096 + (sectorAddress * _imageInfo.SectorSize)), SeekOrigin.Begin);
_writingStream.Write(data, 0, data.Length);
ErrorMessage = "";
@@ -147,22 +147,22 @@ namespace Aaru.DiscImages
return false;
}
if(data.Length % imageInfo.SectorSize != 0)
if(data.Length % _imageInfo.SectorSize != 0)
{
ErrorMessage = "Incorrect data size";
return false;
}
if(sectorAddress + length > imageInfo.Sectors)
if(sectorAddress + length > _imageInfo.Sectors)
{
ErrorMessage = "Tried to write past image size";
return false;
}
writingStream.Seek((long)(4096 + (sectorAddress * imageInfo.SectorSize)), SeekOrigin.Begin);
writingStream.Write(data, 0, data.Length);
_writingStream.Seek((long)(4096 + (sectorAddress * _imageInfo.SectorSize)), SeekOrigin.Begin);
_writingStream.Write(data, 0, data.Length);
ErrorMessage = "";
@@ -192,44 +192,44 @@ namespace Aaru.DiscImages
return false;
}
if((imageInfo.MediaType == MediaType.Unknown || imageInfo.MediaType == MediaType.GENERIC_HDD ||
imageInfo.MediaType == MediaType.FlashDrive || imageInfo.MediaType == MediaType.CompactFlash ||
imageInfo.MediaType == MediaType.CompactFlashType2 || imageInfo.MediaType == MediaType.PCCardTypeI ||
imageInfo.MediaType == MediaType.PCCardTypeII || imageInfo.MediaType == MediaType.PCCardTypeIII ||
imageInfo.MediaType == MediaType.PCCardTypeIV) &&
fdihdr.cylinders == 0)
if((_imageInfo.MediaType == MediaType.Unknown || _imageInfo.MediaType == MediaType.GENERIC_HDD ||
_imageInfo.MediaType == MediaType.FlashDrive || _imageInfo.MediaType == MediaType.CompactFlash ||
_imageInfo.MediaType == MediaType.CompactFlashType2 || _imageInfo.MediaType == MediaType.PCCardTypeI ||
_imageInfo.MediaType == MediaType.PCCardTypeII || _imageInfo.MediaType == MediaType.PCCardTypeIII ||
_imageInfo.MediaType == MediaType.PCCardTypeIV) &&
_fdihdr.cylinders == 0)
{
fdihdr.cylinders = (int)(imageInfo.Sectors / 8 / 33);
fdihdr.heads = 8;
fdihdr.spt = 33;
_fdihdr.cylinders = (int)(_imageInfo.Sectors / 8 / 33);
_fdihdr.heads = 8;
_fdihdr.spt = 33;
while(fdihdr.cylinders == 0)
while(_fdihdr.cylinders == 0)
{
fdihdr.heads--;
_fdihdr.heads--;
if(fdihdr.heads == 0)
if(_fdihdr.heads == 0)
{
fdihdr.spt--;
fdihdr.heads = 8;
_fdihdr.spt--;
_fdihdr.heads = 8;
}
fdihdr.cylinders = (int)imageInfo.Sectors / fdihdr.heads / fdihdr.spt;
_fdihdr.cylinders = (int)_imageInfo.Sectors / _fdihdr.heads / _fdihdr.spt;
if(fdihdr.cylinders == 0 &&
fdihdr.heads == 0 &&
fdihdr.spt == 0)
if(_fdihdr.cylinders == 0 &&
_fdihdr.heads == 0 &&
_fdihdr.spt == 0)
break;
}
}
byte[] hdr = new byte[Marshal.SizeOf<Anex86Header>()];
MemoryMarshal.Write(hdr, ref fdihdr);
MemoryMarshal.Write(hdr, ref _fdihdr);
writingStream.Seek(0, SeekOrigin.Begin);
writingStream.Write(hdr, 0, hdr.Length);
_writingStream.Seek(0, SeekOrigin.Begin);
_writingStream.Write(hdr, 0, hdr.Length);
writingStream.Flush();
writingStream.Close();
_writingStream.Flush();
_writingStream.Close();
IsWriting = false;
ErrorMessage = "";
@@ -262,9 +262,9 @@ namespace Aaru.DiscImages
return false;
}
fdihdr.spt = (int)sectorsPerTrack;
fdihdr.heads = (int)heads;
fdihdr.cylinders = (int)cylinders;
_fdihdr.spt = (int)sectorsPerTrack;
_fdihdr.heads = (int)heads;
_fdihdr.cylinders = (int)cylinders;
return true;
}