Use Count or Length instead of Count() or no-param Any()

This commit is contained in:
YoshiRulz 2019-03-24 19:21:47 +10:00
parent d54146791e
commit e790d904cb
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
59 changed files with 164 additions and 182 deletions

View File

@ -87,7 +87,7 @@ namespace BizHawk.Client.ApiHawk
BizHawk.Common.Win32Hacks.RemoveMOTW(fileName);
externalToolFile = Assembly.LoadFrom(fileName);
object[] attributes = externalToolFile.GetCustomAttributes(typeof(BizHawkExternalToolAttribute), false);
if (attributes != null && attributes.Count() == 1)
if (attributes != null && attributes.Length == 1)
{
BizHawkExternalToolAttribute attribute = (BizHawkExternalToolAttribute)attributes[0];
item = new ToolStripMenuItem(attribute.Name);
@ -110,7 +110,7 @@ namespace BizHawk.Client.ApiHawk
item.Tag = fileName;
attributes = externalToolFile.GetCustomAttributes(typeof(BizHawkExternalToolUsageAttribute), false);
if (attributes != null && attributes.Count() == 1)
if (attributes != null && attributes.Length == 1)
{
BizHawkExternalToolUsageAttribute attribute2 = (BizHawkExternalToolUsageAttribute)attributes[0];
if(Global.Emulator.SystemId == "NULL" && attribute2.ToolUsage != BizHawkExternalToolUsage.Global)

View File

@ -32,7 +32,7 @@ namespace BizHawk.Client.Common
public bool Frozen { get; set; }
[JsonIgnore]
public bool Empty => !recentlist.Any();
public bool Empty => Count == 0;
[JsonIgnore]
public int Count => recentlist.Count;

View File

@ -779,31 +779,20 @@ namespace BizHawk.Client.Common
break;
case "SAT":
var saturnDiscs = DiscsFromXml(xmlGame, "SAT", DiscType.SegaSaturn);
if (!saturnDiscs.Any())
{
return false;
}
if (saturnDiscs.Count == 0) return false;
nextEmulator = new Saturnus(nextComm, saturnDiscs, Deterministic,
(Saturnus.Settings)GetCoreSettings<Saturnus>(), (Saturnus.SyncSettings)GetCoreSyncSettings<Saturnus>());
break;
case "PCFX":
var pcfxDiscs = DiscsFromXml(xmlGame, "PCFX", DiscType.PCFX);
if (!pcfxDiscs.Any())
{
return false;
}
if (pcfxDiscs.Count == 0) return false;
nextEmulator = new Tst(nextComm, pcfxDiscs,
(Tst.Settings)GetCoreSettings<Tst>(), (Tst.SyncSettings)GetCoreSyncSettings<Tst>());
break;
case "GEN":
// We are assuming discs only, for now
var genDiscs = DiscsFromXml(xmlGame, "GEN", DiscType.MegaCD);
if (!genDiscs.Any())
{
return false;
}
if (genDiscs.Count == 0) return false;
nextEmulator = new GPGX(nextComm, null, genDiscs, GetCoreSettings<GPGX>(), GetCoreSyncSettings<GPGX>());
break;
case "Game Gear":

View File

@ -78,7 +78,7 @@ namespace BizHawk.Client.Common
});
}
if (Global.UserBag.Any())
if (Global.UserBag.Count > 0)
{
bs.PutLump(BinaryStateLump.UserData,
delegate(TextWriter tw)

View File

@ -107,7 +107,7 @@ __Types and notation__
var sb = new StringBuilder();
if (f.ParameterList.Any())
if (f.ParameterList.Length > 0)
{
sb
.Append($"{f.Library}.{f.Name}(");

View File

@ -207,7 +207,7 @@ namespace BizHawk.Client.Common
{
get
{
if (ControlsFromLog.Any())
if (ControlsFromLog.Count > 0)
{
return ControlsFromLog;
}

View File

@ -22,7 +22,7 @@ namespace BizHawk.Client.Common
public virtual void StartNewRecording()
{
Mode = Moviemode.Record;
if (Global.Config.EnableBackupMovies && MakeBackup && Log.Any())
if (Global.Config.EnableBackupMovies && MakeBackup && Log.Count > 0)
{
SaveBackup();
MakeBackup = false;

View File

@ -39,7 +39,7 @@ namespace BizHawk.Client.Common
// We are in record mode so replace the movie log with the one from the savestate
if (!Global.MovieSession.MultiTrack.IsActive)
{
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Any())
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Count > 0)
{
SaveBackup();
_makeBackup = false;

View File

@ -22,7 +22,7 @@ namespace BizHawk.Client.Common
public void StartNewRecording()
{
_mode = Moviemode.Record;
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Any())
if (Global.Config.EnableBackupMovies && _makeBackup && _log.Count > 0)
{
SaveBackup();
_makeBackup = false;

View File

@ -129,7 +129,7 @@ namespace BizHawk.Client.Common
// TODO: consider making this IEnumerable<int> instead of forcing the collection to be an array
public void RemoveFrames(int[] frames)
{
if (frames.Any())
if (frames.Length > 0)
{
var invalidateAfter = frames.Min();
@ -316,7 +316,7 @@ namespace BizHawk.Client.Common
ExtendMovieForEdit(states.Count + frame - Log.Count);
}
ChangeLog.AddGeneralUndo(frame, frame + inputStates.Count() - 1, "Copy Over Input: " + frame);
ChangeLog.AddGeneralUndo(frame, frame + states.Count - 1, "Copy Over Input: " + frame);
for (int i = 0; i < states.Count; i++)
{

View File

@ -54,12 +54,12 @@ namespace BizHawk.Client.Common
bs.PutLump(BinaryStateLump.ClientSettings, (TextWriter tw) => tw.Write(clientSettingsJson));
}
if (VerificationLog.Any())
if (VerificationLog.Count > 0)
{
bs.PutLump(BinaryStateLump.VerificationLog, tw => tw.WriteLine(InputLogToString(VerificationLog)));
}
if (Branches.Any())
if (Branches.Count > 0)
{
Branches.Save(bs);
}

View File

@ -109,7 +109,7 @@ namespace BizHawk.Client.Common
{
_defaultFileName = defaultFileName;
if (_cheatList.Any() && _changes && autosave)
if (_cheatList.Count > 0 && _changes && autosave)
{
if (string.IsNullOrEmpty(_currentFileName))
{
@ -341,7 +341,7 @@ namespace BizHawk.Client.Common
{
if (Global.Config.CheatsAutoSaveOnClose)
{
if (Changes && _cheatList.Any())
if (Changes && _cheatList.Count > 0)
{
if (string.IsNullOrWhiteSpace(_currentFileName))
{
@ -350,7 +350,7 @@ namespace BizHawk.Client.Common
SaveFile(_currentFileName);
}
else if (!_cheatList.Any() && !string.IsNullOrWhiteSpace(_currentFileName))
else if (_cheatList.Count == 0 && !string.IsNullOrWhiteSpace(_currentFileName))
{
new FileInfo(_currentFileName).Delete();
}

View File

@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
{
var possibleTypes = ReflectionUtil.GetTypeByName(name);
if (possibleTypes.Any())
if (possibleTypes.Length > 0)
{
return Activator.CreateInstance(possibleTypes.First());
}
@ -116,7 +116,7 @@ namespace BizHawk.Client.EmuHawk
{
var possibleTypes = ReflectionUtil.GetTypeByName(name);
if (possibleTypes.Any())
if (possibleTypes.Length > 0)
{
return Activator.CreateInstance(possibleTypes.First());
}

View File

@ -24,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
var visibleColumns = _columns.VisibleColumns.ToList();
if (visibleColumns.Any())
if (visibleColumns.Count > 0)
{
DrawColumnBg(e, visibleColumns);
DrawColumnText(e, visibleColumns);
@ -283,7 +283,7 @@ namespace BizHawk.Client.EmuHawk
start += CellHeight;
}
if (visibleColumns.Any())
if (visibleColumns.Count > 0)
{
_gdi.Line(1, start, ColumnWidth, start);
}
@ -305,7 +305,7 @@ namespace BizHawk.Client.EmuHawk
}
// Draw right most line
if (visibleColumns.Any())
if (visibleColumns.Count > 0)
{
int right = TotalColWidth.Value - _hBar.Value;
_gdi.Line(right, 0, right, bottomEdge);
@ -422,7 +422,7 @@ namespace BizHawk.Client.EmuHawk
_gdi.Line(x, y, x, Height - 1);
}
if (visibleColumns.Any())
if (visibleColumns.Count > 0)
{
_gdi.Line(totalColWidth.Value - _hBar.Value, y, totalColWidth.Value - _hBar.Value, Height - 1);
}
@ -435,7 +435,7 @@ namespace BizHawk.Client.EmuHawk
}
}
if (_selectedItems.Any())
if (_selectedItems.Count > 0)
{
DoSelectionBG(e, visibleColumns);
}

View File

@ -1108,7 +1108,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (ModifierKeys == Keys.Shift && (CurrentCell.Column.Name == "FrameColumn" || CurrentCell.Column.Type == RollColumn.InputType.Text))
{
if (_selectedItems.Any())
if (_selectedItems.Count > 0)
{
if (FullRowSelect)
{
@ -1181,7 +1181,7 @@ namespace BizHawk.Client.EmuHawk
}
else if (ModifierKeys != Keys.Shift)
{
var hadIndex = _selectedItems.Any();
var hadIndex = _selectedItems.Count > 0;
_selectedItems.Clear();
SelectCell(CurrentCell);
}
@ -1619,7 +1619,7 @@ namespace BizHawk.Client.EmuHawk
{
if (HorizontalOrientation)
{
_vBar.Maximum = ((columns.Count() * CellHeight) - DrawHeight) + _vBar.LargeChange;
_vBar.Maximum = ((columns.Count * CellHeight) - DrawHeight) + _vBar.LargeChange;
}
else
{
@ -1758,7 +1758,7 @@ namespace BizHawk.Client.EmuHawk
var columns = _columns.VisibleColumns.ToList();
// If pointing to a column header
if (columns.Any())
if (columns.Count > 0)
{
if (HorizontalOrientation)
{

View File

@ -183,7 +183,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
if (messages.Any())
if (messages.Count > 0)
{
int i = messages.Count - 1;

View File

@ -335,7 +335,7 @@ namespace BizHawk.Client.EmuHawk
GlobalWin.Tools.Load<Cheats>();
break;
case "Toggle All Cheats":
if (Global.CheatList.Any())
if (Global.CheatList.Count > 0)
{
string type = " (mixed)";
if (Global.CheatList.All(c => c.Enabled))

View File

@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk
RegionComboBox.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region)));
RegionComboBox.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), _syncSettings.RegionOverride);
if (_syncSettings.InitialWRamStatePattern != null && _syncSettings.InitialWRamStatePattern.Any())
if (_syncSettings.InitialWRamStatePattern != null && _syncSettings.InitialWRamStatePattern.Count > 0)
{
var sb = new StringBuilder();
foreach (var b in _syncSettings.InitialWRamStatePattern)

View File

@ -453,8 +453,8 @@ namespace BizHawk.Client.EmuHawk
var FramesItem = new ListViewItem("Frames");
FramesItem.SubItems.Add(_movieList[firstIndex].FrameCount.ToString());
DetailsView.Items.Add(FramesItem);
CommentsBtn.Enabled = _movieList[firstIndex].Comments.Any();
SubtitlesBtn.Enabled = _movieList[firstIndex].Subtitles.Any();
CommentsBtn.Enabled = _movieList[firstIndex].Comments.Count > 0;
SubtitlesBtn.Enabled = _movieList[firstIndex].Subtitles.Count > 0;
}
public double Fps(IMovie movie)

View File

@ -691,7 +691,7 @@ namespace BizHawk.Client.EmuHawk
private void ViewInHexEditorContextMenuItem_Click(object sender, EventArgs e)
{
var selected = SelectedCheats.ToList();
if (selected.Any())
if (selected.Count > 0)
{
GlobalWin.Tools.Load<HexEditor>();

View File

@ -86,7 +86,7 @@ namespace BizHawk.Client.EmuHawk
private void DisassemblerView_QueryItemBkColor(int index, int column, ref Color color)
{
if (_disassemblyLines.Any() && index < _disassemblyLines.Count)
if (_disassemblyLines.Count > 0 && index < _disassemblyLines.Count)
{
if (_disassemblyLines[index].Address == _currentDisassemblerAddress)
{

View File

@ -208,7 +208,7 @@ namespace BizHawk.Client.EmuHawk
DataSize = (int)size;
SetDataSize(DataSize);
var addrList = addresses.ToList();
if (addrList.Any())
if (addrList.Count > 0)
{
SetDomain(domain);
SetHighlighted(addrList[0]);
@ -223,7 +223,7 @@ namespace BizHawk.Client.EmuHawk
public byte[] ConvertTextToBytes(string str)
{
if (_textTable.Any())
if (_textTable.Count > 0)
{
var byteArr = new List<byte>();
foreach (var chr in str)
@ -378,7 +378,7 @@ namespace BizHawk.Client.EmuHawk
private char Remap(byte val)
{
if (_textTable.Any())
if (_textTable.Count > 0)
{
if (_textTable.ContainsKey(val))
{
@ -681,7 +681,7 @@ namespace BizHawk.Client.EmuHawk
}
if (HighlightedAddress >= _domain.Size
|| (_secondaryHighlightedAddresses.Any() && _secondaryHighlightedAddresses.Max() >= _domain.Size))
|| (_secondaryHighlightedAddresses.Count > 0 && _secondaryHighlightedAddresses.Max() >= _domain.Size))
{
_addressHighlighted = -1;
_secondaryHighlightedAddresses.Clear();
@ -767,9 +767,9 @@ namespace BizHawk.Client.EmuHawk
if (_addressHighlighted >= 0)
{
Text += " - Editing Address 0x" + string.Format(_numDigitsStr, _addressHighlighted);
if (_secondaryHighlightedAddresses.Any())
if (_secondaryHighlightedAddresses.Count > 0)
{
Text += string.Format(" (Selected 0x{0:X})", _secondaryHighlightedAddresses.Count() +
Text += string.Format(" (Selected 0x{0:X})", _secondaryHighlightedAddresses.Count +
(_secondaryHighlightedAddresses.Contains(_addressHighlighted) ? 0 : 1));
}
}
@ -1323,7 +1323,7 @@ namespace BizHawk.Client.EmuHawk
SaveAsBinaryMenuItem.Text = "Save as binary...";
}
CloseTableFileMenuItem.Enabled = _textTable.Any();
CloseTableFileMenuItem.Enabled = _textTable.Count > 0;
}
private void SaveMenuItem_Click(object sender, EventArgs e)
@ -1469,7 +1469,7 @@ namespace BizHawk.Client.EmuHawk
var data = Clipboard.GetDataObject();
PasteMenuItem.Enabled =
_domain.CanPoke() &&
(HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Any()) &&
(HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Count > 0) &&
data != null &&
data.GetDataPresent(DataFormats.Text);
@ -1698,7 +1698,7 @@ namespace BizHawk.Client.EmuHawk
private void AddToRamWatchMenuItem_Click(object sender, EventArgs e)
{
if (HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Any())
if (HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Count > 0)
{
GlobalWin.Tools.LoadRamWatch(true);
}
@ -1755,12 +1755,12 @@ namespace BizHawk.Client.EmuHawk
addresses.Add(HighlightedAddress.Value);
}
if (_secondaryHighlightedAddresses.Any())
if (_secondaryHighlightedAddresses.Count > 0)
{
addresses.AddRange(_secondaryHighlightedAddresses);
}
if (addresses.Any())
if (addresses.Count > 0)
{
var poke = new RamPoke
{
@ -2152,14 +2152,14 @@ namespace BizHawk.Client.EmuHawk
CopyContextItem.Visible =
AddToRamWatchContextItem.Visible =
HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Any();
HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Count > 0;
FreezeContextItem.Visible =
PokeContextItem.Visible =
IncrementContextItem.Visible =
DecrementContextItem.Visible =
ContextSeparator2.Visible =
(HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Any()) &&
(HighlightedAddress.HasValue || _secondaryHighlightedAddresses.Count > 0) &&
_domain.CanPoke();
UnfreezeAllContextItem.Visible = Global.CheatList.ActiveCount > 0;
@ -2167,7 +2167,7 @@ namespace BizHawk.Client.EmuHawk
ContextSeparator1.Visible =
HighlightedAddress.HasValue ||
_secondaryHighlightedAddresses.Any() ||
_secondaryHighlightedAddresses.Count > 0 ||
(data != null && data.GetDataPresent(DataFormats.Text));
if (HighlightedAddress.HasValue && IsFrozen(HighlightedAddress.Value))

View File

@ -49,7 +49,7 @@ namespace BizHawk.Client.EmuHawk
{
bool addLibrary = true;
var attributes = lib.GetCustomAttributes(typeof(LuaLibraryAttribute), false);
if (attributes.Any())
if (attributes.Length > 0)
{
addLibrary = VersionInfo.DeveloperBuild || (attributes.First() as LuaLibraryAttribute).Released;
}
@ -74,7 +74,7 @@ namespace BizHawk.Client.EmuHawk
var methods = luaCanvas
.GetMethods()
.Where(m => m.GetCustomAttributes(typeof(LuaMethodAttribute), false).Any());
.Where(m => m.GetCustomAttributes(typeof(LuaMethodAttribute), false).Length > 0);
foreach (var method in methods)
{
@ -101,7 +101,7 @@ namespace BizHawk.Client.EmuHawk
public override void StartLuaDrawing()
{
if (ScriptList.Any() && GuiLibrary.SurfaceIsNull)
if (ScriptList.Count > 0 && GuiLibrary.SurfaceIsNull)
{
GuiLibrary.DrawNew("emu");
}
@ -109,7 +109,7 @@ namespace BizHawk.Client.EmuHawk
public override void EndLuaDrawing()
{
if (ScriptList.Any())
if (ScriptList.Count > 0)
{
GuiLibrary.DrawFinish();
}

View File

@ -800,9 +800,9 @@ namespace BizHawk.Client.EmuHawk
MoveDownMenuItem.Enabled =
LuaListView.SelectedIndices().Any();
SelectAllMenuItem.Enabled = LuaImp.ScriptList.Any();
SelectAllMenuItem.Enabled = LuaImp.ScriptList.Count > 0;
StopAllScriptsMenuItem.Enabled = LuaImp.ScriptList.Any(script => script.Enabled);
RegisteredFunctionsMenuItem.Enabled = LuaImp.GetRegisteredFunctions().Any();
RegisteredFunctionsMenuItem.Enabled = LuaImp.GetRegisteredFunctions().Count > 0;
}
private void NewScriptMenuItem_Click(object sender, EventArgs e)
@ -992,7 +992,7 @@ namespace BizHawk.Client.EmuHawk
private void InsertSeparatorMenuItem_Click(object sender, EventArgs e)
{
var indices = LuaListView.SelectedIndices().ToList();
if (indices.Any() && indices.Last() < LuaImp.ScriptList.Count)
if (indices.Count > 0 && indices[indices.Count - 1] < LuaImp.ScriptList.Count)
{
LuaImp.ScriptList.Insert(indices.Last(), LuaFile.SeparatorInstance);
}
@ -1068,7 +1068,7 @@ namespace BizHawk.Client.EmuHawk
private void RegisteredFunctionsMenuItem_Click(object sender, EventArgs e)
{
if (LuaImp.GetRegisteredFunctions().Any())
if (LuaImp.GetRegisteredFunctions().Count > 0)
{
var alreadyOpen = false;
foreach (Form form in Application.OpenForms)
@ -1225,7 +1225,7 @@ namespace BizHawk.Client.EmuHawk
private void ConsoleContextMenu_Opening(object sender, CancelEventArgs e)
{
RegisteredFunctionsContextItem.Enabled = LuaImp.GetRegisteredFunctions().Any();
RegisteredFunctionsContextItem.Enabled = LuaImp.GetRegisteredFunctions().Count > 0;
CopyContextItem.Enabled = OutputBox.SelectedText.Any();
ClearConsoleContextItem.Enabled =
SelectAllContextItem.Enabled =

View File

@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
try
{
if (_filteredList.Any() && index < _filteredList.Count)
if (_filteredList.Count > 0 && index < _filteredList.Count)
{
switch (column)
{

View File

@ -17,7 +17,7 @@ namespace BizHawk.Client.EmuHawk
public void UpdateValues()
{
if (GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any())
if (GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Count > 0)
{
PopulateListView();
}
@ -118,7 +118,7 @@ namespace BizHawk.Client.EmuHawk
var indexes = FunctionView.SelectedIndices;
CallButton.Enabled = indexes.Count > 0;
RemoveButton.Enabled = indexes.Count > 0;
RemoveAllBtn.Enabled = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Any();
RemoveAllBtn.Enabled = GlobalWin.Tools.LuaConsole.LuaImp.GetRegisteredFunctions().Count > 0;
}
private void FunctionView_KeyDown(object sender, KeyEventArgs e)

View File

@ -165,10 +165,10 @@ namespace BizHawk.Client.EmuHawk
{
if (MarkerView.AnyRowsSelected)
{
while (MarkerView.SelectedRows.Last() > Markers.Count() - 1)
while (MarkerView.SelectedRows.Last() > Markers.Count - 1)
{
MarkerView.SelectRow(Markers.Count(), false);
MarkerView.SelectRow(Markers.Count() - 1, true);
MarkerView.SelectRow(Markers.Count, false);
MarkerView.SelectRow(Markers.Count - 1, true);
}
}
@ -208,7 +208,7 @@ namespace BizHawk.Client.EmuHawk
UpdateValues();
}
MarkerView.ScrollToIndex(Markers.Count() - 1);
MarkerView.ScrollToIndex(Markers.Count - 1);
Tastudio.RefreshDialog();
}

View File

@ -990,7 +990,7 @@ namespace BizHawk.Client.EmuHawk
"Selected: " + TasView.SelectedRows.Count() + " frame" +
(TasView.SelectedRows.Count() == 1 ? "" : "s") +
", States: " + CurrentTasMovie.TasStateManager.StateCount.ToString() +
(_tasClipboard.Any()
(_tasClipboard.Count > 0
? ", Clipboard: " + _tasClipboard.Count + " frame" + (_tasClipboard.Count == 1 ? "" : "s")
: "");
}

View File

@ -240,7 +240,7 @@ namespace BizHawk.Client.EmuHawk
{
TracerBox.Text = "Trace log - logging to file...";
}
else if (_instructions.Any())
else if (_instructions.Count > 0)
{
TracerBox.Text = "Trace log - logging - " + _instructions.Count + " instructions";
}
@ -251,7 +251,7 @@ namespace BizHawk.Client.EmuHawk
}
else
{
if (_instructions.Any())
if (_instructions.Count > 0)
{
TracerBox.Text = "Trace log - " + _instructions.Count + " instructions";
}

View File

@ -84,7 +84,7 @@ namespace BizHawk.Client.EmuHawk
PadBox.Controls.Add(new VirtualPadAnalogStick
{
Name = button.Name,
SecondaryName = (button.SecondaryNames != null && button.SecondaryNames.Any()) ? button.SecondaryNames[0] : "",
SecondaryName = (button.SecondaryNames != null && button.SecondaryNames.Length > 0) ? button.SecondaryNames[0] : "",
Location = UIHelper.Scale(button.Location),
Size = UIHelper.Scale(new Size(180 + 79, 200 + 9)),
RangeX = new float[] { button.MinValue, button.MidValue, button.MaxValue },

View File

@ -803,7 +803,7 @@ namespace BizHawk.Client.EmuHawk
private void RemoveAddresses()
{
var indices = SelectedIndices.ToList();
if (indices.Any())
if (indices.Count > 0)
{
SetRemovedMessage(indices.Count);
_searches.RemoveRange(indices);
@ -856,7 +856,7 @@ namespace BizHawk.Client.EmuHawk
private void AddToRamWatch()
{
var watches = SelectedWatches.ToList();
if (watches.Any())
if (watches.Count > 0)
{
GlobalWin.Tools.LoadRamWatch(true);
watches.ForEach(GlobalWin.Tools.RamWatch.AddWatch);

View File

@ -247,7 +247,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
if (_watches.Any())
if (_watches.Count > 0)
{
_watches.UpdateValues();
@ -316,7 +316,7 @@ namespace BizHawk.Client.EmuHawk
return;
}
if (_watches.Any())
if (_watches.Count > 0)
{
_watches.UpdateValues();
@ -832,7 +832,7 @@ namespace BizHawk.Client.EmuHawk
private void RemoveWatchMenuItem_Click(object sender, EventArgs e)
{
var items = SelectedItems.ToList();
if (items.Any())
if (items.Count > 0)
{
foreach (var item in items)
{
@ -884,7 +884,7 @@ namespace BizHawk.Client.EmuHawk
private void InsertSeparatorMenuItem_Click(object sender, EventArgs e)
{
var indexes = SelectedIndices.ToList();
if (indexes.Any())
if (indexes.Count > 0)
{
_watches.Insert(indexes[0], SeparatorWatch.Instance);
}
@ -907,11 +907,7 @@ namespace BizHawk.Client.EmuHawk
private void MoveUpMenuItem_Click(object sender, EventArgs e)
{
var indexes = SelectedIndices.ToList();
if (!indexes.Any() || indexes[0] == 0)
{
return;
}
if (indexes.Count == 0 || indexes[0] == 0) return;
foreach (var index in indexes)
{
var watch = _watches[index];
@ -962,10 +958,7 @@ namespace BizHawk.Client.EmuHawk
private void MoveTopMenuItem_Click(object sender, EventArgs e)
{
var indexes = SelectedIndices.ToList();
if (!indexes.Any())
{
return;
}
if (indexes.Count == 0) return;
for (int i = 0; i < indexes.Count; i++)
{
@ -1236,7 +1229,7 @@ namespace BizHawk.Client.EmuHawk
{
var selected = SelectedWatches.ToList();
if (selected.Any())
if (selected.Count > 0)
{
var debugger = GlobalWin.Tools.Load<GenericDebugger>();
@ -1251,7 +1244,7 @@ namespace BizHawk.Client.EmuHawk
{
var selected = SelectedWatches.ToList();
if (selected.Any())
if (selected.Count > 0)
{
var debugger = GlobalWin.Tools.Load<GenericDebugger>();

View File

@ -15,7 +15,7 @@ namespace BizHawk.Client.MultiHawk
{
get
{
if (this.Any())
if (this.Count > 0)
{
return this.First();
}

View File

@ -345,7 +345,7 @@ namespace BizHawk.Client.MultiHawk
ew.CoreComm = nextComm;
ew.Init();
if (EmulatorWindows.Any())
if (EmulatorWindows.Count > 0)
{
// Attempt to open the window is a smart location
var last = EmulatorWindows.Last();
@ -656,7 +656,7 @@ namespace BizHawk.Client.MultiHawk
// autohold/autofire must not be affected by the following inputs
Global.ActiveController.Overrides(Global.LuaAndAdaptor);
if (EmulatorWindows.Any())
if (EmulatorWindows.Count > 0)
{
StepRunLoop_Core();
StepRunLoop_Throttle();
@ -1075,7 +1075,7 @@ namespace BizHawk.Client.MultiHawk
private void UpdateAfterFrameChanged()
{
if (EmulatorWindows.Any())
if (EmulatorWindows.Count > 0)
{
string frame = EmulatorWindows.Master.Emulator.Frame.ToString();
@ -1098,7 +1098,7 @@ namespace BizHawk.Client.MultiHawk
private void FileSubMenu_DropDownOpened(object sender, EventArgs e)
{
SaveSessionMenuItem.Enabled = !string.IsNullOrWhiteSpace(EmulatorWindows.SessionName);
SaveSessionAsMenuItem.Enabled = EmulatorWindows.Any();
SaveSessionAsMenuItem.Enabled = EmulatorWindows.Count > 0;
}
private void LoadRomFromRecent(string rom)
@ -1113,7 +1113,7 @@ namespace BizHawk.Client.MultiHawk
{
PlayMovieMenuItem.Enabled =
RecordMovieMenuItem.Enabled =
EmulatorWindows.Any();
EmulatorWindows.Count > 0;
StopMovieMenuItem.Enabled =
RestartMovieMenuItem.Enabled =
@ -1283,7 +1283,7 @@ namespace BizHawk.Client.MultiHawk
if (ew.Emulator == Emulator)
{
if (EmulatorWindows.Any())
if (EmulatorWindows.Count > 0)
{
Emulator = EmulatorWindows.Master.Emulator;
}
@ -1327,7 +1327,7 @@ namespace BizHawk.Client.MultiHawk
private void SaveSessionAsMenuItem_Click(object sender, EventArgs e)
{
if (EmulatorWindows.Any())
if (EmulatorWindows.Count > 0)
{
var file = GetSaveFileFromUser();
if (file != null)

View File

@ -28,7 +28,7 @@ namespace BizHawk.Common
public bool CanRedo => Enabled && _curPos < _history.Count;
public bool HasHistory => Enabled && _history.Any();
public bool HasHistory => Enabled && _history.Count > 0;
public void Clear()
{

View File

@ -225,7 +225,7 @@ namespace BizHawk.Emulation.Common
public bool Any()
{
return BoolButtons.Any() || FloatControls.Any();
return BoolButtons.Count > 0 || FloatControls.Count > 0;
}
}
}

View File

@ -22,32 +22,32 @@ namespace BizHawk.Emulation.Common
// TODO: these just happen to be all the add/remove methods the client uses, to be thorough the others should be overriden as well
public void RemoveAll(IEnumerable<Action> actions)
{
var hadAny = this.Any();
var hadAny = this.Count > 0;
foreach (var action in actions)
{
Remove(action);
}
var hasAny = this.Any();
var hasAny = this.Count > 0;
Changes(hadAny, hasAny);
}
public new void Add(Action item)
{
var hadAny = this.Any();
var hadAny = this.Count > 0;
base.Add(item);
var hasAny = this.Any();
var hasAny = this.Count > 0;
Changes(hadAny, hasAny);
}
public new bool Remove(Action item)
{
var hadAny = this.Any();
var hadAny = this.Count > 0;
var result = base.Remove(item);
var hasAny = this.Any();
var hasAny = this.Count > 0;
Changes(hadAny, hasAny);

View File

@ -71,7 +71,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
StringBuilder sb = new StringBuilder();
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);
}
}
@ -163,7 +163,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
return;
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);
}
@ -422,7 +422,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
sb.Append("Block: ");
sb.Append("(" + (_machine.TapeDevice.CurrentDataBlockIndex + 1) +
" of " + _machine.TapeDevice.DataBlocks.Count() + ") " +
" of " + _machine.TapeDevice.DataBlocks.Count + ") " +
_machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].BlockDescription);
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
sb.Clear();

View File

@ -88,13 +88,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
{
get
{
if (_dataBlocks.Count() > 0) { return _currentDataBlockIndex; }
if (_dataBlocks.Count > 0) { return _currentDataBlockIndex; }
else { return -1; }
}
set
{
if (value == _currentDataBlockIndex) { return; }
if (value < _dataBlocks.Count() && value >= 0)
if (value < _dataBlocks.Count && value >= 0)
{
_currentDataBlockIndex = value;
_position = 0;
@ -258,7 +258,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// move to the next block
_currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
_currentDataBlockIndex = -1;
}
@ -269,7 +269,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (
_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
@ -331,7 +331,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
StringBuilder sbd = new StringBuilder();
sbd.Append("(");
sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count());
sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : ");
//sbd.Append("ID" + bl.BlockID.ToString("X2") + " - ");
sbd.Append(bl.BlockDescription);
@ -519,7 +519,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
StringBuilder sbd = new StringBuilder();
sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count());
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : ");
//sbd.Append("ID" + bl.BlockID.ToString("X2") + " - ");
sbd.Append(bl.BlockDescription);
@ -535,17 +535,17 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
// increment the current period position
_position++;
if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count())
if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count)
{
// 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)
var bl = _dataBlocks[_currentDataBlockIndex];
StringBuilder sbd = new StringBuilder();
sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count());
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : ");
//sbd.Append("ID" + bl.BlockID.ToString("X2") + " - ");
sbd.Append(bl.BlockDescription);
@ -559,7 +559,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
// 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
var command = _dataBlocks[_currentDataBlockIndex].Command;
@ -616,14 +616,14 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
_position = 0;
_currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
break;
}
}
// check for end of tape
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
_currentDataBlockIndex = -1;
RTZ();

View File

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

View File

@ -263,7 +263,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
if (Disk == null)
return (byte)id;
if (Disk.DiskTracks.Count() == 0)
if (Disk.DiskTracks.Length == 0)
return (byte)id;
if (TrackIndex >= Disk.GetTrackCount())

View File

@ -1327,7 +1327,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
public int PhaseCount
{
get { return Phases.Count(); }
get { return Phases.Count; }
}
public void Clear(int screenMode)

View File

@ -38,13 +38,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
int tmp = value;
int result = value;
if (tapeImages == null || tapeImages.Count() == 0)
if (tapeImages == null || tapeImages.Count == 0)
{
// no tape images found
return;
}
if (value >= tapeImages.Count())
if (value >= tapeImages.Count)
{
// media at this index does not exist - loop back to 0
result = 0;
@ -52,7 +52,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
else if (value < 0)
{
// 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
@ -75,13 +75,13 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
int tmp = value;
int result = value;
if (diskImages == null || diskImages.Count() == 0)
if (diskImages == null || diskImages.Count == 0)
{
// no tape images found
return;
}
if (value >= diskImages.Count())
if (value >= diskImages.Count)
{
// media at this index does not exist - loop back to 0
result = 0;
@ -89,7 +89,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
else if (value < 0)
{
// 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

View File

@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
sec.SectorData = data.ToArray();
sec.ActualDataByteLength = data.Count();
sec.ActualDataByteLength = data.Count;
sec.ContainsMultipleWeakSectors = true;
}
}

View File

@ -78,7 +78,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
double multiplier = (double)4 / (double)3.5;
//double cycleScale = ((40 << 16) / 35);
double origPeriods = db.DataPeriods.Count();
double origPeriods = db.DataPeriods.Count;
for (int i = 0; i < origPeriods; i++)
{
@ -1026,7 +1026,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
t.BlockDescription = BlockType.Loop_Start;
// loop should start from the next block
int loopStart = _datacorder.DataBlocks.Count() + 1;
int loopStart = _datacorder.DataBlocks.Count + 1;
int numberOfRepetitions = GetWordValue(data, _position);
@ -1074,7 +1074,7 @@ namespace BizHawk.Emulation.Cores.Computers.AmstradCPC
}
// 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
for (int b = 0; b < numberOfRepetitions; b++)

View File

@ -54,13 +54,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
get
{
if (_dataBlocks.Count() > 0) { return _currentDataBlockIndex; }
if (_dataBlocks.Count > 0) { return _currentDataBlockIndex; }
else { return -1; }
}
set
{
if (value == _currentDataBlockIndex) { return; }
if (value < _dataBlocks.Count() && value >= 0)
if (value < _dataBlocks.Count && value >= 0)
{
_currentDataBlockIndex = value;
_position = 0;
@ -224,7 +224,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// move to the next block
_currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
_currentDataBlockIndex = -1;
}
@ -235,7 +235,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (
_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
@ -297,7 +297,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StringBuilder sbd = new StringBuilder();
sbd.Append("(");
sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count());
sbd.Append((targetBlockId + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : ");
sbd.Append(bl.BlockDescription);
if (bl.MetaData.Count > 0)
@ -520,7 +520,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StringBuilder sbd = new StringBuilder();
sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count());
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : ");
sbd.Append(bl.BlockDescription);
if (bl.MetaData.Count > 0)
@ -534,16 +534,16 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
// increment the current period position
_position++;
if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count())
if (_position >= _dataBlocks[_currentDataBlockIndex].DataPeriods.Count)
{
// 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)
var bl = _dataBlocks[_currentDataBlockIndex];
StringBuilder sbd = new StringBuilder();
sbd.Append("(");
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count());
sbd.Append((_currentDataBlockIndex + 1) + " of " + _dataBlocks.Count);
sbd.Append(") : ");
sbd.Append(bl.BlockDescription);
if (bl.MetaData.Count > 0)
@ -556,7 +556,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// 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
var command = _dataBlocks[_currentDataBlockIndex].Command;
@ -571,7 +571,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_machine.Spectrum.OSD_TapeStoppedAuto();
shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ();
else
{
@ -586,7 +586,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_machine.Spectrum.OSD_TapeStoppedAuto();
shouldStop = true;
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
RTZ();
else
{
@ -604,14 +604,14 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
_position = 0;
_currentDataBlockIndex++;
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
break;
}
}
// check for end of tape
if (_currentDataBlockIndex >= _dataBlocks.Count())
if (_currentDataBlockIndex >= _dataBlocks.Count)
{
_currentDataBlockIndex = -1;
RTZ();
@ -620,7 +620,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// 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
FlipTapeState();

View File

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

View File

@ -263,7 +263,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
if (Disk == null)
return (byte)id;
if (Disk.DiskTracks.Count() == 0)
if (Disk.DiskTracks.Length == 0)
return (byte)id;
if (TrackIndex >= Disk.GetTrackCount())

View File

@ -284,7 +284,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{
List<IJoystick> 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));
}

View File

@ -44,13 +44,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
int tmp = value;
int result = value;
if (tapeImages == null || tapeImages.Count() == 0)
if (tapeImages == null || tapeImages.Count == 0)
{
// no tape images found
return;
}
if (value >= tapeImages.Count())
if (value >= tapeImages.Count)
{
// media at this index does not exist - loop back to 0
result = 0;
@ -58,7 +58,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
else if (value < 0)
{
// 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
@ -84,13 +84,13 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
int tmp = value;
int result = value;
if (diskImages == null || diskImages.Count() == 0)
if (diskImages == null || diskImages.Count == 0)
{
// no tape images found
return;
}
if (value >= diskImages.Count())
if (value >= diskImages.Count)
{
// media at this index does not exist - loop back to 0
result = 0;
@ -98,7 +98,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
else if (value < 0)
{
// 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

View File

@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
sec.SectorData = data.ToArray();
sec.ActualDataByteLength = data.Count();
sec.ActualDataByteLength = data.Count;
sec.ContainsMultipleWeakSectors = true;
}
}

View File

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

View File

@ -966,7 +966,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
t.BlockDescription = BlockType.Loop_Start;
// loop should start from the next block
int loopStart = _datacorder.DataBlocks.Count() + 1;
int loopStart = _datacorder.DataBlocks.Count + 1;
int numberOfRepetitions = GetWordValue(data, _position);
@ -1014,7 +1014,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
}
// 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
for (int b = 0; b < numberOfRepetitions; b++)

View File

@ -71,7 +71,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
StringBuilder sb = new StringBuilder();
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);
}
}
@ -162,7 +162,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
return;
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);
}
@ -393,7 +393,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
sb.Append("Block: ");
sb.Append("(" + (_machine.TapeDevice.CurrentDataBlockIndex + 1) +
" of " + _machine.TapeDevice.DataBlocks.Count() + ") " +
" of " + _machine.TapeDevice.DataBlocks.Count + ") " +
_machine.TapeDevice.DataBlocks[_machine.TapeDevice.CurrentDataBlockIndex].BlockDescription);
SendMessage(sb.ToString().TrimEnd('\n'), MessageCategory.Tape);
sb.Clear();

View File

@ -511,7 +511,7 @@ namespace BizHawk.Emulation.Cores.Atari.Atari2600
{
byte sum = 0;
for (int i = 0; i < s.Count(); i++)
for (int i = 0; i < s.Length; i++)
{
sum += s[i];
}

View File

@ -178,7 +178,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA
void SyncPadCallback()
{
LibVBANext.SetPadCallback(Core, InputCallbacks.Any() ? padcb : null);
LibVBANext.SetPadCallback(Core, InputCallbacks.Count > 0 ? padcb : null);
}
void SyncMemoryCallbacks()

View File

@ -157,7 +157,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
{ //Of course, we gotta emulate the behaviour.
for (int i = 0; i < (Cart.prg_size / 4); i++)
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.prg_size + i] = 0xFF;
}
else if (value == 0x30)

View File

@ -171,7 +171,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
}
// Add in the reset timing float control for subneshawk
if (using_reset_timing && (ControllerDefinition.FloatControls.Count() == 0))
if (using_reset_timing && ControllerDefinition.FloatControls.Count == 0)
{
ControllerDefinition.FloatControls.Add("Reset Cycle");
ControllerDefinition.FloatRanges.Add(new ControllerDefinition.FloatRange(0, 0, 500000));
@ -224,7 +224,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES
// apu has some specific power up bahaviour that we will emulate here
apu.NESHardReset();
if (SyncSettings.InitialWRamStatePattern != null && SyncSettings.InitialWRamStatePattern.Any())
if (SyncSettings.InitialWRamStatePattern != null && SyncSettings.InitialWRamStatePattern.Count > 0)
{
for (int i = 0; i < 0x800; i++)
{

View File

@ -169,7 +169,7 @@ namespace BizHawk.Emulation.Cores.WonderSwan
void SetInputCallback()
{
BizSwan.bizswan_setbuttoncallback(Core, InputCallbacks.Any() ? ButtonCallbackD : null);
BizSwan.bizswan_setbuttoncallback(Core, InputCallbacks.Count > 0 ? ButtonCallbackD : null);
}
void SetMemoryCallbacks()