diff --git a/BizHawk.Client.Common/FrameworkFastZipWriter.cs b/BizHawk.Client.Common/FrameworkFastZipWriter.cs index c55058aad3..878c2a0da2 100644 --- a/BizHawk.Client.Common/FrameworkFastZipWriter.cs +++ b/BizHawk.Client.Common/FrameworkFastZipWriter.cs @@ -106,25 +106,12 @@ namespace BizHawk.Client.Common public override bool CanWrite => true; - public override long Length - { - get - { - throw new NotImplementedException(); - } - } + public override long Length => throw new NotImplementedException(); public override long Position { - get - { - throw new NotImplementedException(); - } - - set - { - throw new NotImplementedException(); - } + get => throw new NotImplementedException(); + set => throw new NotImplementedException(); } } @@ -148,7 +135,7 @@ namespace BizHawk.Client.Common | dt.Month << 5 | (dt.Year - 1980) << 9; - var modifiedDate = new byte[] + var modifiedDate = new[] { (byte)(mtime & 0xff), (byte)(mtime >> 8), diff --git a/BizHawk.Client.Common/QuickBmpFile.cs b/BizHawk.Client.Common/QuickBmpFile.cs index e3d25fb772..3108e711bf 100644 --- a/BizHawk.Client.Common/QuickBmpFile.cs +++ b/BizHawk.Client.Common/QuickBmpFile.cs @@ -234,16 +234,10 @@ namespace BizHawk.Client.Common public int BackgroundColor => unchecked((int)0xff000000); /// always - public int VsyncNumerator - { - get { throw new InvalidOperationException(); } - } + public int VsyncNumerator => throw new InvalidOperationException(); /// always - public int VsyncDenominator - { - get { throw new InvalidOperationException(); } - } + public int VsyncDenominator => throw new InvalidOperationException(); } public static unsafe bool Load(IVideoProvider v, Stream s) diff --git a/BizHawk.Client.Common/tools/Watch/Watch.cs b/BizHawk.Client.Common/tools/Watch/Watch.cs index b5b3348a0d..44ab8eea5a 100644 --- a/BizHawk.Client.Common/tools/Watch/Watch.cs +++ b/BizHawk.Client.Common/tools/Watch/Watch.cs @@ -600,11 +600,7 @@ namespace BizHawk.Client.Common /// Occurs when a is incompatible with the public DisplayType Type { - get - { - return _type; - } - + get => _type; set { if (IsDiplayTypeAvailable(value)) @@ -622,11 +618,7 @@ namespace BizHawk.Client.Common /// (from setter) does not have the same name as this property's value public MemoryDomain Domain { - get - { - return _domain; - } - + get => _domain; internal set { if (value != null && _domain.Name == value.Name) diff --git a/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_GdiPlus.cs b/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_GdiPlus.cs index 04cdac3358..c84a9196a7 100644 --- a/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_GdiPlus.cs +++ b/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_GdiPlus.cs @@ -1,10 +1,6 @@ using System; using System.IO; -using System.Collections.Generic; using System.Drawing; -using System.Drawing.Imaging; -using System.Windows.Forms; - using OpenTK; using OpenTK.Graphics.OpenGL; @@ -32,7 +28,7 @@ namespace BizHawk.Client.EmuHawk { } - public void Clear(OpenTK.Graphics.OpenGL.ClearBufferMask mask) + public void Clear(ClearBufferMask mask) { var g = GetCurrentGraphics(); if((mask & ClearBufferMask.ColorBufferBit) != 0) @@ -41,7 +37,7 @@ namespace BizHawk.Client.EmuHawk } } - public string API { get { return "GDIPLUS"; } } + public string API => "GDIPLUS"; public IBlendState CreateBlendState(BlendingFactorSrc colorSource, BlendEquationMode colorEquation, BlendingFactorDest colorDest, BlendingFactorSrc alphaSource, BlendEquationMode alphaEquation, BlendingFactorDest alphaDest) @@ -85,9 +81,9 @@ namespace BizHawk.Client.EmuHawk class MyBlendState : IBlendState { } static MyBlendState _rsBlendNoneVerbatim = new MyBlendState(), _rsBlendNoneOpaque = new MyBlendState(), _rsBlendNormal = new MyBlendState(); - public IBlendState BlendNoneCopy { get { return _rsBlendNoneVerbatim; } } - public IBlendState BlendNoneOpaque { get { return _rsBlendNoneOpaque; } } - public IBlendState BlendNormal { get { return _rsBlendNormal; } } + public IBlendState BlendNoneCopy => _rsBlendNoneVerbatim; + public IBlendState BlendNoneOpaque => _rsBlendNoneOpaque; + public IBlendState BlendNormal => _rsBlendNormal; public Pipeline CreatePipeline(VertexLayout vertexLayout, Shader vertexShader, Shader fragmentShader, bool required, string memo) { @@ -96,7 +92,7 @@ namespace BizHawk.Client.EmuHawk public void FreePipeline(Pipeline pipeline) {} - public VertexLayout CreateVertexLayout() { return new VertexLayout(this, new IntPtr(0)); } + public VertexLayout CreateVertexLayout() => new VertexLayout(this, new IntPtr(0)); public void SetTextureWrapMode(Texture2d tex, bool clamp) { diff --git a/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_SlimDX9.cs b/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_SlimDX9.cs index e1180a6fdd..ec48778120 100644 --- a/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_SlimDX9.cs +++ b/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_SlimDX9.cs @@ -38,7 +38,7 @@ namespace BizHawk.Client.EmuHawk Pipeline _CurrPipeline; GLControlWrapper_SlimDX9 _CurrentControl; - public string API { get { return "D3D9"; } } + public string API => "D3D9"; public IGL_SlimDX9() { @@ -369,9 +369,9 @@ namespace BizHawk.Client.EmuHawk CacheBlendState _rsBlendNoneVerbatim, _rsBlendNoneOpaque, _rsBlendNormal; - public IBlendState BlendNoneCopy { get { return _rsBlendNoneVerbatim; } } - public IBlendState BlendNoneOpaque { get { return _rsBlendNoneOpaque; } } - public IBlendState BlendNormal { get { return _rsBlendNormal; } } + public IBlendState BlendNoneCopy => _rsBlendNoneVerbatim; + public IBlendState BlendNoneOpaque => _rsBlendNoneOpaque; + public IBlendState BlendNormal => _rsBlendNormal; /// /// is and either or is unavailable (their property is ), or diff --git a/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_TK.cs b/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_TK.cs index 3fa8d447f5..98c41d60cd 100644 --- a/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_TK.cs +++ b/BizHawk.Client.EmuHawk/GraphicsImplementations/IGL_TK.cs @@ -160,9 +160,9 @@ namespace BizHawk.Client.EmuHawk } } - public IBlendState BlendNoneCopy { get { return _rsBlendNoneVerbatim; } } - public IBlendState BlendNoneOpaque { get { return _rsBlendNoneOpaque; } } - public IBlendState BlendNormal { get { return _rsBlendNormal; } } + public IBlendState BlendNoneCopy => _rsBlendNoneVerbatim; + public IBlendState BlendNoneOpaque => _rsBlendNoneOpaque; + public IBlendState BlendNormal => _rsBlendNormal; class ShaderWrapper { diff --git a/BizHawk.Client.EmuHawk/Sound/Utilities/BufferedAsync.cs b/BizHawk.Client.EmuHawk/Sound/Utilities/BufferedAsync.cs index a67436e771..4718c563a7 100644 --- a/BizHawk.Client.EmuHawk/Sound/Utilities/BufferedAsync.cs +++ b/BizHawk.Client.EmuHawk/Sound/Utilities/BufferedAsync.cs @@ -88,15 +88,9 @@ namespace BizHawk.Client.EmuHawk } } - public bool CanProvideAsync - { - get { return true; } - } + public bool CanProvideAsync => true; - public SyncSoundMode SyncMode - { - get { return SyncSoundMode.Async; } - } + public SyncSoundMode SyncMode => SyncSoundMode.Async; /// is not public void SetSyncMode(SyncSoundMode mode) diff --git a/BizHawk.Client.EmuHawk/Sound/Utilities/SoundOutputProvider.cs b/BizHawk.Client.EmuHawk/Sound/Utilities/SoundOutputProvider.cs index a5a4b94758..fa096d6601 100644 --- a/BizHawk.Client.EmuHawk/Sound/Utilities/SoundOutputProvider.cs +++ b/BizHawk.Client.EmuHawk/Sound/Utilities/SoundOutputProvider.cs @@ -119,10 +119,7 @@ namespace BizHawk.Client.EmuHawk public bool LogDebug { get; set; } - private double AdvertisedSamplesPerFrame - { - get { return SampleRate / Global.Emulator.VsyncRate(); } - } + private double AdvertisedSamplesPerFrame => SampleRate / Global.Emulator.VsyncRate(); /// not constructed in standalone mode public void GetSamples(short[] samples) diff --git a/BizHawk.Client.EmuHawk/Sound/Utilities/SyncToAsyncProvider.cs b/BizHawk.Client.EmuHawk/Sound/Utilities/SyncToAsyncProvider.cs index 2e09c43545..35fdd39aa1 100644 --- a/BizHawk.Client.EmuHawk/Sound/Utilities/SyncToAsyncProvider.cs +++ b/BizHawk.Client.EmuHawk/Sound/Utilities/SyncToAsyncProvider.cs @@ -18,15 +18,9 @@ namespace BizHawk.Client.EmuHawk _outputProvider.DiscardSamples(); } - public bool CanProvideAsync - { - get { return true; } - } + public bool CanProvideAsync => true; - public SyncSoundMode SyncMode - { - get { return SyncSoundMode.Async; } - } + public SyncSoundMode SyncMode => SyncSoundMode.Async; /// is not public void SetSyncMode(SyncSoundMode mode) diff --git a/BizHawk.Client.EmuHawk/UpdateChecker.cs b/BizHawk.Client.EmuHawk/UpdateChecker.cs index 713164639c..38168c127e 100644 --- a/BizHawk.Client.EmuHawk/UpdateChecker.cs +++ b/BizHawk.Client.EmuHawk/UpdateChecker.cs @@ -40,7 +40,7 @@ namespace BizHawk.Client.EmuHawk public static void BeginCheck(bool skipCheck = false) { - if (skipCheck || String.IsNullOrEmpty(_latestVersionInfoURL) || !AutoCheckEnabled || LastCheckTimeUTC > DateTime.UtcNow - _minimumCheckDuration) + if (skipCheck || string.IsNullOrEmpty(_latestVersionInfoURL) || !AutoCheckEnabled || LastCheckTimeUTC > DateTime.UtcNow - _minimumCheckDuration) { OnCheckComplete(); return; @@ -49,16 +49,11 @@ namespace BizHawk.Client.EmuHawk ThreadPool.QueueUserWorkItem((s) => CheckInternal()); } - public static bool IsNewVersionAvailable - { - get - { - return AutoCheckEnabled && - LatestVersion != IgnoreVersion && - ParseVersion(VersionInfo.Mainversion) != 0 && // Avoid notifying if current version string is invalid - ParseVersion(LatestVersion) > ParseVersion(VersionInfo.Mainversion); - } - } + public static bool IsNewVersionAvailable => + AutoCheckEnabled + && LatestVersion != IgnoreVersion + && ParseVersion(VersionInfo.Mainversion) != 0 // Avoid notifying if current version string is invalid + && ParseVersion(LatestVersion) > ParseVersion(VersionInfo.Mainversion); public static void IgnoreNewVersion() { diff --git a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs index b296f0d821..06a85969b1 100644 --- a/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs +++ b/BizHawk.Client.EmuHawk/tools/Debugger/Breakpoint.cs @@ -137,11 +137,7 @@ namespace BizHawk.Client.EmuHawk public bool Active { - get - { - return _active; - } - + get => _active; set { if (!ReadOnly) diff --git a/BizHawk.Client.EmuHawk/tools/GameShark.cs b/BizHawk.Client.EmuHawk/tools/GameShark.cs index 9c21b689d3..8edd8c5a37 100644 --- a/BizHawk.Client.EmuHawk/tools/GameShark.cs +++ b/BizHawk.Client.EmuHawk/tools/GameShark.cs @@ -134,34 +134,21 @@ namespace BizHawk.Client.EmuHawk InitializeComponent(); } - public bool UpdateBefore - { - get - { - return true; - } - } - - public bool AskSaveChanges() - { - return true; - } + public bool UpdateBefore => true; + public bool AskSaveChanges() => true; public void FastUpdate() { - } public void Restart() { - } public void NewUpdate(ToolFormUpdateType type) { } public void UpdateValues() { - } //My Variables @@ -198,7 +185,7 @@ namespace BizHawk.Client.EmuHawk GEN(); break; case "N64": - //This determies what kind of Code we have + // This determines what kind of Code we have testo = SingleCheat.Remove(2, 11); N64(); break; diff --git a/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs b/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs index 76a2ec0ac5..8d8747f92d 100644 --- a/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs +++ b/BizHawk.Emulation.DiscSystem/API_MednaDisc.cs @@ -1,8 +1,4 @@ using System; -using System.Text; -using System.IO; -using System.Globalization; -using System.Collections.Generic; using System.Runtime.InteropServices; using BizHawk.Common; @@ -109,7 +105,7 @@ namespace BizHawk.Emulation.DiscSystem } static bool _IsLibraryAvailable; - public static bool IsLibraryAvailable { get { return _IsLibraryAvailable; } } + public static bool IsLibraryAvailable => _IsLibraryAvailable; public void Dispose() { @@ -135,7 +131,7 @@ namespace BizHawk.Emulation.DiscSystem //can't be a bool due to marshalling... [FieldOffset(8)] public byte _validByte; - public bool Valid { get { return _validByte != 0; } } + public bool Valid => _validByte != 0; } [DllImport("mednadisc.dll", CallingConvention = CallingConvention.Cdecl)] diff --git a/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs b/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs index 8170fc54d1..08b53db2c7 100644 --- a/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs +++ b/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_RawFile.cs @@ -50,13 +50,7 @@ namespace BizHawk.Emulation.DiscSystem fs.Position = target; return fs.Read(buffer, offset, count); } - public long Length - { - get - { - return length; - } - } + public long Length => length; } } } \ No newline at end of file diff --git a/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs b/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs index fbd96f4c84..f15365a767 100644 --- a/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs +++ b/BizHawk.Emulation.DiscSystem/DiscFormats/Blobs/Blob_WaveFile.cs @@ -29,10 +29,7 @@ namespace BizHawk.Emulation.DiscSystem { public string PhysicalPath { - get - { - return physicalPath; - } + get => physicalPath; set { physicalPath = value; @@ -65,13 +62,7 @@ namespace BizHawk.Emulation.DiscSystem fs.Position = target; return fs.Read(buffer, offset, count); } - public long Length - { - get - { - return length; - } - } + public long Length => length; } public void Load(byte[] waveData) @@ -144,12 +135,11 @@ namespace BizHawk.Emulation.DiscSystem RiffMaster RiffSource; long waveDataStreamPos; long mDataLength; - public long Length { get { return mDataLength; } } + public long Length => mDataLength; public void Dispose() { - if (RiffSource != null) - RiffSource.Dispose(); + RiffSource?.Dispose(); RiffSource = null; } } diff --git a/BizHawk.Emulation.DiscSystem/DiscHasher.cs b/BizHawk.Emulation.DiscSystem/DiscHasher.cs index 7151ded124..47e3b3d1eb 100644 --- a/BizHawk.Emulation.DiscSystem/DiscHasher.cs +++ b/BizHawk.Emulation.DiscSystem/DiscHasher.cs @@ -155,7 +155,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// The negated output (the typical result of the CRC calculation) /// - public uint Result { get { return current ^ 0xFFFFFFFF; } } + public uint Result => current ^ 0xFFFFFFFF; /// /// The raw non-negated output diff --git a/BizHawk.Emulation.DiscSystem/DiscStream.cs b/BizHawk.Emulation.DiscSystem/DiscStream.cs index 54c536360e..b6fb1c6ac0 100644 --- a/BizHawk.Emulation.DiscSystem/DiscStream.cs +++ b/BizHawk.Emulation.DiscSystem/DiscStream.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; - -using BizHawk.Common.BufferExtensions; namespace BizHawk.Emulation.DiscSystem { @@ -90,11 +87,11 @@ namespace BizHawk.Emulation.DiscSystem cachedSectorBuffer = new byte[SectorSize]; } - public override bool CanRead { get { return true; } } - public override bool CanSeek { get { return true; } } - public override bool CanWrite { get { return false; } } + public override bool CanRead => true; + public override bool CanSeek => true; + public override bool CanWrite => false; public override void Flush() { throw new NotImplementedException(); } - public override long Length { get { return NumSectors * SectorSize; } } + public override long Length => NumSectors * SectorSize; public override long Position { diff --git a/BizHawk.Emulation.DiscSystem/DiscStructure.cs b/BizHawk.Emulation.DiscSystem/DiscStructure.cs index d6a9905df0..a960174f8d 100644 --- a/BizHawk.Emulation.DiscSystem/DiscStructure.cs +++ b/BizHawk.Emulation.DiscSystem/DiscStructure.cs @@ -1,6 +1,4 @@ -using System; -using System.Text; -using System.Collections.Generic; +using System.Collections.Generic; namespace BizHawk.Emulation.DiscSystem { @@ -26,7 +24,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// The LBA of the session's leadout. In other words, for all intents and purposes, the end of the session /// - public int LeadoutLBA { get { return LeadoutTrack.LBA; } } + public int LeadoutLBA => LeadoutTrack.LBA; /// /// The session number @@ -38,7 +36,7 @@ namespace BizHawk.Emulation.DiscSystem /// This excludes the lead-in and lead-out tracks /// Use this instead of Tracks.Count /// - public int InformationTrackCount { get { return Tracks.Count - 2; } } + public int InformationTrackCount => Tracks.Count - 2; /// /// All the tracks in the session.. but... Tracks[0] is the lead-in track. Tracks[1] should be "Track 1". So beware of this. @@ -51,24 +49,24 @@ namespace BizHawk.Emulation.DiscSystem /// A reference to the first information track (Track 1) /// The raw TOC may have specified something different; it's not clear how this discrepancy is handled. /// - public Track FirstInformationTrack { get { return Tracks[1]; } } + public Track FirstInformationTrack => Tracks[1]; /// /// A reference to the last information track on the disc. /// The raw TOC may have specified something different; it's not clear how this discrepancy is handled. /// - public Track LastInformationTrack { get { return Tracks[InformationTrackCount]; } } + public Track LastInformationTrack => Tracks[InformationTrackCount]; /// /// A reference to the lead-out track. /// Effectively, the end of the user area of the disc. /// - public Track LeadoutTrack { get { return Tracks[Tracks.Count - 1]; } } + public Track LeadoutTrack => Tracks[Tracks.Count - 1]; /// /// A reference to the lead-in track /// - public Track LeadinTrack { get { return Tracks[0]; } } + public Track LeadinTrack => Tracks[0]; /// /// Determines which track of the session is at the specified LBA. @@ -144,12 +142,12 @@ namespace BizHawk.Emulation.DiscSystem /// /// Is this track a Data track? /// - public bool IsData { get { return !IsAudio; } } + public bool IsData => !IsAudio; /// /// Is this track an Audio track? /// - public bool IsAudio { get { return Mode == 0; } } + public bool IsAudio => Mode == 0; /// /// The 'control' properties of the track expected to be found in the track's subQ. diff --git a/BizHawk.Emulation.DiscSystem/DiscSubQ.cs b/BizHawk.Emulation.DiscSystem/DiscSubQ.cs index b8adb872c3..4b7123f256 100644 --- a/BizHawk.Emulation.DiscSystem/DiscSubQ.cs +++ b/BizHawk.Emulation.DiscSystem/DiscSubQ.cs @@ -130,12 +130,12 @@ namespace BizHawk.Emulation.DiscSystem /// /// Retrives the ADR field of the q_status member (low 4 bits) /// - public int ADR { get { return q_status & 0xF; } } + public int ADR => q_status & 0xF; /// /// Retrieves the CONTROL field of the q_status member (high 4 bits) /// - public EControlQ CONTROL { get { return (EControlQ)((q_status >> 4) & 0xF); } } + public EControlQ CONTROL => (EControlQ)((q_status >> 4) & 0xF); } } diff --git a/BizHawk.Emulation.DiscSystem/DiscTOC.cs b/BizHawk.Emulation.DiscSystem/DiscTOC.cs index 999f3c826f..c06b8454bf 100644 --- a/BizHawk.Emulation.DiscSystem/DiscTOC.cs +++ b/BizHawk.Emulation.DiscSystem/DiscTOC.cs @@ -1,7 +1,3 @@ -using System; -using System.Text; -using System.Collections.Generic; - namespace BizHawk.Emulation.DiscSystem { /// @@ -40,7 +36,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// Whether the Control indicates that this is data /// - public bool IsData { get { return (Control & EControlQ.DATA) != 0; } } + public bool IsData => (Control & EControlQ.DATA) != 0; /// /// The location of the track (Index 1) @@ -63,9 +59,6 @@ namespace BizHawk.Emulation.DiscSystem /// /// The timestamp of the leadout track. In other words, the end of the user area. /// - public int LeadoutLBA { get { return TOCItems[100].LBA; } } + public int LeadoutLBA => TOCItems[100].LBA; } - - - } \ No newline at end of file diff --git a/BizHawk.Emulation.DiscSystem/DiscTypes.cs b/BizHawk.Emulation.DiscSystem/DiscTypes.cs index 8248d61cc3..53d2ee8dd0 100644 --- a/BizHawk.Emulation.DiscSystem/DiscTypes.cs +++ b/BizHawk.Emulation.DiscSystem/DiscTypes.cs @@ -1,8 +1,4 @@ using System; -using System.Linq; -using System.Text; -using System.IO; -using System.Collections.Generic; namespace BizHawk.Emulation.DiscSystem { @@ -146,7 +142,7 @@ namespace BizHawk.Emulation.DiscSystem /// /// The fully multiplied out flat-address Sector number /// - public int Sector { get { return MIN * 60 * 75 + SEC * 75 + FRAC; } } + public int Sector => MIN * 60 * 75 + SEC * 75 + FRAC; /// /// creates timestamp from the supplied MSF @@ -177,9 +173,6 @@ namespace BizHawk.Emulation.DiscSystem Valid = true; } - public override string ToString() - { - return Value; - } + public override string ToString() => Value; } } \ No newline at end of file