mirror of
https://github.com/DarthAffe/CUE.NET.git
synced 2026-11-11 04:56:44 +00:00
Refactored before merge
This commit is contained in:
1 parent
b977edf1da
commit
920821deee
14 files changed
+61
-35
No files matched your search
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
// ReSharper disable MemberCanBeProtected.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
|
||||
@@ -14,10 +16,10 @@ namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
|
||||
|
||||
#region Constructors
|
||||
|
||||
public AbstractGradient()
|
||||
protected AbstractGradient()
|
||||
{ }
|
||||
|
||||
public AbstractGradient(params GradientStop[] gradientStops)
|
||||
protected AbstractGradient(params GradientStop[] gradientStops)
|
||||
{
|
||||
foreach (GradientStop gradientStop in gradientStops)
|
||||
GradientStops.Add(gradientStop);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Drawing;
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Brushes.Gradient
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// ReSharper disable CollectionNeverUpdated.Global
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable ReturnTypeCanBeEnumerable.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Keyboard.Brushes.Gradient;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Keyboard.Brushes.Gradient;
|
||||
using CUE.NET.Helper;
|
||||
@@ -39,6 +42,7 @@ namespace CUE.NET.Devices.Keyboard.Brushes
|
||||
PointF centerPoint = new PointF(rectangle.X + rectangle.Width * Center.X, rectangle.Y + rectangle.Height * Center.Y);
|
||||
|
||||
// Calculate the distance to the farthest point from the center as reference (this has to be a corner)
|
||||
// ReSharper disable once RedundantCast - never trust this ...
|
||||
float refDistance = (float)Math.Max(Math.Max(Math.Max(GradientHelper.CalculateDistance(rectangle.Location, centerPoint),
|
||||
GradientHelper.CalculateDistance(new PointF(rectangle.X + rectangle.Width, rectangle.Y), centerPoint)),
|
||||
GradientHelper.CalculateDistance(new PointF(rectangle.X, rectangle.Y + rectangle.Height), centerPoint)),
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
using System;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
// ReSharper disable UnusedMember.Global
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
@@ -28,26 +32,13 @@ namespace CUE.NET.Devices.Keyboard
|
||||
CorsairKey key;
|
||||
return _keys.TryGetValue(keyId, out key) ? key : null;
|
||||
}
|
||||
private set { throw new NotSupportedException(); }
|
||||
}
|
||||
|
||||
public CorsairKey this[char key]
|
||||
{
|
||||
get { return this[_CUESDK.CorsairGetLedIdForKeyName(key)]; }
|
||||
private set { throw new NotSupportedException(); }
|
||||
}
|
||||
public CorsairKey this[char key] => this[_CUESDK.CorsairGetLedIdForKeyName(key)];
|
||||
|
||||
public CorsairKey this[PointF location]
|
||||
{
|
||||
get { return _keys.Values.FirstOrDefault(x => x.KeyRectangle.Contains(location)); }
|
||||
private set { throw new NotSupportedException(); }
|
||||
}
|
||||
public CorsairKey this[PointF location] => _keys.Values.FirstOrDefault(x => x.KeyRectangle.Contains(location));
|
||||
|
||||
public IEnumerable<CorsairKey> this[RectangleF referenceRect, float minOverlayPercentage = 0.5f]
|
||||
{
|
||||
get { return _keys.Values.Where(x => RectangleHelper.CalculateIntersectPercentage(x.KeyRectangle, referenceRect) >= minOverlayPercentage); }
|
||||
private set { throw new NotSupportedException(); }
|
||||
}
|
||||
public IEnumerable<CorsairKey> this[RectangleF referenceRect, float minOverlayPercentage = 0.5f] => _keys.Values.Where(x => RectangleHelper.CalculateIntersectPercentage(x.KeyRectangle, referenceRect) >= minOverlayPercentage);
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -142,6 +133,7 @@ namespace CUE.NET.Devices.Keyboard
|
||||
}
|
||||
}
|
||||
|
||||
// ReSharper disable once MemberCanBeMadeStatic.Local - idc
|
||||
private void ApplyBrush(ICollection<CorsairKey> keys, IBrush brush)
|
||||
{
|
||||
RectangleF brushRectangle = RectangleHelper.CreateRectangleFromRectangles(keys.Select(x => x.KeyRectangle));
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using CUE.NET.Devices.Keyboard.Brushes;
|
||||
using CUE.NET.Devices.Keyboard.Keys;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
namespace CUE.NET.Devices.Keyboard.Effects
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Effects
|
||||
{
|
||||
internal class EffectTimeContainer
|
||||
{
|
||||
@@ -14,8 +17,8 @@
|
||||
|
||||
internal EffectTimeContainer(IEffect effect, long ticksAtLastUpdate)
|
||||
{
|
||||
Effect = effect;
|
||||
TicksAtLastUpdate = ticksAtLastUpdate;
|
||||
this.Effect = effect;
|
||||
this.TicksAtLastUpdate = ticksAtLastUpdate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Keyboard.Brushes;
|
||||
|
||||
@@ -117,7 +120,7 @@ namespace CUE.NET.Devices.Keyboard.Effects
|
||||
Decay,
|
||||
Sustain,
|
||||
Release,
|
||||
Pause,
|
||||
Pause
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Linq;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Linq;
|
||||
using CUE.NET.Devices.Keyboard.Enums;
|
||||
using CUE.NET.Devices.Keyboard.Keys;
|
||||
|
||||
@@ -33,6 +35,7 @@ namespace CUE.NET.Devices.Keyboard.Extensions
|
||||
return simpleKeyGroup;
|
||||
}
|
||||
|
||||
// ReSharper disable once UnusedMethodReturnValue.Global
|
||||
public static bool Attach(this BaseKeyGroup keyGroup)
|
||||
{
|
||||
return keyGroup.Keyboard?.AttachKeyGroup(keyGroup) ?? false;
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Drawing;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||
|
||||
using System.Drawing;
|
||||
using CUE.NET.Devices.Generic;
|
||||
using CUE.NET.Devices.Keyboard.Enums;
|
||||
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using CUE.NET.Devices.Keyboard.Enums;
|
||||
|
||||
namespace CUE.NET.Devices.Keyboard.Keys
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
// ReSharper disable MemberCanBePrivate.Global
|
||||
// ReSharper disable AutoPropertyCanBeMadeGetOnly.Global
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using CUE.NET.Devices.Keyboard.Enums;
|
||||
|
||||
Reference in new issue
Block a user