1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-12 17:48:31 +00:00

Compare commits

...

135 Commits

Author SHA1 Message Date
b0acc61618
Merge pull request #430 from DarthAffe/Development 2025-07-17 21:39:16 +02:00
13f3dde185
Merge pull request #429 from DarthAffe/logitechpid
Added detection for logitech G515
2025-07-17 21:35:38 +02:00
845efb6929 Added detection for logitech G515 2025-07-17 21:33:15 +02:00
Diogo Trindade
02d695c4dd
Merge pull request #427 from diogotr7/feature/wooting-grpc
Add Wooting Grpc Rgb sdk client
2025-06-18 22:31:45 +01:00
Diogo Trindade
35a4033521
connect on ipv4 only
speeds up first connection significantly
2025-06-18 22:23:23 +01:00
Diogo Trindade
dc6715b236
use serial number hash as update trigger id 2025-06-18 19:45:22 +01:00
Diogo Trindade
34b04523de
make wootingcolor readonly, use int for array index 2025-06-18 19:31:00 +01:00
Diogo Trindade
a96b994e61
Fix warning 2025-06-18 19:05:33 +01:00
Diogo Trindade
f26b3c193a
Added gRPC sdk client 2025-06-18 19:01:20 +01:00
c0828c1d01
Merge pull request #426 from DarthAffe/Devices/Razer
Added PID for Razer Barracuda X Chroma
2025-05-28 20:14:12 +02:00
7c65b1d0bf Added PID for Razer Barracuda X Chroma
#425
2025-05-28 20:10:33 +02:00
826a5104de
Merge pull request #424 from kyriog/patch-1
Adding Razer Huntsman V3 Pro
2025-05-22 23:57:28 +02:00
Kyriog
80b2365c31
Adding Razer Huntsman V3 Pro 2025-05-12 19:42:22 +02:00
8756ec98f3 Added Razer BlackWidow V4 Pro 75% (#423) 2025-04-27 16:38:03 +02:00
d5ce5fcee7
Merge pull request #422 from jonilala796/SteelSeries-QCK-Prism-Cloth-3XL
Added support for SteelSeries QCK Prism Cloth 3XL
2025-03-11 23:33:35 +01:00
jonilala796
6a47887c18 Added support for SteelSeries QCK Prism Cloth 3XL 2025-03-11 20:21:14 +01:00
eb4ea71d01
Merge pull request #421 from jonilala796/Razer-Kraken-V3-HyperSense
Added support for Kraken V3 HyperSense headset
2025-03-10 22:08:41 +01:00
jonilala796
b0f05ab399 Added support for Kraken V3 HyperSense headset 2025-03-08 21:53:46 +01:00
e1475859c6
Merge pull request #420 from DarthAffe/feature/more-80he-fixes
Fix more 80HE layout
2025-02-21 01:56:42 +01:00
Diogo Trindade
9499b31c13
Fix more 80HE layout 2025-02-20 18:28:07 +00:00
7fabc71b28
Merge pull request #419 from jonilala796/master
Add support for Corsair RX and LX Fans
2025-02-16 14:04:41 +01:00
jonilala796
01bad00d8a simplify LX Fan logic in CorsairDeviceProvider 2025-02-08 21:52:28 +01:00
jonilala796
1deb1b9f2f Add support for RX Fan naming 2025-02-08 21:37:24 +01:00
jonilala796
66843a21e5 Add workaround for LX Fans with invalid ChannelDeviceType 2025-02-08 21:23:33 +01:00
4e575e8d3d
Merge pull request #418 from DarthAffe/Development
v3
2025-02-08 16:43:21 +01:00
f8e4cc6b49
Merge pull request #417 from DarthAffe/LanguageUsage
Language usage
2025-02-08 12:20:26 +01:00
aae509b275 More code issues fixed 2025-02-08 12:13:14 +01:00
5633f82b3b Changed locks to use the new Lock-type for .net9 2025-02-08 12:08:12 +01:00
47770c00b8 Used new collection-initialization 2025-02-08 12:07:48 +01:00
654a7624cd
Merge pull request #412 from DarthAffe/net9
Net9
2025-02-06 20:27:19 +01:00
f9fefe4667
Merge pull request #416 from DarthAffe/SteelSeriesPids
SteelSeries pids
2025-02-06 20:23:03 +01:00
f40190da01 Updated dependencies 2025-02-06 20:22:36 +01:00
f34033a3fe
Merge pull request #410 from harrisck/patch-1
Update SteelSeriesDeviceProvider.cs for Apex Pro TKL Wireless Gen3
2025-02-06 20:14:58 +01:00
e151b3f194
Merge branch 'Development' into patch-1 2025-02-06 20:14:42 +01:00
899fc697e4
Merge pull request #413 from DarthAffe/LogitechPids
Added logitech G915 X (TKL)
2025-02-06 20:13:09 +01:00
d97293ec87
Merge pull request #414 from logicallysynced/device-additions
Added additional Razer & SteelSeries devices
2025-02-06 20:12:54 +01:00
12a353574a Added SteelSeries Arena 9 2025-02-06 20:07:06 +01:00
Danielle
77f55d2eb3 Added additional Razer & SteelSeries devices
Added device references for:
* Razer BlackWidow V4 X
* Razer Cobra
* SteelSeries Apex Pro 3
* SteelSeries Aerox 9 Wireless
2025-01-18 10:33:15 +11:00
9945a5f7cb Updated build-scripts to net9 2025-01-14 22:16:03 +01:00
ed98714439 Added logitech G915 X (TKL) 2025-01-14 22:12:54 +01:00
39da0fd59c Updated dependencies 2025-01-03 15:48:07 +01:00
1d47894dac Added .net9 build target 2025-01-03 15:45:07 +01:00
197be1f986
Merge pull request #408 from Nick026/Development
Added Razer Chroma Wireless ARGB Controller support
2024-12-30 02:05:27 +01:00
harrisck
a2a25bc40a
Update SteelSeriesDeviceProvider.cs for Apex Pro TKL Wireless Gen3
Added Device ID for Apex Pro TKL Wireless Gen3
2024-12-29 20:46:57 +00:00
505e5c6d80
Merge pull request #409 from DarthAffe/SteelSeriesMapping
Fixed mapping for StellSeries Apex 3
2024-12-03 09:54:31 +01:00
f8a530e313 Fixed mapping for StellSeries Apex 3 2024-12-01 21:02:35 +01:00
Nick S.
aa7bfd3976
Added Razer Chroma Wireless ARGB Controller support 2024-11-29 15:56:33 +01:00
71f1115c31
Merge pull request #403 from stonstad/Contributions
Remove CustomUpdateData heap allocation in OnUpdate hot path.
2024-11-03 15:44:03 +01:00
Shaun Tonstad
da51871e04
Update RGB.NET.Core/Update/CustomUpdateData.cs
Co-authored-by: DarthAffe <darthaffe@wyrez.org>
2024-10-29 20:19:29 -05:00
a26eaf9a9a
Merge pull request #335 from Aytackydln/asus-remove-system-management
Asus: Remove System.Management
2024-10-20 11:26:50 +02:00
54c09a1d6f
Fixed default name for Asus Keyboards 2024-10-20 11:23:23 +02:00
a0198e3991
Merge pull request #405 from DarthAffe/LogitechMultipleDevicesFix
Fixed crash in logitech device provider, when multiple lightspeed dev…
2024-10-20 11:19:08 +02:00
f2491038a3 Fixed crash in logitech device provider, when multiple lightspeed devices with the same usage are connected 2024-10-20 11:06:40 +02:00
5c864a03e5
Merge pull request #404 from diogotr7/feature/80he-layout-fixes
Fixed incorrect 80he international keys
2024-10-17 20:51:27 +02:00
Diogo Trindade
7cfe08921e
Fixed incorrect 80he international keys 2024-10-17 12:05:54 +01:00
Shaun Tonstad
c34435b958 Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property.
Remove CustomUpdateData heap allocation in OnUpdate hot path. Added CustomUpdateData.Empty property.
2024-10-12 13:01:53 -05:00
2bf081d16e
Merge pull request #400 from DarthAffe/Devices/Razer
Added pid for Razer Firefly v2 Pro
2024-09-21 22:53:38 +02:00
466d136089 Added pid for Razer Firefly v2 Pro 2024-09-20 09:29:03 +02:00
13a5a6162d
Merge pull request #398 from diogotr7/feature/openrgb-fix
Update OpenRGB.NET
2024-07-28 19:39:26 +02:00
Diogo Trindade
54b4eac1f3
Update OpenRGB.NET 2024-07-28 17:17:08 +01:00
9346948bfb
Merge pull request #397 from DarthAffe/HPPH
Updated build-files
2024-07-22 00:04:53 +02:00
9a997694a5 Updated build-files 2024-07-22 00:01:50 +02:00
1396e978db Fixed doc-comment mistake 2024-07-22 00:00:28 +02:00
681adcb1cb
Merge pull request #396 from DarthAffe/HPPH
Added HPPH Image texture in presets; Removed old .NET versions
2024-07-21 23:56:58 +02:00
cfbbdc6069 Changed ImageTexture Image to be public 2024-07-21 23:52:06 +02:00
0d41314f7e
Merge pull request #395 from DarthAffe/SmallPerformanceThings
(MAJOR) Removed all in paramters as their performance impact is too h…
2024-07-21 23:47:32 +02:00
b1cf26b1e6 Added support for HPPH-images in presets 2024-07-21 23:46:13 +02:00
4c3875e561 Fixed a doc comment 2024-07-21 23:45:23 +02:00
3e53b51bac Removed support for old .NETs 2024-07-21 23:44:59 +02:00
fdfd35eff8
Merge pull request #394 from diogotr7/feature/wooting-80he
Add Wooting 80HE support
2024-07-21 23:12:22 +02:00
c39849949a (MAJOR) Removed all in paramters as their performance impact is too hard to predict 2024-07-21 23:10:56 +02:00
Diogo Trindade
d207fdf495
Add Wooting 80HE support 2024-07-20 23:09:09 +01:00
4e80764015
Merge pull request #393 from roxaskeyheart/patch-4
Added Razer Leviathan V2 X Speakers & BlackWidow V4 Mini HyperSpeed
2024-07-07 14:07:49 +02:00
9de1233c93
Update RGB.NET.Devices.Razer/RazerDeviceProvider.cs 2024-07-07 12:03:39 +00:00
Danielle
976ee6d007
Added BlackWidow V4 Mini HyperSpeed 2024-07-07 19:15:55 +10:00
Danielle
9f0c3be7bb
Added Razer Leviathan V2 X Speakers 2024-07-07 19:08:17 +10:00
Aytackydln
5e895f5806 Merge remote-tracking branch 'refs/remotes/origin/Development' into asus-remove-system-management 2024-07-02 17:31:41 +02:00
41a1d5d97b
Merge pull request #391 from DarthAffe/SmallPerformanceThings
Small performance things
2024-06-22 19:52:51 +02:00
6f0711564c Removed unnecessary in GetByteValueFromPercentage 2024-06-22 19:49:38 +02:00
f21acbd767 Fixed potential performance issue with for-loops when Spans are passed by reference 2024-06-22 19:48:52 +02:00
da2c2a678b
Merge pull request #390 from DarthAffe/RazerKeyboardMapping
Added media-keys and underglow-leds to razer-mapping; Correctly named…
2024-06-22 19:40:22 +02:00
5a13fcef7f Added media-keys and underglow-leds to razer-mapping; Correctly named BlackWidow v4 Pro 2024-06-22 19:30:47 +02:00
bc7c2374f9
Merge pull request #388 from DarthAffe/DeviceDetection
Added detection for SteelSeries Apex 3
2024-06-10 19:48:12 +02:00
ed7ff76210 Added detection for SteelSeries Apex 3 2024-06-10 19:46:06 +02:00
f4cf5c3286
Merge pull request #386 from DarthAffe/DeviceDetection
Added detection for a razer and a stellseries device
2024-05-27 22:42:19 +02:00
83d1b2472b Added detection for a razer and a stellseries device 2024-05-27 22:31:58 +02:00
1b9531a86f
Merge pull request #384 from DarthAffe/Development
Updated workflows
2024-04-11 23:46:07 +02:00
5f71ffdf1f
Merge pull request #383 from DarthAffe/WorkflowImprovements
Workflow improvements
2024-04-11 23:43:17 +02:00
835987155c
Removed semantiv-versioning from release 2024-04-11 23:30:19 +02:00
31db13cb3d
Removed semantic versioning action in ci 2024-04-11 23:24:24 +02:00
51373e4441 (MINOR) Merge pull request #382 from DarthAffe/Fix/CorsairCallback
Fix/corsair callback
2024-04-10 15:31:55 +02:00
8f7e24ba33 Fixed potential callback collection in CorsairDeviceProvider 2024-03-19 22:03:55 +01:00
c0adbad599
Update release.yml 2024-03-09 12:15:21 +01:00
4773e0df74
Merge pull request #381 from DarthAffe/Development
v2.1
2024-03-09 12:11:38 +01:00
29e68ae8fe
Update release.yml 2024-03-09 00:44:57 +01:00
5aac20e982
Update ci.yml 2024-03-09 00:44:36 +01:00
d1e71ef827
Update ci.yml 2024-03-08 23:46:26 +01:00
08d526a7a4
Update ci.yml 2024-03-08 23:44:18 +01:00
acd4462b2a
Update ci.yml 2024-03-08 23:38:45 +01:00
e58d26d58d
Update ci.yml 2024-03-08 23:34:47 +01:00
417b9be3f9
Merge pull request #380 from DarthAffe/Actions
(MINOR) Updated workflows and bumped version for release
2024-03-08 21:47:22 +01:00
ced13e9ec2 (MINOR) Updated workflows and bumped version for release 2024-03-08 20:50:58 +01:00
4f0f25e34e
Merge pull request #379 from DarthAffe/RazerDebugDevices
Razer: Load Debug Device Properties for Each Device Type
2024-03-08 20:38:01 +01:00
58ed8bb2f1
Merge pull request #378 from diogotr7/feature/msi-pid
Add extra MSI pid to steelseries provider
2024-03-08 20:35:40 +01:00
Aytaç Kayadelen
d82eebd769 Razer: Load Debug Device Properties for Each Device Type 2024-03-08 20:28:09 +01:00
Diogo Trindade
3ca782a6a7
Add extra MSI pid to steelseries provider 2024-03-02 22:16:07 +00:00
a4bd797912
Merge pull request #375 from Aytackydln/logi-shutdown-on-dispose
Call LogiLedShutdown on Logitech provider dispose
2024-02-12 14:57:37 +01:00
Aytaç Kayadelen
b56a50ab08 call shutdown on Logitech provider dispose 2024-02-11 18:26:10 +01:00
50e20a7bdd
Merge pull request #374 from Aytackydln/num-lock-scroll-indicators
added Num/Caps/Scroll lock indicator mappings to OpenRGB
2024-01-28 22:20:43 +01:00
Aytaç Kayadelen
4959c6e8ad added Num/Caps/Scroll lock indicator mappings to OpenRGB 2024-01-27 22:19:46 +01:00
ef980f754c
Merge pull request #373 from DarthAffe/SDK/Wled
Changed WLED-devices to flush and reduced heartbeat timer
2024-01-18 23:41:52 +01:00
1df23a6b36 Changed WLED-devices to flush and reduced heartbeat timer 2024-01-18 23:35:19 +01:00
16b2877dce
Merge pull request #371 from DarthAffe/SDK/Wled
Added Provider for WLED-Devices
2024-01-18 20:40:07 +01:00
657bca29b0
Merge pull request #372 from DarthAffe/SmallFixes
Small fixes
2024-01-18 20:39:42 +01:00
6ba7e44e3c Added mising dispose in E131UpdateQueue 2024-01-17 23:39:39 +01:00
9004c50d78 Disabled resharper warning about missspelling of MSI 2024-01-17 23:39:06 +01:00
b2848cfbaa Fixed small mistake in WLED readme 2024-01-17 23:36:04 +01:00
23bd1119f2 Added helper to auto discover WLED devices to the readme 2024-01-17 23:34:43 +01:00
67672be54c Added Provider for WLED-Devices 2024-01-17 23:02:02 +01:00
3400edcf93
Merge pull request #370 from Myp3a/GE78LedMapping
Added MSI Raider GE78HX LED mapping
2024-01-17 10:25:33 +01:00
Myp3a
1fe8cab0a4 Added MSI GE78HX LED mapping 2024-01-16 17:42:02 +03:00
95f162de2d
Merge pull request #368 from DarthAffe/DarthAffe-patch-1
Update ci.yml
2024-01-09 23:45:30 +01:00
f07d228408
Update ci.yml 2024-01-09 22:44:33 +00:00
1312566eb0
Merge pull request #367 from DarthAffe/Devices/Razer
Added PID for Razer Naga Classic Edition
2024-01-09 23:18:06 +01:00
9aee9a1640 Renamed Razer Naga Classic Edition To Naga Classic 2024-01-09 22:57:28 +01:00
c89bbfea96 Added PID for Razer Naga Classic Edition 2024-01-09 22:56:13 +01:00
af43c0ae87
Merge pull request #365 from DarthAffe/Devices/Novation
Added Novation Launchpad Mini MK3
2024-01-04 20:12:24 +01:00
7898c50eed Fixed unexpected name of the Launchpad Mini MK3 2024-01-04 18:10:31 +01:00
505e7481f7 Small Novation-detection refactoring 2024-01-04 18:10:20 +01:00
4f478879c2 Added Novation Launchpad Mini MK3 2024-01-04 17:29:59 +01:00
Aytaç Kayadelen
8b1c5927d3 Merge branch 'Development' of https://github.com/DarthAffe/RGB.NET into asus-remove-system-management 2024-01-01 22:12:05 +01:00
Aytaç Kayadelen
1bd5b54892 pull 2023-12-06 22:19:43 +01:00
Aytaç Kayadelen
c11965eb3a Merge branch 'Development' of https://github.com/DarthAffe/RGB.NET into asus-remove-system-management 2023-12-06 20:48:53 +01:00
Aytaç Kayadelen
cadf96634e Merge branch 'Development' of https://github.com/DarthAffe/RGB.NET into asus-remove-system-management 2023-08-07 09:30:40 +02:00
Aytaç Kayadelen
5cb5962c1e remove System.Management dependency 2023-06-14 22:41:07 +02:00
158 changed files with 2057 additions and 600 deletions

View File

@ -1,12 +1,15 @@
name: RGB.NET-CI
on:
push:
branches: [ Development ]
paths:
- '**.cs'
- '**.csproj'
- '**.yml'
workflow_dispatch:
inputs:
version:
description: 'version'
required: true
type: string
increment:
required: true
type: string
jobs:
build:
@ -14,48 +17,35 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
8.0.x
7.0.x
6.0.x
- name: Git Semantic Version
id: versioning
uses: PaulHatch/semantic-version@v4.0.3
with:
short_tags: false
format: "${major}.${minor}.${patch}-prerelease.${increment}"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.versioning.outputs.version }}
run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }}-prerelease.${{ github.event.inputs.increment }}
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Upload a Build Artifact NET6
uses: actions/upload-artifact@v2.2.4
- name: Upload a Build Artifact NET9
uses: actions/upload-artifact@v4.3.1
with:
name: RGB.NET-NET6
path: bin/net6.0/RGB.NET.*.dll
if-no-files-found: error
- name: Upload a Build Artifact NET7
uses: actions/upload-artifact@v2.2.4
with:
name: RGB.NET-NET7
path: bin/net7.0/RGB.NET.*.dll
name: RGB.NET-NET9
path: bin/net9.0/RGB.NET.*.dll
if-no-files-found: error
- name: Upload a Build Artifact NET8
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4.3.1
with:
name: RGB.NET-NET8
path: bin/net8.0/RGB.NET.*.dll
if-no-files-found: error
- name: Upload Nuget Build Artifact
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4.3.1
with:
name: RGB.NET-Nugets
path: bin/*nupkg
@ -64,9 +54,3 @@ jobs:
run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
- name: Symbols Push
run: dotnet nuget push **\*.snupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json
- name: Create Tag
uses: mathieudutour/github-tag-action@v6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
custom_tag: ${{ steps.versioning.outputs.version }}
tag_prefix: v

View File

@ -10,14 +10,13 @@ jobs:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
8.0.x
7.0.x
6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build

View File

@ -1,60 +1,47 @@
name: RGB.NET-Release
on:
push:
branches: [ master ]
paths:
- '**.cs'
- '**.csproj'
- '**.yml'
workflow_dispatch:
inputs:
version:
description: 'version'
required: true
type: string
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4.1.1
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v3
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
9.0.x
8.0.x
7.0.x
6.0.x
- name: Git Semantic Version
id: versioning
uses: PaulHatch/semantic-version@v4.0.3
with:
short_tags: false
format: "${major}.${minor}.${patch}"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release /p:Version=${{ steps.versioning.outputs.version }}
run: dotnet build --no-restore --configuration Release /p:Version=${{ github.event.inputs.version }}
- name: Test
run: dotnet test --no-build --verbosity normal --configuration Release
- name: Upload a Build Artifact NET6
uses: actions/upload-artifact@v2.2.4
- name: Upload a Build Artifact NET9
uses: actions/upload-artifact@v4.3.1
with:
name: RGB.NET-NET6
path: bin/net6.0/RGB.NET.*.dll
if-no-files-found: error
- name: Upload a Build Artifact NET7
uses: actions/upload-artifact@v2.2.4
with:
name: RGB.NET-NET7
path: bin/net7.0/RGB.NET.*.dll
name: RGB.NET-NET9
path: bin/net9.0/RGB.NET.*.dll
if-no-files-found: error
- name: Upload a Build Artifact NET8
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4.3.1
with:
name: RGB.NET-NET8
path: bin/net8.0/RGB.NET.*.dll
if-no-files-found: error
- name: Upload Nuget Build Artifact
uses: actions/upload-artifact@v2.2.4
uses: actions/upload-artifact@v4.3.1
with:
name: RGB.NET-Nugets
path: bin/*nupkg
@ -62,8 +49,8 @@ jobs:
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.versioning.outputs.version_tag }}
tag_name: v${{ github.event.inputs.version }}
generate_release_notes: true
files: bin/net8.0/RGB.NET.*.dll
files: bin/net9.0/RGB.NET.*.dll
- name: Nuget Push
run: dotnet nuget push **\*.nupkg --skip-duplicate --api-key ${{ secrets.NUGET_TOKEN }} --source https://api.nuget.org/v3/index.json

View File

@ -14,7 +14,7 @@ public sealed class DefaultColorBehavior : IColorBehavior
/// Converts the individual byte values of this <see cref="Color"/> to a human-readable string.
/// </summary>
/// <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>
public string ToString(in Color color) => $"[A: {color.GetA()}, R: {color.GetR()}, G: {color.GetG()}, B: {color.GetB()}]";
public string ToString(Color color) => $"[A: {color.GetA()}, R: {color.GetR()}, G: {color.GetG()}, B: {color.GetB()}]";
/// <summary>
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
@ -22,7 +22,7 @@ public sealed class DefaultColorBehavior : IColorBehavior
/// <param name="color">The color to test.</param>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Color" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
public bool Equals(in Color color, object? obj) => obj is Color color2 && Equals(color, color2);
public bool Equals(Color color, object? obj) => obj is Color color2 && Equals(color, color2);
/// <summary>
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
@ -30,7 +30,7 @@ public sealed class DefaultColorBehavior : IColorBehavior
/// <param name="color">The first color to test.</param>
/// <param name="color2">The second color to test.</param>
/// <returns><c>true</c> if <paramref name="color2" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
public bool Equals(in Color color, in Color color2) => color.A.EqualsInTolerance(color2.A)
public bool Equals(Color color, Color color2) => color.A.EqualsInTolerance(color2.A)
&& color.R.EqualsInTolerance(color2.R)
&& color.G.EqualsInTolerance(color2.G)
&& color.B.EqualsInTolerance(color2.B);
@ -39,14 +39,14 @@ public sealed class DefaultColorBehavior : IColorBehavior
/// Returns a hash code for this <see cref="Color" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="Color" />.</returns>
public int GetHashCode(in Color color) => HashCode.Combine(color.A, color.R, color.G, color.B);
public int GetHashCode(Color color) => HashCode.Combine(color.A, color.R, color.G, color.B);
/// <summary>
/// Blends a <see cref="Color"/> over this color.
/// </summary>
/// <param name="baseColor">The <see cref="Color"/> to to blend over.</param>
/// <param name="blendColor">The <see cref="Color"/> to blend.</param>
public Color Blend(in Color baseColor, in Color blendColor)
public Color Blend(Color baseColor, Color blendColor)
{
if (blendColor.A.EqualsInTolerance(0)) return baseColor;

View File

@ -10,7 +10,7 @@ public interface IColorBehavior
/// </summary>
/// <param name="color">The color to convert.</param>
/// <returns>The string representation of the specified color.</returns>
string ToString(in Color color);
string ToString(Color color);
/// <summary>
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
@ -18,7 +18,7 @@ public interface IColorBehavior
/// <param name="color">The color to test.</param>
/// <param name="obj">The object to test.</param>
/// <returns><c>true</c> if <paramref name="obj" /> is a <see cref="Color" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
bool Equals(in Color color, object? obj);
bool Equals(Color color, object? obj);
/// <summary>
/// Tests whether the specified object is a <see cref="Color" /> and is equivalent to this <see cref="Color" />.
@ -26,18 +26,18 @@ public interface IColorBehavior
/// <param name="color">The first color to test.</param>
/// <param name="color2">The second color to test.</param>
/// <returns><c>true</c> if <paramref name="color2" /> equivalent to this <see cref="Color" />; otherwise, <c>false</c>.</returns>
bool Equals(in Color color, in Color color2);
bool Equals(Color color, Color color2);
/// <summary>
/// Returns a hash code for this <see cref="Color" />.
/// </summary>
/// <returns>An integer value that specifies the hash code for this <see cref="Color" />.</returns>
int GetHashCode(in Color color);
int GetHashCode(Color color);
/// <summary>
/// Blends a <see cref="Color"/> over this color.
/// </summary>
/// <param name="baseColor">The <see cref="Color"/> to to blend over.</param>
/// <param name="blendColor">The <see cref="Color"/> to blend.</param>
Color Blend(in Color baseColor, in Color blendColor);
Color Blend(Color baseColor, Color blendColor);
}

View File

@ -175,7 +175,7 @@ public readonly struct Color : IEquatable<Color>
/// Initializes a new instance of the <see cref="T:RGB.NET.Core.Color" /> struct by cloning a existing <see cref="T:RGB.NET.Core.Color" />.
/// </summary>
/// <param name="color">The <see cref="T:RGB.NET.Core.Color" /> the values are copied from.</param>
public Color(in Color color)
public Color(Color color)
: this(color.A, color.R, color.G, color.B)
{ }
@ -214,7 +214,7 @@ public readonly struct Color : IEquatable<Color>
/// Blends a <see cref="Color"/> over this color, as defined by the current <see cref="Behavior"/>.
/// </summary>
/// <param name="color">The <see cref="Color"/> to blend.</param>
public Color Blend(in Color color) => Behavior.Blend(this, color);
public Color Blend(Color color) => Behavior.Blend(this, color);
#endregion
@ -226,7 +226,7 @@ public readonly struct Color : IEquatable<Color>
/// <param name="color1">The base color.</param>
/// <param name="color2">The color to blend.</param>
/// <returns>The blended color.</returns>
public static Color operator +(in Color color1, in Color color2) => color1.Blend(color2);
public static Color operator +(Color color1, Color color2) => color1.Blend(color2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="Color" /> are equal.
@ -234,7 +234,7 @@ public readonly struct Color : IEquatable<Color>
/// <param name="color1">The first <see cref="Color" /> to compare.</param>
/// <param name="color2">The second <see cref="Color" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="color1" /> and <paramref name="color2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(in Color color1, in Color color2) => color1.Equals(color2);
public static bool operator ==(Color color1, Color color2) => color1.Equals(color2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="Color" /> are equal.
@ -242,7 +242,7 @@ public readonly struct Color : IEquatable<Color>
/// <param name="color1">The first <see cref="Color" /> to compare.</param>
/// <param name="color2">The second <see cref="Color" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="color1" /> and <paramref name="color2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(in Color color1, in Color color2) => !(color1 == color2);
public static bool operator !=(Color color1, Color color2) => !(color1 == color2);
/// <summary>
/// Converts a <see cref="ValueTuple"/> of ARGB-components to a <see cref="Color"/>.

View File

@ -16,21 +16,21 @@ public static class HSVColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The hue component value of the color.</returns>
public static float GetHue(this in Color color) => color.GetHSV().hue;
public static float GetHue(this Color color) => color.GetHSV().hue;
/// <summary>
/// Gets the saturation component value (HSV-color space) of this <see cref="Color"/> in the range [0..1].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The saturation component value of the color.</returns>
public static float GetSaturation(this in Color color) => color.GetHSV().saturation;
public static float GetSaturation(this Color color) => color.GetHSV().saturation;
/// <summary>
/// Gets the value component value (HSV-color space) of this <see cref="Color"/> in the range [0..1].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The value component value of the color.</returns>
public static float GetValue(this in Color color) => color.GetHSV().value;
public static float GetValue(this Color color) => color.GetHSV().value;
/// <summary>
/// Gets the hue, saturation and value component values (HSV-color space) of this <see cref="Color"/>.
@ -40,7 +40,7 @@ public static class HSVColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>A tuple containing the hue, saturation and value component value of the color.</returns>
public static (float hue, float saturation, float value) GetHSV(this in Color color)
public static (float hue, float saturation, float value) GetHSV(this Color color)
=> CaclulateHSVFromRGB(color.R, color.G, color.B);
#endregion
@ -55,7 +55,7 @@ public static class HSVColor
/// <param name="saturation">The saturation value to add.</param>
/// <param name="value">The value value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddHSV(this in Color color, float hue = 0, float saturation = 0, float value = 0)
public static Color AddHSV(this Color color, float hue = 0, float saturation = 0, float value = 0)
{
(float cHue, float cSaturation, float cValue) = color.GetHSV();
return Create(color.A, cHue + hue, cSaturation + saturation, cValue + value);
@ -69,7 +69,7 @@ public static class HSVColor
/// <param name="saturation">The saturation value to subtract.</param>
/// <param name="value">The value value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractHSV(this in Color color, float hue = 0, float saturation = 0, float value = 0)
public static Color SubtractHSV(this Color color, float hue = 0, float saturation = 0, float value = 0)
{
(float cHue, float cSaturation, float cValue) = color.GetHSV();
return Create(color.A, cHue - hue, cSaturation - saturation, cValue - value);
@ -83,7 +83,7 @@ public static class HSVColor
/// <param name="saturation">The saturation value to multiply.</param>
/// <param name="value">The value value to multiply.</param>
/// <returns>The new color after the modification.</returns>
public static Color MultiplyHSV(this in Color color, float hue = 1, float saturation = 1, float value = 1)
public static Color MultiplyHSV(this Color color, float hue = 1, float saturation = 1, float value = 1)
{
(float cHue, float cSaturation, float cValue) = color.GetHSV();
return Create(color.A, cHue * hue, cSaturation * saturation, cValue * value);
@ -97,7 +97,7 @@ public static class HSVColor
/// <param name="saturation">The saturation value to divide.</param>
/// <param name="value">The value value to divide.</param>
/// <returns>The new color after the modification.</returns>
public static Color DivideHSV(this in Color color, float hue = 1, float saturation = 1, float value = 1)
public static Color DivideHSV(this Color color, float hue = 1, float saturation = 1, float value = 1)
{
(float cHue, float cSaturation, float cValue) = color.GetHSV();
return Create(color.A, cHue / hue, cSaturation / saturation, cValue / value);
@ -111,7 +111,7 @@ public static class HSVColor
/// <param name="saturation">The saturation value to set.</param>
/// <param name="value">The value value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetHSV(this in Color color, float? hue = null, float? saturation = null, float? value = null)
public static Color SetHSV(this Color color, float? hue = null, float? saturation = null, float? value = null)
{
(float cHue, float cSaturation, float cValue) = color.GetHSV();
return Create(color.A, hue ?? cHue, saturation ?? cSaturation, value ?? cValue);

View File

@ -16,21 +16,21 @@ public static class HclColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The H component value of the color. </returns>
public static float GetHclH(this in Color color) => color.GetHcl().h;
public static float GetHclH(this Color color) => color.GetHcl().h;
/// <summary>
/// Gets the c component value (Hcl-color space) of this <see cref="Color"/> in the range [0..1].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The c component value of the color. </returns>
public static float GetHclC(this in Color color) => color.GetHcl().c;
public static float GetHclC(this Color color) => color.GetHcl().c;
/// <summary>
/// Gets the l component value (Hcl-color space) of this <see cref="Color"/> in the range [0..1].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The l component value of the color. </returns>
public static float GetHclL(this in Color color) => color.GetHcl().l;
public static float GetHclL(this Color color) => color.GetHcl().l;
/// <summary>
/// Gets the H, c and l component values (Hcl-color space) of this <see cref="Color"/>.
@ -40,7 +40,7 @@ public static class HclColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>A tuple containing the H, c and l component value of the color.</returns>
public static (float h, float c, float l) GetHcl(this in Color color)
public static (float h, float c, float l) GetHcl(this Color color)
=> CalculateHclFromRGB(color.R, color.G, color.B);
#endregion
@ -55,7 +55,7 @@ public static class HclColor
/// <param name="c">The c value to add.</param>
/// <param name="l">The l value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddHcl(this in Color color, float h = 0, float c = 0, float l = 0)
public static Color AddHcl(this Color color, float h = 0, float c = 0, float l = 0)
{
(float cH, float cC, float cL) = color.GetHcl();
return Create(color.A, cH + h, cC + c, cL + l);
@ -69,7 +69,7 @@ public static class HclColor
/// <param name="c">The c value to subtract.</param>
/// <param name="l">The l value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractHcl(this in Color color, float h = 0, float c = 0, float l = 0)
public static Color SubtractHcl(this Color color, float h = 0, float c = 0, float l = 0)
{
(float cH, float cC, float cL) = color.GetHcl();
return Create(color.A, cH - h, cC - c, cL - l);
@ -83,7 +83,7 @@ public static class HclColor
/// <param name="c">The c value to multiply.</param>
/// <param name="l">The l value to multiply.</param>
/// <returns>The new color after the modification.</returns>
public static Color MultiplyHcl(this in Color color, float h = 1, float c = 1, float l = 1)
public static Color MultiplyHcl(this Color color, float h = 1, float c = 1, float l = 1)
{
(float cH, float cC, float cL) = color.GetHcl();
return Create(color.A, cH * h, cC * c, cL * l);
@ -97,7 +97,7 @@ public static class HclColor
/// <param name="c">The c value to divide.</param>
/// <param name="l">The l value to divide.</param>
/// <returns>The new color after the modification.</returns>
public static Color DivideHcl(this in Color color, float h = 1, float c = 1, float l = 1)
public static Color DivideHcl(this Color color, float h = 1, float c = 1, float l = 1)
{
(float cH, float cC, float cL) = color.GetHcl();
return Create(color.A, cH / h, cC / c, cL / l);
@ -111,7 +111,7 @@ public static class HclColor
/// <param name="c">The c value to set.</param>
/// <param name="l">The l value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetHcl(this in Color color, float? h = null, float? c = null, float? l = null)
public static Color SetHcl(this Color color, float? h = null, float? c = null, float? l = null)
{
(float cH, float cC, float cL) = color.GetHcl();
return Create(color.A, h ?? cH, c ?? cC, l ?? cL);

View File

@ -16,21 +16,21 @@ public static class LabColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The L component value of the color.</returns>
public static float GetLabL(this in Color color) => color.GetLab().l;
public static float GetLabL(this Color color) => color.GetLab().l;
/// <summary>
/// Gets the a component value (Lab-color space) of this <see cref="Color"/> in the range [0..1].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The a component value of the color.</returns>
public static float GetLabA(this in Color color) => color.GetLab().a;
public static float GetLabA(this Color color) => color.GetLab().a;
/// <summary>
/// Gets the b component value (Lab-color space) of this <see cref="Color"/> in the range [0..1].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The b component value of the color.</returns>
public static float GetLabB(this in Color color) => color.GetLab().b;
public static float GetLabB(this Color color) => color.GetLab().b;
/// <summary>
/// Gets the L, a and b component values (Lab-color space) of this <see cref="Color"/>.
@ -40,7 +40,7 @@ public static class LabColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>A tuple containing the L, a and b component value of the color.</returns>
public static (float l, float a, float b) GetLab(this in Color color)
public static (float l, float a, float b) GetLab(this Color color)
=> CalculateLabFromRGB(color.R, color.G, color.B);
#endregion
@ -55,7 +55,7 @@ public static class LabColor
/// <param name="a">The a value to add.</param>
/// <param name="b">The b value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddLab(this in Color color, float l = 0, float a = 0, float b = 0)
public static Color AddLab(this Color color, float l = 0, float a = 0, float b = 0)
{
(float cL, float cA, float cB) = color.GetLab();
return Create(color.A, cL + l, cA + a, cB + b);
@ -69,7 +69,7 @@ public static class LabColor
/// <param name="a">The a value to subtract.</param>
/// <param name="b">The b value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractLab(this in Color color, float l = 0, float a = 0, float b = 0)
public static Color SubtractLab(this Color color, float l = 0, float a = 0, float b = 0)
{
(float cL, float cA, float cB) = color.GetLab();
return Create(color.A, cL - l, cA - a, cB - b);
@ -83,7 +83,7 @@ public static class LabColor
/// <param name="a">The a value to multiply.</param>
/// <param name="b">The b value to multiply.</param>
/// <returns>The new color after the modification.</returns>
public static Color MultiplyLab(this in Color color, float l = 1, float a = 1, float b = 1)
public static Color MultiplyLab(this Color color, float l = 1, float a = 1, float b = 1)
{
(float cL, float cA, float cB) = color.GetLab();
return Create(color.A, cL * l, cA * a, cB * b);
@ -97,7 +97,7 @@ public static class LabColor
/// <param name="a">The a value to divide.</param>
/// <param name="b">The b value to divide.</param>
/// <returns>The new color after the modification.</returns>
public static Color DivideLab(this in Color color, float l = 1, float a = 1, float b = 1)
public static Color DivideLab(this Color color, float l = 1, float a = 1, float b = 1)
{
(float cL, float cA, float cB) = color.GetLab();
return Create(color.A, cL / l, cA / a, cB / b);
@ -111,7 +111,7 @@ public static class LabColor
/// <param name="a">The a value to set.</param>
/// <param name="b">The b value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetLab(this in Color color, float? l = null, float? a = null, float? b = null)
public static Color SetLab(this Color color, float? l = null, float? a = null, float? b = null)
{
(float cL, float cA, float cB) = color.GetLab();
return Create(color.A, l ?? cL, a ?? cA, b ?? cB);

View File

@ -16,35 +16,35 @@ public static class RGBColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The A component value of the color.</returns>
public static byte GetA(this in Color color) => color.A.GetByteValueFromPercentage();
public static byte GetA(this Color color) => color.A.GetByteValueFromPercentage();
/// <summary>
/// Gets the R component value of this <see cref="Color"/> as byte in the range [0..255].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The R component value of the color.</returns>
public static byte GetR(this in Color color) => color.R.GetByteValueFromPercentage();
public static byte GetR(this Color color) => color.R.GetByteValueFromPercentage();
/// <summary>
/// Gets the G component value of this <see cref="Color"/> as byte in the range [0..255].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The G component value of the color.</returns>
public static byte GetG(this in Color color) => color.G.GetByteValueFromPercentage();
public static byte GetG(this Color color) => color.G.GetByteValueFromPercentage();
/// <summary>
/// Gets the B component value of this <see cref="Color"/> as byte in the range [0..255].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The B component value of the color.</returns>
public static byte GetB(this in Color color) => color.B.GetByteValueFromPercentage();
public static byte GetB(this Color color) => color.B.GetByteValueFromPercentage();
/// <summary>
/// Gets the A, R, G and B component value of this <see cref="Color"/> as byte in the range [0..255].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>A tuple containing the A, R, G and B component value of the color.</returns>
public static (byte a, byte r, byte g, byte b) GetRGBBytes(this in Color color)
public static (byte a, byte r, byte g, byte b) GetRGBBytes(this Color color)
=> (color.GetA(), color.GetR(), color.GetG(), color.GetB());
/// <summary>
@ -52,7 +52,7 @@ public static class RGBColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>A tuple containing the A, R, G and B component value of the color.</returns>
public static (float a, float r, float g, float b) GetRGB(this in Color color)
public static (float a, float r, float g, float b) GetRGB(this Color color)
=> (color.A, color.R, color.G, color.B);
#endregion
@ -69,7 +69,7 @@ public static class RGBColor
/// <param name="g">The green value to add.</param>
/// <param name="b">The blue value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddRGB(this in Color color, int r = 0, int g = 0, int b = 0)
public static Color AddRGB(this Color color, int r = 0, int g = 0, int b = 0)
=> new(color.A, color.GetR() + r, color.GetG() + g, color.GetB() + b);
/// <summary>
@ -80,7 +80,7 @@ public static class RGBColor
/// <param name="g">The green value to add.</param>
/// <param name="b">The blue value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddRGB(this in Color color, float r = 0, float g = 0, float b = 0)
public static Color AddRGB(this Color color, float r = 0, float g = 0, float b = 0)
=> new(color.A, color.R + r, color.G + g, color.B + b);
/// <summary>
@ -89,7 +89,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddA(this in Color color, int a)
public static Color AddA(this Color color, int a)
=> new(color.GetA() + a, color.R, color.G, color.B);
/// <summary>
@ -98,7 +98,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddA(this in Color color, float a)
public static Color AddA(this Color color, float a)
=> new(color.A + a, color.R, color.G, color.B);
#endregion
@ -113,7 +113,7 @@ public static class RGBColor
/// <param name="g">The green value to subtract.</param>
/// <param name="b">The blue value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractRGB(this in Color color, int r = 0, int g = 0, int b = 0)
public static Color SubtractRGB(this Color color, int r = 0, int g = 0, int b = 0)
=> new(color.A, color.GetR() - r, color.GetG() - g, color.GetB() - b);
/// <summary>
@ -124,7 +124,7 @@ public static class RGBColor
/// <param name="g">The green value to subtract.</param>
/// <param name="b">The blue value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractRGB(this in Color color, float r = 0, float g = 0, float b = 0)
public static Color SubtractRGB(this Color color, float r = 0, float g = 0, float b = 0)
=> new(color.A, color.R - r, color.G - g, color.B - b);
/// <summary>
@ -133,7 +133,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractA(this in Color color, int a)
public static Color SubtractA(this Color color, int a)
=> new(color.GetA() - a, color.R, color.G, color.B);
/// <summary>
@ -142,7 +142,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="aPercent">The alpha value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractA(this in Color color, float aPercent)
public static Color SubtractA(this Color color, float aPercent)
=> new(color.A - aPercent, color.R, color.G, color.B);
#endregion
@ -157,7 +157,7 @@ public static class RGBColor
/// <param name="g">The green value to multiply.</param>
/// <param name="b">The blue value to multiply.</param>
/// <returns>The new color after the modification.</returns>
public static Color MultiplyRGB(this in Color color, float r = 1, float g = 1, float b = 1)
public static Color MultiplyRGB(this Color color, float r = 1, float g = 1, float b = 1)
=> new(color.A, color.R * r, color.G * g, color.B * b);
/// <summary>
@ -166,7 +166,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to multiply.</param>
/// <returns>The new color after the modification.</returns>
public static Color MultiplyA(this in Color color, float a)
public static Color MultiplyA(this Color color, float a)
=> new(color.A * a, color.R, color.G, color.B);
#endregion
@ -181,7 +181,7 @@ public static class RGBColor
/// <param name="g">The green value to divide.</param>
/// <param name="b">The blue value to divide.</param>
/// <returns>The new color after the modification.</returns>
public static Color DivideRGB(this in Color color, float r = 1, float g = 1, float b = 1)
public static Color DivideRGB(this Color color, float r = 1, float g = 1, float b = 1)
=> new(color.A, color.R / r, color.G / g, color.B / b);
/// <summary>
@ -190,7 +190,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to divide.</param>
/// <returns>The new color after the modification.</returns>
public static Color DivideA(this in Color color, float a)
public static Color DivideA(this Color color, float a)
=> new(color.A / a, color.R, color.G, color.B);
#endregion
@ -205,7 +205,7 @@ public static class RGBColor
/// <param name="g">The green value to set.</param>
/// <param name="b">The blue value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetRGB(this in Color color, byte? r = null, byte? g = null, byte? b = null)
public static Color SetRGB(this Color color, byte? r = null, byte? g = null, byte? b = null)
=> new(color.A, r ?? color.GetR(), g ?? color.GetG(), b ?? color.GetB());
/// <summary>
@ -216,7 +216,7 @@ public static class RGBColor
/// <param name="g">The green value to set.</param>
/// <param name="b">The blue value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetRGB(this in Color color, int? r = null, int? g = null, int? b = null)
public static Color SetRGB(this Color color, int? r = null, int? g = null, int? b = null)
=> new(color.A, r ?? color.GetR(), g ?? color.GetG(), b ?? color.GetB());
/// <summary>
@ -227,7 +227,7 @@ public static class RGBColor
/// <param name="g">The green value to set.</param>
/// <param name="b">The blue value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetRGB(this in Color color, float? r = null, float? g = null, float? b = null)
public static Color SetRGB(this Color color, float? r = null, float? g = null, float? b = null)
=> new(color.A, r ?? color.R, g ?? color.G, b ?? color.B);
/// <summary>
@ -236,7 +236,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetA(this in Color color, int a) => new(a, color.R, color.G, color.B);
public static Color SetA(this Color color, int a) => new(a, color.R, color.G, color.B);
/// <summary>
/// Sets the specified alpha value of this color.
@ -244,7 +244,7 @@ public static class RGBColor
/// <param name="color">The color to modify.</param>
/// <param name="a">The alpha value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetA(this in Color color, float a) => new(a, color.R, color.G, color.B);
public static Color SetA(this Color color, float a) => new(a, color.R, color.G, color.B);
#endregion
@ -256,13 +256,13 @@ public static class RGBColor
/// Gets the current color as a RGB-HEX-string.
/// </summary>
/// <returns>The RGB-HEX-string.</returns>
public static string AsRGBHexString(this in Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetR(), color.GetG(), color.GetB());
public static string AsRGBHexString(this Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetR(), color.GetG(), color.GetB());
/// <summary>
/// Gets the current color as a ARGB-HEX-string.
/// </summary>
/// <returns>The ARGB-HEX-string.</returns>
public static string AsARGBHexString(this in Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetA(), color.GetR(), color.GetG(), color.GetB());
public static string AsARGBHexString(this Color color, bool leadingHash = true) => (leadingHash ? "#" : "") + ConversionHelper.ToHex(color.GetA(), color.GetR(), color.GetG(), color.GetB());
#endregion

View File

@ -16,21 +16,21 @@ public static class XYZColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The X component value of the color.</returns>
public static float GetX(this in Color color) => color.GetXYZ().x;
public static float GetX(this Color color) => color.GetXYZ().x;
/// <summary>
/// Gets the Y component value (XYZ-color space) of this <see cref="Color"/> in the range [0..100].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The Y component value of the color.</returns>
public static float GetY(this in Color color) => color.GetXYZ().y;
public static float GetY(this Color color) => color.GetXYZ().y;
/// <summary>
/// Gets the Z component value (XYZ-color space) of this <see cref="Color"/> in the range [0..108.883].
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>The Z component value of the color.</returns>
public static float GetZ(this in Color color) => color.GetXYZ().z;
public static float GetZ(this Color color) => color.GetXYZ().z;
/// <summary>
/// Gets the X, Y and Z component values (XYZ-color space) of this <see cref="Color"/>.
@ -40,7 +40,7 @@ public static class XYZColor
/// </summary>
/// <param name="color">The color to get the value from.</param>
/// <returns>A tuple containing the X, Y and Z component value of the color.</returns>
public static (float x, float y, float z) GetXYZ(this in Color color)
public static (float x, float y, float z) GetXYZ(this Color color)
=> CaclulateXYZFromRGB(color.R, color.G, color.B);
#endregion
@ -55,7 +55,7 @@ public static class XYZColor
/// <param name="y">The Y value to add.</param>
/// <param name="z">The Z value to add.</param>
/// <returns>The new color after the modification.</returns>
public static Color AddXYZ(this in Color color, float x = 0, float y = 0, float z = 0)
public static Color AddXYZ(this Color color, float x = 0, float y = 0, float z = 0)
{
(float cX, float cY, float cZ) = color.GetXYZ();
return Create(color.A, cX + x, cY + y, cZ + z);
@ -69,7 +69,7 @@ public static class XYZColor
/// <param name="y">The Y value to subtract.</param>
/// <param name="z">The Z value to subtract.</param>
/// <returns>The new color after the modification.</returns>
public static Color SubtractXYZ(this in Color color, float x = 0, float y = 0, float z = 0)
public static Color SubtractXYZ(this Color color, float x = 0, float y = 0, float z = 0)
{
(float cX, float cY, float cZ) = color.GetXYZ();
return Create(color.A, cX - x, cY - y, cZ - z);
@ -83,7 +83,7 @@ public static class XYZColor
/// <param name="y">The Y value to multiply.</param>
/// <param name="z">The Z value to multiply.</param>
/// <returns>The new color after the modification.</returns>
public static Color MultiplyXYZ(this in Color color, float x = 1, float y = 1, float z = 1)
public static Color MultiplyXYZ(this Color color, float x = 1, float y = 1, float z = 1)
{
(float cX, float cY, float cZ) = color.GetXYZ();
return Create(color.A, cX * x, cY * y, cZ * z);
@ -97,7 +97,7 @@ public static class XYZColor
/// <param name="y">The Y value to divide.</param>
/// <param name="z">The Z value to divide.</param>
/// <returns>The new color after the modification.</returns>
public static Color DivideXYZ(this in Color color, float x = 1, float y = 1, float z = 1)
public static Color DivideXYZ(this Color color, float x = 1, float y = 1, float z = 1)
{
(float cX, float cY, float cZ) = color.GetXYZ();
return Create(color.A, cX / x, cY / y, cZ / z);
@ -111,7 +111,7 @@ public static class XYZColor
/// <param name="y">The Y value to set.</param>
/// <param name="z">The Z value to set.</param>
/// <returns>The new color after the modification.</returns>
public static Color SetXYZ(this in Color color, float? x = null, float? y = null, float? z = null)
public static Color SetXYZ(this Color color, float? x = null, float? y = null, float? z = null)
{
(float cX, float cY, float cZ) = color.GetXYZ();
return Create(color.A, x ?? cX, y ?? cY, z ?? cZ);

View File

@ -0,0 +1,8 @@
#if NET8_0
// ReSharper disable once CheckNamespace
namespace RGB.NET.Core.Compatibility.Net8;
public sealed class Lock;
#endif

View File

@ -12,5 +12,5 @@ public interface IBrushDecorator : IDecorator
/// <param name="rectangle">The rectangle in which the <see cref="IBrush"/> should be drawn.</param>
/// <param name="renderTarget">The target (key/point) from which the <see cref="Color"/> should be taken.</param>
/// <param name="color">The <see cref="Color"/> to be modified.</param>
void ManipulateColor(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color);
void ManipulateColor(Rectangle rectangle, RenderTarget renderTarget, ref Color color);
}

View File

@ -43,7 +43,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
IRGBDeviceInfo IRGBDevice.DeviceInfo => DeviceInfo;
/// <inheritdoc />
public IList<IColorCorrection> ColorCorrections { get; } = new List<IColorCorrection>();
public IList<IColorCorrection> ColorCorrections { get; } = [];
/// <summary>
/// Gets or sets if the device needs to be flushed on every update.
@ -63,7 +63,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
#region Indexer
/// <inheritdoc />
Led? IRGBDevice.this[LedId ledId] => LedMapping.TryGetValue(ledId, out Led? led) ? led : null;
Led? IRGBDevice.this[LedId ledId] => LedMapping.GetValueOrDefault(ledId);
/// <inheritdoc />
Led? IRGBDevice.this[Point location] => LedMapping.Values.FirstOrDefault(x => x.Boundary.Contains(location));
@ -119,7 +119,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
/// Applies all <see cref="ColorCorrections"/>.
/// if no <see cref="Led.CustomData"/> ist specified the <see cref="Led.Id"/> is used.
/// </remarks>
/// <param name="leds">The enumerable of leds to convert.</param>
/// <param name="led">The of led to convert.</param>
/// <returns>The enumerable of custom data and color tuples for the specified leds.</returns>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected (object key, Color color) GetUpdateData(Led led)
@ -179,7 +179,7 @@ public abstract class AbstractRGBDevice<TDeviceInfo> : Placeable, IRGBDevice<TDe
{ }
/// <inheritdoc />
public virtual Led? AddLed(LedId ledId, in Point location, in Size size, object? customData = null)
public virtual Led? AddLed(LedId ledId, Point location, Size size, object? customData = null)
{
if ((ledId == LedId.Invalid) || LedMapping.ContainsKey(ledId)) return null;

View File

@ -72,7 +72,7 @@ public interface IRGBDevice : IEnumerable<Led>, IPlaceable, IBindable, IDisposab
/// <param name="size">The size of the led.</param>
/// <param name="customData">Custom data saved on the led.</param>
/// <returns>The newly added led or <c>null</c> if a led with this id is already added.</returns>
Led? AddLed(LedId ledId, in Point location, in Size size, object? customData = null);
Led? AddLed(LedId ledId, Point location, Size size, object? customData = null);
/// <summary>
/// Removes the led with the specified id from the device.

View File

@ -16,7 +16,7 @@ public static class ColorExtensions
/// <param name="color1">The start color of the distance calculation.</param>
/// <param name="color2">The end color fot the distance calculation.</param>
/// <returns>The redmean distance between the two specified colors.</returns>
public static double DistanceTo(this in Color color1, in Color color2)
public static double DistanceTo(this Color color1, Color color2)
{
(_, byte r1, byte g1, byte b1) = color1.GetRGBBytes();
(_, byte r2, byte g2, byte b2) = color2.GetRGBBytes();

View File

@ -91,10 +91,11 @@ public static class FloatExtensions
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static byte GetByteValueFromPercentage(this float percentage)
{
if (float.IsNaN(percentage)) return 0;
// ReSharper disable once ConvertIfStatementToSwitchStatement - This results in a bit more instructions
if (float.IsNaN(percentage) || (percentage <= 0)) return 0;
if (percentage >= 1.0f) return byte.MaxValue;
percentage = percentage.Clamp(0, 1.0f);
return (byte)(percentage >= 1.0f ? 255 : percentage * 256.0f);
return (byte)(percentage * 256.0f);
}
/// <summary>

View File

@ -16,7 +16,7 @@ public static class PointExtensions
/// <param name="x">The x-ammount to move.</param>
/// <param name="y">The y-ammount to move.</param>
/// <returns>The new location of the point.</returns>
public static Point Translate(this in Point point, float x = 0, float y = 0) => new(point.X + x, point.Y + y);
public static Point Translate(this Point point, float x = 0, float y = 0) => new(point.X + x, point.Y + y);
/// <summary>
/// Rotates the specified <see cref="Point"/> by the specified amuont around the specified origin.
@ -25,7 +25,7 @@ public static class PointExtensions
/// <param name="rotation">The rotation.</param>
/// <param name="origin">The origin to rotate around. [0,0] if not set.</param>
/// <returns>The new location of the point.</returns>
public static Point Rotate(this in Point point, in Rotation rotation, in Point origin = new())
public static Point Rotate(this Point point, Rotation rotation, Point origin = new())
{
float sin = MathF.Sin(rotation.Radians);
float cos = MathF.Cos(rotation.Radians);

View File

@ -15,7 +15,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to modify.</param>
/// <param name="location">The new location of the rectangle.</param>
/// <returns>The modified <see cref="Rectangle"/>.</returns>
public static Rectangle SetLocation(this in Rectangle rect, in Point location) => new(location, rect.Size);
public static Rectangle SetLocation(this Rectangle rect, Point location) => new(location, rect.Size);
/// <summary>
/// Sets the <see cref="Point.X"/> of the <see cref="Rectangle.Location"/> of the specified rectangle.
@ -23,7 +23,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to modify.</param>
/// <param name="x">The new x-location of the rectangle.</param>
/// <returns>The modified <see cref="Rectangle"/>.</returns>
public static Rectangle SetX(this in Rectangle rect, float x) => new(new Point(x, rect.Location.Y), rect.Size);
public static Rectangle SetX(this Rectangle rect, float x) => new(new Point(x, rect.Location.Y), rect.Size);
/// <summary>
/// Sets the <see cref="Point.Y"/> of the <see cref="Rectangle.Location"/> of the specified rectangle.
@ -31,7 +31,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to modify.</param>
/// <param name="y">The new y-location of the rectangle.</param>
/// <returns>The modified <see cref="Rectangle"/>.</returns>
public static Rectangle SetY(this in Rectangle rect, float y) => new(new Point(rect.Location.X, y), rect.Size);
public static Rectangle SetY(this Rectangle rect, float y) => new(new Point(rect.Location.X, y), rect.Size);
/// <summary>
/// Sets the <see cref="Rectangle.Size"/> of the specified rectangle.
@ -39,7 +39,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to modify.</param>
/// <param name="size">The new size of the rectangle.</param>
/// <returns>The modified <see cref="Rectangle"/>.</returns>
public static Rectangle SetSize(this in Rectangle rect, in Size size) => new(rect.Location, size);
public static Rectangle SetSize(this Rectangle rect, Size size) => new(rect.Location, size);
/// <summary>
/// Sets the <see cref="Size.Width"/> of the <see cref="Rectangle.Size"/> of the specified rectangle.
@ -47,7 +47,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to modify.</param>
/// <param name="width">The new width of the rectangle.</param>
/// <returns>The modified <see cref="Rectangle"/>.</returns>
public static Rectangle SetWidth(this in Rectangle rect, float width) => new(rect.Location, new Size(width, rect.Size.Height));
public static Rectangle SetWidth(this Rectangle rect, float width) => new(rect.Location, new Size(width, rect.Size.Height));
/// <summary>
/// Sets the <see cref="Size.Height"/> of the <see cref="Rectangle.Size"/> of the specified rectangle.
@ -55,7 +55,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to modify.</param>
/// <param name="height">The new height of the rectangle.</param>
/// <returns>The modified <see cref="Rectangle"/>.</returns>
public static Rectangle SetHeight(this in Rectangle rect, float height) => new(rect.Location, new Size(rect.Size.Width, height));
public static Rectangle SetHeight(this Rectangle rect, float height) => new(rect.Location, new Size(rect.Size.Width, height));
/// <summary>
/// Calculates the percentage of intersection of a rectangle.
@ -63,7 +63,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to calculate the intersection for.</param>
/// <param name="intersectingRect">The intersecting rectangle.</param>
/// <returns>The percentage of intersection.</returns>
public static float CalculateIntersectPercentage(this in Rectangle rect, in Rectangle intersectingRect)
public static float CalculateIntersectPercentage(this Rectangle rect, Rectangle intersectingRect)
{
if (rect.IsEmpty || intersectingRect.IsEmpty) return 0;
@ -77,7 +77,7 @@ public static class RectangleExtensions
/// <param name="rect">The rectangle to calculate the intersection for.</param>
/// <param name="intersectingRectangle">The intersecting <see cref="Rectangle"/>.</param>
/// <returns>A new <see cref="Rectangle"/> representing the intersection this <see cref="Rectangle"/> and the one provided as parameter.</returns>
public static Rectangle CalculateIntersection(this in Rectangle rect, in Rectangle intersectingRectangle)
public static Rectangle CalculateIntersection(this Rectangle rect, Rectangle intersectingRectangle)
{
float x1 = Math.Max(rect.Location.X, intersectingRectangle.Location.X);
float x2 = Math.Min(rect.Location.X + rect.Size.Width, intersectingRectangle.Location.X + intersectingRectangle.Size.Width);
@ -97,7 +97,7 @@ public static class RectangleExtensions
/// <param name="rect">The containing rectangle.</param>
/// <param name="point">The <see cref="Point"/> to test.</param>
/// <returns><c>true</c> if the rectangle contains the specified point; otherwise <c>false</c>.</returns>
public static bool Contains(this in Rectangle rect, in Point point) => rect.Contains(point.X, point.Y);
public static bool Contains(this Rectangle rect, Point point) => rect.Contains(point.X, point.Y);
/// <summary>
/// Determines if the specified location is contained within this <see cref="Rectangle"/>.
@ -106,7 +106,7 @@ public static class RectangleExtensions
/// <param name="x">The X-location to test.</param>
/// <param name="y">The Y-location to test.</param>
/// <returns><c>true</c> if the rectangle contains the specified coordinates; otherwise <c>false</c>.</returns>
public static bool Contains(this in Rectangle rect, float x, float y) => (rect.Location.X <= x) && (x < (rect.Location.X + rect.Size.Width))
public static bool Contains(this Rectangle rect, float x, float y) => (rect.Location.X <= x) && (x < (rect.Location.X + rect.Size.Width))
&& (rect.Location.Y <= y) && (y < (rect.Location.Y + rect.Size.Height));
/// <summary>
@ -115,7 +115,7 @@ public static class RectangleExtensions
/// <param name="rect">The containing rectangle.</param>
/// <param name="rect2">The <see cref="Rectangle"/> to test.</param>
/// <returns><c>true</c> if the rectangle contains the specified rect; otherwise <c>false</c>.</returns>
public static bool Contains(this in Rectangle rect, in Rectangle rect2) => (rect.Location.X <= rect2.Location.X) && ((rect2.Location.X + rect2.Size.Width) <= (rect.Location.X + rect.Size.Width))
public static bool Contains(this Rectangle rect, Rectangle rect2) => (rect.Location.X <= rect2.Location.X) && ((rect2.Location.X + rect2.Size.Width) <= (rect.Location.X + rect.Size.Width))
&& (rect.Location.Y <= rect2.Location.Y) && ((rect2.Location.Y + rect2.Size.Height) <= (rect.Location.Y + rect.Size.Height));
/// <summary>
@ -124,7 +124,7 @@ public static class RectangleExtensions
/// <param name="rect">The <see cref="Rectangle"/> to move.</param>
/// <param name="point">The amount to move.</param>
/// <returns>The moved rectangle.</returns>
public static Rectangle Translate(this in Rectangle rect, in Point point) => rect.Translate(point.X, point.Y);
public static Rectangle Translate(this Rectangle rect, Point point) => rect.Translate(point.X, point.Y);
/// <summary>
/// Moves the specified <see cref="Rectangle"/> by the specified amount.
@ -133,7 +133,7 @@ public static class RectangleExtensions
/// <param name="x">The x-ammount to move.</param>
/// <param name="y">The y-ammount to move.</param>
/// <returns>The moved rectangle.</returns>
public static Rectangle Translate(this in Rectangle rect, float x = 0, float y = 0) => new(rect.Location.Translate(x, y), rect.Size);
public static Rectangle Translate(this Rectangle rect, float x = 0, float y = 0) => new(rect.Location.Translate(x, y), rect.Size);
/// <summary>
/// Rotates the specified <see cref="Rectangle"/> by the specified amuont around the specified origin.
@ -149,14 +149,14 @@ public static class RectangleExtensions
/// <param name="rotation">The rotation.</param>
/// <param name="origin">The origin to rotate around. [0,0] if not set.</param>
/// <returns>A array of <see cref="Point"/> containing the new locations of the corners of the original rectangle.</returns>
public static Point[] Rotate(this in Rectangle rect, in Rotation rotation, in Point origin = new())
public static Point[] Rotate(this Rectangle rect, Rotation rotation, Point origin = new())
{
Point[] points =
[
rect.Location, // top left
new Point(rect.Location.X + rect.Size.Width, rect.Location.Y), // top right
new Point(rect.Location.X + rect.Size.Width, rect.Location.Y + rect.Size.Height), // bottom right
new Point(rect.Location.X, rect.Location.Y + rect.Size.Height), // bottom right
new(rect.Location.X + rect.Size.Width, rect.Location.Y), // top right
new(rect.Location.X + rect.Size.Width, rect.Location.Y + rect.Size.Height), // bottom right
new(rect.Location.X, rect.Location.Y + rect.Size.Height), // bottom right
];
float sin = MathF.Sin(rotation.Radians);

View File

@ -20,7 +20,7 @@ public sealed class ListLedGroup : AbstractLedGroup
/// <summary>
/// Gets the list containing the <see cref="Led"/> of this <see cref="ListLedGroup"/>.
/// </summary>
private readonly IList<Led> _groupLeds = new List<Led>();
private readonly IList<Led> _groupLeds = [];
#endregion
@ -142,7 +142,7 @@ public sealed class ListLedGroup : AbstractLedGroup
public override IList<Led> ToList()
{
lock (_groupLeds)
return new List<Led>(_groupLeds);
return [.._groupLeds];
}
protected override IDisposable ToListUnsafe(out IList<Led> leds)

View File

@ -40,7 +40,7 @@ public static class ConversionHelper
public static byte[] HexToBytes(ReadOnlySpan<char> hexString)
{
if ((hexString.Length == 0) || ((hexString.Length % 2) != 0))
return Array.Empty<byte>();
return [];
byte[] buffer = new byte[hexString.Length / 2];
for (int bx = 0, sx = 0; bx < buffer.Length; ++bx, ++sx)

View File

@ -24,7 +24,7 @@ public static class TimerHelper
#region Properties & Fields
private static readonly object HIGH_RESOLUTION_TIMER_LOCK = new();
private static readonly Lock HIGH_RESOLUTION_TIMER_LOCK = new();
private static bool _areHighResolutionTimersEnabled = false;

View File

@ -90,7 +90,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point1">The first <see cref="Point" /> to compare.</param>
/// <param name="point2">The second <see cref="Point" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="point1" /> and <paramref name="point2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(in Point point1, in Point point2) => point1.Equals(point2);
public static bool operator ==(Point point1, Point point2) => point1.Equals(point2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="Point" /> are equal.
@ -98,7 +98,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point1">The first <see cref="Point" /> to compare.</param>
/// <param name="point2">The second <see cref="Point" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="point1" /> and <paramref name="point2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(in Point point1, in Point point2) => !(point1 == point2);
public static bool operator !=(Point point1, Point point2) => !(point1 == point2);
/// <summary>
/// Returns a new <see cref="Point"/> representing the addition of the two provided <see cref="Point"/>.
@ -106,7 +106,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point1">The first <see cref="Point"/>.</param>
/// <param name="point2">The second <see cref="Point"/>.</param>
/// <returns>A new <see cref="Point"/> representing the addition of the two provided <see cref="Point"/>.</returns>
public static Point operator +(in Point point1, in Point point2) => new(point1.X + point2.X, point1.Y + point2.Y);
public static Point operator +(Point point1, Point point2) => new(point1.X + point2.X, point1.Y + point2.Y);
/// <summary>
/// Returns a new <see cref="Rectangle"/> created from the provided <see cref="Point"/> and <see cref="Size"/>.
@ -114,7 +114,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point">The <see cref="Point"/> of the rectangle.</param>
/// <param name="size">The <see cref="Size"/> of the rectangle.</param>
/// <returns>The rectangle created from the provided <see cref="Point"/> and <see cref="Size"/>.</returns>
public static Rectangle operator +(in Point point, in Size size) => new(point, size);
public static Rectangle operator +(Point point, Size size) => new(point, size);
/// <summary>
/// Returns a new <see cref="Point"/> representing the subtraction of the two provided <see cref="Point"/>.
@ -122,7 +122,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point1">The first <see cref="Point"/>.</param>
/// <param name="point2">The second <see cref="Point"/>.</param>
/// <returns>A new <see cref="Point"/> representing the subtraction of the two provided <see cref="Point"/>.</returns>
public static Point operator -(in Point point1, in Point point2) => new(point1.X - point2.X, point1.Y - point2.Y);
public static Point operator -(Point point1, Point point2) => new(point1.X - point2.X, point1.Y - point2.Y);
/// <summary>
/// Returns a new <see cref="Point"/> representing the multiplication of the two provided <see cref="Point"/>.
@ -130,7 +130,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point1">The first <see cref="Point"/>.</param>
/// <param name="point2">The second <see cref="Point"/>.</param>
/// <returns>A new <see cref="Point"/> representing the multiplication of the two provided <see cref="Point"/>.</returns>
public static Point operator *(in Point point1, in Point point2) => new(point1.X * point2.X, point1.Y * point2.Y);
public static Point operator *(Point point1, Point point2) => new(point1.X * point2.X, point1.Y * point2.Y);
/// <summary>
/// Returns a new <see cref="Point"/> representing the division of the two provided <see cref="Point"/>.
@ -138,7 +138,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point1">The first <see cref="Point"/>.</param>
/// <param name="point2">The second <see cref="Point"/>.</param>
/// <returns>A new <see cref="Point"/> representing the division of the two provided <see cref="Point"/>.</returns>
public static Point operator /(in Point point1, in Point point2)
public static Point operator /(Point point1, Point point2)
{
if (point2.X.EqualsInTolerance(0) || point2.Y.EqualsInTolerance(0)) return Invalid;
return new Point(point1.X / point2.X, point1.Y / point2.Y);
@ -150,7 +150,7 @@ public readonly struct Point : IEquatable<Point>
/// <param name="point">The <see cref="Point"/>.</param>
/// <param name="scale">The <see cref="Scale"/>.</param>
/// <returns>A new <see cref="Point"/> representing the multiplication of the <see cref="Point"/> and the provided <see cref="Scale"/>.</returns>
public static Point operator *(in Point point, in Scale scale) => new(point.X * scale.Horizontal, point.Y * scale.Vertical);
public static Point operator *(Point point, Scale scale) => new(point.X * scale.Horizontal, point.Y * scale.Vertical);
#endregion
}

View File

@ -179,7 +179,7 @@ public readonly struct Rectangle : IEquatable<Rectangle>
#region Methods
private static (Point location, Size size) InitializeFromPoints(in Point point1, in Point point2)
private static (Point location, Size size) InitializeFromPoints(Point point1, Point point2)
{
float posX = Math.Min(point1.X, point2.X);
float posY = Math.Min(point1.Y, point2.Y);
@ -225,7 +225,7 @@ public readonly struct Rectangle : IEquatable<Rectangle>
/// <param name="rectangle1">The first <see cref="Rectangle" /> to compare.</param>
/// <param name="rectangle2">The second <see cref="Rectangle" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="rectangle1" /> and <paramref name="rectangle2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(in Rectangle rectangle1, in Rectangle rectangle2) => rectangle1.Equals(rectangle2);
public static bool operator ==(Rectangle rectangle1, Rectangle rectangle2) => rectangle1.Equals(rectangle2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="Rectangle" /> are equal.
@ -233,7 +233,7 @@ public readonly struct Rectangle : IEquatable<Rectangle>
/// <param name="rectangle1">The first <see cref="Rectangle" /> to compare.</param>
/// <param name="rectangle2">The second <see cref="Rectangle" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="rectangle1" /> and <paramref name="rectangle2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(in Rectangle rectangle1, in Rectangle rectangle2) => !(rectangle1 == rectangle2);
public static bool operator !=(Rectangle rectangle1, Rectangle rectangle2) => !(rectangle1 == rectangle2);
// DarthAffe 20.02.2021: Used for normalization
/// <summary>
@ -242,7 +242,7 @@ public readonly struct Rectangle : IEquatable<Rectangle>
/// <param name="rectangle1">The rectangle to nromalize.</param>
/// <param name="rectangle2">The reference used for normalization.</param>
/// <returns>A normalized rectangle.</returns>
public static Rectangle operator /(in Rectangle rectangle1, in Rectangle rectangle2)
public static Rectangle operator /(Rectangle rectangle1, Rectangle rectangle2)
{
float x = rectangle1.Location.X / (rectangle2.Size.Width - rectangle2.Location.X);
float y = rectangle1.Location.Y / (rectangle2.Size.Height - rectangle2.Location.Y);

View File

@ -103,7 +103,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// <param name="rotation1">The first <see cref="Rotation" /> to compare.</param>
/// <param name="rotation2">The second <see cref="Rotation" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="rotation1" /> and <paramref name="rotation2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(in Rotation rotation1, in Rotation rotation2) => rotation1.Equals(rotation2);
public static bool operator ==(Rotation rotation1, Rotation rotation2) => rotation1.Equals(rotation2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="Rotation" /> are equal.
@ -111,7 +111,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// <param name="rotation1">The first <see cref="Rotation" /> to compare.</param>
/// <param name="rotation2">The second <see cref="Rotation" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="rotation1" /> and <paramref name="rotation2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(in Rotation rotation1, in Rotation rotation2) => !(rotation1 == rotation2);
public static bool operator !=(Rotation rotation1, Rotation rotation2) => !(rotation1 == rotation2);
/// <summary>
/// Returns a new <see cref="Rotation"/> representing the addition of the <see cref="Rotation"/> and the provided value.
@ -119,7 +119,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// <param name="rotation">The <see cref="Rotation"/>.</param>
/// <param name="value">The value to add.</param>
/// <returns>A new <see cref="Rotation"/> representing the addition of the <see cref="Rotation"/> and the provided value.</returns>
public static Rotation operator +(in Rotation rotation, float value) => new(rotation.Degrees + value);
public static Rotation operator +(Rotation rotation, float value) => new(rotation.Degrees + value);
/// <summary>
/// Returns a new <see cref="Rotation"/> representing the subtraction of the <see cref="Rotation"/> and the provided value.
@ -127,7 +127,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// <param name="rotation">The <see cref="Rotation"/>.</param>
/// <param name="value">The value to substract.</param>
/// <returns>A new <see cref="Rotation"/> representing the subtraction of the <see cref="Rotation"/> and the provided value.</returns>
public static Rotation operator -(in Rotation rotation, float value) => new(rotation.Degrees - value);
public static Rotation operator -(Rotation rotation, float value) => new(rotation.Degrees - value);
/// <summary>
/// Returns a new <see cref="Rotation"/> representing the multiplication of the <see cref="Rotation"/> and the provided value.
@ -135,7 +135,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// <param name="rotation">The <see cref="Rotation"/>.</param>
/// <param name="value">The value to multiply with.</param>
/// <returns>A new <see cref="Rotation"/> representing the multiplication of the <see cref="Rotation"/> and the provided value.</returns>
public static Rotation operator *(in Rotation rotation, float value) => new(rotation.Degrees * value);
public static Rotation operator *(Rotation rotation, float value) => new(rotation.Degrees * value);
/// <summary>
/// Returns a new <see cref="Rotation"/> representing the division of the <see cref="Rotation"/> and the provided value.
@ -143,7 +143,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// <param name="rotation">The <see cref="Rotation"/>.</param>
/// <param name="value">The value to device with.</param>
/// <returns>A new <see cref="Rotation"/> representing the division of the <see cref="Rotation"/> and the provided value.</returns>
public static Rotation operator /(in Rotation rotation, float value) => value.EqualsInTolerance(0) ? new Rotation(0) : new Rotation(rotation.Degrees / value);
public static Rotation operator /(Rotation rotation, float value) => value.EqualsInTolerance(0) ? new Rotation(0) : new Rotation(rotation.Degrees / value);
/// <summary>
/// Converts a float to a <see cref="Rotation" />.
@ -155,7 +155,7 @@ public readonly struct Rotation : IEquatable<Rotation>
/// Converts <see cref="Rotation" /> to a float representing the rotation in degrees.
/// </summary>
/// <param name="rotation">The rotatio to convert.</param>
public static implicit operator float(in Rotation rotation) => rotation.Degrees;
public static implicit operator float(Rotation rotation) => rotation.Degrees;
#endregion
}

View File

@ -110,7 +110,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size1">The first <see cref="Size" /> to compare.</param>
/// <param name="size2">The second <see cref="Size" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="size1" /> and <paramref name="size2" /> are equal; otherwise, <c>false</c>.</returns>
public static bool operator ==(in Size size1, in Size size2) => size1.Equals(size2);
public static bool operator ==(Size size1, Size size2) => size1.Equals(size2);
/// <summary>
/// Returns a value that indicates whether two specified <see cref="Size" /> are equal.
@ -118,7 +118,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size1">The first <see cref="Size" /> to compare.</param>
/// <param name="size2">The second <see cref="Size" /> to compare.</param>
/// <returns><c>true</c> if <paramref name="size1" /> and <paramref name="size2" /> are not equal; otherwise, <c>false</c>.</returns>
public static bool operator !=(in Size size1, in Size size2) => !(size1 == size2);
public static bool operator !=(Size size1, Size size2) => !(size1 == size2);
/// <summary>
/// Returns a new <see cref="Size"/> representing the addition of the two provided <see cref="Size"/>.
@ -126,7 +126,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size1">The first <see cref="Size"/>.</param>
/// <param name="size2">The second <see cref="Size"/>.</param>
/// <returns>A new <see cref="Size"/> representing the addition of the two provided <see cref="Size"/>.</returns>
public static Size operator +(in Size size1, in Size size2) => new(size1.Width + size2.Width, size1.Height + size2.Height);
public static Size operator +(Size size1, Size size2) => new(size1.Width + size2.Width, size1.Height + size2.Height);
/// <summary>
/// Returns a new <see cref="Rectangle"/> created from the provided <see cref="Point"/> and <see cref="Size"/>.
@ -134,7 +134,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size">The <see cref="Size"/> of the rectangle.</param>
/// <param name="point">The <see cref="Point"/> of the rectangle.</param>
/// <returns>The rectangle created from the provided <see cref="Point"/> and <see cref="Size"/>.</returns>
public static Rectangle operator +(in Size size, in Point point) => new(point, size);
public static Rectangle operator +(Size size, Point point) => new(point, size);
/// <summary>
/// Returns a new <see cref="Size"/> representing the subtraction of the two provided <see cref="Size"/>.
@ -142,7 +142,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size1">The first <see cref="Size"/>.</param>
/// <param name="size2">The second <see cref="Size"/>.</param>
/// <returns>A new <see cref="Size"/> representing the subtraction of the two provided <see cref="Size"/>.</returns>
public static Size operator -(in Size size1, in Size size2) => new(size1.Width - size2.Width, size1.Height - size2.Height);
public static Size operator -(Size size1, Size size2) => new(size1.Width - size2.Width, size1.Height - size2.Height);
/// <summary>
/// Returns a new <see cref="Size"/> representing the multiplication of the two provided <see cref="Size"/>.
@ -150,7 +150,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size1">The first <see cref="Size"/>.</param>
/// <param name="size2">The second <see cref="Size"/>.</param>
/// <returns>A new <see cref="Size"/> representing the multiplication of the two provided <see cref="Size"/>.</returns>
public static Size operator *(in Size size1, in Size size2) => new(size1.Width * size2.Width, size1.Height * size2.Height);
public static Size operator *(Size size1, Size size2) => new(size1.Width * size2.Width, size1.Height * size2.Height);
/// <summary>
/// Returns a new <see cref="Size"/> representing the multiplication of the <see cref="Size"/> and the provided factor.
@ -158,7 +158,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size">The <see cref="Size"/>.</param>
/// <param name="factor">The factor by which the <see cref="Size"/> should be multiplied.</param>
/// <returns>A new <see cref="Size"/> representing the multiplication of the <see cref="Size"/> and the provided factor.</returns>
public static Size operator *(in Size size, float factor) => new(size.Width * factor, size.Height * factor);
public static Size operator *(Size size, float factor) => new(size.Width * factor, size.Height * factor);
/// <summary>
/// Returns a new <see cref="Size"/> representing the division of the two provided <see cref="Size"/>.
@ -166,7 +166,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size1">The first <see cref="Size"/>.</param>
/// <param name="size2">The second <see cref="Size"/>.</param>
/// <returns>A new <see cref="Size"/> representing the division of the two provided <see cref="Size"/>.</returns>
public static Size operator /(in Size size1, in Size size2)
public static Size operator /(Size size1, Size size2)
=> size2.Width.EqualsInTolerance(0) || size2.Height.EqualsInTolerance(0)
? Invalid : new Size(size1.Width / size2.Width, size1.Height / size2.Height);
@ -176,7 +176,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size">The <see cref="Size"/>.</param>
/// <param name="factor">The factor by which the <see cref="Size"/> should be divided.</param>
/// <returns>A new <see cref="Size"/> representing the division of the <see cref="Size"/> and the provided factor.</returns>
public static Size operator /(in Size size, float factor) => factor.EqualsInTolerance(0) ? Invalid : new Size(size.Width / factor, size.Height / factor);
public static Size operator /(Size size, float factor) => factor.EqualsInTolerance(0) ? Invalid : new Size(size.Width / factor, size.Height / factor);
/// <summary>
/// Returns a new <see cref="Size"/> representing the multiplication of the <see cref="Size"/> and the specified <see cref="Scale"/>.
@ -184,7 +184,7 @@ public readonly struct Size : IEquatable<Size>
/// <param name="size">The <see cref="Size"/> to scale.</param>
/// <param name="scale">The scaling factor.</param>
/// <returns>A new <see cref="Size"/> representing the multiplication of the <see cref="Size"/> and the specified <see cref="Scale"/>.</returns>
public static Size operator *(in Size size, in Scale scale) => new(size.Width * scale.Horizontal, size.Height * scale.Vertical);
public static Size operator *(Size size, Scale scale) => new(size.Width * scale.Horizontal, size.Height * scale.Vertical);
#endregion
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -52,6 +52,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -20,8 +20,8 @@ public sealed class RGBSurface : AbstractBindable, IDisposable
private readonly Stopwatch _deltaTimeCounter;
private readonly IList<IRGBDevice> _devices = new List<IRGBDevice>();
private readonly IList<IUpdateTrigger> _updateTriggers = new List<IUpdateTrigger>();
private readonly IList<IRGBDevice> _devices = [];
private readonly IList<IUpdateTrigger> _updateTriggers = [];
private readonly List<ILedGroup> _ledGroups = [];
/// <summary>

View File

@ -69,7 +69,7 @@ public abstract class AbstractBrush : AbstractDecoratable<IBrushDecorator>, IBru
/// <param name="rectangle">The rectangle in which the brush should be drawn.</param>
/// <param name="renderTarget">The target (key/point) from which the color should be taken.</param>
/// <param name="color">The <see cref="Color"/> to be modified.</param>
protected virtual void ApplyDecorators(in Rectangle rectangle, in RenderTarget renderTarget, ref Color color)
protected virtual void ApplyDecorators(Rectangle rectangle, RenderTarget renderTarget, ref Color color)
{
if (Decorators.Count == 0) return;
@ -89,7 +89,7 @@ public abstract class AbstractBrush : AbstractDecoratable<IBrushDecorator>, IBru
/// <param name="rectangle">The rectangle in which the brush should be drawn.</param>
/// <param name="renderTarget">The target (key/point) from which the color should be taken.</param>
/// <returns>The color at the specified point.</returns>
protected abstract Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget);
protected abstract Color GetColorAtPoint(Rectangle rectangle, RenderTarget renderTarget);
/// <summary>
/// Finalizes the color by appliing the overall brightness and opacity.<br/>

View File

@ -41,7 +41,7 @@ public sealed class SolidColorBrush : AbstractBrush
#region Methods
/// <inheritdoc />
protected override Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget) => Color;
protected override Color GetColorAtPoint(Rectangle rectangle, RenderTarget renderTarget) => Color;
#endregion

View File

@ -36,7 +36,7 @@ public sealed class TextureBrush : AbstractBrush
#region Methods
/// <inheritdoc />
protected override Color GetColorAtPoint(in Rectangle rectangle, in RenderTarget renderTarget)
protected override Color GetColorAtPoint(Rectangle rectangle, RenderTarget renderTarget)
{
Rectangle normalizedRect = renderTarget.Rectangle / rectangle;
return Texture[normalizedRect];

View File

@ -5,8 +5,8 @@ internal sealed class EmptyTexture : ITexture
#region Properties & Fields
public Size Size { get; } = new(0, 0);
public Color this[in Point point] => Color.Transparent;
public Color this[in Rectangle rectangle] => Color.Transparent;
public Color this[Point point] => Color.Transparent;
public Color this[Rectangle rectangle] => Color.Transparent;
#endregion
}

View File

@ -20,12 +20,12 @@ public interface ITexture
/// </summary>
/// <param name="point">The location to get the color from.</param>
/// <returns>The color at the specified location.</returns>
Color this[in Point point] { get; }
Color this[Point point] { get; }
/// <summary>
/// Gets the sampled color inside the specified rectangle.
/// </summary>
/// <param name="rectangle">The rectangle to get the color from.</param>
/// <returns>The sampled color.</returns>
Color this[in Rectangle rectangle] { get; }
Color this[Rectangle rectangle] { get; }
}

View File

@ -39,7 +39,7 @@ public abstract class PixelTexture<T> : ITexture
public Size Size { get; }
/// <inheritdoc />
public virtual Color this[in Point point]
public virtual Color this[Point point]
{
get
{
@ -52,7 +52,7 @@ public abstract class PixelTexture<T> : ITexture
}
/// <inheritdoc />
public virtual Color this[in Rectangle rectangle]
public virtual Color this[Rectangle rectangle]
{
get
{
@ -126,7 +126,7 @@ public abstract class PixelTexture<T> : ITexture
/// </summary>
/// <param name="pixel">The pixel-data to convert.</param>
/// <returns>The color represented by the specified pixel-data.</returns>
protected abstract Color GetColor(in ReadOnlySpan<T> pixel);
protected abstract Color GetColor(ReadOnlySpan<T> pixel);
/// <summary>
/// Gets the pixel-data at the specified location.
@ -189,7 +189,7 @@ public sealed class PixelTexture : PixelTexture<Color>
/// <inheritdoc />
[MethodImpl(MethodImplOptions.AggressiveInlining)]
protected override Color GetColor(in ReadOnlySpan<Color> pixel) => pixel[0];
protected override Color GetColor(ReadOnlySpan<Color> pixel) => pixel[0];
#endregion
}

View File

@ -22,7 +22,7 @@ public sealed class AverageColorSampler : ISampler<Color>
#region Methods
/// <inheritdoc />
public unsafe void Sample(in SamplerInfo<Color> info, in Span<Color> pixelData)
public unsafe void Sample(SamplerInfo<Color> info, Span<Color> pixelData)
{
int count = info.Width * info.Height;
if (count == 0) return;

View File

@ -13,5 +13,5 @@ public interface ISampler<T>
/// </summary>
/// <param name="info">The information containing the data to sample.</param>
/// <param name="pixelData">The buffer used to write the resulting pixel to.</param>
void Sample(in SamplerInfo<T> info, in Span<T> pixelData);
void Sample(SamplerInfo<T> info, Span<T> pixelData);
}

View File

@ -44,7 +44,7 @@ public readonly ref struct SamplerInfo<T>
/// <param name="width">The width of the region the data comes from.</param>
/// <param name="height">The height of region the data comes from.</param>
/// <param name="data">The data to sample.</param>
public SamplerInfo(int x, int y, int width, int height, int stride, int dataPerPixel, in ReadOnlySpan<T> data)
public SamplerInfo(int x, int y, int width, int height, int stride, int dataPerPixel, ReadOnlySpan<T> data)
{
this._x = x;
this._y = y;

View File

@ -29,13 +29,13 @@ public abstract class AbstractUpdateTrigger : AbstractBindable, IUpdateTrigger
/// Invokes the <see cref="Starting"/>-event.
/// </summary>
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Starting"/>.event.</param>
protected virtual void OnStartup(CustomUpdateData? updateData = null) => Starting?.Invoke(this, updateData ?? new CustomUpdateData());
protected virtual void OnStartup(CustomUpdateData? updateData = null) => Starting?.Invoke(this, updateData ?? CustomUpdateData.Empty);
/// <summary>
/// Invokes the <see cref="Update"/>-event.
/// </summary>
/// <param name="updateData">Optional custom-data passed to the subscribers of the <see cref="Update"/>.event.</param>
protected virtual void OnUpdate(CustomUpdateData? updateData = null) => Update?.Invoke(this, updateData ?? new CustomUpdateData());
protected virtual void OnUpdate(CustomUpdateData? updateData = null) => Update?.Invoke(this, updateData ?? CustomUpdateData.Empty);
/// <inheritdoc />
public abstract void Start();

View File

@ -52,6 +52,9 @@ public sealed class CustomUpdateData : ICustomUpdateData
{
#region Properties & Fields
// ReSharper disable once InconsistentNaming
public static readonly CustomUpdateData Empty = new();
private readonly Dictionary<string, object?> _data = [];
#endregion
@ -65,7 +68,7 @@ public sealed class CustomUpdateData : ICustomUpdateData
/// <returns>The value represented by the specified key.</returns>
public object? this[string key]
{
get => _data.TryGetValue(key, out object? data) ? data : default;
get => _data.GetValueOrDefault(key);
set => _data[key] = value;
}

View File

@ -1,6 +1,7 @@
using System;
using System.Buffers;
using System.Collections.Generic;
using System.Threading;
namespace RGB.NET.Core;
@ -14,7 +15,7 @@ public abstract class UpdateQueue<TIdentifier, TData> : AbstractReferenceCountin
{
#region Properties & Fields
private readonly object _dataLock = new();
private readonly Lock _dataLock = new();
private readonly IDeviceUpdateTrigger _updateTrigger;
private readonly Dictionary<TIdentifier, TData> _currentDataSet = [];
@ -80,7 +81,7 @@ public abstract class UpdateQueue<TIdentifier, TData> : AbstractReferenceCountin
/// Performs the update this queue is responsible for.
/// </summary>
/// <param name="dataSet">The set of data that needs to be updated.</param>
protected abstract bool Update(in ReadOnlySpan<(TIdentifier key, TData color)> dataSet);
protected abstract bool Update(ReadOnlySpan<(TIdentifier key, TData color)> dataSet);
/// <summary>
/// Sets or merges the provided data set in the current dataset and notifies the trigger that there is new data available.

View File

@ -14,7 +14,7 @@ public sealed class TimerUpdateTrigger : AbstractUpdateTrigger
{
#region Properties & Fields
private readonly object _lock = new();
private readonly Lock _lock = new();
private readonly CustomUpdateData? _customUpdateData;

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using AuraServiceLib;
using RGB.NET.Core;
@ -17,7 +18,7 @@ public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static AsusDeviceProvider? _instance;
/// <summary>
@ -76,7 +77,7 @@ public sealed class AsusDeviceProvider : AbstractRGBDeviceProvider
yield return (AsusDeviceType)device.Type switch
{
AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, WMIHelper.GetMainboardInfo()?.model ?? device.Name), GetUpdateTrigger()),
AsusDeviceType.MB_RGB => new AsusMainboardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Mainboard, device, "Asus Motherboard"), GetUpdateTrigger()),
AsusDeviceType.MB_ADDRESABLE => new AsusUnspecifiedRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.LedStripe, device), LedId.LedStripe1, GetUpdateTrigger()),
AsusDeviceType.VGA_RGB => new AsusGraphicsCardRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.GraphicsCard, device), GetUpdateTrigger()),
AsusDeviceType.HEADSET_RGB => new AsusHeadsetRGBDevice(new AsusRGBDeviceInfo(RGBDeviceType.Headset, device), GetUpdateTrigger()),

View File

@ -43,7 +43,7 @@ public sealed class AsusUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -1,82 +0,0 @@
using System;
using System.Management;
namespace RGB.NET.Devices.Asus;
// ReSharper disable once InconsistentNaming
internal static class WMIHelper
{
#region Properties & Fields
// ReSharper disable InconsistentNaming
private static readonly ManagementObjectSearcher? _systemModelSearcher;
private static readonly ManagementObjectSearcher? _mainboardSearcher;
private static readonly ManagementObjectSearcher? _graphicsCardSearcher;
// ReSharper restore InconsistentNaming
private static string? _systemModelInfo;
private static (string manufacturer, string model)? _mainboardInfo;
private static string? _graphicsCardInfo;
#endregion
#region Constructors
static WMIHelper()
{
if (OperatingSystem.IsWindows())
{
_systemModelSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Model FROM Win32_ComputerSystem");
_mainboardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Manufacturer,Product FROM Win32_BaseBoard");
_graphicsCardSearcher = new ManagementObjectSearcher(@"root\CIMV2", "SELECT Name FROM Win32_VideoController");
}
}
#endregion
#region Methods
internal static string? GetSystemModelInfo()
{
if (!OperatingSystem.IsWindows()) return null;
if ((_systemModelInfo == null) && (_systemModelSearcher != null))
foreach (ManagementBaseObject managementBaseObject in _systemModelSearcher.Get())
{
_systemModelInfo = managementBaseObject["Model"].ToString();
break;
}
return _systemModelInfo;
}
internal static (string manufacturer, string model)? GetMainboardInfo()
{
if (!OperatingSystem.IsWindows()) return null;
if (!_mainboardInfo.HasValue && (_mainboardSearcher != null))
foreach (ManagementBaseObject managementBaseObject in _mainboardSearcher.Get())
{
_mainboardInfo = (managementBaseObject["Manufacturer"].ToString() ?? string.Empty, managementBaseObject["Product"].ToString() ?? string.Empty);
break;
}
return _mainboardInfo;
}
internal static string? GetGraphicsCardsInfo()
{
if (!OperatingSystem.IsWindows()) return null;
if ((_graphicsCardInfo == null) && (_graphicsCardSearcher != null))
foreach (ManagementBaseObject managementBaseObject in _graphicsCardSearcher.Get())
{
_graphicsCardInfo = managementBaseObject["Name"].ToString();
break;
}
return _graphicsCardInfo;
}
#endregion
}

View File

@ -37,8 +37,8 @@ public sealed class AsusKeyboardRGBDevice : AsusRGBDevice<AsusKeyboardRGBDeviceI
// ReSharper disable once InconsistentNaming
public static readonly List<AsusKeyboardExtraMapping> ExtraLedMappings =
[
new AsusKeyboardExtraMapping(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15),
new AsusKeyboardExtraMapping(new Regex("(ROG Strix G513QM).*?"), LedMappings.ROGStrixG15)
new(new Regex("(ROG Zephyrus Duo 15).*?"), LedMappings.ROGZephyrusDuo15),
new(new Regex("(ROG Strix G513QM).*?"), LedMappings.ROGStrixG15)
];
#endregion

View File

@ -13,7 +13,6 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi
/// <summary>
/// The ASUS SDK returns useless names for notebook keyboards, possibly for others as well.
/// Keep a list of those and rely on <see cref="WMIHelper.GetSystemModelInfo()"/> to get the real model
/// </summary>
private static readonly List<string> GENERIC_DEVICE_NAMES = ["NotebookKeyboard"];
@ -37,7 +36,7 @@ public sealed class AsusKeyboardRGBDeviceInfo : AsusRGBDeviceInfo, IKeyboardDevi
#region Methods
private static string? GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? WMIHelper.GetSystemModelInfo() : deviceName;
private static string GetKeyboardModel(string deviceName) => GENERIC_DEVICE_NAMES.Contains(deviceName) ? "Asus Keyboard" : deviceName;
#endregion
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,13 +51,13 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Management" Version="7.0.0" />
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using RGB.NET.Core;
using RGB.NET.Devices.CoolerMaster.Helper;
using RGB.NET.Devices.CoolerMaster.Native;
@ -18,7 +19,7 @@ public sealed class CoolerMasterDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static CoolerMasterDeviceProvider? _instance;
/// <summary>

View File

@ -37,7 +37,7 @@ public sealed class CoolerMasterUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,6 +51,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -18,7 +18,7 @@ public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static CorsairDeviceProvider? _instance;
/// <summary>
@ -273,7 +273,12 @@ public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider
break;
case CorsairChannelDeviceType.EightLedSeriesFan:
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "8-Led-Series Fan Fan"), updateQueue);
string fanModelName = "8-Led-Series Fan";
if (device.model == "iCUE LINK System Hub")
fanModelName = "RX Fan";
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, fanModelName), updateQueue);
break;
case CorsairChannelDeviceType.DAP:
@ -289,20 +294,20 @@ public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider
break;
case CorsairChannelDeviceType.Strip:
string modelName = "LED Strip";
string stripModelName = "LED Strip";
// LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
if ((device.model == "LS100 Starter Kit") && (ledCount == 138))
modelName = "LS100 LED Strip (dual monitor)";
stripModelName = "LS100 LED Strip (dual monitor)";
else if ((device.model == "LS100 Starter Kit") && (ledCount == 84))
modelName = "LS100 LED Strip (single monitor)";
stripModelName = "LS100 LED Strip (single monitor)";
// Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
else if ((device.model == "LS100 Starter Kit") && (ledCount == 15))
modelName = "LS100 LED Strip (short)";
stripModelName = "LS100 LED Strip (short)";
else if ((device.model == "LS100 Starter Kit") && (ledCount == 27))
modelName = "LS100 LED Strip (long)";
stripModelName = "LS100 LED Strip (long)";
yield return new CorsairLedStripRGBDevice(new CorsairLedStripRGBDeviceInfo(device, ledCount, offset, modelName), updateQueue);
yield return new CorsairLedStripRGBDevice(new CorsairLedStripRGBDeviceInfo(device, ledCount, offset, stripModelName), updateQueue);
break;
case CorsairChannelDeviceType.DRAM:
@ -310,7 +315,12 @@ public sealed class CorsairDeviceProvider : AbstractRGBDeviceProvider
break;
default:
Throw(new RGBDeviceException("Unknown Device-Type"));
//Workaround to support LX Fans because they have an invalid ChannelDeviceType
if ((device.model == "iCUE LINK System Hub") && (ledCount == 18))
yield return new CorsairFanRGBDevice(new CorsairFanRGBDeviceInfo(device, ledCount, offset, "LX Fan"), updateQueue);
else
Throw(new RGBDeviceException("Unknown Device-Type"));
break;
}

View File

@ -40,7 +40,7 @@ public sealed class CorsairDeviceUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override unsafe bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override unsafe bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -47,6 +47,9 @@ internal static unsafe class _CUESDK
#region Properties & Fields
// ReSharper disable once NotAccessedField.Local - This is important, the delegate can be collected if it's not stored!
private static readonly CorsairSessionStateChangedHandler SESSION_STATE_CHANGED_CALLBACK;
internal static bool IsConnected => SesionState == CorsairSessionState.Connected;
internal static CorsairSessionState SesionState { get; private set; }
@ -58,6 +61,15 @@ internal static unsafe class _CUESDK
#endregion
#region Constructors
static _CUESDK()
{
SESSION_STATE_CHANGED_CALLBACK = CorsairSessionStateChangedCallback;
}
#endregion
#region Methods
private static void CorsairSessionStateChangedCallback(nint context, _CorsairSessionStateChanged eventdata)
@ -121,7 +133,7 @@ internal static unsafe class _CUESDK
if (OperatingSystem.IsWindows())
possibleLibraryPaths = Environment.Is64BitProcess ? CorsairDeviceProvider.PossibleX64NativePaths : CorsairDeviceProvider.PossibleX86NativePaths;
else
possibleLibraryPaths = Enumerable.Empty<string>();
possibleLibraryPaths = [];
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
}
@ -174,7 +186,7 @@ internal static unsafe class _CUESDK
{
if (_corsairConnectPtr == null) throw new RGBDeviceException("The Corsair-SDK is not initialized.");
if (IsConnected) throw new RGBDeviceException("The Corsair-SDK is already connected.");
return _corsairConnectPtr(CorsairSessionStateChangedCallback, 0);
return _corsairConnectPtr(SESSION_STATE_CHANGED_CALLBACK, 0);
}
internal static CorsairError CorsairGetSessionDetails(out _CorsairSessionDetails? details)

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -52,6 +52,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using RGB.NET.Core;
using RGB.NET.Devices.CorsairLegacy.Native;
@ -19,7 +20,7 @@ public sealed class CorsairLegacyDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static CorsairLegacyDeviceProvider? _instance;
/// <summary>

View File

@ -124,16 +124,19 @@ public class CorsairCustomRGBDeviceInfo : CorsairRGBDeviceInfo
// LS100 Led Strips are reported as one big strip if configured in monitor mode in iCUE, 138 LEDs for dual monitor, 84 for single
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 138))
return "LS100 LED Strip (dual monitor)";
else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 84))
return "LS100 LED Strip (single monitor)";
// Any other value means an "External LED Strip" in iCUE, these are reported per-strip, 15 for short strips, 27 for long
else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 15))
return "LS100 LED Strip (short)";
else if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
if ((model == "LS100 Starter Kit") && (channelDeviceInfo.deviceLedCount == 27))
return "LS100 LED Strip (long)";
// Device model is "Commander Pro" for regular LED strips
else
return "LED Strip";
return "LED Strip";
case CorsairChannelDeviceType.DAP:
return "DAP Fan";

View File

@ -35,7 +35,7 @@ public class CorsairDeviceUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -64,7 +64,7 @@ internal static class _CUESDK
if (OperatingSystem.IsWindows())
possibleLibraryPaths = Environment.Is64BitProcess ? CorsairLegacyDeviceProvider.PossibleX64NativePaths : CorsairLegacyDeviceProvider.PossibleX86NativePaths;
else
possibleLibraryPaths = Enumerable.Empty<string>();
possibleLibraryPaths = [];
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -52,6 +52,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using RGB.NET.Core;
using RGB.NET.Devices.DMX.E131;
@ -17,7 +18,7 @@ public sealed class DMXDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static DMXDeviceProvider? _instance;
/// <summary>

View File

@ -59,7 +59,7 @@ public sealed class E131UpdateQueue : UpdateQueue
}
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{
@ -99,5 +99,12 @@ public sealed class E131UpdateQueue : UpdateQueue
return _sequenceNumber++;
}
public override void Dispose()
{
base.Dispose();
_socket.Dispose();
}
#endregion
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,6 +51,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using RGB.NET.Core;
using RGB.NET.Layout;
@ -17,7 +18,7 @@ public sealed class DebugDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static DebugDeviceProvider? _instance;
/// <summary>

View File

@ -7,7 +7,7 @@ internal sealed class DebugDeviceUpdateQueue() : UpdateQueue(new DeviceUpdateTri
{
#region Methods
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet) => true;
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet) => true;
#endregion
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,6 +51,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -104,7 +104,9 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
Dictionary<byte, HidDevice> deviceUsages = DeviceList.Local
.GetHidDevices(VendorId, pid)
.Where(d => d.DevicePath.Contains("mi_02"))
.ToDictionary(x => (byte)x.GetUsage(), x => x);
.Select(x => ((byte)x.GetUsage(), x))
.DistinctBy(x => x.Item1)
.ToDictionary(x => x.Item1, x => x.x);
foreach ((int wirelessPid, byte _) in GetWirelessDevices(deviceUsages))
yield return wirelessPid;
@ -137,7 +139,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
getConnectedDevices.Init(LOGITECH_RECEIVER_ADDRESS, LOGITECH_GET_REGISTER_REQUEST);
stream.Write(getConnectedDevices.AsSpan());
stream.Read(response.AsSpan());
stream.ReadExactly(response.AsSpan());
bool wirelessNotifications = (response.Data01 & 1) == 1;
if (!wirelessNotifications)
@ -148,7 +150,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
getConnectedDevices.Data1 = 1;
stream.Write(getConnectedDevices.AsSpan());
stream.Read(response.AsSpan());
stream.ReadExactly(response.AsSpan());
if (getConnectedDevices.FeatureIndex == 0x8f)
{
@ -162,7 +164,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
getConnectedDevices.FeatureCommand = 0x02;
stream.Write(getConnectedDevices.AsSpan());
stream.Read(response.AsSpan());
stream.ReadExactly(response.AsSpan());
int deviceCount = response.Data01;
if (deviceCount <= 0)
return map;
@ -178,7 +180,7 @@ public sealed class LightspeedHIDLoader<TLed, TData> : IEnumerable<HIDDeviceDefi
for (int i = 0; i < deviceCount; i++)
{
FapResponse devices = new();
stream.Read(devices.AsSpan());
stream.ReadExactly(devices.AsSpan());
int wirelessPid = (devices.Data02 << 8) | devices.Data01;
if (devices.DeviceIndex != 0xff)
map.Add(wirelessPid, devices.DeviceIndex);

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using HidSharp;
using RGB.NET.Core;
using RGB.NET.Devices.Logitech.Native;
@ -21,7 +22,7 @@ public class LogitechDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static LogitechDeviceProvider? _instance;
/// <summary>
@ -70,6 +71,9 @@ public class LogitechDeviceProvider : AbstractRGBDeviceProvider
{ 0xC342, RGBDeviceType.Keyboard, "G512", LedMappings.PerKey, 0 },
{ 0xC343, RGBDeviceType.Keyboard, "G915 TKL", LedMappings.PerKey, 0 },
{ 0xC541, RGBDeviceType.Keyboard, "G915", LedMappings.PerKey, 0 },
{ 0xC359, RGBDeviceType.Keyboard, "G915 X", LedMappings.PerKey, 0 },
{ 0xC547, RGBDeviceType.Keyboard, "G915 X TKL", LedMappings.PerKey, 0 },
{ 0xC358, RGBDeviceType.Keyboard, "G515", LedMappings.PerKey, 0 },
//non-rgb
{ 0xC333, RGBDeviceType.Keyboard, "G610", LedMappings.PerKey, 0 },
@ -277,6 +281,9 @@ public class LogitechDeviceProvider : AbstractRGBDeviceProvider
try { _LogitechGSDK.LogiLedRestoreLighting(); }
catch { /* at least we tried */ }
try { _LogitechGSDK.LogiLedShutdown(); }
catch { /* at least we tried */ }
try { _LogitechGSDK.UnloadLogitechGSDK(); }
catch { /* at least we tried */ }

View File

@ -63,7 +63,7 @@ internal static class _LogitechGSDK
if (OperatingSystem.IsWindows())
possibleLibraryPaths = Environment.Is64BitProcess ? LogitechDeviceProvider.PossibleX64NativePaths : LogitechDeviceProvider.PossibleX86NativePaths;
else
possibleLibraryPaths = Enumerable.Empty<string>();
possibleLibraryPaths = [];
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
}

View File

@ -25,7 +25,7 @@ public sealed class LogitechPerDeviceUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -24,7 +24,7 @@ public sealed class LogitechPerKeyUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -52,6 +52,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -33,7 +33,7 @@ public sealed class LogitechZoneUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -34,7 +34,7 @@ public sealed class MsiDeviceUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Threading;
using RGB.NET.Core;
using RGB.NET.Devices.Msi.Exceptions;
using RGB.NET.Devices.Msi.Native;
@ -18,7 +19,7 @@ public class MsiDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static MsiDeviceProvider? _instance;
/// <summary>

View File

@ -68,7 +68,7 @@ internal static class _MsiSDK
if (OperatingSystem.IsWindows())
possibleLibraryPaths = Environment.Is64BitProcess ? MsiDeviceProvider.PossibleX64NativePaths : MsiDeviceProvider.PossibleX86NativePaths;
else
possibleLibraryPaths = Enumerable.Empty<string>();
possibleLibraryPaths = [];
return possibleLibraryPaths.Select(Environment.ExpandEnvironmentVariables);
}

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,6 +51,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -34,5 +34,10 @@ public enum NovationDevices
[DeviceId("Launchpad Open")]
[ColorCapability(NovationColorCapabilities.RGB)]
[LedIdMapping(LedIdMappings.Pro)]
LaunchpadCustomFirmware
LaunchpadCustomFirmware,
[DeviceId("LPMiniMK3")]
[ColorCapability(NovationColorCapabilities.RGB)]
[LedIdMapping(LedIdMappings.Current)]
LaunchpadMiniMK3,
}

View File

@ -25,7 +25,7 @@ public sealed class LimitedColorUpdateQueue : MidiUpdateQueue
#region Methods
/// <inheritdoc />
protected override ShortMessage CreateMessage(object key, in Color color)
protected override ShortMessage CreateMessage(object key, Color color)
{
(byte mode, byte id) = ((byte, byte))key;
return new ShortMessage(mode, id, Convert.ToByte(ConvertColor(color)));
@ -37,7 +37,7 @@ public sealed class LimitedColorUpdateQueue : MidiUpdateQueue
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert.</param>
/// <returns>The novation-representation of the <see cref="Color"/>.</returns>
private static int ConvertColor(in Color color)
private static int ConvertColor(Color color)
{
(double hue, double _, double value) = color.GetHSV();

View File

@ -35,7 +35,7 @@ public abstract class MidiUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{
@ -68,7 +68,7 @@ public abstract class MidiUpdateQueue : UpdateQueue
/// <param name="key">The key used to identify the LED to update.</param>
/// <param name="color">The color to send.</param>
/// <returns>The message created out of the data set.</returns>
protected abstract ShortMessage? CreateMessage(object key, in Color color);
protected abstract ShortMessage? CreateMessage(object key, Color color);
/// <inheritdoc />
public override void Dispose()

View File

@ -151,7 +151,7 @@ public sealed class RGBColorUpdateQueue : MidiUpdateQueue
#region Methods
/// <inheritdoc />
protected override ShortMessage? CreateMessage(object key, in Color color)
protected override ShortMessage? CreateMessage(object key, Color color)
{
(byte mode, byte id) = ((byte, byte))key;
if (mode == 0x00) return null;
@ -165,7 +165,7 @@ public sealed class RGBColorUpdateQueue : MidiUpdateQueue
/// </summary>
/// <param name="color">The <see cref="Color"/> to convert.</param>
/// <returns>The novation-representation of the <see cref="Color"/>.</returns>
private static int ConvertColor(in Color color)
private static int ConvertColor(Color color)
{
int bestVelocity = 0;
double bestMatchDistance = double.MaxValue;

View File

@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using RGB.NET.Core;
using Sanford.Multimedia.Midi;
@ -18,7 +19,7 @@ public sealed class NovationDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static NovationDeviceProvider? _instance;
/// <summary>
@ -65,11 +66,10 @@ public sealed class NovationDeviceProvider : AbstractRGBDeviceProvider
MidiOutCaps outCaps = OutputDeviceBase.GetDeviceCapabilities(index);
if (outCaps.name == null) continue;
string deviceName = outCaps.name.ToUpperInvariant();
NovationDevices? deviceId = (NovationDevices?)Enum.GetValues(typeof(NovationDevices))
.Cast<Enum>()
.Where(x => x.GetDeviceId() != null)
.FirstOrDefault(x => deviceName.Contains(x.GetDeviceId()!.ToUpperInvariant()));
.FirstOrDefault(x => outCaps.name.Contains(x.GetDeviceId()!, StringComparison.InvariantCultureIgnoreCase));
if (deviceId == null) continue;

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,6 +51,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -141,5 +141,8 @@ internal static class LedMappings
["Key: G9"] = LedId.Keyboard_Programmable9,
["Lighting"] = LedId.Keyboard_Brightness,
["Game Mode"] = LedId.Keyboard_WinLock,
["Num Lock Indicator"] = LedId.Keyboard_IndicatorNumLock,
["Caps Lock Indicator"] = LedId.Keyboard_IndicatorCapsLock,
["Scroll Lock Indicator"] = LedId.Keyboard_IndicatorScrollLock,
};
}

View File

@ -48,7 +48,7 @@ public sealed class OpenRGBUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -3,6 +3,7 @@ using RGB.NET.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
namespace RGB.NET.Devices.OpenRGB;
@ -15,7 +16,7 @@ public sealed class OpenRGBDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private readonly List<OpenRgbClient> _clients = [];

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,13 +51,17 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="OpenRGB.NET" Version="2.2.0" />
<PackageReference Include="OpenRGB.NET" Version="3.1.1" />
</ItemGroup>
<ItemGroup>

View File

@ -44,7 +44,7 @@ public sealed class PicoPiBulkUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -41,7 +41,7 @@ public sealed class PicoPiHIDUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{

View File

@ -212,7 +212,7 @@ public sealed class PicoPiSDK : IDisposable
/// </summary>
/// <param name="data">The data to send.</param>
/// <param name="channel">The channel to update.</param>
public void SendHidUpdate(in Span<byte> buffer, int channel)
public void SendHidUpdate(Span<byte> buffer, int channel)
{
int chunks = buffer.Length / HID_OFFSET_MULTIPLIER;
if ((chunks * HID_OFFSET_MULTIPLIER) < buffer.Length) chunks++;
@ -232,7 +232,7 @@ public sealed class PicoPiSDK : IDisposable
/// <param name="channel">The channel to update.</param>
/// <param name="chunk">The chunk id of the packet. (Required if packets are fragmented.)</param>
/// <param name="update">A value indicating if the device should update directly after receiving this packet. (If packets are fragmented this should only be true for the last chunk.)</param>
public void SendHidUpdate(in Span<byte> data, int channel, int chunk, bool update)
public void SendHidUpdate(Span<byte> data, int channel, int chunk, bool update)
{
if (data.Length == 0) return;
@ -253,7 +253,7 @@ public sealed class PicoPiSDK : IDisposable
/// </remarks>
/// <param name="data">The data packet to send.</param>
/// <param name="channel">The channel to update.</param>
public void SendBulkUpdate(in Span<byte> data, int channel)
public void SendBulkUpdate(Span<byte> data, int channel)
{
if ((data.Length == 0) || !IsBulkSupported) return;

View File

@ -3,6 +3,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using HidSharp;
using RGB.NET.Core;
using RGB.NET.Devices.PicoPi.Enum;
@ -26,7 +27,7 @@ public sealed class PicoPiDeviceProvider : AbstractRGBDeviceProvider
#region Properties & Fields
// ReSharper disable once InconsistentNaming
private static readonly object _lock = new();
private static readonly Lock _lock = new();
private static PicoPiDeviceProvider? _instance;
/// <summary>

View File

@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net7.0;net6.0</TargetFrameworks>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
@ -51,6 +51,10 @@
<DefineConstants>RELEASE</DefineConstants>
</PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net8.0'">
<Using Include="RGB.NET.Core.Compatibility.Net8" />
</ItemGroup>
<ItemGroup>
<Content Include="..\Resources\icon.png" Link="icon.png" Pack="true" PackagePath="\" />
<None Include="README.md" Pack="true" PackagePath="\" />

View File

@ -25,7 +25,7 @@ public sealed class RazerChromaLinkUpdateQueue : RazerUpdateQueue
#region Methods
/// <inheritdoc />
protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet)
{
_Color[] colors = new _Color[_Defines.CHROMALINK_MAX_LEDS];

View File

@ -1,42 +1,55 @@
namespace RGB.NET.Devices.Razer;
using System;
namespace RGB.NET.Devices.Razer;
/// <summary>
/// Represents a type of Razer SDK endpoint
/// </summary>
[Flags]
public enum RazerEndpointType
{
/// <summary>
/// No endpoint
/// </summary>
None = 0,
/// <summary>
/// The keyboard endpoint
/// </summary>
Keyboard,
Keyboard = 1 << 0,
/// <summary>
/// The laptop keyboard endpoint, shares the <see cref="Keyboard"/> endpoint but has a different LED layout
/// </summary>
LaptopKeyboard,
LaptopKeyboard = 1 << 1,
/// <summary>
/// The mouse endpoint
/// </summary>
Mouse,
Mouse = 1 << 2,
/// <summary>
/// The headset endpoint
/// </summary>
Headset,
Headset = 1 << 3,
/// <summary>
/// The mousepad endpoint
/// </summary>
Mousepad,
Mousepad = 1 << 4,
/// <summary>
/// The keypad endpoint
/// </summary>
Keypad,
Keypad = 1 << 5,
/// <summary>
/// The Chroma Link endpoint
/// </summary>
ChromaLink,
}
ChromaLink = 1 << 6,
/// <summary>
/// All endpoints
/// </summary>
All = ~None
}

View File

@ -13,10 +13,17 @@ public static class LedMappings
/// </summary>
public static LedMapping<int> Keyboard { get; } = new()
{
//Row 0 is empty
#region Row 0
[LedId.LedStripe1] = (_Defines.KEYBOARD_MAX_COLUMN * 0) + 0,
[LedId.LedStripe16] = (_Defines.KEYBOARD_MAX_COLUMN * 0) + 23,
#endregion
#region Row 1
[LedId.LedStripe2] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 0,
[LedId.Custom1] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 1,
[LedId.Keyboard_Escape] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 2,
[LedId.Keyboard_F1] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 4,
[LedId.Keyboard_F2] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 5,
@ -33,12 +40,17 @@ public static class LedMappings
[LedId.Keyboard_PrintScreen] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 16,
[LedId.Keyboard_ScrollLock] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 17,
[LedId.Keyboard_PauseBreak] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 18,
[LedId.Logo] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 21,
[LedId.Keyboard_MediaPreviousTrack] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 19,
[LedId.Keyboard_MediaPlay] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 20,
[LedId.Keyboard_MediaNextTrack] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 21,
[LedId.Keyboard_MediaMute] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 22,
[LedId.LedStripe15] = (_Defines.KEYBOARD_MAX_COLUMN * 1) + 23,
#endregion
#region Row 2
[LedId.LedStripe3] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 0,
[LedId.Keyboard_Programmable1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 1,
[LedId.Keyboard_GraveAccentAndTilde] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 2,
[LedId.Keyboard_1] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 3,
@ -61,11 +73,13 @@ public static class LedMappings
[LedId.Keyboard_NumSlash] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 20,
[LedId.Keyboard_NumAsterisk] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 21,
[LedId.Keyboard_NumMinus] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 22,
[LedId.LedStripe14] = (_Defines.KEYBOARD_MAX_COLUMN * 2) + 23,
#endregion
#region Row 3
[LedId.LedStripe4] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 0,
[LedId.Keyboard_Programmable2] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 1,
[LedId.Keyboard_Tab] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 2,
[LedId.Keyboard_Q] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 3,
@ -88,11 +102,13 @@ public static class LedMappings
[LedId.Keyboard_Num8] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 20,
[LedId.Keyboard_Num9] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 21,
[LedId.Keyboard_NumPlus] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 22,
[LedId.LedStripe13] = (_Defines.KEYBOARD_MAX_COLUMN * 3) + 23,
#endregion
#region Row 4
[LedId.LedStripe5] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 0,
[LedId.Keyboard_Programmable3] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 1,
[LedId.Keyboard_CapsLock] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 2,
[LedId.Keyboard_A] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 3,
@ -111,11 +127,13 @@ public static class LedMappings
[LedId.Keyboard_Num4] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 19,
[LedId.Keyboard_Num5] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 20,
[LedId.Keyboard_Num6] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 21,
[LedId.LedStripe12] = (_Defines.KEYBOARD_MAX_COLUMN * 4) + 23,
#endregion
#region Row 5
[LedId.LedStripe6] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 0,
[LedId.Keyboard_Programmable4] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 1,
[LedId.Keyboard_LeftShift] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 2,
[LedId.Keyboard_NonUsBackslash] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 3,
@ -135,11 +153,13 @@ public static class LedMappings
[LedId.Keyboard_Num2] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 20,
[LedId.Keyboard_Num3] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 21,
[LedId.Keyboard_NumEnter] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 22,
[LedId.LedStripe11] = (_Defines.KEYBOARD_MAX_COLUMN * 5) + 23,
#endregion
#region Row 6
[LedId.LedStripe7] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 0,
[LedId.Keyboard_Programmable5] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 1,
[LedId.Keyboard_LeftCtrl] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 2,
[LedId.Keyboard_LeftGui] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 3,
@ -152,12 +172,18 @@ public static class LedMappings
[LedId.Keyboard_ArrowLeft] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 16,
[LedId.Keyboard_ArrowDown] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 17,
[LedId.Keyboard_ArrowRight] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 18,
[LedId.LedStripe9] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 19,
[LedId.Keyboard_Num0] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 20,
[LedId.Keyboard_NumPeriodAndDelete] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 21,
[LedId.LedStripe10] = (_Defines.KEYBOARD_MAX_COLUMN * 6) + 23,
#endregion
//Row 7 is also empty
#region Row 6
[LedId.LedStripe8] = (_Defines.KEYBOARD_MAX_COLUMN * 7) + 0,
#endregion
};

View File

@ -30,7 +30,7 @@ public abstract class RazerUpdateQueue : UpdateQueue
#region Methods
/// <inheritdoc />
protected override bool Update(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override bool Update(ReadOnlySpan<(object key, Color color)> dataSet)
{
try
{
@ -77,7 +77,7 @@ public abstract class RazerUpdateQueue : UpdateQueue
/// </summary>
/// <param name="dataSet">The data to be updated.</param>
/// <returns>An <see cref="IntPtr"/> pointing to the effect parameter struct.</returns>
protected abstract nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet);
protected abstract nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet);
#endregion
}

View File

@ -25,7 +25,7 @@ public sealed class RazerHeadsetUpdateQueue : RazerUpdateQueue
#region Methods
/// <inheritdoc />
protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet)
{
_Color[] colors = new _Color[_Defines.HEADSET_MAX_LEDS];

View File

@ -25,7 +25,7 @@ public sealed class RazerKeyboardUpdateQueue : RazerUpdateQueue
#region Methods
/// <inheritdoc />
protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet)
{
_Color[] colors = new _Color[_Defines.KEYBOARD_MAX_LEDS];

View File

@ -25,7 +25,7 @@ public sealed class RazerKeypadUpdateQueue : RazerUpdateQueue
#region Methods
/// <inheritdoc />
protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet)
{
_Color[] colors = new _Color[_Defines.KEYPAD_MAX_LEDS];

View File

@ -25,7 +25,7 @@ public sealed class RazerMouseUpdateQueue : RazerUpdateQueue
#region Methods
/// <inheritdoc />
protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet)
{
_Color[] colors = new _Color[_Defines.MOUSE_MAX_LEDS];

View File

@ -25,7 +25,7 @@ public sealed class RazerMousepadUpdateQueue : RazerUpdateQueue
#region Methods
/// <inheritdoc />
protected override nint CreateEffectParams(in ReadOnlySpan<(object key, Color color)> dataSet)
protected override nint CreateEffectParams(ReadOnlySpan<(object key, Color color)> dataSet)
{
_Color[] colors = new _Color[_Defines.MOUSEPAD_MAX_LEDS];

Some files were not shown because too many files have changed in this diff Show More