mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2025-12-12 08:48:30 +00:00
Fixed some code-issues
This commit is contained in:
parent
8523a4ddb3
commit
925e02f146
@ -36,9 +36,9 @@ namespace CUE.NET.Brushes
|
||||
public float Opacity { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of color-corrections used to correct the colors of the brush.
|
||||
/// Gets a list of <see cref="IColorCorrection"/> used to correct the colors of the brush.
|
||||
/// </summary>
|
||||
public List<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
|
||||
public IList<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Rectangle used in the last render pass.
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
// ReSharper disable UnusedMemberInSuper.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
@ -33,7 +34,7 @@ namespace CUE.NET.Brushes
|
||||
/// <summary>
|
||||
/// Gets a list of color-corrections used to correct the colors of the brush.
|
||||
/// </summary>
|
||||
List<IColorCorrection> ColorCorrections { get; }
|
||||
IList<IColorCorrection> ColorCorrections { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the Rectangle used in the last render pass.
|
||||
|
||||
@ -2,8 +2,14 @@
|
||||
|
||||
namespace CUE.NET.Brushes
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a basic gradient-brush.
|
||||
/// </summary>
|
||||
public interface IGradientBrush : IBrush
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the gradient used by this <see cref="IGradientBrush"/>.
|
||||
/// </summary>
|
||||
IGradient Gradient { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,21 +50,37 @@ namespace CUE.NET.Brushes
|
||||
|
||||
#region Operators
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Color" /> to a <see cref="SolidColorBrush" />.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="Color"/> to convert.</param>
|
||||
public static explicit operator SolidColorBrush(Color color)
|
||||
{
|
||||
return new SolidColorBrush(color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SolidColorBrush" /> to a <see cref="Color" />.
|
||||
/// </summary>
|
||||
/// <param name="brush">The <see cref="Color"/> to convert.</param>
|
||||
public static implicit operator Color(SolidColorBrush brush)
|
||||
{
|
||||
return brush.Color;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="CorsairColor" /> to a <see cref="SolidColorBrush" />.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="Color"/> to convert.</param>
|
||||
public static explicit operator SolidColorBrush(CorsairColor color)
|
||||
{
|
||||
return new SolidColorBrush(color);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="SolidColorBrush" /> to a <see cref="CorsairColor" />.
|
||||
/// </summary>
|
||||
/// <param name="brush">The <see cref="Color"/> to convert.</param>
|
||||
public static implicit operator CorsairColor(SolidColorBrush brush)
|
||||
{
|
||||
return brush.Color;
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
using System;
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Helper;
|
||||
|
||||
|
||||
@ -16,6 +16,9 @@ using CUE.NET.Native;
|
||||
|
||||
namespace CUE.NET
|
||||
{
|
||||
/// <summary>
|
||||
/// Static entry point to work with the Corsair-SDK.
|
||||
/// </summary>
|
||||
public static partial class CueSDK
|
||||
{
|
||||
#region Properties & Fields
|
||||
@ -91,6 +94,7 @@ namespace CUE.NET
|
||||
{
|
||||
try
|
||||
{
|
||||
// ReSharper disable once RedundantIfElseBlock
|
||||
if (IsInitialized)
|
||||
{
|
||||
// ReSharper disable once SwitchStatementMissingSomeCases - everything else is true
|
||||
|
||||
@ -9,6 +9,9 @@ using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace CUE.NET
|
||||
{
|
||||
/// <summary>
|
||||
/// Static entry point to work with the Corsair-SDK.
|
||||
/// </summary>
|
||||
public static partial class CueSDK
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
@ -396,7 +396,7 @@ namespace CUE.NET.Devices.Generic
|
||||
{
|
||||
long lastUpdateTicks = _lastUpdate.Ticks;
|
||||
_lastUpdate = DateTime.Now;
|
||||
Updating?.Invoke(this, new UpdatingEventArgs((float)((DateTime.Now.Ticks - lastUpdateTicks) / 10000000f)));
|
||||
Updating?.Invoke(this, new UpdatingEventArgs((DateTime.Now.Ticks - lastUpdateTicks) / 10000000f));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@ -2,35 +2,77 @@
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
|
||||
namespace CUE.NET.Devices.Generic
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents an ARGB (alpha, red, green, blue) color used by CUE.NET.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")]
|
||||
public class CorsairColor
|
||||
{
|
||||
#region Constants
|
||||
|
||||
/// <summary>
|
||||
/// Gets an transparent color [A: 0, R: 0, G: 0, B: 0]
|
||||
/// </summary>
|
||||
public static CorsairColor Transparent => Color.Transparent;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the alpha component value of this <see cref="CorsairColor"/>.
|
||||
/// </summary>
|
||||
public byte A { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the red component value of this <see cref="CorsairColor"/>.
|
||||
/// </summary>
|
||||
public byte R { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the green component value of this <see cref="CorsairColor"/>.
|
||||
/// </summary>
|
||||
public byte G { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the blue component value of this <see cref="CorsairColor"/>.
|
||||
/// </summary>
|
||||
public byte B { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairColor"/> class.
|
||||
/// The class created by this constructor equals <see cref="Transparent"/>.
|
||||
/// </summary>
|
||||
public CorsairColor()
|
||||
{ }
|
||||
|
||||
public CorsairColor(byte r, byte g, byte b) : this(255, r, g, b)
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairColor"/> class using only RGB-Values.
|
||||
/// Alpha defaults to 255.
|
||||
/// </summary>
|
||||
/// <param name="r">The red component value of this <see cref="CorsairColor"/>.</param>
|
||||
/// <param name="g">The green component value of this <see cref="CorsairColor"/>.</param>
|
||||
/// <param name="b">The blue component value of this <see cref="CorsairColor"/>.</param>
|
||||
public CorsairColor(byte r, byte g, byte b)
|
||||
: this(255, r, g, b)
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairColor"/> class using ARGB-values.
|
||||
/// </summary>
|
||||
/// <param name="a">The alpha component value of this <see cref="CorsairColor"/>.</param>
|
||||
/// <param name="r">The red component value of this <see cref="CorsairColor"/>.</param>
|
||||
/// <param name="g">The green component value of this <see cref="CorsairColor"/>.</param>
|
||||
/// <param name="b">The blue component value of this <see cref="CorsairColor"/>.</param>
|
||||
public CorsairColor(byte a, byte r, byte g, byte b)
|
||||
{
|
||||
this.A = a;
|
||||
@ -39,6 +81,10 @@ namespace CUE.NET.Devices.Generic
|
||||
this.B = b;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="CorsairColor"/> class by cloning a existing <see cref="CorsairColor"/>.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="CorsairColor"/> the values are copied from.</param>
|
||||
public CorsairColor(CorsairColor color)
|
||||
: this(color.A, color.R, color.G, color.B)
|
||||
{ }
|
||||
@ -47,11 +93,19 @@ namespace CUE.NET.Devices.Generic
|
||||
|
||||
#region Operators
|
||||
|
||||
/// <summary>
|
||||
/// Converts the individual byte-values of this <see cref="CorsairColor"/> to a human-readable string.
|
||||
/// </summary>
|
||||
/// <returns>A string that contains the individual byte-values of this <see cref="CorsairColor"/>. For example "[A: 255, R: 255, G: 0, B: 0]".</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"[A: {A}, R: {R}, G: {G}, B: {B}]";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tests whether the specified object is a <see cref="CorsairColor" /> and is equivalent to this <see cref="CorsairColor" />.
|
||||
/// </summary>
|
||||
/// <param name="obj">The object to test.</param>
|
||||
/// <returns>true if <paramref name="obj" /> is a <see cref="CorsairColor" /> equivalent to this <see cref="CorsairColor" /> ; otherwise, false.</returns>
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
CorsairColor compareColor = obj as CorsairColor;
|
||||
@ -67,6 +121,10 @@ namespace CUE.NET.Devices.Generic
|
||||
return (compareColor.A == A) && (compareColor.R == R) && (compareColor.G == G) && (compareColor.B == B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a hash code for this <see cref="CorsairColor" />.
|
||||
/// </summary>
|
||||
/// <returns>An integer value that specifies the hash code for this <see cref="CorsairColor" />.</returns>
|
||||
public override int GetHashCode()
|
||||
{
|
||||
unchecked
|
||||
@ -79,20 +137,41 @@ namespace CUE.NET.Devices.Generic
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates whether two specified <see cref="CorsairColor" /> are equal.
|
||||
/// </summary>
|
||||
/// <param name="color1">The first <see cref="CorsairColor" /> color to compare.</param>
|
||||
/// <param name="color2">The second <see cref="CorsairColor" /> color to compare.</param>
|
||||
/// <returns>true if <paramref name="color1" /> and <paramref name="color2" /> are equal; otherwise, false.</returns>
|
||||
public static bool operator ==(CorsairColor color1, CorsairColor color2)
|
||||
{
|
||||
return ReferenceEquals(color1, null) ? ReferenceEquals(color2, null) : color1.Equals(color2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a value that indicates whether two specified <see cref="CorsairColor" /> are equal.
|
||||
/// </summary>
|
||||
/// <param name="color1">The first <see cref="CorsairColor" /> color to compare.</param>
|
||||
/// <param name="color2">The second <see cref="CorsairColor" /> color to compare.</param>
|
||||
/// <returns>true if <paramref name="color1" /> and <paramref name="color2" /> are not equal; otherwise, false.</returns>
|
||||
public static bool operator !=(CorsairColor color1, CorsairColor color2)
|
||||
{
|
||||
return !(color1 == color2);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="Color" /> to a <see cref="CorsairColor" />.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="Color"/> to convert.</param>
|
||||
public static implicit operator CorsairColor(Color color)
|
||||
{
|
||||
return new CorsairColor(color.A, color.R, color.G, color.B);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="CorsairColor" /> to a <see cref="Color" />.
|
||||
/// </summary>
|
||||
/// <param name="color">The <see cref="CorsairColor"/> to convert.</param>
|
||||
public static implicit operator Color(CorsairColor color)
|
||||
{
|
||||
return Color.FromArgb(color.A, color.R, color.G, color.B);
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
using CUE.NET.Helper;
|
||||
@ -11,10 +12,11 @@ namespace CUE.NET.Devices.Generic
|
||||
/// <summary>
|
||||
/// Represents a single LED of a CUE-device.
|
||||
/// </summary>
|
||||
[DebuggerDisplay("{Id} {Color}")]
|
||||
public class CorsairLed
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the key-ID of the Led.
|
||||
/// </summary>
|
||||
@ -52,7 +54,7 @@ namespace CUE.NET.Devices.Generic
|
||||
/// <summary>
|
||||
/// Gets or sets if the color of this LED can be changed.
|
||||
/// </summary>
|
||||
public bool IsLocked { get; set; } = false;
|
||||
public bool IsLocked { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
@ -73,6 +75,15 @@ namespace CUE.NET.Devices.Generic
|
||||
|
||||
#region Methods
|
||||
|
||||
/// <summary>
|
||||
/// Converts the Id and the <see cref="Color"/> of this <see cref="CorsairLed"/> to a human-readable string.
|
||||
/// </summary>
|
||||
/// <returns>A string that contains the Id and the <see cref="Color"/> of this <see cref="CorsairLed"/>. For example "Enter [A: 255, R: 255, G: 0, B: 0]".</returns>
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{Id} {Color}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Updates the LED to the requested color.
|
||||
/// </summary>
|
||||
@ -92,5 +103,27 @@ namespace CUE.NET.Devices.Generic
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Operators
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="CorsairLed" /> to a <see cref="CorsairLedId" />.
|
||||
/// </summary>
|
||||
/// <param name="led">The <see cref="CorsairLed"/> to convert.</param>
|
||||
public static implicit operator CorsairLedId(CorsairLed led)
|
||||
{
|
||||
return led?.Id ?? CorsairLedId.Invalid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a <see cref="CorsairLed" /> to a <see cref="CorsairColor" />.
|
||||
/// </summary>
|
||||
/// <param name="led">The <see cref="CorsairLed"/> to convert.</param>
|
||||
public static implicit operator CorsairColor(CorsairLed led)
|
||||
{
|
||||
return led?.Color;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace CUE.NET.Devices.Generic.Enums
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace CUE.NET.Devices.Generic.Enums
|
||||
{
|
||||
/// <summary>
|
||||
@ -8,6 +10,7 @@ namespace CUE.NET.Devices.Generic.Enums
|
||||
/// </summary>
|
||||
public enum CorsairDeviceType
|
||||
{
|
||||
|
||||
Unknown = 0,
|
||||
Mouse = 1,
|
||||
Keyboard = 2,
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace CUE.NET.Devices.Generic.Enums
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -6,7 +6,7 @@ using System;
|
||||
namespace CUE.NET.Devices.Generic.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the information supplied with an Exception-event.
|
||||
/// Represents the information supplied with an <see cref="ICueDevice.Exception"/>-event.
|
||||
/// </summary>
|
||||
public class ExceptionEventArgs : System.EventArgs
|
||||
{
|
||||
|
||||
@ -5,16 +5,26 @@ using System.Collections.Generic;
|
||||
|
||||
namespace CUE.NET.Devices.Generic.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the information supplied with an <see cref="ICueDevice.LedsUpdated"/>-event.
|
||||
/// </summary>
|
||||
public class LedsUpdatedEventArgs : System.EventArgs
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="LedUpateRequest"/> from the updated leds.
|
||||
/// </summary>
|
||||
public IEnumerable<LedUpateRequest> UpdatedLeds { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LedsUpdatedEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updatedLeds">The updated leds.</param>
|
||||
public LedsUpdatedEventArgs(IEnumerable<LedUpateRequest> updatedLeds)
|
||||
{
|
||||
this.UpdatedLeds = updatedLeds;
|
||||
|
||||
@ -5,16 +5,26 @@ using System.Collections.Generic;
|
||||
|
||||
namespace CUE.NET.Devices.Generic.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the information supplied with an <see cref="ICueDevice.LedsUpdating"/>-event.
|
||||
/// </summary>
|
||||
public class LedsUpdatingEventArgs : System.EventArgs
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets a list of <see cref="LedUpateRequest"/> from the updating leds.
|
||||
/// </summary>
|
||||
public ICollection<LedUpateRequest> UpdatingLeds { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="LedsUpdatingEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="updatingLeds">The updating leds.</param>
|
||||
public LedsUpdatingEventArgs(ICollection<LedUpateRequest> updatingLeds)
|
||||
{
|
||||
this.UpdatingLeds = updatingLeds;
|
||||
|
||||
@ -1,5 +1,8 @@
|
||||
namespace CUE.NET.Devices.Generic.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the information supplied with an <see cref="ICueDevice.Updated"/>-event.
|
||||
/// </summary>
|
||||
public class UpdatedEventArgs : System.EventArgs
|
||||
{ }
|
||||
}
|
||||
|
||||
@ -3,16 +3,26 @@
|
||||
|
||||
namespace CUE.NET.Devices.Generic.EventArgs
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents the information supplied with an <see cref="ICueDevice.Updating"/>-event.
|
||||
/// </summary>
|
||||
public class UpdatingEventArgs : System.EventArgs
|
||||
{
|
||||
#region Properties & Fields
|
||||
|
||||
/// <summary>
|
||||
/// Gets the elapsed time (in seconds) sonce the last update.
|
||||
/// </summary>
|
||||
public float DeltaTime { get; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="UpdatingEventArgs"/> class.
|
||||
/// </summary>
|
||||
/// <param name="deltaTime">The elapsed time (in seconds) sonce the last update.</param>
|
||||
public UpdatingEventArgs(float deltaTime)
|
||||
{
|
||||
this.DeltaTime = deltaTime;
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace CUE.NET.Devices.Headset.Enums
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Enums
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable InconsistentNaming
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Enums
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace CUE.NET.Devices.Mouse.Enums
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
// ReSharper disable UnusedMember.Global
|
||||
// ReSharper disable InconsistentNaming
|
||||
|
||||
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
|
||||
|
||||
using CUE.NET.Devices.Generic.Enums;
|
||||
|
||||
namespace CUE.NET.Devices.Mousemat.Enums
|
||||
|
||||
@ -76,6 +76,7 @@ namespace CUE.NET.Effects
|
||||
_currentPhaseValue -= deltaTime;
|
||||
|
||||
// Using ifs instead of a switch allows to skip phases with time 0.
|
||||
// ReSharper disable InvertIf
|
||||
|
||||
if (_currentPhase == ADSRPhase.Attack)
|
||||
if (_currentPhaseValue > 0f)
|
||||
@ -123,6 +124,8 @@ namespace CUE.NET.Effects
|
||||
_currentPhaseValue = Attack;
|
||||
_currentPhase = ADSRPhase.Attack;
|
||||
}
|
||||
|
||||
// ReSharper restore InvertIf
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -9,6 +9,8 @@ namespace CUE.NET.Effects
|
||||
public class MoveGradientEffect : AbstractBrushEffect<IGradientBrush>
|
||||
{
|
||||
#region Properties & Fields
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the direction the gradient is moved.
|
||||
@ -24,6 +26,8 @@ namespace CUE.NET.Effects
|
||||
/// </summary>
|
||||
public float Speed { get; set; }
|
||||
|
||||
// ReSharper restore MemberCanBePrivate.Global
|
||||
// ReSharper restore AutoPropertyCanBeMadeGetOnly.Global
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
@ -53,6 +57,7 @@ namespace CUE.NET.Effects
|
||||
if (!Direction)
|
||||
movement = -movement;
|
||||
|
||||
// ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull
|
||||
if (Brush.Gradient is LinearGradient)
|
||||
{
|
||||
LinearGradient linearGradient = (LinearGradient)Brush.Gradient;
|
||||
|
||||
@ -14,6 +14,7 @@ namespace Example_Ambilight_full.TakeAsIs
|
||||
get { return _ambienceCreatorType; }
|
||||
set
|
||||
{
|
||||
// ReSharper disable once InvertIf
|
||||
if (_ambienceCreatorType != value)
|
||||
{
|
||||
_ambienceCreatorType = value;
|
||||
|
||||
@ -76,10 +76,7 @@ namespace CUE.NET.Gradients
|
||||
return max;
|
||||
|
||||
float min = GradientStops.Min(n => n.Offset);
|
||||
if (offset < min)
|
||||
return min;
|
||||
|
||||
return offset;
|
||||
return offset < min ? min : offset;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@ -19,6 +19,7 @@ namespace CUE.NET.Groups.Extensions
|
||||
public static ListLedGroup ToListLedGroup(this AbstractLedGroup ledGroup)
|
||||
{
|
||||
ListLedGroup listLedGroup = ledGroup as ListLedGroup;
|
||||
// ReSharper disable once InvertIf
|
||||
if (listLedGroup == null)
|
||||
{
|
||||
bool wasAttached = ledGroup.Detach();
|
||||
|
||||
@ -8,6 +8,9 @@ using CUE.NET.Effects;
|
||||
|
||||
namespace CUE.NET.Groups
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a basic led-group.
|
||||
/// </summary>
|
||||
public interface ILedGroup : IEffectTarget<ILedGroup>
|
||||
{
|
||||
/// <summary>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System;
|
||||
using CUE.NET.ColorCorrection;
|
||||
using CUE.NET.Devices.Generic;
|
||||
|
||||
namespace CUE.NET.Helper
|
||||
@ -90,6 +89,7 @@ namespace CUE.NET.Helper
|
||||
/// <returns>The resulting color.</returns>
|
||||
public static CorsairColor Blend(this CorsairColor bg, CorsairColor fg)
|
||||
{
|
||||
// ReSharper disable once ConvertIfStatementToSwitchStatement
|
||||
if (fg.A == 255)
|
||||
return fg;
|
||||
|
||||
@ -120,7 +120,7 @@ namespace CUE.NET.Helper
|
||||
float min = Math.Min(Math.Min(color.R, color.G), color.B);
|
||||
float max = Math.Max(Math.Max(color.R, color.G), color.B);
|
||||
|
||||
float hue = 0f;
|
||||
float hue;
|
||||
if (Math.Abs(max - color.R) < float.Epsilon) // r is max
|
||||
hue = (color.G - color.B) / (max - min);
|
||||
else if (Math.Abs(max - color.G) < float.Epsilon) // g is max
|
||||
|
||||
@ -63,6 +63,7 @@ namespace CUE.NET.Profiles
|
||||
public static CueProfile LoadProfileByName(string name = null)
|
||||
{
|
||||
string id = null;
|
||||
// ReSharper disable once InvertIf
|
||||
if (name != null && !_profileNameMapping.TryGetValue(name, out id))
|
||||
{
|
||||
LoadProfileNames(); // Reload and try again
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user