mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Inline temporary variable.
This commit is contained in:
@@ -165,7 +165,6 @@ partial class Dump
|
||||
}
|
||||
|
||||
uint blocksToRead = scsiReader.BlocksToRead;
|
||||
uint logicalBlockSize = blockSize;
|
||||
uint physicalBlockSize = scsiReader.PhysicalBlockSize;
|
||||
|
||||
if(blocks == 0)
|
||||
@@ -794,7 +793,7 @@ partial class Dump
|
||||
|
||||
sidecar.BlockMedia[0].LogicalBlocks = blocks;
|
||||
sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = logicalBlockSize;
|
||||
sidecar.BlockMedia[0].LogicalBlockSize = blockSize;
|
||||
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
|
||||
sidecar.BlockMedia[0].Model = _dev.Model;
|
||||
|
||||
|
||||
@@ -93,9 +93,8 @@ static partial class Usb
|
||||
|
||||
// now we can get some more detailed information
|
||||
var nRequiredSize = 0;
|
||||
const int nBytes = BUFFER_SIZE;
|
||||
|
||||
if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, nBytes, ref nRequiredSize, ref da))
|
||||
if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, BUFFER_SIZE, ref nRequiredSize, ref da))
|
||||
{
|
||||
host._controllerDevicePath = didd.DevicePath;
|
||||
|
||||
@@ -131,11 +130,10 @@ static partial class Usb
|
||||
static string GetDescriptionByKeyName(string driverKeyName)
|
||||
{
|
||||
var ans = "";
|
||||
const string devEnum = REGSTR_KEY_USB;
|
||||
|
||||
// Use the "enumerator form" of the SetupDiGetClassDevs API
|
||||
// to generate a list of all USB devices
|
||||
IntPtr h = SetupDiGetClassDevs(0, devEnum, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
|
||||
IntPtr h = SetupDiGetClassDevs(0, REGSTR_KEY_USB, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
|
||||
|
||||
if(h == _invalidHandleValue)
|
||||
return ans;
|
||||
@@ -190,11 +188,10 @@ static partial class Usb
|
||||
static string GetInstanceIdByKeyName(string driverKeyName)
|
||||
{
|
||||
var ans = "";
|
||||
const string devEnum = REGSTR_KEY_USB;
|
||||
|
||||
// Use the "enumerator form" of the SetupDiGetClassDevs API
|
||||
// to generate a list of all USB devices
|
||||
IntPtr h = SetupDiGetClassDevs(0, devEnum, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
|
||||
IntPtr h = SetupDiGetClassDevs(0, REGSTR_KEY_USB, IntPtr.Zero, DIGCF_PRESENT | DIGCF_ALLCLASSES);
|
||||
|
||||
if(h == _invalidHandleValue)
|
||||
return ans;
|
||||
@@ -227,9 +224,8 @@ static partial class Usb
|
||||
// is it a match?
|
||||
if(keyName == driverKeyName)
|
||||
{
|
||||
const int nBytes = BUFFER_SIZE;
|
||||
var sb = new StringBuilder(nBytes);
|
||||
SetupDiGetDeviceInstanceId(h, ref da, sb, nBytes, out requiredSize);
|
||||
var sb = new StringBuilder(BUFFER_SIZE);
|
||||
SetupDiGetDeviceInstanceId(h, ref da, sb, BUFFER_SIZE, out requiredSize);
|
||||
ans = sb.ToString();
|
||||
|
||||
break;
|
||||
|
||||
@@ -241,9 +241,8 @@ static partial class Usb
|
||||
|
||||
// now we can get some more detailed information
|
||||
var nRequiredSize = 0;
|
||||
const int nBytes = BUFFER_SIZE;
|
||||
|
||||
if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, nBytes, ref nRequiredSize, ref da))
|
||||
if(SetupDiGetDeviceInterfaceDetail(h, ref dia, ref didd, BUFFER_SIZE, ref nRequiredSize, ref da))
|
||||
if(GetDeviceNumber(didd.DevicePath) == devNum)
|
||||
{
|
||||
// current InstanceID is at the "USBSTOR" level, so we
|
||||
@@ -251,8 +250,8 @@ static partial class Usb
|
||||
CM_Get_Parent(out IntPtr ptrPrevious, da.DevInst, 0);
|
||||
|
||||
// Now we get the InstanceID of the USB level device
|
||||
IntPtr ptrInstanceBuf = Marshal.AllocHGlobal(nBytes);
|
||||
CM_Get_Device_ID(ptrPrevious, ptrInstanceBuf, nBytes, 0);
|
||||
nint ptrInstanceBuf = Marshal.AllocHGlobal(BUFFER_SIZE);
|
||||
CM_Get_Device_ID(ptrPrevious, ptrInstanceBuf, BUFFER_SIZE, 0);
|
||||
instanceId = Marshal.PtrToStringAuto(ptrInstanceBuf);
|
||||
|
||||
Marshal.FreeHGlobal(ptrInstanceBuf);
|
||||
|
||||
@@ -445,20 +445,19 @@ public sealed class BlockMap : ItemsControl
|
||||
using var ctx = new DrawingContext(ctxi, false);
|
||||
|
||||
int squareWidth = (sideLength - 2 * borderWidth) / colors.Length;
|
||||
int squareHeight = squareWidth;
|
||||
var x = 0;
|
||||
var y = 0;
|
||||
|
||||
foreach(Color color in colors)
|
||||
{
|
||||
ctx.FillRectangle(new SolidColorBrush(color), new Rect(x, y, squareWidth, squareHeight));
|
||||
ctx.FillRectangle(new SolidColorBrush(color), new Rect(x, y, squareWidth, squareWidth));
|
||||
x += squareWidth + 2 * borderWidth;
|
||||
|
||||
if(x < sideLength)
|
||||
continue;
|
||||
|
||||
x = 0;
|
||||
y += squareHeight + 2 * borderWidth;
|
||||
y += squareWidth + 2 * borderWidth;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -457,7 +457,6 @@ public sealed partial class Alcohol120
|
||||
|
||||
foreach(CommonTypes.Structs.Track track in tracks.OrderBy(t => t.Sequence))
|
||||
{
|
||||
CommonTypes.Structs.Track newTrack = track;
|
||||
uint subchannelSize;
|
||||
|
||||
switch(track.SubchannelType)
|
||||
@@ -477,12 +476,12 @@ public sealed partial class Alcohol120
|
||||
return false;
|
||||
}
|
||||
|
||||
newTrack.FileOffset = currentDataOffset;
|
||||
track.FileOffset = currentDataOffset;
|
||||
|
||||
currentDataOffset += (ulong)(newTrack.RawBytesPerSector + subchannelSize) *
|
||||
(newTrack.EndSector - newTrack.StartSector + 1);
|
||||
currentDataOffset += (ulong)(track.RawBytesPerSector + subchannelSize) *
|
||||
(track.EndSector - track.StartSector + 1);
|
||||
|
||||
_writingTracks.Add(newTrack);
|
||||
_writingTracks.Add(track);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -468,18 +468,16 @@ public sealed partial class Cdrdao
|
||||
return false;
|
||||
}
|
||||
|
||||
Track newTrack = track;
|
||||
|
||||
newTrack.File = _separateTracksWriting ? _writingBaseName + $"_track{track.Sequence:D2}.bin"
|
||||
track.File = _separateTracksWriting ? _writingBaseName + $"_track{track.Sequence:D2}.bin"
|
||||
: _writingBaseName + ".bin";
|
||||
|
||||
newTrack.FileOffset = _separateTracksWriting ? 0 : currentOffset;
|
||||
_writingTracks.Add(newTrack);
|
||||
track.FileOffset = _separateTracksWriting ? 0 : currentOffset;
|
||||
_writingTracks.Add(track);
|
||||
|
||||
currentOffset += (ulong)newTrack.RawBytesPerSector * (newTrack.EndSector - newTrack.StartSector + 1);
|
||||
currentOffset += (ulong)track.RawBytesPerSector * (track.EndSector - track.StartSector + 1);
|
||||
|
||||
if(track.SubchannelType != TrackSubchannelType.None)
|
||||
currentOffset += 96 * (newTrack.EndSector - newTrack.StartSector + 1);
|
||||
currentOffset += 96 * (track.EndSector - track.StartSector + 1);
|
||||
}
|
||||
|
||||
_writingStreams = new Dictionary<uint, FileStream>();
|
||||
|
||||
@@ -389,13 +389,11 @@ public sealed partial class CdrWin
|
||||
|
||||
foreach(Track track in tracks.OrderBy(t => t.Sequence))
|
||||
{
|
||||
Track newTrack = track;
|
||||
|
||||
newTrack.File = _separateTracksWriting ? _writingBaseName + $"_track{track.Sequence:D2}.bin"
|
||||
track.File = _separateTracksWriting ? _writingBaseName + $"_track{track.Sequence:D2}.bin"
|
||||
: _writingBaseName + ".bin";
|
||||
|
||||
newTrack.FileOffset = _separateTracksWriting ? 0 : track.StartSector * 2352;
|
||||
_writingTracks.Add(newTrack);
|
||||
track.FileOffset = _separateTracksWriting ? 0 : track.StartSector * 2352;
|
||||
_writingTracks.Add(track);
|
||||
}
|
||||
|
||||
_writingStreams = new Dictionary<uint, FileStream>();
|
||||
|
||||
Reference in New Issue
Block a user