Enable CA1829 and fix noncompliance

"Use Length/Count property instead of Count() when available"
This commit is contained in:
YoshiRulz 2020-06-18 07:35:13 +10:00
parent 620e54580d
commit 8e414aea29
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
20 changed files with 71 additions and 79 deletions

View File

@ -179,9 +179,6 @@
<!-- Do not use Count() or LongCount() when Any() can be used --> <!-- Do not use Count() or LongCount() when Any() can be used -->
<Rule Id="CA1827" Action="Hidden" /> <Rule Id="CA1827" Action="Hidden" />
<!-- Use Length/Count property instead of Count() when available -->
<Rule Id="CA1829" Action="Hidden" />
<!-- Dispose objects before losing scope --> <!-- Dispose objects before losing scope -->
<Rule Id="CA2000" Action="Hidden" /> <Rule Id="CA2000" Action="Hidden" />

View File

@ -802,7 +802,7 @@ namespace BizHawk.Client.Common
public MovieActionInsertFrames(int frame, List<string> newInputs) public MovieActionInsertFrames(int frame, List<string> newInputs)
{ {
FirstFrame = frame; FirstFrame = frame;
LastFrame = frame + newInputs.Count(); LastFrame = frame + newInputs.Count;
_onlyEmpty = false; _onlyEmpty = false;
_newInputs = newInputs; _newInputs = newInputs;
} }

View File

@ -1,4 +1,3 @@
using System.Linq;
using System.Text; using System.Text;
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
@ -61,7 +60,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (_machine.diskImages != null && _machine.UPDDiskDevice != null) if (_machine.diskImages != null && _machine.UPDDiskDevice != null)
{ {
sb.Append("Disk Media Imported (count: " + _machine.diskImages.Count() + ")"); sb.Append("Disk Media Imported (count: " + _machine.diskImages.Count + ")");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator);
} }
} }
@ -149,7 +148,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
return; return;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append("Tape Media Imported (count: " + _tapeInfo.Count() + ")"); sb.Append("Tape Media Imported (count: " + _tapeInfo.Count + ")");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator);
} }
@ -408,7 +407,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
sb.Append("Block: "); sb.Append("Block: ");
sb.Append("(" + (_machine.TapeDevice.CurrentDataBlockIndex + 1) + sb.Append("(" + (_machine.TapeDevice.CurrentDataBlockIndex + 1) +
" of " + _machine.TapeDevice.DataBlocks.Count() + ") " + " of " + _machine.TapeDevice.DataBlocks.Count + ") " +
_machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].BlockDescription); _machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].BlockDescription);
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
sb.Clear(); sb.Clear();

View File

@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
set set
{ {
if (value == _currentDataBlockIndex) { return; } if (value == _currentDataBlockIndex) { return; }
if (value < _dataBlocks.Count() && value >= 0) if (value < _dataBlocks.Count && value >= 0)
{ {
_currentDataBlockIndex = value; _currentDataBlockIndex = value;
_position = 0; _position = 0;
@ -233,7 +233,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// move to the next block // move to the next block
_currentDataBlockIndex++; _currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
{ {
_currentDataBlockIndex = -1; _currentDataBlockIndex = -1;
} }
@ -244,7 +244,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if ( if (
_currentDataBlockIndex < 0 && // block index is -1 _currentDataBlockIndex < 0 && // block index is -1
_dataBlocks.Count() > 0 // number of blocks is greater than 0 _dataBlocks.Count > 0 // number of blocks is greater than 0
) )
{ {
// move the index on to 0 // move the index on to 0
@ -305,7 +305,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
StringBuilder sbd = new StringBuilder(); StringBuilder sbd = new StringBuilder();
sbd.Append("("); sbd.Append("(");
sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count()); sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : "); sbd.Append(") : ");
//sbd.Append("ID" + bl.BlockID.ToString("X2") + " - "); //sbd.Append("ID" + bl.BlockID.ToString("X2") + " - ");
sbd.Append(bl.BlockDescription); sbd.Append(bl.BlockDescription);
@ -486,7 +486,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
StringBuilder sbd = new StringBuilder(); StringBuilder sbd = new StringBuilder();
sbd.Append("("); sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count()); sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : "); sbd.Append(") : ");
//sbd.Append("ID" + bl.BlockID.ToString("X2") + " - "); //sbd.Append("ID" + bl.BlockID.ToString("X2") + " - ");
sbd.Append(bl.BlockDescription); sbd.Append(bl.BlockDescription);
@ -502,17 +502,17 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// increment the current period position // increment the current period position
_position++; _position++;
if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count()) if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count)
{ {
// we have reached the end of the current block // we have reached the end of the current block
if (_dataBlocks[_currentDataBlockIndex].DataPeriods.Count() == 0) if (_dataBlocks[_currentDataBlockIndex].DataPeriods.Count == 0)
{ {
// notify about the current block (we are skipping it because its empty) // notify about the current block (we are skipping it because its empty)
var bl = _dataBlocks[_currentDataBlockIndex]; var bl = _dataBlocks[_currentDataBlockIndex];
StringBuilder sbd = new StringBuilder(); StringBuilder sbd = new StringBuilder();
sbd.Append("("); sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count()); sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : "); sbd.Append(") : ");
//sbd.Append("ID" + bl.BlockID.ToString("X2") + " - "); //sbd.Append("ID" + bl.BlockID.ToString("X2") + " - ");
sbd.Append(bl.BlockDescription); sbd.Append(bl.BlockDescription);
@ -526,7 +526,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
} }
// skip any empty blocks (and process any command blocks) // skip any empty blocks (and process any command blocks)
while (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count()) while (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count)
{ {
// check for any commands // check for any commands
var command = _dataBlocks[_currentDataBlockIndex].Command; var command = _dataBlocks[_currentDataBlockIndex].Command;
@ -546,7 +546,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_machine.CPC.OSD_TapeStoppedAuto(); _machine.CPC.OSD_TapeStoppedAuto();
shouldStop = true; shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ(); RTZ();
else else
{ {
@ -562,7 +562,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_machine.CPC.OSD_TapeStoppedAuto(); _machine.CPC.OSD_TapeStoppedAuto();
shouldStop = true; shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ(); RTZ();
else else
{ {
@ -583,14 +583,14 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_position = 0; _position = 0;
_currentDataBlockIndex++; _currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
{ {
break; break;
} }
} }
// check for end of tape // check for end of tape
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
{ {
_currentDataBlockIndex = -1; _currentDataBlockIndex = -1;
RTZ(); RTZ();

View File

@ -2498,7 +2498,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (cmd == null) if (cmd == null)
{ {
// no command found - use invalid // no command found - use invalid
CMDIndex = CommandList.Count() - 1; CMDIndex = CommandList.Count - 1;
} }
else else
{ {
@ -2522,7 +2522,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (invalid) if (invalid)
{ {
// command byte included spurious bit 5,6 or 7 flags // command byte included spurious bit 5,6 or 7 flags
CMDIndex = CommandList.Count() - 1; CMDIndex = CommandList.Count - 1;
} }
/* /*
@ -2531,7 +2531,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
(CMD_FLAG_SK && !ActiveCommand.SK)) (CMD_FLAG_SK && !ActiveCommand.SK))
{ {
// command byte included spurious bit 5,6 or 7 flags // command byte included spurious bit 5,6 or 7 flags
CMDIndex = CommandList.Count() - 1; CMDIndex = CommandList.Count - 1;
} }
*/ */
} }

View File

@ -1,7 +1,6 @@
using BizHawk.Common; using BizHawk.Common;
using BizHawk.Common.NumberExtensions; using BizHawk.Common.NumberExtensions;
using System; using System;
using System.Linq;
namespace BizHawk.Emulation.Cores.Computers.AmstradCPC namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
{ {
@ -237,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (Disk == null) if (Disk == null)
return (byte)id; return (byte)id;
if (Disk.DiskTracks.Count() == 0) if (Disk.DiskTracks.Length == 0)
return (byte)id; return (byte)id;
if (TrackIndex >= Disk.GetTrackCount()) if (TrackIndex >= Disk.GetTrackCount())
@ -305,7 +304,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public void MoveHead(SkipDirection direction, int cylinderCount) public void MoveHead(SkipDirection direction, int cylinderCount)
{ {
// get total tracks // get total tracks
int trackCount = Disk.DiskTracks.Count(); int trackCount = Disk.DiskTracks.Length;
int trk = 0; int trk = 0;

View File

@ -1255,7 +1255,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
Phases.Add(phase); Phases.Add(phase);
} }
public int PhaseCount => Phases.Count(); public int PhaseCount => Phases.Count;
public void Clear(int screenMode) public void Clear(int screenMode)
{ {

View File

@ -38,13 +38,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
int tmp = value; int tmp = value;
int result = value; int result = value;
if (tapeImages == null || tapeImages.Count() == 0) if (tapeImages == null || tapeImages.Count == 0)
{ {
// no tape images found // no tape images found
return; return;
} }
if (value >= tapeImages.Count()) if (value >= tapeImages.Count)
{ {
// media at this index does not exist - loop back to 0 // media at this index does not exist - loop back to 0
result = 0; result = 0;
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
else if (value < 0) else if (value < 0)
{ {
// negative index not allowed - move to last item in the collection // negative index not allowed - move to last item in the collection
result = tapeImages.Count() - 1; result = tapeImages.Count - 1;
} }
// load the media into the tape device // load the media into the tape device
@ -75,13 +75,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
int tmp = value; int tmp = value;
int result = value; int result = value;
if (diskImages == null || diskImages.Count() == 0) if (diskImages == null || diskImages.Count == 0)
{ {
// no tape images found // no tape images found
return; return;
} }
if (value >= diskImages.Count()) if (value >= diskImages.Count)
{ {
// media at this index does not exist - loop back to 0 // media at this index does not exist - loop back to 0
result = 0; result = 0;
@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
else if (value < 0) else if (value < 0)
{ {
// negative index not allowed - move to last item in the collection // negative index not allowed - move to last item in the collection
result = diskImages.Count() - 1; result = diskImages.Count - 1;
} }
// load the media into the disk device // load the media into the disk device

View File

@ -156,7 +156,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
} }
sec.SectorData = data.ToArray(); sec.SectorData = data.ToArray();
sec.ActualDataByteLength = data.Count(); sec.ActualDataByteLength = data.Count;
sec.ContainsMultipleWeakSectors = true; sec.ContainsMultipleWeakSectors = true;
} }
} }
@ -496,7 +496,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// commit the sector data // commit the sector data
sec.SectorData = data.ToArray(); sec.SectorData = data.ToArray();
sec.ContainsMultipleWeakSectors = true; sec.ContainsMultipleWeakSectors = true;
sec.ActualDataByteLength = data.Count(); sec.ActualDataByteLength = data.Count;
} }
*/ */

View File

@ -68,7 +68,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
double multiplier = 8.0 / 7.0; double multiplier = 8.0 / 7.0;
//double cycleScale = ((40 << 16) / 35); //double cycleScale = ((40 << 16) / 35);
double origPeriods = db.DataPeriods.Count(); double origPeriods = db.DataPeriods.Count;
for (int i = 0; i < origPeriods; i++) for (int i = 0; i < origPeriods; i++)
{ {
@ -182,7 +182,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
/* /*
// convert for Amstrad CPC // convert for Amstrad CPC
List<TapeDataBlock> newBlocks = new List<TapeDataBlock>(); List<TapeDataBlock> newBlocks = new List<TapeDataBlock>();
for (int i = 0; i < _datacorder.DataBlocks.Count(); i++) for (int i = 0; i < _datacorder.DataBlocks.Count; i++)
{ {
newBlocks.Add(ConvertClock(_datacorder.DataBlocks[i])); newBlocks.Add(ConvertClock(_datacorder.DataBlocks[i]));
} }
@ -1002,7 +1002,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}; };
// loop should start from the next block // loop should start from the next block
int loopStart = _datacorder.DataBlocks.Count() + 1; int loopStart = _datacorder.DataBlocks.Count + 1;
int numberOfRepetitions = GetWordValue(data, _position); int numberOfRepetitions = GetWordValue(data, _position);
@ -1050,7 +1050,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
} }
// get the number of blocks to loop // get the number of blocks to loop
int blockCnt = _datacorder.DataBlocks.Count() - loopStart; int blockCnt = _datacorder.DataBlocks.Count - loopStart;
// loop through each group to repeat // loop through each group to repeat
for (int b = 0; b < numberOfRepetitions; b++) for (int b = 0; b < numberOfRepetitions; b++)

View File

@ -48,13 +48,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{ {
get get
{ {
if (_dataBlocks.Count() > 0) { return _currentDataBlockIndex; } if (_dataBlocks.Count > 0) { return _currentDataBlockIndex; }
else { return -1; } else { return -1; }
} }
set set
{ {
if (value == _currentDataBlockIndex) { return; } if (value == _currentDataBlockIndex) { return; }
if (value < _dataBlocks.Count() && value >= 0) if (value < _dataBlocks.Count && value >= 0)
{ {
_currentDataBlockIndex = value; _currentDataBlockIndex = value;
_position = 0; _position = 0;
@ -204,7 +204,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// move to the next block // move to the next block
_currentDataBlockIndex++; _currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
{ {
_currentDataBlockIndex = -1; _currentDataBlockIndex = -1;
} }
@ -215,7 +215,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if ( if (
_currentDataBlockIndex < 0 && // block index is -1 _currentDataBlockIndex < 0 && // block index is -1
_dataBlocks.Count() > 0 // number of blocks is greater than 0 _dataBlocks.Count > 0 // number of blocks is greater than 0
) )
{ {
// move the index on to 0 // move the index on to 0
@ -276,7 +276,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StringBuilder sbd = new StringBuilder(); StringBuilder sbd = new StringBuilder();
sbd.Append("("); sbd.Append("(");
sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count()); sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : "); sbd.Append(") : ");
sbd.Append(bl.BlockDescription); sbd.Append(bl.BlockDescription);
if (bl.MetaData.Count > 0) if (bl.MetaData.Count > 0)
@ -492,7 +492,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StringBuilder sbd = new StringBuilder(); StringBuilder sbd = new StringBuilder();
sbd.Append("("); sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count()); sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : "); sbd.Append(") : ");
sbd.Append(bl.BlockDescription); sbd.Append(bl.BlockDescription);
if (bl.MetaData.Count > 0) if (bl.MetaData.Count > 0)
@ -506,16 +506,16 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// increment the current period position // increment the current period position
_position++; _position++;
if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count()) if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count)
{ {
// we have reached the end of the current block // we have reached the end of the current block
if (_dataBlocks[_currentDataBlockIndex].DataPeriods.Count() == 0) if (_dataBlocks[_currentDataBlockIndex].DataPeriods.Count == 0)
{ {
// notify about the current block (we are skipping it because its empty) // notify about the current block (we are skipping it because its empty)
var bl = _dataBlocks[_currentDataBlockIndex]; var bl = _dataBlocks[_currentDataBlockIndex];
StringBuilder sbd = new StringBuilder(); StringBuilder sbd = new StringBuilder();
sbd.Append("("); sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count()); sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : "); sbd.Append(") : ");
sbd.Append(bl.BlockDescription); sbd.Append(bl.BlockDescription);
if (bl.MetaData.Count > 0) if (bl.MetaData.Count > 0)
@ -528,7 +528,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
} }
// skip any empty blocks (and process any command blocks) // skip any empty blocks (and process any command blocks)
while (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count()) while (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count)
{ {
// check for any commands // check for any commands
var command = _dataBlocks[_currentDataBlockIndex].Command; var command = _dataBlocks[_currentDataBlockIndex].Command;
@ -543,7 +543,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_machine.Spectrum.OSD_TapeStoppedAuto(); _machine.Spectrum.OSD_TapeStoppedAuto();
shouldStop = true; shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ(); RTZ();
else else
{ {
@ -558,7 +558,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_machine.Spectrum.OSD_TapeStoppedAuto(); _machine.Spectrum.OSD_TapeStoppedAuto();
shouldStop = true; shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ(); RTZ();
else else
{ {
@ -576,14 +576,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_position = 0; _position = 0;
_currentDataBlockIndex++; _currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
{ {
break; break;
} }
} }
// check for end of tape // check for end of tape
if (_currentDataBlockIndex >= _dataBlocks.Count()) if (_currentDataBlockIndex >= _dataBlocks.Count)
{ {
_currentDataBlockIndex = -1; _currentDataBlockIndex = -1;
RTZ(); RTZ();
@ -592,7 +592,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
} }
// update waitEdge with current position within the current block // update waitEdge with current position within the current block
_waitEdge = _dataBlocks[_currentDataBlockIndex].DataPeriods.Count() > 0 ? _dataBlocks[_currentDataBlockIndex].DataPeriods[_position] : 0; _waitEdge = _dataBlocks[_currentDataBlockIndex].DataPeriods.Count > 0 ? _dataBlocks[_currentDataBlockIndex].DataPeriods[_position] : 0;
// flip the current state // flip the current state
FlipTapeState(); FlipTapeState();

View File

@ -2522,7 +2522,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (cmd == null) if (cmd == null)
{ {
// no command found - use invalid // no command found - use invalid
CMDIndex = CommandList.Count() - 1; CMDIndex = CommandList.Count - 1;
} }
else else
{ {
@ -2546,7 +2546,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (invalid) if (invalid)
{ {
// command byte included spurious bit 5,6 or 7 flags // command byte included spurious bit 5,6 or 7 flags
CMDIndex = CommandList.Count() - 1; CMDIndex = CommandList.Count - 1;
} }
/* /*
@ -2555,7 +2555,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
(CMD_FLAG_SK && !ActiveCommand.SK)) (CMD_FLAG_SK && !ActiveCommand.SK))
{ {
// command byte included spurious bit 5,6 or 7 flags // command byte included spurious bit 5,6 or 7 flags
CMDIndex = CommandList.Count() - 1; CMDIndex = CommandList.Count - 1;
} }
*/ */
} }

View File

@ -1,7 +1,6 @@
using BizHawk.Common; using BizHawk.Common;
using BizHawk.Common.NumberExtensions; using BizHawk.Common.NumberExtensions;
using System; using System;
using System.Linq;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{ {
@ -237,7 +236,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (Disk == null) if (Disk == null)
return (byte)id; return (byte)id;
if (Disk.DiskTracks.Count() == 0) if (Disk.DiskTracks.Length == 0)
return (byte)id; return (byte)id;
if (TrackIndex >= Disk.GetTrackCount()) if (TrackIndex >= Disk.GetTrackCount())
@ -298,7 +297,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
public void MoveHead(SkipDirection direction, int cylinderCount) public void MoveHead(SkipDirection direction, int cylinderCount)
{ {
// get total tracks // get total tracks
int trackCount = Disk.DiskTracks.Count(); int trackCount = Disk.DiskTracks.Length;
int trk = 0; int trk = 0;

View File

@ -282,7 +282,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{ {
var jCollection = new List<IJoystick>(); var jCollection = new List<IJoystick>();
for (int i = 0; i < joys.Count(); i++) for (int i = 0; i < joys.Count; i++)
{ {
jCollection.Add(InstantiateJoystick(joys[i], i + 1)); jCollection.Add(InstantiateJoystick(joys[i], i + 1));
} }

View File

@ -44,13 +44,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
int tmp = value; int tmp = value;
int result = value; int result = value;
if (tapeImages == null || tapeImages.Count() == 0) if (tapeImages == null || tapeImages.Count == 0)
{ {
// no tape images found // no tape images found
return; return;
} }
if (value >= tapeImages.Count()) if (value >= tapeImages.Count)
{ {
// media at this index does not exist - loop back to 0 // media at this index does not exist - loop back to 0
result = 0; result = 0;
@ -58,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
else if (value < 0) else if (value < 0)
{ {
// negative index not allowed - move to last item in the collection // negative index not allowed - move to last item in the collection
result = tapeImages.Count() - 1; result = tapeImages.Count - 1;
} }
// load the media into the tape device // load the media into the tape device
@ -84,13 +84,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
int tmp = value; int tmp = value;
int result = value; int result = value;
if (diskImages == null || diskImages.Count() == 0) if (diskImages == null || diskImages.Count == 0)
{ {
// no tape images found // no tape images found
return; return;
} }
if (value >= diskImages.Count()) if (value >= diskImages.Count)
{ {
// media at this index does not exist - loop back to 0 // media at this index does not exist - loop back to 0
result = 0; result = 0;
@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
else if (value < 0) else if (value < 0)
{ {
// negative index not allowed - move to last item in the collection // negative index not allowed - move to last item in the collection
result = diskImages.Count() - 1; result = diskImages.Count - 1;
} }
// load the media into the disk device // load the media into the disk device

View File

@ -156,7 +156,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
} }
sec.SectorData = data.ToArray(); sec.SectorData = data.ToArray();
sec.ActualDataByteLength = data.Count(); sec.ActualDataByteLength = data.Count;
sec.ContainsMultipleWeakSectors = true; sec.ContainsMultipleWeakSectors = true;
} }
} }
@ -496,7 +496,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// commit the sector data // commit the sector data
sec.SectorData = data.ToArray(); sec.SectorData = data.ToArray();
sec.ContainsMultipleWeakSectors = true; sec.ContainsMultipleWeakSectors = true;
sec.ActualDataByteLength = data.Count(); sec.ActualDataByteLength = data.Count;
} }
*/ */

View File

@ -66,7 +66,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
var IMGEblocks = blocks.Where(a => a.RecordType == RecordHeaderType.IMGE).ToList(); var IMGEblocks = blocks.Where(a => a.RecordType == RecordHeaderType.IMGE).ToList();
var DATAblocks = blocks.Where(a => a.RecordType == RecordHeaderType.DATA); var DATAblocks = blocks.Where(a => a.RecordType == RecordHeaderType.DATA);
DiskHeader.NumberOfTracks = (byte)(IMGEblocks.Count()); DiskHeader.NumberOfTracks = (byte)(IMGEblocks.Count);
DiskHeader.NumberOfSides = (byte)(infoBlock.INFOmaxSide + 1); DiskHeader.NumberOfSides = (byte)(infoBlock.INFOmaxSide + 1);
DiskTracks = new Track[DiskHeader.NumberOfTracks]; DiskTracks = new Track[DiskHeader.NumberOfTracks];

View File

@ -922,7 +922,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
t.BlockDescription = BlockType.Loop_Start; t.BlockDescription = BlockType.Loop_Start;
// loop should start from the next block // loop should start from the next block
int loopStart = _datacorder.DataBlocks.Count() + 1; int loopStart = _datacorder.DataBlocks.Count + 1;
int numberOfRepetitions = GetWordValue(data, _position); int numberOfRepetitions = GetWordValue(data, _position);
@ -968,7 +968,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
} }
// get the number of blocks to loop // get the number of blocks to loop
int blockCnt = _datacorder.DataBlocks.Count() - loopStart; int blockCnt = _datacorder.DataBlocks.Count - loopStart;
// loop through each group to repeat // loop through each group to repeat
for (int b = 0; b < numberOfRepetitions; b++) for (int b = 0; b < numberOfRepetitions; b++)

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Linq;
using System.Text; using System.Text;
namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
@ -62,7 +61,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (_machine.diskImages != null && _machine.UPDDiskDevice != null) if (_machine.diskImages != null && _machine.UPDDiskDevice != null)
{ {
sb.Append("Disk Media Imported (count: " + _machine.diskImages.Count() + ")"); sb.Append("Disk Media Imported (count: " + _machine.diskImages.Count + ")");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator);
} }
} }
@ -149,7 +148,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
return; return;
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.Append("Tape Media Imported (count: " + _tapeInfo.Count() + ")"); sb.Append("Tape Media Imported (count: " + _tapeInfo.Count + ")");
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Emulator);
} }
@ -380,7 +379,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
sb.Append("Block: "); sb.Append("Block: ");
sb.Append("(" + (_machine.TapeDevice.CurrentDataBlockIndex + 1) + sb.Append("(" + (_machine.TapeDevice.CurrentDataBlockIndex + 1) +
" of " + _machine.TapeDevice.DataBlocks.Count() + ") " + " of " + _machine.TapeDevice.DataBlocks.Count + ") " +
_machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].BlockDescription); _machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].BlockDescription);
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape); SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
sb.Clear(); sb.Clear();

View File

@ -1,5 +1,4 @@
using System; using System;
using System.Linq;
using BizHawk.Common; using BizHawk.Common;
namespace BizHawk.Emulation.Cores.Nintendo.NES namespace BizHawk.Emulation.Cores.Nintendo.NES
@ -154,7 +153,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ //Of course, we gotta emulate the behaviour. { //Of course, we gotta emulate the behaviour.
for (int i = 0; i < (Cart.PrgSize / 4); i++) for (int i = 0; i < (Cart.PrgSize / 4); i++)
increment_flash_write_count(i, true); increment_flash_write_count(i, true);
for (int i = 0; i < flash_rom.Count(); i++) for (int i = 0; i < flash_rom.Length; i++)
flash_rom[Cart.PrgSize + i] = 0xFF; flash_rom[Cart.PrgSize + i] = 0xFF;
} }
else if (value == 0x30) else if (value == 0x30)