diff --git a/BizHawk.Client.Common/tools/Watch/Watch.cs b/BizHawk.Client.Common/tools/Watch/Watch.cs index 9b8a6aab9a..b40ea178df 100644 --- a/BizHawk.Client.Common/tools/Watch/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch/Watch.cs @@ -59,7 +59,7 @@ namespace BizHawk.Client.Common } else { - throw new ArgumentException(string.Format("DisplayType {0} is invalid for this type of Watch", type.ToString()), "type"); + throw new ArgumentException(string.Format("DisplayType {0} is invalid for this type of Watch", type.ToString()), nameof(type)); } } diff --git a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs index 40aa73d19e..603da8aca4 100644 --- a/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs +++ b/BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs @@ -276,7 +276,7 @@ namespace BizHawk.Client.EmuHawk public void SetAudioParameters(int sampleRate, int channels, int bits) { if (bits != 16) - throw new ArgumentOutOfRangeException("bits", "Sampling depth must be 16 bits!"); + throw new ArgumentOutOfRangeException(nameof(bits), "Sampling depth must be 16 bits!"); this.sampleRate = sampleRate; this.channels = channels; } diff --git a/BizHawk.Client.EmuHawk/AVOut/NutMuxer.cs b/BizHawk.Client.EmuHawk/AVOut/NutMuxer.cs index ec622a9aee..4ecc135d8e 100644 --- a/BizHawk.Client.EmuHawk/AVOut/NutMuxer.cs +++ b/BizHawk.Client.EmuHawk/AVOut/NutMuxer.cs @@ -106,7 +106,7 @@ namespace BizHawk.Client.EmuHawk static void WriteVarU(int v, Stream stream) { if (v < 0) - throw new ArgumentOutOfRangeException("v", "unsigned must be non-negative"); + throw new ArgumentOutOfRangeException(nameof(v), "unsigned must be non-negative"); WriteVarU((ulong)v, stream); } @@ -116,7 +116,7 @@ namespace BizHawk.Client.EmuHawk static void WriteVarU(long v, Stream stream) { if (v < 0) - throw new ArgumentOutOfRangeException("v", "unsigned must be non-negative"); + throw new ArgumentOutOfRangeException(nameof(v), "unsigned must be non-negative"); WriteVarU((ulong)v, stream); } diff --git a/BizHawk.Client.EmuHawk/AVOut/NutWriter.cs b/BizHawk.Client.EmuHawk/AVOut/NutWriter.cs index 6e8770ed84..ed8afd85de 100644 --- a/BizHawk.Client.EmuHawk/AVOut/NutWriter.cs +++ b/BizHawk.Client.EmuHawk/AVOut/NutWriter.cs @@ -112,7 +112,7 @@ namespace BizHawk.Client.EmuHawk public void SetAudioParameters(int sampleRate, int channels, int bits) { if (bits != 16) - throw new ArgumentOutOfRangeException("bits", "Audio depth must be 16 bit!"); + throw new ArgumentOutOfRangeException(nameof(bits), "Audio depth must be 16 bit!"); this.sampleRate = sampleRate; this.channels = channels; } diff --git a/BizHawk.Client.EmuHawk/AVOut/Quantize/OctreeQuantizer.cs b/BizHawk.Client.EmuHawk/AVOut/Quantize/OctreeQuantizer.cs index 1d0a75007d..9fada01af0 100644 --- a/BizHawk.Client.EmuHawk/AVOut/Quantize/OctreeQuantizer.cs +++ b/BizHawk.Client.EmuHawk/AVOut/Quantize/OctreeQuantizer.cs @@ -51,10 +51,10 @@ namespace BizHawk.Client.EmuHawk : base(false) { if (maxColors > 255) - throw new ArgumentOutOfRangeException("maxColors", maxColors, "The number of colors should be less than 256"); + throw new ArgumentOutOfRangeException(nameof(maxColors), maxColors, "The number of colors should be less than 256"); if ((maxColorBits < 1) |(maxColorBits > 8)) - throw new ArgumentOutOfRangeException("maxColorBits", maxColorBits, "This should be between 1 and 8"); + throw new ArgumentOutOfRangeException(nameof(maxColorBits), maxColorBits, "This should be between 1 and 8"); _octree = new Octree(maxColorBits); _maxColors = maxColors; diff --git a/BizHawk.Client.EmuHawk/AVOut/SynclessRecorder.cs b/BizHawk.Client.EmuHawk/AVOut/SynclessRecorder.cs index a8e4a84ded..9b79b534ce 100644 --- a/BizHawk.Client.EmuHawk/AVOut/SynclessRecorder.cs +++ b/BizHawk.Client.EmuHawk/AVOut/SynclessRecorder.cs @@ -107,7 +107,7 @@ namespace BizHawk.Client.EmuHawk /// static List StringChunkSplit(string s, int len) { - if (len == 0) throw new ArgumentException("Invalid len", "len"); + if (len == 0) throw new ArgumentException("Invalid len", nameof(len)); int numChunks = (s.Length + len - 1) / len; List output = new List(numChunks); diff --git a/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs b/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs index 10c3b5dd78..6a3dad199e 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/MsgBox.cs @@ -136,7 +136,7 @@ namespace BizHawk.Client.EmuHawk.CustomControls public void SetButtons(string[] names, DialogResult[] results, int def) { if (names == null) - throw new ArgumentNullException("names", "Button Text is null"); + throw new ArgumentNullException(nameof(names), "Button Text is null"); int count = names.Length; diff --git a/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs b/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs index 1d71b17849..67d9512152 100644 --- a/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs +++ b/BizHawk.Emulation.Common/Base Implementations/BasicServiceProvider.cs @@ -55,7 +55,7 @@ namespace BizHawk.Emulation.Common { if (provider == null) { - throw new ArgumentNullException("provider"); + throw new ArgumentNullException(nameof(provider)); } Services[typeof(T)] = provider; diff --git a/BizHawk.Emulation.Common/Base Implementations/MemoryDomainImpls.cs b/BizHawk.Emulation.Common/Base Implementations/MemoryDomainImpls.cs index a9a80e4f02..41424c8810 100644 --- a/BizHawk.Emulation.Common/Base Implementations/MemoryDomainImpls.cs +++ b/BizHawk.Emulation.Common/Base Implementations/MemoryDomainImpls.cs @@ -69,7 +69,7 @@ namespace BizHawk.Emulation.Common if ((ulong)addr < (ulong)Size) return ((byte*)Data)[addr]; else - throw new ArgumentOutOfRangeException("addr"); + throw new ArgumentOutOfRangeException(nameof(addr)); } public override void PokeByte(long addr, byte val) @@ -79,7 +79,7 @@ namespace BizHawk.Emulation.Common if ((ulong)addr < (ulong)Size) ((byte*)Data)[addr] = val; else - throw new ArgumentOutOfRangeException("addr"); + throw new ArgumentOutOfRangeException(nameof(addr)); } } @@ -108,7 +108,7 @@ namespace BizHawk.Emulation.Common if ((ulong)addr < (ulong)Size) return ((byte*)Data)[addr ^ 1]; else - throw new ArgumentOutOfRangeException("addr"); + throw new ArgumentOutOfRangeException(nameof(addr)); } public override void PokeByte(long addr, byte val) @@ -118,7 +118,7 @@ namespace BizHawk.Emulation.Common if ((ulong)addr < (ulong)Size) ((byte*)Data)[addr ^ 1] = val; else - throw new ArgumentOutOfRangeException("addr"); + throw new ArgumentOutOfRangeException(nameof(addr)); } } diff --git a/BizHawk.Emulation.Common/Interfaces/Services/IDebuggable.cs b/BizHawk.Emulation.Common/Interfaces/Services/IDebuggable.cs index 590361544e..b2d2357ca7 100644 --- a/BizHawk.Emulation.Common/Interfaces/Services/IDebuggable.cs +++ b/BizHawk.Emulation.Common/Interfaces/Services/IDebuggable.cs @@ -57,7 +57,7 @@ namespace BizHawk.Emulation.Common } else if (bitSize > 64 || bitSize == 0) { - throw new System.ArgumentOutOfRangeException("bitSize", "BitSize must be in 1..64"); + throw new System.ArgumentOutOfRangeException(nameof(bitSize), "BitSize must be in 1..64"); } else { diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.IGBAGPUViewable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.IGBAGPUViewable.cs index 183f53e49b..76142c1433 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.IGBAGPUViewable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/Meteor.IGBAGPUViewable.cs @@ -31,7 +31,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { if (scanline < 0 || scanline > 227) { - throw new ArgumentOutOfRangeException("scanline", "Scanline must be in [0, 227]!"); + throw new ArgumentOutOfRangeException(nameof(scanline), "Scanline must be in [0, 227]!"); } if (callback == null) diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs index 6acde38273..d86306ea4f 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/GBA/VBANext.IGBAGPUViewable.cs @@ -25,7 +25,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.GBA { if (scanline < 0 || scanline > 227) { - throw new ArgumentOutOfRangeException("scanline", "Scanline must be in [0, 227]!"); + throw new ArgumentOutOfRangeException(nameof(scanline), "Scanline must be in [0, 227]!"); } if (callback == null) { diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs index 2c0793a5d9..336c3c0667 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/Gameboy/Gambatte.cs @@ -523,7 +523,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.Gameboy } else { - throw new ArgumentOutOfRangeException("line", "line must be in [0, 153]"); + throw new ArgumentOutOfRangeException(nameof(line), "line must be in [0, 153]"); } } diff --git a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs index fbbc7026b5..de789fb36e 100644 --- a/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs +++ b/BizHawk.Emulation.Cores/Consoles/Nintendo/NES/Boards/DatachBarcode.cs @@ -91,7 +91,7 @@ namespace BizHawk.Emulation.Cores.Nintendo.NES public static bool ValidString(string s, out string why) { if (s == null) - throw new ArgumentNullException("s"); + throw new ArgumentNullException(nameof(s)); if (!s.Length.In(MIN_DIGITS, MAX_DIGITS)) { why = string.Format("String must be {0} or {1} digits long!", MIN_DIGITS, MAX_DIGITS); diff --git a/BizHawk.Emulation.Cores/MemoryBlock.cs b/BizHawk.Emulation.Cores/MemoryBlock.cs index 68244ba9ab..5bdea3a105 100644 --- a/BizHawk.Emulation.Cores/MemoryBlock.cs +++ b/BizHawk.Emulation.Cores/MemoryBlock.cs @@ -215,10 +215,10 @@ namespace BizHawk.Emulation.Cores public Stream GetStream(ulong start, ulong length, bool writer) { if (start < Start) - throw new ArgumentOutOfRangeException("start"); + throw new ArgumentOutOfRangeException(nameof(start)); if (start + length > End) - throw new ArgumentOutOfRangeException("length"); + throw new ArgumentOutOfRangeException(nameof(length)); return new MemoryViewStream(!writer, writer, (long)start, (long)length, this); } @@ -232,7 +232,7 @@ namespace BizHawk.Emulation.Cores case Protection.R: p = Kernel32.MemoryProtection.READONLY; break; case Protection.RW: p = Kernel32.MemoryProtection.READWRITE; break; case Protection.RX: p = Kernel32.MemoryProtection.EXECUTE_READ; break; - default: throw new ArgumentOutOfRangeException("prot"); + default: throw new ArgumentOutOfRangeException(nameof(prot)); } return p; } diff --git a/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs b/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs index 29eff2afc5..06ed24b922 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL.GdiPlus/GdiPlusGuiRenderer.cs @@ -34,7 +34,7 @@ namespace BizHawk.Bizware.BizwareGL.Drivers.GdiPlus public void SetCornerColors(OpenTK.Graphics.Color4[] colors) { Flush(); //dont really need to flush with current implementation. we might as well roll modulate color into it too. - if (colors.Length != 4) throw new ArgumentException("array must be size 4", "colors"); + if (colors.Length != 4) throw new ArgumentException("array must be size 4", nameof(colors)); for (int i = 0; i < 4; i++) CornerColors[i] = colors[i]; } diff --git a/Bizware/BizHawk.Bizware.BizwareGL/Borrowed/BitmapFontParser/BitmapFontLoader.cs b/Bizware/BizHawk.Bizware.BizwareGL/Borrowed/BitmapFontParser/BitmapFontLoader.cs index 28e33ce7b2..a8e8dc291a 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/Borrowed/BitmapFontParser/BitmapFontLoader.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/Borrowed/BitmapFontParser/BitmapFontLoader.cs @@ -65,7 +65,7 @@ namespace Cyotek.Drawing.BitmapFont string[] lines; if (string.IsNullOrEmpty(fileName)) - throw new ArgumentNullException("fileName", "File name not specified"); + throw new ArgumentNullException(nameof(fileName), "File name not specified"); else if (!File.Exists(fileName)) throw new FileNotFoundException(string.Format("Cannot find file '{0}'", fileName), fileName); diff --git a/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs b/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs index 637101e054..9ecf4b5e5d 100644 --- a/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs +++ b/Bizware/BizHawk.Bizware.BizwareGL/GuiRenderer.cs @@ -67,7 +67,7 @@ namespace BizHawk.Bizware.BizwareGL public void SetCornerColors(OpenTK.Graphics.Color4[] colors) { Flush(); //dont really need to flush with current implementation. we might as well roll modulate color into it too. - if (colors.Length != 4) throw new ArgumentException("array must be size 4", "colors"); + if (colors.Length != 4) throw new ArgumentException("array must be size 4", nameof(colors)); for (int i = 0; i < 4; i++) CornerColors[i] = colors[i]; }