Fix covariant arrays (passing ASupertype[] where AType[] is expected)

This commit is contained in:
YoshiRulz 2020-12-29 16:48:23 +10:00
parent 206a3e30c8
commit 9cfe9485ef
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
12 changed files with 21 additions and 19 deletions

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Client.Common; using BizHawk.Client.Common;
@ -149,7 +150,7 @@ namespace BizHawk.Client.EmuHawk
public static FormatPreset DoFFmpegWriterDlg(IWin32Window owner, Config config) public static FormatPreset DoFFmpegWriterDlg(IWin32Window owner, Config config)
{ {
FFmpegWriterForm dlg = new FFmpegWriterForm(); FFmpegWriterForm dlg = new FFmpegWriterForm();
dlg.listBox1.Items.AddRange(FormatPreset.GetPresets(config.FFmpegCustomCommand)); dlg.listBox1.Items.AddRange(FormatPreset.GetPresets(config.FFmpegCustomCommand).Cast<object>().ToArray());
int i = dlg.listBox1.FindStringExact(config.FFmpegFormat); int i = dlg.listBox1.FindStringExact(config.FFmpegFormat);
if (i != ListBox.NoMatches) if (i != ListBox.NoMatches)

View File

@ -27,9 +27,7 @@ namespace BizHawk.Client.EmuHawk
} }
box.Items.Clear(); box.Items.Clear();
box.Items.AddRange( box.Items.AddRange(typeof(T).GetEnumDescriptions().Cast<object>().ToArray());
typeof(T).GetEnumDescriptions()
.ToArray());
box.SelectedItem = enumVal.GetDescription(); box.SelectedItem = enumVal.GetDescription();
} }

View File

@ -1942,7 +1942,7 @@ namespace BizHawk.Client.EmuHawk
{ {
ZXSpectrumTapesSubMenu.DropDownItems.Clear(); ZXSpectrumTapesSubMenu.DropDownItems.Clear();
var items = new List<ToolStripMenuItem>(); List<ToolStripItem> items = new();
if (Emulator is ZXSpectrum speccy) if (Emulator is ZXSpectrum speccy)
{ {
@ -1976,7 +1976,7 @@ namespace BizHawk.Client.EmuHawk
{ {
ZXSpectrumDisksSubMenu.DropDownItems.Clear(); ZXSpectrumDisksSubMenu.DropDownItems.Clear();
var items = new List<ToolStripMenuItem>(); List<ToolStripItem> items = new();
if (Emulator is ZXSpectrum speccy) if (Emulator is ZXSpectrum speccy)
{ {
@ -2071,7 +2071,7 @@ namespace BizHawk.Client.EmuHawk
{ {
AmstradCPCTapesSubMenu.DropDownItems.Clear(); AmstradCPCTapesSubMenu.DropDownItems.Clear();
var items = new List<ToolStripMenuItem>(); List<ToolStripItem> items = new();
if (Emulator is AmstradCPC ams) if (Emulator is AmstradCPC ams)
{ {
@ -2105,7 +2105,7 @@ namespace BizHawk.Client.EmuHawk
{ {
AmstradCPCDisksSubMenu.DropDownItems.Clear(); AmstradCPCDisksSubMenu.DropDownItems.Clear();
var items = new List<ToolStripMenuItem>(); List<ToolStripItem> items = new();
if (Emulator is AmstradCPC ams) if (Emulator is AmstradCPC ams)
{ {

View File

@ -127,7 +127,7 @@ namespace BizHawk.Client.EmuHawk
= tbbOpenFolder.Image = Resources.Placeholder; = tbbOpenFolder.Image = Resources.Placeholder;
// prep ImageList for ListView with 3 item states for {idUnsure, idMissing, idOk} // prep ImageList for ListView with 3 item states for {idUnsure, idMissing, idOk}
imageList1.Images.AddRange(new[] { Resources.RetroQuestion, Resources.ExclamationRed, Resources.GreenCheck }); imageList1.Images.AddRange(new Image[] { Resources.RetroQuestion, Resources.ExclamationRed, Resources.GreenCheck });
_listViewSorter = new ListViewSorter(-1); _listViewSorter = new ListViewSorter(-1);

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Drawing;
using System.Windows.Forms; using System.Windows.Forms;
// todo - display details on the current resolution status // todo - display details on the current resolution status
@ -23,7 +24,7 @@ namespace BizHawk.Client.EmuHawk
InitializeComponent(); InitializeComponent();
// prep imagelist for listview with 4 item states for (ideal, acceptable, unacceptable, bad) // prep imagelist for listview with 4 item states for (ideal, acceptable, unacceptable, bad)
imageList1.Images.AddRange(new[] { Properties.Resources.GreenCheck, Properties.Resources.Freeze, Properties.Resources.ThumbsDown, Properties.Resources.ExclamationRed }); imageList1.Images.AddRange(new Image[] { Properties.Resources.GreenCheck, Properties.Resources.Freeze, Properties.Resources.ThumbsDown, Properties.Resources.ExclamationRed });
} }
private void LvOptions_KeyDown(object sender, KeyEventArgs e) private void LvOptions_KeyDown(object sender, KeyEventArgs e)

View File

@ -1,4 +1,5 @@
using System; using System;
using System.Linq;
using System.Windows.Forms; using System.Windows.Forms;
using BizHawk.Common.StringExtensions; using BizHawk.Common.StringExtensions;
@ -205,7 +206,7 @@ namespace BizHawk.Client.EmuHawk
// Change resolution list to the rest // Change resolution list to the rest
VideoResolutionComboBox.Items.Clear(); VideoResolutionComboBox.Items.Clear();
VideoResolutionComboBox.Items.AddRange(ValidResolutions); VideoResolutionComboBox.Items.AddRange(ValidResolutions.Cast<object>().ToArray());
// If the given resolution is in the table, pick it. // If the given resolution is in the table, pick it.
// Otherwise find a best fit // Otherwise find a best fit

View File

@ -37,7 +37,7 @@ namespace BizHawk.Client.EmuHawk
InfoLabel.Visible = true; InfoLabel.Visible = true;
} }
RegionComboBox.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region))); RegionComboBox.Items.AddRange(Enum.GetNames(typeof(NES.NESSyncSettings.Region)).Cast<object>().ToArray());
RegionComboBox.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), _syncSettings.RegionOverride); RegionComboBox.SelectedItem = Enum.GetName(typeof(NES.NESSyncSettings.Region), _syncSettings.RegionOverride);
if (_syncSettings.InitialWRamStatePattern != null && _syncSettings.InitialWRamStatePattern.Any()) if (_syncSettings.InitialWRamStatePattern != null && _syncSettings.InitialWRamStatePattern.Any())

View File

@ -20,9 +20,9 @@ namespace BizHawk.Client.EmuHawk
Icon = Properties.Resources.GameControllerIcon; Icon = Properties.Resources.GameControllerIcon;
// TODO: use combobox extension and add descriptions to enum values // TODO: use combobox extension and add descriptions to enum values
comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().ToArray()); comboBoxFamicom.Items.AddRange(NESControlSettings.GetFamicomExpansionValues().Cast<object>().ToArray());
comboBoxNESL.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray()); comboBoxNESL.Items.AddRange(NESControlSettings.GetNesPortValues().Cast<object>().ToArray());
comboBoxNESR.Items.AddRange(NESControlSettings.GetNesPortValues().ToArray()); comboBoxNESR.Items.AddRange(NESControlSettings.GetNesPortValues().Cast<object>().ToArray());
comboBoxFamicom.SelectedItem = _syncSettings.Controls.FamicomExpPort; comboBoxFamicom.SelectedItem = _syncSettings.Controls.FamicomExpPort;
comboBoxNESL.SelectedItem = _syncSettings.Controls.NesLeftPort; comboBoxNESL.SelectedItem = _syncSettings.Controls.NesLeftPort;

View File

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Windows.Forms; using System.Windows.Forms;
using System.Threading; using System.Threading;
using System.IO; using System.IO;
using System.Linq;
using BizHawk.Client.Common; using BizHawk.Client.Common;
using BizHawk.Emulation.Common; using BizHawk.Emulation.Common;
@ -41,7 +42,7 @@ namespace BizHawk.Client.EmuHawk
if (e.Data.GetDataPresent(DataFormats.FileDrop)) if (e.Data.GetDataPresent(DataFormats.FileDrop))
{ {
string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
listBox1.Items.AddRange(files); listBox1.Items.AddRange(files.Cast<object>().ToArray());
SetCount(); SetCount();
} }
} }

View File

@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk
DomainDropDown.Items.Clear(); DomainDropDown.Items.Clear();
DomainDropDown.Items.AddRange(MemoryDomains DomainDropDown.Items.AddRange(MemoryDomains
.Where(d => d.Writable) .Where(d => d.Writable)
.Select(d => d.ToString()) .Select(d => (object) d.ToString())
.ToArray()); .ToArray());
DomainDropDown.SelectedItem = MemoryDomains.HasSystemBus DomainDropDown.SelectedItem = MemoryDomains.HasSystemBus

View File

@ -61,7 +61,7 @@ namespace BizHawk.Client.EmuHawk
DropDownStyle = ComboBoxStyle.DropDownList DropDownStyle = ComboBoxStyle.DropDownList
}; };
c.Items.AddRange(Disassembler.AvailableCpus.ToArray()); c.Items.AddRange(Disassembler.AvailableCpus.Cast<object>().ToArray());
c.SelectedItem = Disassembler.Cpu; c.SelectedItem = Disassembler.Cpu;
c.SelectedIndexChanged += OnCpuDropDownIndexChanged; c.SelectedIndexChanged += OnCpuDropDownIndexChanged;

View File

@ -170,7 +170,7 @@ namespace BizHawk.Emulation.Cores.Computers.SinclairSpectrum
{ {
get get
{ {
List<UDIv1Sector> secs = new List<UDIv1Sector>(); List<Sector> secs = new();
var datas = TrackData.Skip(3).Take(TLEN).ToArray(); var datas = TrackData.Skip(3).Take(TLEN).ToArray();
var clocks = new BitArray(TrackData.Skip(3 + TLEN).Take(CLEN).ToArray()); var clocks = new BitArray(TrackData.Skip(3 + TLEN).Take(CLEN).ToArray());