1
0
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:
Darth Affe 2017-01-05 16:37:00 +01:00
parent 8523a4ddb3
commit 925e02f146
31 changed files with 223 additions and 16 deletions

View File

@ -36,9 +36,9 @@ namespace CUE.NET.Brushes
public float Opacity { get; set; } public float Opacity { get; set; }
/// <summary> /// <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> /// </summary>
public List<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>(); public IList<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
/// <summary> /// <summary>
/// Gets the Rectangle used in the last render pass. /// Gets the Rectangle used in the last render pass.

View File

@ -1,5 +1,6 @@
// ReSharper disable UnusedMemberInSuper.Global // ReSharper disable UnusedMemberInSuper.Global
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
// ReSharper disable ReturnTypeCanBeEnumerable.Global
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
@ -33,7 +34,7 @@ namespace CUE.NET.Brushes
/// <summary> /// <summary>
/// Gets a list of color-corrections used to correct the colors of the brush. /// Gets a list of color-corrections used to correct the colors of the brush.
/// </summary> /// </summary>
List<IColorCorrection> ColorCorrections { get; } IList<IColorCorrection> ColorCorrections { get; }
/// <summary> /// <summary>
/// Gets the Rectangle used in the last render pass. /// Gets the Rectangle used in the last render pass.

View File

@ -2,8 +2,14 @@
namespace CUE.NET.Brushes namespace CUE.NET.Brushes
{ {
/// <summary>
/// Represents a basic gradient-brush.
/// </summary>
public interface IGradientBrush : IBrush public interface IGradientBrush : IBrush
{ {
/// <summary>
/// Gets the gradient used by this <see cref="IGradientBrush"/>.
/// </summary>
IGradient Gradient { get; } IGradient Gradient { get; }
} }
} }

View File

@ -50,21 +50,37 @@ namespace CUE.NET.Brushes
#region Operators #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) public static explicit operator SolidColorBrush(Color color)
{ {
return new SolidColorBrush(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) public static implicit operator Color(SolidColorBrush brush)
{ {
return brush.Color; 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) public static explicit operator SolidColorBrush(CorsairColor color)
{ {
return new SolidColorBrush(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) public static implicit operator CorsairColor(SolidColorBrush brush)
{ {
return brush.Color; return brush.Color;

View File

@ -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.Devices.Generic;
using CUE.NET.Helper; using CUE.NET.Helper;

View File

@ -16,6 +16,9 @@ using CUE.NET.Native;
namespace CUE.NET namespace CUE.NET
{ {
/// <summary>
/// Static entry point to work with the Corsair-SDK.
/// </summary>
public static partial class CueSDK public static partial class CueSDK
{ {
#region Properties & Fields #region Properties & Fields
@ -91,6 +94,7 @@ namespace CUE.NET
{ {
try try
{ {
// ReSharper disable once RedundantIfElseBlock
if (IsInitialized) if (IsInitialized)
{ {
// ReSharper disable once SwitchStatementMissingSomeCases - everything else is true // ReSharper disable once SwitchStatementMissingSomeCases - everything else is true

View File

@ -9,6 +9,9 @@ using CUE.NET.Devices.Generic.Enums;
namespace CUE.NET namespace CUE.NET
{ {
/// <summary>
/// Static entry point to work with the Corsair-SDK.
/// </summary>
public static partial class CueSDK public static partial class CueSDK
{ {
#region Properties & Fields #region Properties & Fields

View File

@ -396,7 +396,7 @@ namespace CUE.NET.Devices.Generic
{ {
long lastUpdateTicks = _lastUpdate.Ticks; long lastUpdateTicks = _lastUpdate.Ticks;
_lastUpdate = DateTime.Now; _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 catch
{ {

View File

@ -2,35 +2,77 @@
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
using System.Diagnostics;
using System.Drawing; using System.Drawing;
namespace CUE.NET.Devices.Generic 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 public class CorsairColor
{ {
#region Constants #region Constants
/// <summary>
/// Gets an transparent color [A: 0, R: 0, G: 0, B: 0]
/// </summary>
public static CorsairColor Transparent => Color.Transparent; public static CorsairColor Transparent => Color.Transparent;
#endregion #endregion
#region Properties & Fields #region Properties & Fields
/// <summary>
/// Gets or sets the alpha component value of this <see cref="CorsairColor"/>.
/// </summary>
public byte A { get; set; } public byte A { get; set; }
/// <summary>
/// Gets or sets the red component value of this <see cref="CorsairColor"/>.
/// </summary>
public byte R { get; set; } public byte R { get; set; }
/// <summary>
/// Gets or sets the green component value of this <see cref="CorsairColor"/>.
/// </summary>
public byte G { get; set; } public byte G { get; set; }
/// <summary>
/// Gets or sets the blue component value of this <see cref="CorsairColor"/>.
/// </summary>
public byte B { get; set; } public byte B { get; set; }
#endregion #endregion
#region Constructors #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()
{ } { }
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) public CorsairColor(byte a, byte r, byte g, byte b)
{ {
this.A = a; this.A = a;
@ -39,6 +81,10 @@ namespace CUE.NET.Devices.Generic
this.B = b; 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) public CorsairColor(CorsairColor color)
: this(color.A, color.R, color.G, color.B) : this(color.A, color.R, color.G, color.B)
{ } { }
@ -47,11 +93,19 @@ namespace CUE.NET.Devices.Generic
#region Operators #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() public override string ToString()
{ {
return $"[A: {A}, R: {R}, G: {G}, B: {B}]"; 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) public override bool Equals(object obj)
{ {
CorsairColor compareColor = obj as CorsairColor; 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); 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() public override int GetHashCode()
{ {
unchecked 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) public static bool operator ==(CorsairColor color1, CorsairColor color2)
{ {
return ReferenceEquals(color1, null) ? ReferenceEquals(color2, null) : color1.Equals(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) public static bool operator !=(CorsairColor color1, CorsairColor color2)
{ {
return !(color1 == 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) public static implicit operator CorsairColor(Color color)
{ {
return new CorsairColor(color.A, color.R, color.G, color.B); 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) public static implicit operator Color(CorsairColor color)
{ {
return Color.FromArgb(color.A, color.R, color.G, color.B); return Color.FromArgb(color.A, color.R, color.G, color.B);

View File

@ -2,6 +2,7 @@
// ReSharper disable UnusedAutoPropertyAccessor.Global // ReSharper disable UnusedAutoPropertyAccessor.Global
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global // ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
using System.Diagnostics;
using System.Drawing; using System.Drawing;
using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Generic.Enums;
using CUE.NET.Helper; using CUE.NET.Helper;
@ -11,10 +12,11 @@ namespace CUE.NET.Devices.Generic
/// <summary> /// <summary>
/// Represents a single LED of a CUE-device. /// Represents a single LED of a CUE-device.
/// </summary> /// </summary>
[DebuggerDisplay("{Id} {Color}")]
public class CorsairLed public class CorsairLed
{ {
#region Properties & Fields #region Properties & Fields
/// <summary> /// <summary>
/// Gets the key-ID of the Led. /// Gets the key-ID of the Led.
/// </summary> /// </summary>
@ -52,7 +54,7 @@ namespace CUE.NET.Devices.Generic
/// <summary> /// <summary>
/// Gets or sets if the color of this LED can be changed. /// Gets or sets if the color of this LED can be changed.
/// </summary> /// </summary>
public bool IsLocked { get; set; } = false; public bool IsLocked { get; set; }
#endregion #endregion
@ -73,6 +75,15 @@ namespace CUE.NET.Devices.Generic
#region Methods #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> /// <summary>
/// Updates the LED to the requested color. /// Updates the LED to the requested color.
/// </summary> /// </summary>
@ -92,5 +103,27 @@ namespace CUE.NET.Devices.Generic
} }
#endregion #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
} }
} }

View File

@ -1,6 +1,8 @@
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace CUE.NET.Devices.Generic.Enums namespace CUE.NET.Devices.Generic.Enums
{ {
/// <summary> /// <summary>

View File

@ -1,6 +1,8 @@
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace CUE.NET.Devices.Generic.Enums namespace CUE.NET.Devices.Generic.Enums
{ {
/// <summary> /// <summary>
@ -8,6 +10,7 @@ namespace CUE.NET.Devices.Generic.Enums
/// </summary> /// </summary>
public enum CorsairDeviceType public enum CorsairDeviceType
{ {
Unknown = 0, Unknown = 0,
Mouse = 1, Mouse = 1,
Keyboard = 2, Keyboard = 2,

View File

@ -1,5 +1,7 @@
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace CUE.NET.Devices.Generic.Enums namespace CUE.NET.Devices.Generic.Enums
{ {
/// <summary> /// <summary>

View File

@ -6,7 +6,7 @@ using System;
namespace CUE.NET.Devices.Generic.EventArgs namespace CUE.NET.Devices.Generic.EventArgs
{ {
/// <summary> /// <summary>
/// Represents the information supplied with an Exception-event. /// Represents the information supplied with an <see cref="ICueDevice.Exception"/>-event.
/// </summary> /// </summary>
public class ExceptionEventArgs : System.EventArgs public class ExceptionEventArgs : System.EventArgs
{ {

View File

@ -5,16 +5,26 @@ using System.Collections.Generic;
namespace CUE.NET.Devices.Generic.EventArgs namespace CUE.NET.Devices.Generic.EventArgs
{ {
/// <summary>
/// Represents the information supplied with an <see cref="ICueDevice.LedsUpdated"/>-event.
/// </summary>
public class LedsUpdatedEventArgs : System.EventArgs public class LedsUpdatedEventArgs : System.EventArgs
{ {
#region Properties & Fields #region Properties & Fields
/// <summary>
/// Gets a list of <see cref="LedUpateRequest"/> from the updated leds.
/// </summary>
public IEnumerable<LedUpateRequest> UpdatedLeds { get; } public IEnumerable<LedUpateRequest> UpdatedLeds { get; }
#endregion #endregion
#region Constructors #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) public LedsUpdatedEventArgs(IEnumerable<LedUpateRequest> updatedLeds)
{ {
this.UpdatedLeds = updatedLeds; this.UpdatedLeds = updatedLeds;

View File

@ -5,16 +5,26 @@ using System.Collections.Generic;
namespace CUE.NET.Devices.Generic.EventArgs namespace CUE.NET.Devices.Generic.EventArgs
{ {
/// <summary>
/// Represents the information supplied with an <see cref="ICueDevice.LedsUpdating"/>-event.
/// </summary>
public class LedsUpdatingEventArgs : System.EventArgs public class LedsUpdatingEventArgs : System.EventArgs
{ {
#region Properties & Fields #region Properties & Fields
/// <summary>
/// Gets a list of <see cref="LedUpateRequest"/> from the updating leds.
/// </summary>
public ICollection<LedUpateRequest> UpdatingLeds { get; } public ICollection<LedUpateRequest> UpdatingLeds { get; }
#endregion #endregion
#region Constructors #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) public LedsUpdatingEventArgs(ICollection<LedUpateRequest> updatingLeds)
{ {
this.UpdatingLeds = updatingLeds; this.UpdatingLeds = updatingLeds;

View File

@ -1,5 +1,8 @@
namespace CUE.NET.Devices.Generic.EventArgs namespace CUE.NET.Devices.Generic.EventArgs
{ {
/// <summary>
/// Represents the information supplied with an <see cref="ICueDevice.Updated"/>-event.
/// </summary>
public class UpdatedEventArgs : System.EventArgs public class UpdatedEventArgs : System.EventArgs
{ } { }
} }

View File

@ -3,16 +3,26 @@
namespace CUE.NET.Devices.Generic.EventArgs namespace CUE.NET.Devices.Generic.EventArgs
{ {
/// <summary>
/// Represents the information supplied with an <see cref="ICueDevice.Updating"/>-event.
/// </summary>
public class UpdatingEventArgs : System.EventArgs public class UpdatingEventArgs : System.EventArgs
{ {
#region Properties & Fields #region Properties & Fields
/// <summary>
/// Gets the elapsed time (in seconds) sonce the last update.
/// </summary>
public float DeltaTime { get; } public float DeltaTime { get; }
#endregion #endregion
#region Constructors #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) public UpdatingEventArgs(float deltaTime)
{ {
this.DeltaTime = deltaTime; this.DeltaTime = deltaTime;

View File

@ -1,6 +1,8 @@
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Generic.Enums;
namespace CUE.NET.Devices.Headset.Enums namespace CUE.NET.Devices.Headset.Enums

View File

@ -1,6 +1,8 @@
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Generic.Enums;
namespace CUE.NET.Devices.Keyboard.Enums namespace CUE.NET.Devices.Keyboard.Enums

View File

@ -1,6 +1,8 @@
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
namespace CUE.NET.Devices.Keyboard.Enums namespace CUE.NET.Devices.Keyboard.Enums
{ {
/// <summary> /// <summary>

View File

@ -1,6 +1,8 @@
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Generic.Enums;
namespace CUE.NET.Devices.Mouse.Enums namespace CUE.NET.Devices.Mouse.Enums

View File

@ -1,6 +1,8 @@
// ReSharper disable UnusedMember.Global // ReSharper disable UnusedMember.Global
// ReSharper disable InconsistentNaming // ReSharper disable InconsistentNaming
#pragma warning disable 1591 // Missing XML comment for publicly visible type or member
using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Generic.Enums;
namespace CUE.NET.Devices.Mousemat.Enums namespace CUE.NET.Devices.Mousemat.Enums

View File

@ -76,6 +76,7 @@ namespace CUE.NET.Effects
_currentPhaseValue -= deltaTime; _currentPhaseValue -= deltaTime;
// Using ifs instead of a switch allows to skip phases with time 0. // Using ifs instead of a switch allows to skip phases with time 0.
// ReSharper disable InvertIf
if (_currentPhase == ADSRPhase.Attack) if (_currentPhase == ADSRPhase.Attack)
if (_currentPhaseValue > 0f) if (_currentPhaseValue > 0f)
@ -123,6 +124,8 @@ namespace CUE.NET.Effects
_currentPhaseValue = Attack; _currentPhaseValue = Attack;
_currentPhase = ADSRPhase.Attack; _currentPhase = ADSRPhase.Attack;
} }
// ReSharper restore InvertIf
} }
/// <summary> /// <summary>

View File

@ -9,6 +9,8 @@ namespace CUE.NET.Effects
public class MoveGradientEffect : AbstractBrushEffect<IGradientBrush> public class MoveGradientEffect : AbstractBrushEffect<IGradientBrush>
{ {
#region Properties & Fields #region Properties & Fields
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
// ReSharper disable MemberCanBePrivate.Global
/// <summary> /// <summary>
/// Gets or sets the direction the gradient is moved. /// Gets or sets the direction the gradient is moved.
@ -24,6 +26,8 @@ namespace CUE.NET.Effects
/// </summary> /// </summary>
public float Speed { get; set; } public float Speed { get; set; }
// ReSharper restore MemberCanBePrivate.Global
// ReSharper restore AutoPropertyCanBeMadeGetOnly.Global
#endregion #endregion
#region Constructors #region Constructors
@ -53,6 +57,7 @@ namespace CUE.NET.Effects
if (!Direction) if (!Direction)
movement = -movement; movement = -movement;
// ReSharper disable once CanBeReplacedWithTryCastAndCheckForNull
if (Brush.Gradient is LinearGradient) if (Brush.Gradient is LinearGradient)
{ {
LinearGradient linearGradient = (LinearGradient)Brush.Gradient; LinearGradient linearGradient = (LinearGradient)Brush.Gradient;

View File

@ -14,6 +14,7 @@ namespace Example_Ambilight_full.TakeAsIs
get { return _ambienceCreatorType; } get { return _ambienceCreatorType; }
set set
{ {
// ReSharper disable once InvertIf
if (_ambienceCreatorType != value) if (_ambienceCreatorType != value)
{ {
_ambienceCreatorType = value; _ambienceCreatorType = value;

View File

@ -76,10 +76,7 @@ namespace CUE.NET.Gradients
return max; return max;
float min = GradientStops.Min(n => n.Offset); float min = GradientStops.Min(n => n.Offset);
if (offset < min) return offset < min ? min : offset;
return min;
return offset;
} }
/// <summary> /// <summary>

View File

@ -19,6 +19,7 @@ namespace CUE.NET.Groups.Extensions
public static ListLedGroup ToListLedGroup(this AbstractLedGroup ledGroup) public static ListLedGroup ToListLedGroup(this AbstractLedGroup ledGroup)
{ {
ListLedGroup listLedGroup = ledGroup as ListLedGroup; ListLedGroup listLedGroup = ledGroup as ListLedGroup;
// ReSharper disable once InvertIf
if (listLedGroup == null) if (listLedGroup == null)
{ {
bool wasAttached = ledGroup.Detach(); bool wasAttached = ledGroup.Detach();

View File

@ -8,6 +8,9 @@ using CUE.NET.Effects;
namespace CUE.NET.Groups namespace CUE.NET.Groups
{ {
/// <summary>
/// Represents a basic led-group.
/// </summary>
public interface ILedGroup : IEffectTarget<ILedGroup> public interface ILedGroup : IEffectTarget<ILedGroup>
{ {
/// <summary> /// <summary>

View File

@ -1,7 +1,6 @@
// ReSharper disable MemberCanBePrivate.Global // ReSharper disable MemberCanBePrivate.Global
using System; using System;
using CUE.NET.ColorCorrection;
using CUE.NET.Devices.Generic; using CUE.NET.Devices.Generic;
namespace CUE.NET.Helper namespace CUE.NET.Helper
@ -90,6 +89,7 @@ namespace CUE.NET.Helper
/// <returns>The resulting color.</returns> /// <returns>The resulting color.</returns>
public static CorsairColor Blend(this CorsairColor bg, CorsairColor fg) public static CorsairColor Blend(this CorsairColor bg, CorsairColor fg)
{ {
// ReSharper disable once ConvertIfStatementToSwitchStatement
if (fg.A == 255) if (fg.A == 255)
return fg; return fg;
@ -120,7 +120,7 @@ namespace CUE.NET.Helper
float min = Math.Min(Math.Min(color.R, color.G), color.B); 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 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 if (Math.Abs(max - color.R) < float.Epsilon) // r is max
hue = (color.G - color.B) / (max - min); hue = (color.G - color.B) / (max - min);
else if (Math.Abs(max - color.G) < float.Epsilon) // g is max else if (Math.Abs(max - color.G) < float.Epsilon) // g is max

View File

@ -63,6 +63,7 @@ namespace CUE.NET.Profiles
public static CueProfile LoadProfileByName(string name = null) public static CueProfile LoadProfileByName(string name = null)
{ {
string id = null; string id = null;
// ReSharper disable once InvertIf
if (name != null && !_profileNameMapping.TryGetValue(name, out id)) if (name != null && !_profileNameMapping.TryGetValue(name, out id))
{ {
LoadProfileNames(); // Reload and try again LoadProfileNames(); // Reload and try again