From 6479de8d261b05a9e5ef650036059c5501493db7 Mon Sep 17 00:00:00 2001 From: Darth Affe Date: Sun, 7 Feb 2016 10:26:35 +0100 Subject: [PATCH] Added code-documentation for the Profile-implementation --- Brushes/ProfileBrush.cs | 13 +++++++++++++ Profiles/CueProfile.cs | 23 +++++++++++++++++++++++ Profiles/CueProfileDevice.cs | 19 +++++++++++++++++++ Profiles/CueProfileMode.cs | 15 +++++++++++++++ Profiles/CueProfiles.cs | 19 +++++++++++++++++++ 5 files changed, 89 insertions(+) diff --git a/Brushes/ProfileBrush.cs b/Brushes/ProfileBrush.cs index 4008b2c..815672b 100644 --- a/Brushes/ProfileBrush.cs +++ b/Brushes/ProfileBrush.cs @@ -5,6 +5,9 @@ using CUE.NET.Devices.Keyboard.Keys; namespace CUE.NET.Brushes { + /// + /// Represents a brush drawing the lighting of a CUE profile. + /// public class ProfileBrush : AbstractBrush { #region Properties & Fields @@ -15,6 +18,10 @@ namespace CUE.NET.Brushes #region Constructors + /// + /// Initializes a new instance of the class. + /// + /// The light settings of the CUE profile. internal ProfileBrush(Dictionary keyLights) { this._keyLights = keyLights; @@ -24,6 +31,12 @@ namespace CUE.NET.Brushes #region Methods + /// + /// Gets the color at an specific point getting the color of the key at the given point. + /// + /// The rectangle in which the brush should be drawn. + /// The point from which the color should be taken. + /// The color of the key at the specified point. public override Color GetColorAtPoint(RectangleF rectangle, PointF point) { CorsairKey key = CueSDK.KeyboardSDK[point]; diff --git a/Profiles/CueProfile.cs b/Profiles/CueProfile.cs index e9e40ed..638ae32 100644 --- a/Profiles/CueProfile.cs +++ b/Profiles/CueProfile.cs @@ -10,15 +10,28 @@ using CUE.NET.Brushes; namespace CUE.NET.Profiles { + /// + /// Represents a CUE profile. + /// public class CueProfile { #region Properties & Fields private Dictionary _devices; + /// + /// Gets the Id of the profile. + /// public string Id { get; } + + /// + /// Gets the Name of the profile. + /// public string Name { get; } + /// + /// Returns a list of strings containing the name of all modes available. + /// public IEnumerable Modes { get @@ -29,6 +42,11 @@ namespace CUE.NET.Profiles } } + /// + /// Returns the for the given mode. + /// + /// The mode to select. + /// The of the given mode. public ProfileBrush this[string mode] { get @@ -53,6 +71,11 @@ namespace CUE.NET.Profiles #region Methods + /// + /// Loads a CUE profile from the given file. + /// + /// The profile-file. + /// The loaded or null. internal static CueProfile Load(string file) { // ReSharper disable PossibleNullReferenceException - Just let it fail - no need to check anything here ... diff --git a/Profiles/CueProfileDevice.cs b/Profiles/CueProfileDevice.cs index 446dab1..eda8958 100644 --- a/Profiles/CueProfileDevice.cs +++ b/Profiles/CueProfileDevice.cs @@ -5,12 +5,21 @@ using CUE.NET.Brushes; namespace CUE.NET.Profiles { + /// + /// Represents a device of a CUE profile. + /// internal class CueProfileDevice { #region Properties & Fields + /// + /// The name of the device. + /// internal string Name { get; } + /// + /// Returns a list of strings containing the name of all modes available for this device. + /// internal IEnumerable Modes => _modes.Keys.ToList(); private Dictionary _modes; @@ -19,6 +28,11 @@ namespace CUE.NET.Profiles #region Brush Conversion + /// + /// Returns the for the given mode. + /// + /// The mode to select. + /// The of the given mode. internal ProfileBrush this[string mode] { get @@ -44,6 +58,11 @@ namespace CUE.NET.Profiles #region Methods + /// + /// Loads a device of a CUE profile from the given XML-node. + /// + /// The node containing the device. + /// The loaded or null. internal static CueProfileDevice Load(XElement deviceRoot) { // ReSharper disable PossibleNullReferenceException - Just let it fail - no need to check anything here ... diff --git a/Profiles/CueProfileMode.cs b/Profiles/CueProfileMode.cs index dbe570f..5075225 100644 --- a/Profiles/CueProfileMode.cs +++ b/Profiles/CueProfileMode.cs @@ -8,10 +8,16 @@ using CUE.NET.Devices.Keyboard.Enums; namespace CUE.NET.Profiles { + /// + /// Represents a mode of a CUE profile. + /// internal class CueProfileMode { #region Properties & Fields + /// + /// Gets the name of the mode. + /// internal string Name { get; } private Dictionary _keyLights; @@ -20,6 +26,10 @@ namespace CUE.NET.Profiles #region Brush Conversion + /// + /// Converts a to a . + /// + /// The profile mode to convert. public static implicit operator ProfileBrush(CueProfileMode profile) { return profile != null ? new ProfileBrush(profile._keyLights) : null; @@ -38,6 +48,11 @@ namespace CUE.NET.Profiles #region Methods + /// + /// Loads a mode of a CUE profile from the given XML-node. + /// + /// The node containing the mode. + /// The loaded or null. internal static CueProfileMode Load(XElement modeRoot) { // ReSharper disable PossibleNullReferenceException - Just let it fail - no need to check anything here ... diff --git a/Profiles/CueProfiles.cs b/Profiles/CueProfiles.cs index 45892df..54596c9 100644 --- a/Profiles/CueProfiles.cs +++ b/Profiles/CueProfiles.cs @@ -8,6 +8,9 @@ using System.Xml.Linq; namespace CUE.NET.Profiles { + /// + /// Represents the SDK for CUE profiles. + /// public static class CueProfiles { #region Constants @@ -22,6 +25,9 @@ namespace CUE.NET.Profiles private static Dictionary _profileNameMapping = new Dictionary(); + /// + /// Gets a list containing the names of all existing profiles. + /// public static List ProfileNames { get @@ -31,6 +37,9 @@ namespace CUE.NET.Profiles } } + /// + /// Gets a list containing the ids of all existing profiles. + /// public static List ProfileIds { get @@ -44,6 +53,11 @@ namespace CUE.NET.Profiles #region Methods + /// + /// Loads the profile with the given name. + /// + /// The name (the one given in CUE, not the filename) of the profile. + /// The loaded or null if it couldn't be loaded. public static CueProfile LoadProfileByName(string name = null) { string id = null; @@ -57,6 +71,11 @@ namespace CUE.NET.Profiles return LoadProfileByID(id); } + /// + /// Loads the profile with the given id. + /// + /// The id of the profile. + /// The loaded or null if it couldn't be loaded. public static CueProfile LoadProfileByID(string id = null) { if (id == null) id = GetDefaultProfileId();