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

@@ -34,7 +34,7 @@ namespace Aaru.DiscImages
{
public partial class Nhdr0
{
readonly byte[] signature =
readonly byte[] _signature =
{
0x54, 0x39, 0x38, 0x48, 0x44, 0x44, 0x49, 0x4D, 0x41, 0x47, 0x45, 0x2E, 0x52, 0x30, 0x00
};

View File

@@ -55,24 +55,24 @@ namespace Aaru.DiscImages
byte[] hdrB = new byte[Marshal.SizeOf<Nhdr0Header>()];
stream.Read(hdrB, 0, hdrB.Length);
nhdhdr = Marshal.ByteArrayToStructureLittleEndian<Nhdr0Header>(hdrB);
_nhdhdr = Marshal.ByteArrayToStructureLittleEndian<Nhdr0Header>(hdrB);
if(!nhdhdr.szFileID.SequenceEqual(signature))
if(!_nhdhdr.szFileID.SequenceEqual(_signature))
return false;
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.szFileID = \"{0}\"",
StringHandlers.CToString(nhdhdr.szFileID, shiftjis));
StringHandlers.CToString(_nhdhdr.szFileID, shiftjis));
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.reserved1 = {0}", nhdhdr.reserved1);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.reserved1 = {0}", _nhdhdr.reserved1);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.szComment = \"{0}\"",
StringHandlers.CToString(nhdhdr.szComment, shiftjis));
StringHandlers.CToString(_nhdhdr.szComment, shiftjis));
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwHeadSize = {0}", nhdhdr.dwHeadSize);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwCylinder = {0}", nhdhdr.dwCylinder);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wHead = {0}", nhdhdr.wHead);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSect = {0}", nhdhdr.wSect);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSectLen = {0}", nhdhdr.wSectLen);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwHeadSize = {0}", _nhdhdr.dwHeadSize);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.dwCylinder = {0}", _nhdhdr.dwCylinder);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wHead = {0}", _nhdhdr.wHead);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSect = {0}", _nhdhdr.wSect);
AaruConsole.DebugWriteLine("NHDr0 plugin", "nhdhdr.wSectLen = {0}", _nhdhdr.wSectLen);
return true;
}

View File

@@ -41,12 +41,12 @@ namespace Aaru.DiscImages
// Info from http://www.geocities.jp/t98next/nhdr0.txt
public partial class Nhdr0 : IWritableImage
{
ImageInfo imageInfo;
Nhdr0Header nhdhdr;
IFilter nhdImageFilter;
FileStream writingStream;
ImageInfo _imageInfo;
Nhdr0Header _nhdhdr;
IFilter _nhdImageFilter;
FileStream _writingStream;
public Nhdr0() => imageInfo = new ImageInfo
public Nhdr0() => _imageInfo = new ImageInfo
{
ReadableSectorTags = new List<SectorTagType>(),
ReadableMediaTags = new List<MediaTagType>(),

View File

@@ -43,7 +43,7 @@ namespace Aaru.DiscImages
{
public string Name => "T98-Next NHD r0 Disk Image";
public Guid Id => new Guid("6ECACD0A-8F4D-4465-8815-AEA000D370E3");
public ImageInfo Info => imageInfo;
public ImageInfo Info => _imageInfo;
public string Author => "Natalia Portillo";
public string Format => "NHDr0 disk image";
public List<DumpHardwareType> DumpHardware => null;

View File

@@ -56,23 +56,23 @@ namespace Aaru.DiscImages
byte[] hdrB = new byte[Marshal.SizeOf<Nhdr0Header>()];
stream.Read(hdrB, 0, hdrB.Length);
nhdhdr = Marshal.ByteArrayToStructureLittleEndian<Nhdr0Header>(hdrB);
_nhdhdr = Marshal.ByteArrayToStructureLittleEndian<Nhdr0Header>(hdrB);
imageInfo.MediaType = MediaType.GENERIC_HDD;
_imageInfo.MediaType = MediaType.GENERIC_HDD;
imageInfo.ImageSize = (ulong)(stream.Length - nhdhdr.dwHeadSize);
imageInfo.CreationTime = imageFilter.GetCreationTime();
imageInfo.LastModificationTime = imageFilter.GetLastWriteTime();
imageInfo.MediaTitle = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
imageInfo.Sectors = (ulong)(nhdhdr.dwCylinder * nhdhdr.wHead * nhdhdr.wSect);
imageInfo.XmlMediaType = XmlMediaType.BlockMedia;
imageInfo.SectorSize = (uint)nhdhdr.wSectLen;
imageInfo.Cylinders = (uint)nhdhdr.dwCylinder;
imageInfo.Heads = (uint)nhdhdr.wHead;
imageInfo.SectorsPerTrack = (uint)nhdhdr.wSect;
imageInfo.Comments = StringHandlers.CToString(nhdhdr.szComment, shiftjis);
_imageInfo.ImageSize = (ulong)(stream.Length - _nhdhdr.dwHeadSize);
_imageInfo.CreationTime = imageFilter.GetCreationTime();
_imageInfo.LastModificationTime = imageFilter.GetLastWriteTime();
_imageInfo.MediaTitle = Path.GetFileNameWithoutExtension(imageFilter.GetFilename());
_imageInfo.Sectors = (ulong)(_nhdhdr.dwCylinder * _nhdhdr.wHead * _nhdhdr.wSect);
_imageInfo.XmlMediaType = XmlMediaType.BlockMedia;
_imageInfo.SectorSize = (uint)_nhdhdr.wSectLen;
_imageInfo.Cylinders = (uint)_nhdhdr.dwCylinder;
_imageInfo.Heads = (uint)_nhdhdr.wHead;
_imageInfo.SectorsPerTrack = (uint)_nhdhdr.wSect;
_imageInfo.Comments = StringHandlers.CToString(_nhdhdr.szComment, shiftjis);
nhdImageFilter = imageFilter;
_nhdImageFilter = imageFilter;
return true;
}
@@ -81,19 +81,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 = nhdImageFilter.GetDataForkStream();
Stream stream = _nhdImageFilter.GetDataForkStream();
stream.Seek((long)((ulong)nhdhdr.dwHeadSize + (sectorAddress * imageInfo.SectorSize)), SeekOrigin.Begin);
stream.Seek((long)((ulong)_nhdhdr.dwHeadSize + (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

@@ -62,7 +62,7 @@ namespace Aaru.DiscImages
return false;
}
imageInfo = new ImageInfo
_imageInfo = new ImageInfo
{
MediaType = mediaType,
SectorSize = sectorSize,
@@ -71,7 +71,7 @@ namespace Aaru.DiscImages
try
{
writingStream = new FileStream(path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
_writingStream = new FileStream(path, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.None);
}
catch(IOException e)
{
@@ -102,24 +102,24 @@ 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)((ulong)Marshal.SizeOf<Nhdr0Header>() + (sectorAddress * imageInfo.SectorSize)),
SeekOrigin.Begin);
_writingStream.Seek((long)((ulong)Marshal.SizeOf<Nhdr0Header>() + (sectorAddress * _imageInfo.SectorSize)),
SeekOrigin.Begin);
writingStream.Write(data, 0, data.Length);
_writingStream.Write(data, 0, data.Length);
ErrorMessage = "";
@@ -142,17 +142,17 @@ namespace Aaru.DiscImages
return false;
}
if(sectorAddress + length > imageInfo.Sectors)
if(sectorAddress + length > _imageInfo.Sectors)
{
ErrorMessage = "Tried to write past image size";
return false;
}
writingStream.Seek((long)((ulong)Marshal.SizeOf<Nhdr0Header>() + (sectorAddress * imageInfo.SectorSize)),
SeekOrigin.Begin);
_writingStream.Seek((long)((ulong)Marshal.SizeOf<Nhdr0Header>() + (sectorAddress * _imageInfo.SectorSize)),
SeekOrigin.Begin);
writingStream.Write(data, 0, data.Length);
_writingStream.Write(data, 0, data.Length);
ErrorMessage = "";
@@ -182,47 +182,47 @@ namespace Aaru.DiscImages
return false;
}
if(imageInfo.Cylinders == 0)
if(_imageInfo.Cylinders == 0)
{
imageInfo.Cylinders = (uint)(imageInfo.Sectors / 8 / 17);
imageInfo.Heads = 8;
imageInfo.SectorsPerTrack = 17;
_imageInfo.Cylinders = (uint)(_imageInfo.Sectors / 8 / 17);
_imageInfo.Heads = 8;
_imageInfo.SectorsPerTrack = 17;
while(imageInfo.Cylinders == 0)
while(_imageInfo.Cylinders == 0)
{
imageInfo.Heads--;
_imageInfo.Heads--;
if(imageInfo.Heads == 0)
if(_imageInfo.Heads == 0)
{
imageInfo.SectorsPerTrack--;
imageInfo.Heads = 16;
_imageInfo.SectorsPerTrack--;
_imageInfo.Heads = 16;
}
imageInfo.Cylinders = (uint)(imageInfo.Sectors / imageInfo.Heads / imageInfo.SectorsPerTrack);
_imageInfo.Cylinders = (uint)(_imageInfo.Sectors / _imageInfo.Heads / _imageInfo.SectorsPerTrack);
if(imageInfo.Cylinders == 0 &&
imageInfo.Heads == 0 &&
imageInfo.SectorsPerTrack == 0)
if(_imageInfo.Cylinders == 0 &&
_imageInfo.Heads == 0 &&
_imageInfo.SectorsPerTrack == 0)
break;
}
}
var header = new Nhdr0Header
{
szFileID = signature,
szFileID = _signature,
szComment = new byte[0x100],
dwHeadSize = Marshal.SizeOf<Nhdr0Header>(),
dwCylinder = (byte)imageInfo.Cylinders,
wHead = (byte)imageInfo.Heads,
wSect = (byte)imageInfo.SectorsPerTrack,
wSectLen = (byte)imageInfo.SectorSize,
dwCylinder = (byte)_imageInfo.Cylinders,
wHead = (byte)_imageInfo.Heads,
wSect = (byte)_imageInfo.SectorsPerTrack,
wSectLen = (byte)_imageInfo.SectorSize,
reserved2 = new byte[2],
reserved3 = new byte[0xE0]
};
if(!string.IsNullOrEmpty(imageInfo.Comments))
if(!string.IsNullOrEmpty(_imageInfo.Comments))
{
byte[] commentBytes = Encoding.GetEncoding("shift_jis").GetBytes(imageInfo.Comments);
byte[] commentBytes = Encoding.GetEncoding("shift_jis").GetBytes(_imageInfo.Comments);
Array.Copy(commentBytes, 0, header.szComment, 0,
commentBytes.Length >= 0x100 ? 0x100 : commentBytes.Length);
@@ -234,11 +234,11 @@ namespace Aaru.DiscImages
System.Runtime.InteropServices.Marshal.Copy(hdrPtr, hdr, 0, hdr.Length);
System.Runtime.InteropServices.Marshal.FreeHGlobal(hdrPtr);
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;
return true;
@@ -246,7 +246,7 @@ namespace Aaru.DiscImages
public bool SetMetadata(ImageInfo metadata)
{
imageInfo.Comments = metadata.Comments;
_imageInfo.Comments = metadata.Comments;
return true;
}
@@ -274,9 +274,9 @@ namespace Aaru.DiscImages
return false;
}
imageInfo.SectorsPerTrack = sectorsPerTrack;
imageInfo.Heads = heads;
imageInfo.Cylinders = cylinders;
_imageInfo.SectorsPerTrack = sectorsPerTrack;
_imageInfo.Heads = heads;
_imageInfo.Cylinders = cylinders;
return true;
}