Skip to content

Commit 5a104ea

Browse files
authored
Merge pull request #364 from DarthAffe/Development
v2.0.0
2 parents be3f2bf + 79f71ba commit 5a104ea

366 files changed

Lines changed: 7418 additions & 2326 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/ci.yml

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,19 @@ on:
1111
jobs:
1212
build:
1313

14-
runs-on: windows-2022
14+
runs-on: windows-latest
1515

1616
steps:
17-
- uses: actions/checkout@v2
17+
- uses: actions/checkout@v3
1818
with:
1919
fetch-depth: 0
2020
- name: Setup .NET
21-
uses: actions/setup-dotnet@v1
21+
uses: actions/setup-dotnet@v3
2222
with:
23-
dotnet-version: 7.0.x
23+
dotnet-version: |
24+
8.0.x
25+
7.0.x
26+
6.0.x
2427
- name: Git Semantic Version
2528
id: versioning
2629
uses: PaulHatch/semantic-version@v4.0.3
@@ -33,12 +36,6 @@ jobs:
3336
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.versioning.outputs.version }}
3437
- name: Test
3538
run: dotnet test --no-build --verbosity normal --configuration Release
36-
- name: Upload a Build Artifact NET5
37-
uses: actions/upload-artifact@v2.2.4
38-
with:
39-
name: RGB.NET-NET5
40-
path: bin/net5.0/RGB.NET.*.dll
41-
if-no-files-found: error
4239
- name: Upload a Build Artifact NET6
4340
uses: actions/upload-artifact@v2.2.4
4441
with:
@@ -51,6 +48,12 @@ jobs:
5148
name: RGB.NET-NET7
5249
path: bin/net7.0/RGB.NET.*.dll
5350
if-no-files-found: error
51+
- name: Upload a Build Artifact NET8
52+
uses: actions/upload-artifact@v2.2.4
53+
with:
54+
name: RGB.NET-NET8
55+
path: bin/net8.0/RGB.NET.*.dll
56+
if-no-files-found: error
5457
- name: Upload Nuget Build Artifact
5558
uses: actions/upload-artifact@v2.2.4
5659
with:
@@ -59,3 +62,11 @@ jobs:
5962
if-no-files-found: error
6063
- name: Nuget Push
6164
run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
65+
- name: Symbols Push
66+
run: dotnet nuget push **\*.snupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
67+
- name: Create Tag
68+
uses: mathieudutour/github-tag-action@v6.1
69+
with:
70+
github_token: ${{ secrets.GITHUB_TOKEN }}
71+
custom_tag: ${{ steps.versioning.outputs.version }}
72+
tag_prefix: v

.github/workflows/pr_verify.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,17 @@ on:
77
jobs:
88
build:
99

10-
runs-on: windows-2022
10+
runs-on: windows-latest
1111

1212
steps:
13-
- uses: actions/checkout@v2
13+
- uses: actions/checkout@v3
1414
- name: Setup .NET
15-
uses: actions/setup-dotnet@v1
15+
uses: actions/setup-dotnet@v3
1616
with:
17-
dotnet-version: 7.0.x
17+
dotnet-version: |
18+
8.0.x
19+
7.0.x
20+
6.0.x
1821
- name: Restore dependencies
1922
run: dotnet restore
2023
- name: Build

.github/workflows/release.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: windows-2022
13+
runs-on: windows-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v3
1717
with:
1818
fetch-depth: 0
1919
- name: Setup .NET
20-
uses: actions/setup-dotnet@v1
20+
uses: actions/setup-dotnet@v3
2121
with:
22-
dotnet-version: 7.0.x
22+
dotnet-version: |
23+
8.0.x
24+
7.0.x
25+
6.0.x
2326
- name: Git Semantic Version
2427
id: versioning
2528
uses: PaulHatch/semantic-version@v4.0.3
@@ -32,12 +35,6 @@ jobs:
3235
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.versioning.outputs.version }}
3336
- name: Test
3437
run: dotnet test --no-build --verbosity normal --configuration Release
35-
- name: Upload a Build Artifact NET5
36-
uses: actions/upload-artifact@v2.2.4
37-
with:
38-
name: RGB.NET-NET5
39-
path: bin/net5.0/RGB.NET.*.dll
40-
if-no-files-found: error
4138
- name: Upload a Build Artifact NET6
4239
uses: actions/upload-artifact@v2.2.4
4340
with:
@@ -50,6 +47,12 @@ jobs:
5047
name: RGB.NET-NET7
5148
path: bin/net7.0/RGB.NET.*.dll
5249
if-no-files-found: error
50+
- name: Upload a Build Artifact NET8
51+
uses: actions/upload-artifact@v2.2.4
52+
with:
53+
name: RGB.NET-NET8
54+
path: bin/net8.0/RGB.NET.*.dll
55+
if-no-files-found: error
5356
- name: Upload Nuget Build Artifact
5457
uses: actions/upload-artifact@v2.2.4
5558
with:
@@ -61,6 +64,6 @@ jobs:
6164
with:
6265
tag_name: ${{ steps.versioning.outputs.version_tag }}
6366
generate_release_notes: true
64-
files: bin/net7.0/RGB.NET.*.dll
67+
files: bin/net8.0/RGB.NET.*.dll
6568
- name: Nuget Push
6669
run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json

RGB.NET.Core/Color/Behaviors/DefaultColorBehavior.cs

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,47 @@ namespace RGB.NET.Core;
66
/// <summary>
77
/// Represents the default-behavior for the work with colors.
88
/// </summary>
9-
public class DefaultColorBehavior : IColorBehavior
9+
public sealed class DefaultColorBehavior : IColorBehavior
1010
{
1111
#region Methods
1212

1313
/// <summary>
1414
/// Converts the individual byte values of this <see cref="Color"/> to a human-readable string.
1515
/// </summary>
1616
/// <returns>A string that contains the individual byte values of this <see cref="Color"/>. For example "[A: 255, R: 255, G: 0, B: 0]".</returns>
17-
public virtual string ToString(in Color color) => $"[A: {color.GetA()}, R: {color.GetR()}, G: {color.GetG()}, B: {color.GetB()}]";
17+
public string ToString(in Color color) => $"[A: {color.GetA()}, R: {color.GetR()}, G: {color.GetG()}, B: {color.GetB()}]";
1818

1919
/// <summary>
2020
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
2121
/// </summary>
2222
/// <param name="color">The color to test.</param>
2323
/// <param name="obj">The object to test.</param>
2424
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Color" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
25-
public virtual bool Equals(in Color color, object? obj)
26-
{
27-
if (obj is not Color color2) return false;
28-
29-
return color.A.EqualsInTolerance(color2.A)
30-
&& color.R.EqualsInTolerance(color2.R)
31-
&& color.G.EqualsInTolerance(color2.G)
32-
&& color.B.EqualsInTolerance(color2.B);
33-
}
25+
public bool Equals(in Color color, object? obj) => obj is Color color2 && Equals(color, color2);
26+
27+
/// <summary>
28+
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
29+
/// </summary>
30+
/// <param name="color">The first color to test.</param>
31+
/// <param name="color2">The second color to test.</param>
32+
/// <returns><c>true</c> if <paramref name="color2" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
33+
public bool Equals(in Color color, in Color color2) => color.A.EqualsInTolerance(color2.A)
34+
&& color.R.EqualsInTolerance(color2.R)
35+
&& color.G.EqualsInTolerance(color2.G)
36+
&& color.B.EqualsInTolerance(color2.B);
3437

3538
/// <summary>
3639
/// Returns a hash code for this <see cref="Color" />.
3740
/// </summary>
3841
/// <returns>An integer value that specifies the hash code for this <see cref="Color" />.</returns>
39-
public virtual int GetHashCode(in Color color) => HashCode.Combine(color.A, color.R, color.G, color.B);
42+
public int GetHashCode(in Color color) => HashCode.Combine(color.A, color.R, color.G, color.B);
4043

4144
/// <summary>
4245
/// Blends a <see cref="Color"/> over this color.
4346
/// </summary>
4447
/// <param name="baseColor">The <see cref="Color"/> to to blend over.</param>
4548
/// <param name="blendColor">The <see cref="Color"/> to blend.</param>
46-
public virtual Color Blend(in Color baseColor, in Color blendColor)
49+
public Color Blend(in Color baseColor, in Color blendColor)
4750
{
4851
if (blendColor.A.EqualsInTolerance(0)) return baseColor;
4952

RGB.NET.Core/Color/Behaviors/IColorBehavior.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ public interface IColorBehavior
2020
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Color" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
2121
bool Equals(in Color color, object? obj);
2222

23+
/// <summary>
24+
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
25+
/// </summary>
26+
/// <param name="color">The first color to test.</param>
27+
/// <param name="color2">The second color to test.</param>
28+
/// <returns><c>true</c> if <paramref name="color2" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
29+
bool Equals(in Color color, in Color color2);
30+
2331
/// <summary>
2432
/// Returns a hash code for this <see cref="Color" />.
2533
/// </summary>

RGB.NET.Core/Color/Color.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace RGB.NET.Core;
1111
/// Represents an ARGB (alpha, red, green, blue) color.
1212
/// </summary>
1313
[DebuggerDisplay("[A: {A}, R: {R}, G: {G}, B: {B}]")]
14-
public readonly struct Color
14+
public readonly struct Color : IEquatable<Color>
1515
{
1616
#region Constants
1717

@@ -196,6 +196,13 @@ public Color(in Color color)
196196
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Color" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
197197
public override bool Equals(object? obj) => Behavior.Equals(this, obj);
198198

199+
/// <summary>
200+
/// Tests whether the specified <see cref="Color" /> is equivalent to this <see cref="Color" />, as defined by the current <see cref="Behavior"/>.
201+
/// </summary>
202+
/// <param name="other">The color to test.</param>
203+
/// <returns><c>true</c> if <paramref name="other" /> is equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
204+
public bool Equals(Color other) => Behavior.Equals(this, other);
205+
199206
/// <summary>
200207
/// Returns a hash code for this <see cref="Color" />, as defined by the current <see cref="Behavior"/>.
201208
/// </summary>

RGB.NET.Core/Decorators/AbstractDecorateable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public abstract class AbstractDecoratable<T> : AbstractBindable, IDecoratable<T>
1111
{
1212
#region Properties & Fields
1313

14-
private readonly List<T> _decorators = new();
14+
private readonly List<T> _decorators = [];
1515

1616
/// <inheritdoc />
1717
public IReadOnlyList<T> Decorators { get; }

RGB.NET.Core/Decorators/AbstractDecorator.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public int Order
2929
/// <summary>
3030
/// Gets a readonly-list of all <see cref="IDecoratable"/> this decorator is attached to.
3131
/// </summary>
32-
protected List<IDecoratable> DecoratedObjects { get; } = new();
32+
protected List<IDecoratable> DecoratedObjects { get; } = [];
3333

3434
#endregion
3535

@@ -46,14 +46,14 @@ public int Order
4646
/// </summary>
4747
protected virtual void Detach()
4848
{
49-
List<IDecoratable> decoratables = new(DecoratedObjects);
49+
List<IDecoratable> decoratables = [..DecoratedObjects];
5050
foreach (IDecoratable decoratable in decoratables)
5151
{
5252
IEnumerable<Type> types = decoratable.GetType().GetInterfaces().Where(t => t.IsGenericType
5353
&& (t.Name == typeof(IDecoratable<>).Name)
5454
&& t.GenericTypeArguments[0].IsInstanceOfType(this));
5555
foreach (Type decoratableType in types)
56-
decoratableType.GetMethod(nameof(IDecoratable<IDecorator>.RemoveDecorator))?.Invoke(decoratable, new object[] { this });
56+
decoratableType.GetMethod(nameof(IDecoratable<IDecorator>.RemoveDecorator))?.Invoke(decoratable, [this]);
5757
}
5858
}
5959

RGB.NET.Core/Decorators/IDecoratable.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ namespace RGB.NET.Core;
66
/// <summary>
77
/// Represents a basic decoratable.
88
/// </summary>
9-
public interface IDecoratable : INotifyPropertyChanged
10-
{ }
9+
public interface IDecoratable : INotifyPropertyChanged;
1110

1211
/// <inheritdoc />
1312
/// <summary>

RGB.NET.Core/Decorators/ILedGroupDecorator.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,4 @@
44
/// <summary>
55
/// Represents a basic decorator decorating a <see cref="T:RGB.NET.Core.ILedGroup" />.
66
/// </summary>
7-
public interface ILedGroupDecorator : IDecorator
8-
{ }
7+
public interface ILedGroupDecorator : IDecorator;

0 commit comments

Comments
 (0)