1
0
mirror of https://github.com/DarthAffe/RGB.NET.git synced 2025-12-13 01:58:30 +00:00
RGB.NET/RGB.NET.Core/Update/CustomUpdateData.cs
Darth Affe c47afc4704 Updated corsair SDK
This adds support for custom devices (lightning node and commander). And introduced 'fan' as device type.
fixes #23
2018-07-08 20:04:01 +02:00

52 lines
1.5 KiB
C#

using System.Collections.Generic;
namespace RGB.NET.Core
{
/// <summary>
/// Represents a set of custom data, each indexed by a string-key.
/// </summary>
public class CustomUpdateData
{
#region Properties & Fields
private Dictionary<string, object> _data = new Dictionary<string, object>();
#endregion
#region Indexer
/// <summary>
/// Gets or sets the value for a specific key.
/// </summary>
/// <param name="key">The key of the value.</param>
/// <returns>The value represented by the given key.</returns>
public object this[string key]
{
get => _data.TryGetValue(key?.ToUpperInvariant() ?? string.Empty, out object data) ? data : default;
set => _data[key?.ToUpperInvariant() ?? string.Empty] = value;
}
#endregion
#region Constructors
/// <summary>
/// Initializes a new instance of the <see cref="CustomUpdateData"/> class.
/// </summary>
public CustomUpdateData()
{ }
/// <summary>
/// Initializes a new instance of the <see cref="CustomUpdateData"/> class.
/// </summary>
/// <param name="values">A params-list of tuples containing the key (string) and the value of a specific custom-data.</param>
public CustomUpdateData(params (string key, object value)[] values)
{
foreach ((string key, object value) in values)
this[key] = value;
}
#endregion
}
}