Use expression body syntax

This commit is contained in:
teinarss
2021-02-25 20:52:13 +01:00
committed by Paul Chote
parent 555c43843b
commit 4a1e4f3e16
403 changed files with 1342 additions and 2031 deletions

View File

@@ -15,7 +15,7 @@ namespace OpenRA.Platforms.Default
{
sealed class DummySoundEngine : ISoundEngine
{
public bool Dummy { get { return true; } }
public bool Dummy => true;
public SoundDevice[] AvailableDevices()
{
@@ -46,7 +46,7 @@ namespace OpenRA.Platforms.Default
public float Volume
{
get { return 0; }
get => 0;
set { }
}
@@ -67,8 +67,8 @@ namespace OpenRA.Platforms.Default
class NullSound : ISound
{
public float Volume { get; set; }
public float SeekPosition { get { return 0; } }
public bool Complete { get { return false; } }
public float SeekPosition => 0;
public bool Complete => false;
public void SetPosition(WPos position) { }
}

View File

@@ -23,7 +23,7 @@ namespace OpenRA.Platforms.Default
{
sealed class OpenAlSoundEngine : ISoundEngine
{
public bool Dummy { get { return false; } }
public bool Dummy => false;
public SoundDevice[] AvailableDevices()
{
@@ -272,8 +272,8 @@ namespace OpenRA.Platforms.Default
public float Volume
{
get { return volume; }
set { AL10.alListenerf(AL10.AL_GAIN, volume = value); }
get => volume;
set => AL10.alListenerf(AL10.AL_GAIN, volume = value);
}
public void PauseSound(ISound sound, bool paused)
@@ -380,7 +380,7 @@ namespace OpenRA.Platforms.Default
uint buffer;
bool disposed;
public uint Buffer { get { return buffer; } }
public uint Buffer => buffer;
public int SampleRate { get; private set; }
public OpenAlSoundSource(byte[] data, int byteCount, int channels, int sampleBits, int sampleRate)
@@ -442,7 +442,7 @@ namespace OpenRA.Platforms.Default
public float Volume
{
get { AL10.alGetSourcef(Source, AL10.AL_GAIN, out var volume); return volume; }
set { AL10.alSourcef(Source, AL10.AL_GAIN, value); }
set => AL10.alSourcef(Source, AL10.AL_GAIN, value);
}
public virtual float SeekPosition
@@ -602,9 +602,6 @@ namespace OpenRA.Platforms.Default
}
}
public override bool Complete
{
get { return playTask.IsCompleted; }
}
public override bool Complete => playTask.IsCompleted;
}
}

View File

@@ -269,6 +269,6 @@ namespace OpenRA.Platforms.Default
}
}
public string GLVersion { get { return OpenGL.Version; } }
public string GLVersion => OpenGL.Version;
}
}

View File

@@ -25,7 +25,7 @@ namespace OpenRA.Platforms.Default
readonly IGraphicsContext context;
readonly Sdl2Input input;
public IGraphicsContext Context { get { return context; } }
public IGraphicsContext Context => context;
readonly IntPtr window;
bool disposed;
@@ -93,21 +93,9 @@ namespace OpenRA.Platforms.Default
}
}
public int CurrentDisplay
{
get
{
return SDL.SDL_GetWindowDisplayIndex(window);
}
}
public int CurrentDisplay => SDL.SDL_GetWindowDisplayIndex(window);
public int DisplayCount
{
get
{
return SDL.SDL_GetNumVideoDisplays();
}
}
public int DisplayCount => SDL.SDL_GetNumVideoDisplays();
public bool HasInputFocus { get; internal set; }

View File

@@ -20,17 +20,14 @@ namespace OpenRA.Platforms.Default
uint texture;
TextureScaleFilter scaleFilter;
public uint ID { get { return texture; } }
public uint ID => texture;
public Size Size { get; private set; }
bool disposed;
public TextureScaleFilter ScaleFilter
{
get
{
return scaleFilter;
}
get => scaleFilter;
set
{

View File

@@ -364,13 +364,7 @@ namespace OpenRA.Platforms.Default
renderThread.Join();
}
public string GLVersion
{
get
{
return Send(getGLVersion);
}
}
public string GLVersion => Send(getGLVersion);
public void Clear()
{
@@ -473,13 +467,7 @@ namespace OpenRA.Platforms.Default
disableScissor = frameBuffer.DisableScissor;
}
public ITexture Texture
{
get
{
return device.Send(getTexture);
}
}
public ITexture Texture => device.Send(getTexture);
public void Bind()
{
@@ -589,34 +577,16 @@ namespace OpenRA.Platforms.Default
dispose = texture.Dispose;
}
public uint ID
{
get
{
return id;
}
}
public uint ID => id;
public TextureScaleFilter ScaleFilter
{
get
{
return (TextureScaleFilter)device.Send(getScaleFilter);
}
get => (TextureScaleFilter)device.Send(getScaleFilter);
set
{
device.Post(setScaleFilter, value);
}
set => device.Post(setScaleFilter, value);
}
public Size Size
{
get
{
return (Size)device.Send(getSize);
}
}
public Size Size => (Size)device.Send(getSize);
public void SetEmpty(int width, int height)
{