From d65092e96797a47fc996f536a5a1eed74b311b3b Mon Sep 17 00:00:00 2001 From: adelikat Date: Tue, 29 Oct 2019 09:27:56 -0500 Subject: [PATCH] Misc cleanups in tool dialogs - mostly the use of expression body (C#6/C#7isms) --- .../tools/NES/BarcodeEntry.cs | 20 +++-------- .../tools/NES/NESGameGenie.cs | 7 ++-- .../tools/NES/NESMusicRipper.cs | 18 ++++------ .../tools/NES/NESNameTableViewer.cs | 13 +++---- BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs | 20 ++++------- .../tools/NES/PaletteViewer.cs | 7 ++-- .../tools/NES/SpriteViewer.cs | 5 +-- .../tools/PCE/PCEBGViewer.cs | 13 ++----- .../tools/PCE/PCESoundDebugger.cs | 23 ++++-------- .../tools/PCE/PCETileViewer.cs | 13 +++---- BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs | 11 +++--- .../tools/SNES/SNESGraphicsDebugger.cs | 19 +++++----- BizHawk.Client.EmuHawk/tools/ToolManager.cs | 1 - .../tools/VirtualPads/VirtualPad.cs | 21 ++++------- .../tools/VirtualPads/VirtualpadsTool.cs | 14 +++----- .../controls/VirtualPadAnalogButton.cs | 35 ++++--------------- .../controls/VirtualPadAnalogStick.cs | 11 ++---- .../VirtualPads/controls/VirtualPadButton.cs | 10 ++---- .../VirtualPadDiscManager.Designer.cs | 1 - .../controls/VirtualPadDiscManager.cs | 25 ++++--------- .../controls/VirtualPadTargetScreen.cs | 24 +++---------- .../controls/components/AnalogStickPanel.cs | 10 ++---- BizHawk.sln.DotSettings | 3 ++ 23 files changed, 92 insertions(+), 232 deletions(-) diff --git a/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs b/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs index 6b4e0d07f4..5b5e514046 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/BarcodeEntry.cs @@ -1,14 +1,6 @@ using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; using BizHawk.Emulation.Cores.Nintendo.NES; -using BizHawk.Common; -using BizHawk.Client.Common; using BizHawk.Emulation.Common; namespace BizHawk.Client.EmuHawk @@ -16,7 +8,7 @@ namespace BizHawk.Client.EmuHawk public partial class BarcodeEntry : Form, IToolForm { [RequiredService] - private DatachBarcode reader { get; set; } + private DatachBarcode Reader { get; set; } public BarcodeEntry() { @@ -45,17 +37,13 @@ namespace BizHawk.Client.EmuHawk return true; } - public bool UpdateBefore - { - get { return false; } - } + public bool UpdateBefore => false; #endregion private void textBox1_TextChanged(object sender, EventArgs e) { - string why; - if (!DatachBarcode.ValidString(textBox1.Text, out why)) + if (!DatachBarcode.ValidString(textBox1.Text, out var why)) { label3.Text = $"Invalid: {why}"; label3.Visible = true; @@ -70,7 +58,7 @@ namespace BizHawk.Client.EmuHawk private void button1_Click(object sender, EventArgs e) { - reader.Transfer(textBox1.Text); + Reader.Transfer(textBox1.Text); } } } diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs b/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs index 0b6912c602..516456a7f3 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESGameGenie.cs @@ -41,12 +41,9 @@ namespace BizHawk.Client.EmuHawk private int? _value; private int? _compare; - public int? Address { get { return _address; } } - public int? Value { get { return _value; } } - public int? Compare { get { return _compare; } } - public bool AskSaveChanges() { return true; } - public bool UpdateBefore { get { return false; } } + public bool UpdateBefore => false; + public void Restart() { if (Emulator.SystemId != "NES") diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs b/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs index 2c0cfcb7ed..e5c2a12963 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESMusicRipper.cs @@ -1,15 +1,9 @@ using System; -using System.Xml; using System.Xml.XPath; using System.Xml.Linq; -using System.Linq; using System.IO; -using System.Text; using System.Collections.Generic; -using System.Drawing; -using System.Drawing.Imaging; using System.Windows.Forms; -using BizHawk.Client.Common; using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Common; @@ -27,7 +21,7 @@ namespace BizHawk.Client.EmuHawk } public bool AskSaveChanges() { return true; } - public bool UpdateBefore { get { return true; } } + public bool UpdateBefore => true; public void Restart() { @@ -48,12 +42,12 @@ namespace BizHawk.Client.EmuHawk //http://www.phy.mtu.edu/~suits/notefreqs.html //begins at C0. ends at B8 - static readonly float[] freqtbl = new[] {0, + static readonly float[] freqtbl = {0, 16.35f,17.32f,18.35f,19.45f,20.6f,21.83f,23.12f,24.5f,25.96f,27.5f,29.14f,30.87f,32.7f,34.65f,36.71f,38.89f,41.2f,43.65f,46.25f,49f,51.91f,55f,58.27f,61.74f,65.41f,69.3f,73.42f,77.78f,82.41f,87.31f,92.5f,98f,103.83f,110f,116.54f,123.47f,130.81f,138.59f,146.83f,155.56f,164.81f,174.61f,185f,196f,207.65f,220f,233.08f,246.94f,261.63f,277.18f,293.66f,311.13f,329.63f,349.23f,369.99f,392f,415.3f,440f,466.16f,493.88f,523.25f,554.37f,587.33f,622.25f,659.25f,698.46f,739.99f,783.99f,830.61f,880f,932.33f,987.77f,1046.5f,1108.73f,1174.66f,1244.51f,1318.51f,1396.91f,1479.98f,1567.98f,1661.22f,1760f,1864.66f,1975.53f,2093f,2217.46f,2349.32f,2489.02f,2637.02f,2793.83f,2959.96f,3135.96f,3322.44f,3520f,3729.31f,3951.07f,4186.01f,4434.92f,4698.63f,4978.03f,5274.04f,5587.65f,5919.91f,6271.93f,6644.88f,7040f,7458.62f,7902.13f, 1000000 }; - static readonly string[] noteNames = new[] { "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-" }; + static readonly string[] noteNames = { "C-", "C#", "D-", "D#", "E-", "F-", "F#", "G-", "G#", "A-", "A#", "B-" }; string NameForNote(int note) { @@ -115,8 +109,10 @@ namespace BizHawk.Client.EmuHawk private void btnExport_Click(object sender, EventArgs e) { //acquire target - var sfd = new SaveFileDialog(); - sfd.Filter = "XRNS (*.xrns)|*.xrns"; + var sfd = new SaveFileDialog + { + Filter = "XRNS (*.xrns)|*.xrns" + }; if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs index 1856b0206a..2f8d37f9fd 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESNameTableViewer.cs @@ -1,9 +1,7 @@ using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; -using BizHawk.Client.Common; using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Common; @@ -21,8 +19,8 @@ namespace BizHawk.Client.EmuHawk [ConfigPersist] private int RefreshRateConfig { - get { return RefreshRate.Value; } - set { RefreshRate.Value = value; } + get => RefreshRate.Value; + set => RefreshRate.Value = value; } int scanline; @@ -40,7 +38,7 @@ namespace BizHawk.Client.EmuHawk #region Public API public bool AskSaveChanges() { return true; } - public bool UpdateBefore { get { return true; } } + public bool UpdateBefore => true; public void Restart() { @@ -238,10 +236,7 @@ namespace BizHawk.Client.EmuHawk private void NESNameTableViewer_FormClosed(object sender, FormClosedEventArgs e) { - if (_ppu != null) - { - _ppu.RemoveCallback1(); - } + _ppu?.RemoveCallback1(); } private void ScanlineTextbox_TextChanged(object sender, EventArgs e) diff --git a/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs b/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs index e4238baa17..ec28b1c2cd 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/NESPPU.cs @@ -1,12 +1,9 @@ using System; using System.Drawing; using System.Drawing.Imaging; -using System.Linq; using System.Windows.Forms; -using BizHawk.Client.Common; using BizHawk.Emulation.Cores.Nintendo.NES; using BizHawk.Emulation.Common; -using System.Collections.Generic; namespace BizHawk.Client.EmuHawk { @@ -33,15 +30,15 @@ namespace BizHawk.Client.EmuHawk [ConfigPersist] private int RefreshRateConfig { - get { return RefreshRate.Value; } - set { RefreshRate.Value = value; } + get => RefreshRate.Value; + set => RefreshRate.Value = value; } - private bool _chrromview = false; + private bool _chrromview; [ConfigPersist] private bool ChrRomView { - get { return _chrromview; } + get => _chrromview; set { _chrromview = value; CalculateFormSize(); } } @@ -61,7 +58,7 @@ namespace BizHawk.Client.EmuHawk #region Public API public bool AskSaveChanges() { return true; } - public bool UpdateBefore { get { return true; } } + public bool UpdateBefore => true; public void NewUpdate(ToolFormUpdateType type) { } public void UpdateValues() @@ -790,16 +787,13 @@ namespace BizHawk.Client.EmuHawk private void NesPPU_FormClosed(object sender, FormClosedEventArgs e) { - if (_ppu != null) - { - _ppu.RemoveCallback2(); - } + _ppu?.RemoveCallback2(); } #endregion MemoryDomain CHRROM; - byte[] chrromcache = new byte[8192]; + readonly byte[] chrromcache = new byte[8192]; private void cHRROMTileViewerToolStripMenuItem_Click(object sender, EventArgs e) { diff --git a/BizHawk.Client.EmuHawk/tools/NES/PaletteViewer.cs b/BizHawk.Client.EmuHawk/tools/NES/PaletteViewer.cs index 12f7a126db..0f8b22c0a7 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/PaletteViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/PaletteViewer.cs @@ -12,12 +12,9 @@ namespace BizHawk.Client.EmuHawk { public class Palette { - public int Address { get; private set; } + public int Address { get; } public int Value { get; set; } - public Color Color - { - get { return Color.FromArgb(Value); } - } + public Color Color => Color.FromArgb(Value); public Palette(int address) { diff --git a/BizHawk.Client.EmuHawk/tools/NES/SpriteViewer.cs b/BizHawk.Client.EmuHawk/tools/NES/SpriteViewer.cs index 3ca6f07d52..fe7d3aaea5 100644 --- a/BizHawk.Client.EmuHawk/tools/NES/SpriteViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/NES/SpriteViewer.cs @@ -29,10 +29,7 @@ namespace BizHawk.Client.EmuHawk private void Display(Graphics g) { - unchecked - { - g.DrawImage(sprites, 1, 1); - } + g.DrawImage(sprites, 1, 1); } private void SpriteViewer_Paint(object sender, PaintEventArgs e) diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs index 10e69b4186..ad8ebbfc67 100644 --- a/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCEBGViewer.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Drawing; using System.Drawing.Imaging; using System.Windows.Forms; @@ -16,14 +15,8 @@ namespace BizHawk.Client.EmuHawk [ConfigPersist] private int RefreshRateConfig { - get - { - return RefreshRate.Value; - } - set - { - RefreshRate.Value = Math.Max(Math.Min(value, RefreshRate.Maximum), RefreshRate.Minimum); - } + get => RefreshRate.Value; + set => RefreshRate.Value = Math.Max(Math.Min(value, RefreshRate.Maximum), RefreshRate.Minimum); } private int _vdcType; @@ -41,7 +34,7 @@ namespace BizHawk.Client.EmuHawk #region Public API public bool AskSaveChanges() { return true; } - public bool UpdateBefore { get { return true; } } + public bool UpdateBefore => true; public unsafe void Generate() { diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs index b32faac779..95032064a9 100644 --- a/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCESoundDebugger.cs @@ -1,18 +1,10 @@ using System; using System.IO; using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; using System.Windows.Forms; using BizHawk.Common.BufferExtensions; -using BizHawk.Client.Common; - using BizHawk.Emulation.Cores.PCEngine; -using BizHawk.Emulation.Common.Components; using BizHawk.Emulation.Common; using ICSharpCode.SharpZipLib.Zip; @@ -33,7 +25,7 @@ namespace BizHawk.Client.EmuHawk SetStyle(ControlStyles.OptimizedDoubleBuffer, true); } - byte[] waveformTemp = new byte[32 * 2]; + readonly byte[] waveformTemp = new byte[32 * 2]; protected override void OnShown(EventArgs e) { @@ -161,9 +153,9 @@ namespace BizHawk.Client.EmuHawk public short[] waveform; } - PSGEntry[] LastSamples = new PSGEntry[8]; - List PSGEntries = new List(); - Dictionary PSGEntryTable = new Dictionary(); + readonly PSGEntry[] LastSamples = new PSGEntry[8]; + readonly List PSGEntries = new List(); + readonly Dictionary PSGEntryTable = new Dictionary(); public void Restart() { @@ -174,14 +166,11 @@ namespace BizHawk.Client.EmuHawk return true; } - public bool UpdateBefore - { - get { return false; } - } + public bool UpdateBefore => false; //32*16 samples, 16bit, mono, 8khz (but we'll change the sample rate) - static readonly byte[] emptyWav = new byte[] { + static readonly byte[] emptyWav = { 0x52, 0x49, 0x46, 0x46, 0x24, 0x04, 0x00, 0x00, 0x57, 0x41, 0x56, 0x45, 0x66, 0x6D, 0x74, 0x20, 0x10, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0xE0, 0x2E, 0x00, 0x00, 0xC0, 0x5D, 0x00, 0x00, 0x02, 0x00, 0x10, 0x00, 0x64, 0x61, 0x74, 0x61, 0x00, 0x04, 0x00, 0x00, diff --git a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs index 2a94623389..53f00f7edb 100644 --- a/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/PCE/PCETileViewer.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.Drawing; -using System.Linq; using System.Windows.Forms; using BizHawk.Emulation.Cores.PCEngine; @@ -50,7 +48,7 @@ namespace BizHawk.Client.EmuHawk // Do nothing } - unsafe static void Draw16x16(byte* src, int* dest, int pitch, int* pal) + static unsafe void Draw16x16(byte* src, int* dest, int pitch, int* pal) { int inc = pitch - 16; dest -= inc; @@ -62,7 +60,7 @@ namespace BizHawk.Client.EmuHawk } } - unsafe static void Draw8x8(byte* src, int* dest, int pitch, int* pal) + static unsafe void Draw8x8(byte* src, int* dest, int pitch, int* pal) { int inc = pitch - 8; dest -= inc; @@ -125,7 +123,7 @@ namespace BizHawk.Client.EmuHawk } } - unsafe static void DrawPalette(Bitmap bmp, int* pal) + static unsafe void DrawPalette(Bitmap bmp, int* pal) { var lockdata = bmp.LockBits(new Rectangle(0, 0, 256, 256), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb); @@ -165,10 +163,7 @@ namespace BizHawk.Client.EmuHawk return true; } - public bool UpdateBefore - { - get { return true; } - } + public bool UpdateBefore => true; #endregion diff --git a/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs b/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs index 760bb758b5..847ae7f61d 100644 --- a/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs +++ b/BizHawk.Client.EmuHawk/tools/SMS/VDPViewer.cs @@ -18,7 +18,7 @@ namespace BizHawk.Client.EmuHawk { [RequiredService] private SMS sms { get; set; } - private VDP vdp { get { return sms.Vdp; } } + private VDP vdp => sms.Vdp; int palindex = 0; @@ -31,7 +31,7 @@ namespace BizHawk.Client.EmuHawk bmpViewBG.ChangeBitmapSize(256, 256); } - unsafe static void Draw8x8(byte* src, int* dest, int pitch, int* pal) + static unsafe void Draw8x8(byte* src, int* dest, int pitch, int* pal) { int inc = pitch - 8; dest -= inc; @@ -43,7 +43,7 @@ namespace BizHawk.Client.EmuHawk } } - unsafe static void Draw8x8hv(byte* src, int* dest, int pitch, int* pal, bool hflip, bool vflip) + static unsafe void Draw8x8hv(byte* src, int* dest, int pitch, int* pal, bool hflip, bool vflip) { int incx = hflip ? -1 : 1; int incy = vflip ? -pitch : pitch; @@ -169,10 +169,7 @@ namespace BizHawk.Client.EmuHawk return true; } - public bool UpdateBefore - { - get { return true; } - } + public bool UpdateBefore => true; private void bmpViewPalette_MouseClick(object sender, MouseEventArgs e) { diff --git a/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs b/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs index 4b703e762c..7c6535b182 100644 --- a/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs +++ b/BizHawk.Client.EmuHawk/tools/SNES/SNESGraphicsDebugger.cs @@ -40,9 +40,9 @@ namespace BizHawk.Client.EmuHawk { public unsafe partial class SNESGraphicsDebugger : Form, IToolFormAutoConfig { - List displayTypeItems = new List(); + readonly List displayTypeItems = new List(); - public bool UpdateBefore { get { return false; } } + public bool UpdateBefore => false; public bool AskSaveChanges() { return true; } [RequiredService] @@ -51,8 +51,8 @@ namespace BizHawk.Client.EmuHawk [ConfigPersist] public bool UseUserBackdropColor { - get { return checkBackdropColor.Checked; } - set { checkBackdropColor.Checked = value; } + get => checkBackdropColor.Checked; + set => checkBackdropColor.Checked = value; } [ConfigPersist] public int UserBackdropColor { get; set; } @@ -116,8 +116,7 @@ namespace BizHawk.Client.EmuHawk protected override void OnClosed(EventArgs e) { base.OnClosed(e); - if (currentSnesCore != null) - currentSnesCore.ScanlineHookManager.Unregister(this); + currentSnesCore?.ScanlineHookManager.Unregister(this); currentSnesCore = null; } @@ -224,7 +223,7 @@ namespace BizHawk.Client.EmuHawk void RegenerateData() { - if (gd != null) gd.Dispose(); + gd?.Dispose(); gd = null; if (currentSnesCore == null) return; gd = NewDecoder(); @@ -345,7 +344,7 @@ namespace BizHawk.Client.EmuHawk } } - eDisplayType CurrDisplaySelection { get { return (comboDisplayType.SelectedValue as eDisplayType?).Value; } } + eDisplayType CurrDisplaySelection => (comboDisplayType.SelectedValue as eDisplayType?).Value; //todo - something smarter to cycle through bitmaps without repeatedly trashing them (use the dispose callback on the viewer) private void RenderView() @@ -527,8 +526,8 @@ namespace BizHawk.Client.EmuHawk class PaletteTypeItem { - public SnesColors.ColorType Type { get; private set; } - public string Descr { get; private set; } + public SnesColors.ColorType Type { get; } + public string Descr { get; } public PaletteTypeItem(string descr, SnesColors.ColorType type) { Type = type; diff --git a/BizHawk.Client.EmuHawk/tools/ToolManager.cs b/BizHawk.Client.EmuHawk/tools/ToolManager.cs index 86973efc73..e04f82d9f6 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolManager.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolManager.cs @@ -9,7 +9,6 @@ using System.Windows.Forms; using BizHawk.Client.ApiHawk; using BizHawk.Client.Common; -using BizHawk.Client.EmuHawk; using BizHawk.Client.EmuHawk.CoreExtensions; using BizHawk.Common; using BizHawk.Common.ReflectionExtensions; diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs index 2f5b802fcc..b8d2103c93 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualPad.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Windows.Forms; -using BizHawk.Client.Common; using BizHawk.Emulation.Common; using System.Drawing; @@ -19,24 +18,16 @@ namespace BizHawk.Client.EmuHawk PadControls.ForEach(c => c.UpdateValues()); } - private List PadControls - { - get - { - return PadBox.Controls - .OfType() - .ToList(); - } - } + private List PadControls => + PadBox.Controls + .OfType() + .ToList(); - public string PadSchemaDisplayName { get { return _schema.DisplayName; } } + public string PadSchemaDisplayName => _schema.DisplayName; public bool ReadOnly { - get - { - return _readOnly; - } + get => _readOnly; set { diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs index 44ca4ac00b..4e303320bb 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/VirtualpadsTool.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Drawing; using System.Linq; using System.Reflection; using System.Windows.Forms; @@ -23,15 +22,10 @@ namespace BizHawk.Client.EmuHawk private bool _readOnly; - private List Pads - { - get - { - return ControllerPanel.Controls - .OfType() - .ToList(); - } - } + private List Pads => + ControllerPanel.Controls + .OfType() + .ToList(); public bool Readonly { diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs index ddc2b76b4e..617fd78021 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogButton.cs @@ -17,10 +17,7 @@ namespace BizHawk.Client.EmuHawk private bool _isSet = false; private bool IsSet { - get - { - return _isSet; - } + get => _isSet; set { @@ -62,10 +59,7 @@ namespace BizHawk.Client.EmuHawk public bool ReadOnly { - get - { - return _readonly; - } + get => _readonly; set { @@ -102,10 +96,7 @@ namespace BizHawk.Client.EmuHawk public string DisplayName { - get - { - return _displayName; - } + get => _displayName; set { @@ -119,10 +110,7 @@ namespace BizHawk.Client.EmuHawk public int MaxValue { - get - { - return _maxValue; - } + get => _maxValue; set { @@ -137,10 +125,7 @@ namespace BizHawk.Client.EmuHawk public int MinValue { - get - { - return _minValue; - } + get => _minValue; set { @@ -155,10 +140,7 @@ namespace BizHawk.Client.EmuHawk public Orientation Orientation { - get - { - return AnalogTrackBar.Orientation; - } + get => AnalogTrackBar.Orientation; set { @@ -207,10 +189,7 @@ namespace BizHawk.Client.EmuHawk public int CurrentValue { - get - { - return AnalogTrackBar.Value; - } + get => AnalogTrackBar.Value; set { diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs index 0237b74de7..026489f496 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadAnalogStick.cs @@ -1,10 +1,8 @@ using System; -using System.Drawing; using System.Windows.Forms; using BizHawk.Emulation.Common; using BizHawk.Client.Common; -using System.Windows; using BizHawk.Common.NumberExtensions; namespace BizHawk.Client.EmuHawk @@ -31,8 +29,8 @@ namespace BizHawk.Client.EmuHawk manualTheta.ValueChanged += PolarNumeric_Changed; } - public float[] RangeX = new float[] { -128f, 0.0f, 127f }; - public float[] RangeY = new float[] { -128f, 0.0f, 127f }; + public float[] RangeX = { -128f, 0.0f, 127f }; + public float[] RangeY = { -128f, 0.0f, 127f }; private bool ReverseX; private bool ReverseY; @@ -112,10 +110,7 @@ namespace BizHawk.Client.EmuHawk public bool ReadOnly { - get - { - return _readonly; - } + get => _readonly; set { diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs index 3540991722..216b902f25 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadButton.cs @@ -57,10 +57,7 @@ namespace BizHawk.Client.EmuHawk public bool ReadOnly { - get - { - return _readonly; - } + get => _readonly; set { @@ -123,10 +120,7 @@ namespace BizHawk.Client.EmuHawk public bool RightClicked { - get - { - return !ReadOnly && _rightClicked; - } + get => !ReadOnly && _rightClicked; set { diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.Designer.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.Designer.cs index a998f2e866..ca4a99c50b 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.Designer.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.Designer.cs @@ -51,7 +51,6 @@ this.groupBox1.TabIndex = 1; this.groupBox1.TabStop = false; this.groupBox1.Text = "Discs"; - this.groupBox1.Enter += new System.EventHandler(this.groupBox1_Enter); // // lvDiscs // diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs index 2bdf09fc35..6366e785f8 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadDiscManager.cs @@ -1,10 +1,5 @@ using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; -using System.Data; -using System.Linq; -using System.Text; using System.Windows.Forms; using BizHawk.Client.Common; @@ -29,7 +24,7 @@ namespace BizHawk.Client.EmuHawk object _ownerEmulator; public object OwnerEmulator { - get { return _ownerEmulator; } + get => _ownerEmulator; set { _ownerEmulator = value; @@ -59,8 +54,7 @@ namespace BizHawk.Client.EmuHawk int idx = 0; foreach (var button in buttons) { - var lvi = new ListViewItem(); - lvi.Text = idx.ToString(); + var lvi = new ListViewItem { Text = idx.ToString() }; lvi.SubItems.Add(button); lvDiscs.Items.Add(lvi); idx++; @@ -105,9 +99,9 @@ namespace BizHawk.Client.EmuHawk enableDiscs = btnOpen.Checked; - //since user hasnt ever needed to set the disc, make sure it's set here - //UPDATE: do it below - //Global.StickyXORAdapter.SetFloat(_discSelectName, psx.CurrentDiscIndexMounted); + // since user hasn't ever needed to set the disc, make sure it's set here + // UPDATE: do it below + //Global.StickyXORAdapter.SetFloat(_discSelectName, psx.CurrentDiscIndexMounted); } else { @@ -128,8 +122,8 @@ namespace BizHawk.Client.EmuHawk } } - //make sure we try to keep something selected here, for clarity. - //but maybe later we'll just make it so that unselecting means no disc and dont display the disc 0 + // make sure we try to keep something selected here, for clarity. + // but maybe later we'll just make it so that unselecting means no disc and don't display the disc 0 if (lvDiscs.SelectedIndices.Count == 0) lvDiscs.SelectedIndices.Add(0); } @@ -143,11 +137,6 @@ namespace BizHawk.Client.EmuHawk #endregion //IVirtualPadControl - private void groupBox1_Enter(object sender, EventArgs e) - { - - } - private void lvDiscs_SelectedIndexChanged(object sender, EventArgs e) { //not a valid way to fight unselection, it results in craptons of ping-ponging logic and eventual malfunction diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs index 0710804b03..0ec7705863 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/VirtualPadTargetScreen.cs @@ -76,10 +76,7 @@ namespace BizHawk.Client.EmuHawk public bool ReadOnly { - get - { - return _readonly; - } + get => _readonly; set { @@ -106,14 +103,11 @@ namespace BizHawk.Client.EmuHawk #endregion // Size of the extra controls to the right / bottom of the target panel at 96 DPI - private Size PaddingSize - { - get { return new Size(0, 30); } - } + private Size PaddingSize => new Size(0, 30); public Size TargetSize { - get { return TargetPanel.Size; } + get => TargetPanel.Size; set { TargetPanel.Size = value; @@ -171,11 +165,7 @@ namespace BizHawk.Client.EmuHawk public int X { - get - { - return _overrideX ?? (int)(Global.StickyXORAdapter.GetFloat(XName) / MultiplierX); - } - + get => _overrideX ?? (int)(Global.StickyXORAdapter.GetFloat(XName) / MultiplierX); set { if (value < 0) @@ -198,11 +188,7 @@ namespace BizHawk.Client.EmuHawk } public int Y { - get - { - return _overrideY ?? (int)(Global.StickyXORAdapter.GetFloat(YName) / MultiplierY); - } - + get => _overrideY ?? (int)(Global.StickyXORAdapter.GetFloat(YName) / MultiplierY); set { if (value < 0) diff --git a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs index e85d267ea9..acb6c08f37 100644 --- a/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs +++ b/BizHawk.Client.EmuHawk/tools/VirtualPads/controls/components/AnalogStickPanel.cs @@ -16,10 +16,7 @@ namespace BizHawk.Client.EmuHawk public int X { - get - { - return _x; - } + get => _x; set { _x = RangeX.Constrain(value); @@ -29,10 +26,7 @@ namespace BizHawk.Client.EmuHawk public int Y { - get - { - return _y; - } + get => _y; set { _y = RangeY.Constrain(value); diff --git a/BizHawk.sln.DotSettings b/BizHawk.sln.DotSettings index 7e543eb96d..9583238608 100644 --- a/BizHawk.sln.DotSettings +++ b/BizHawk.sln.DotSettings @@ -230,7 +230,9 @@ True True True + True True + True True True True @@ -261,6 +263,7 @@ True True True + True True True True