use expression body in various places

This commit is contained in:
adelikat 2020-02-25 14:13:06 -06:00
parent e744511573
commit e1bb93971a
21 changed files with 63 additions and 170 deletions

View File

@ -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),

View File

@ -234,16 +234,10 @@ namespace BizHawk.Client.Common
public int BackgroundColor => unchecked((int)0xff000000);
/// <exception cref="InvalidOperationException">always</exception>
public int VsyncNumerator
{
get { throw new InvalidOperationException(); }
}
public int VsyncNumerator => throw new InvalidOperationException();
/// <exception cref="InvalidOperationException">always</exception>
public int VsyncDenominator
{
get { throw new InvalidOperationException(); }
}
public int VsyncDenominator => throw new InvalidOperationException();
}
public static unsafe bool Load(IVideoProvider v, Stream s)

View File

@ -600,11 +600,7 @@ namespace BizHawk.Client.Common
/// <exception cref="ArgumentException">Occurs when a <see cref="DisplayType"/> is incompatible with the <see cref="WatchSize"/></exception>
public DisplayType Type
{
get
{
return _type;
}
get => _type;
set
{
if (IsDiplayTypeAvailable(value))
@ -622,11 +618,7 @@ namespace BizHawk.Client.Common
/// <exception cref="InvalidOperationException">(from setter) <paramref name="value"/> does not have the same name as this property's value</exception>
public MemoryDomain Domain
{
get
{
return _domain;
}
get => _domain;
internal set
{
if (value != null && _domain.Name == value.Name)

View File

@ -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)
{

View File

@ -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;
/// <exception cref="InvalidOperationException">
/// <paramref name="required"/> is <see langword="true"/> and either <paramref name="vertexShader"/> or <paramref name="fragmentShader"/> is unavailable (their <see cref="Shader.Available"/> property is <see langword="false"/>), or

View File

@ -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
{

View File

@ -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;
/// <exception cref="NotSupportedException"><paramref name="mode"/> is not <see cref="SyncSoundMode.Async"/></exception>
public void SetSyncMode(SyncSoundMode mode)

View File

@ -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();
/// <exception cref="InvalidOperationException">not constructed in standalone mode</exception>
public void GetSamples(short[] samples)

View File

@ -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;
/// <exception cref="NotSupportedException"><paramref name="mode"/> is not <see cref="SyncSoundMode.Async"/></exception>
public void SetSyncMode(SyncSoundMode mode)

View File

@ -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()
{

View File

@ -137,11 +137,7 @@ namespace BizHawk.Client.EmuHawk
public bool Active
{
get
{
return _active;
}
get => _active;
set
{
if (!ReadOnly)

View File

@ -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;

View File

@ -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)]

View File

@ -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;
}
}
}

View File

@ -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;
}
}

View File

@ -155,7 +155,7 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// The negated output (the typical result of the CRC calculation)
/// </summary>
public uint Result { get { return current ^ 0xFFFFFFFF; } }
public uint Result => current ^ 0xFFFFFFFF;
/// <summary>
/// The raw non-negated output

View File

@ -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
{

View File

@ -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
/// <summary>
/// The LBA of the session's leadout. In other words, for all intents and purposes, the end of the session
/// </summary>
public int LeadoutLBA { get { return LeadoutTrack.LBA; } }
public int LeadoutLBA => LeadoutTrack.LBA;
/// <summary>
/// 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
/// </summary>
public int InformationTrackCount { get { return Tracks.Count - 2; } }
public int InformationTrackCount => Tracks.Count - 2;
/// <summary>
/// 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.
/// </summary>
public Track FirstInformationTrack { get { return Tracks[1]; } }
public Track FirstInformationTrack => Tracks[1];
/// <summary>
/// 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.
/// </summary>
public Track LastInformationTrack { get { return Tracks[InformationTrackCount]; } }
public Track LastInformationTrack => Tracks[InformationTrackCount];
/// <summary>
/// A reference to the lead-out track.
/// Effectively, the end of the user area of the disc.
/// </summary>
public Track LeadoutTrack { get { return Tracks[Tracks.Count - 1]; } }
public Track LeadoutTrack => Tracks[Tracks.Count - 1];
/// <summary>
/// A reference to the lead-in track
/// </summary>
public Track LeadinTrack { get { return Tracks[0]; } }
public Track LeadinTrack => Tracks[0];
/// <summary>
/// Determines which track of the session is at the specified LBA.
@ -144,12 +142,12 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// Is this track a Data track?
/// </summary>
public bool IsData { get { return !IsAudio; } }
public bool IsData => !IsAudio;
/// <summary>
/// Is this track an Audio track?
/// </summary>
public bool IsAudio { get { return Mode == 0; } }
public bool IsAudio => Mode == 0;
/// <summary>
/// The 'control' properties of the track expected to be found in the track's subQ.

View File

@ -130,12 +130,12 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// Retrives the ADR field of the q_status member (low 4 bits)
/// </summary>
public int ADR { get { return q_status & 0xF; } }
public int ADR => q_status & 0xF;
/// <summary>
/// Retrieves the CONTROL field of the q_status member (high 4 bits)
/// </summary>
public EControlQ CONTROL { get { return (EControlQ)((q_status >> 4) & 0xF); } }
public EControlQ CONTROL => (EControlQ)((q_status >> 4) & 0xF);
}
}

View File

@ -1,7 +1,3 @@
using System;
using System.Text;
using System.Collections.Generic;
namespace BizHawk.Emulation.DiscSystem
{
/// <summary>
@ -40,7 +36,7 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// Whether the Control indicates that this is data
/// </summary>
public bool IsData { get { return (Control & EControlQ.DATA) != 0; } }
public bool IsData => (Control & EControlQ.DATA) != 0;
/// <summary>
/// The location of the track (Index 1)
@ -63,9 +59,6 @@ namespace BizHawk.Emulation.DiscSystem
/// <summary>
/// The timestamp of the leadout track. In other words, the end of the user area.
/// </summary>
public int LeadoutLBA { get { return TOCItems[100].LBA; } }
public int LeadoutLBA => TOCItems[100].LBA;
}
}

View File

@ -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
/// <summary>
/// The fully multiplied out flat-address Sector number
/// </summary>
public int Sector { get { return MIN * 60 * 75 + SEC * 75 + FRAC; } }
public int Sector => MIN * 60 * 75 + SEC * 75 + FRAC;
/// <summary>
/// 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;
}
}