Skip to content
This repository has been archived by the owner on May 10, 2024. It is now read-only.

Commit

Permalink
Merge pull request #29 from akmadian/develop
Browse files Browse the repository at this point in the history
v2.0.0 Release
  • Loading branch information
Ari Madian committed Mar 18, 2019
2 parents 1d0adbd + 8e80e1f commit 968d3d3
Show file tree
Hide file tree
Showing 27 changed files with 451 additions and 165 deletions.
17 changes: 16 additions & 1 deletion .gitignore
Expand Up @@ -334,6 +334,21 @@ ASALocalRun/
.localhistory/

TestApp/
TestApp2/
NZXTSharpTesterApp/
Scripts/
.vscode/
NZXTSharp.Profiles/
.vscode/


# DocFX Files
NZXTSharp/_site/
NZXTSharp/api/
NZXTSharp/apidoc/
NZXTSharp/articles/
NZXTSharp/images/
NZXTSharp/src
NZXTSharp/docfx.json
NZXTSharp/index.md
NZXTSharp/log.txt
NZXTSharp/toc.yml
6 changes: 6 additions & 0 deletions NZXTSharp.sln
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NZXTSharp", "NZXTSharp\NZXT
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp", "TestApp\TestApp.csproj", "{CDEB958B-5717-4232-BE56-3A0F8A74DC66}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TestApp2", "TestApp2\TestApp2.csproj", "{D2D5F159-C835-4D6C-A052-1C1E4016ED14}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{CDEB958B-5717-4232-BE56-3A0F8A74DC66}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CDEB958B-5717-4232-BE56-3A0F8A74DC66}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CDEB958B-5717-4232-BE56-3A0F8A74DC66}.Release|Any CPU.Build.0 = Release|Any CPU
{D2D5F159-C835-4D6C-A052-1C1E4016ED14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D2D5F159-C835-4D6C-A052-1C1E4016ED14}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D2D5F159-C835-4D6C-A052-1C1E4016ED14}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D2D5F159-C835-4D6C-A052-1C1E4016ED14}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
9 changes: 9 additions & 0 deletions NZXTSharp/.gitignore
@@ -0,0 +1,9 @@
###############
# folder #
###############
/**/DROP/
/**/TEMP/
/**/packages/
/**/bin/
/**/obj/
_site
Binary file added NZXTSharp/Assets/Logos/favicon.ico
Binary file not shown.
34 changes: 34 additions & 0 deletions NZXTSharp/Assets/Logos/logo.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion NZXTSharp/COM/ICOMController.cs
Expand Up @@ -3,6 +3,10 @@
using System.Text;

namespace NZXTSharp.COM {
interface ICOMController {

/// <summary>
/// Represents an HID or serial communication controller.
/// </summary>
public interface ICOMController {
}
}
6 changes: 5 additions & 1 deletion NZXTSharp/COM/Serial/SerialCOMData.cs
Expand Up @@ -9,7 +9,7 @@ namespace NZXTSharp.COM {
/// <summary>
/// Contains information needed to open a COM port.
/// </summary>
internal class SerialCOMData {
public class SerialCOMData {

#region Properties and Fields
private readonly Parity _Parity;
Expand Down Expand Up @@ -78,6 +78,10 @@ internal class SerialCOMData {
this._Name = Name;
}

/// <summary>
/// Generates a string with information about the <see cref="SerialCOMData"/> instance.
/// </summary>
/// <returns>A string with information about the <see cref="SerialCOMData"/> instance.</returns>
public override string ToString()
{
return String.Format("Parity: {0}, StopBits: {1}, WriteTimeout: {2}, ReadTimeout: {3}, Baud: {4}, DataBits: {5}, Name: {6}",
Expand Down
2 changes: 1 addition & 1 deletion NZXTSharp/COM/Serial/SerialController.cs
Expand Up @@ -11,7 +11,7 @@ namespace NZXTSharp.COM {
/// <summary>
/// Represents a <see cref="SerialPort"/> with some useful methods.
/// </summary>
internal class SerialController : ICOMController {
public class SerialController : ICOMController {

#region Properties and Fields
private SerialPort _Port;
Expand Down
26 changes: 14 additions & 12 deletions NZXTSharp/COM/USB/DeviceEnumerator.cs
Expand Up @@ -10,29 +10,31 @@ namespace NZXTSharp.COM
/// <summary>
/// Copied from https://github.com/DarkMio/Octopode with modifications.
/// </summary>
class DeviceEnumerator
public class DeviceEnumerator
{
/// <summary>
/// Enumerates all HID devices connected to the system.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> containing all found <see cref="HidDevice"/>s.</returns>
public static IEnumerable<HidDevice> EnumAllDevices()
{
return HidDevices.Enumerate();
}

/// <summary>
/// Enumerates all NZXT devices connected to the system.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> containing all found NZXT <see cref="HidDevice"/>s.</returns>
public static IEnumerable<HidDevice> EnumNZXTDevices()
{
return HidDevices.Enumerate(0x1E71);
}

public static IEnumerable<HidDevice> EnumKrakenMDevices()
{
foreach (var device in EnumNZXTDevices())
{
if (device.Attributes.ProductId == (int)HIDDeviceID.KrakenM)
{
yield return device;
}
}
}

/// <summary>
/// Enumerates all <see cref="KrakenX.KrakenX"/> devices connected to the system.
/// </summary>
/// <returns>An <see cref="IEnumerable{T}"/> containing all found
/// <see cref="KrakenX.KrakenX"/> <see cref="HidDevice"/>s.</returns>
public static IEnumerable<HidDevice> EnumKrakenXDevices()
{
foreach (var device in EnumNZXTDevices())
Expand Down
2 changes: 1 addition & 1 deletion NZXTSharp/COM/USB/USBController.cs
Expand Up @@ -14,7 +14,7 @@
using NZXTSharp.Exceptions;

namespace NZXTSharp.COM {
internal class USBController
public class USBController
{

private NZXTDeviceType _Type;
Expand Down
2 changes: 1 addition & 1 deletion NZXTSharp/Core/Color.cs
Expand Up @@ -85,7 +85,7 @@ public Color(int R, int G, int B)
/// Returns a list of 40 "#ffffff" color codes in G, R, B format.
/// </summary>
/// <returns></returns>
public byte[] AllOff()
public static byte[] AllOff()
{
List<int> outBytes = new List<int>();
for (int i = 0; i < 40; i++)
Expand Down
4 changes: 2 additions & 2 deletions NZXTSharp/Core/Common/Effects/Marquee.cs
Expand Up @@ -74,14 +74,14 @@ public bool IsCompatibleWith(NZXTDeviceType Type)
case NZXTDeviceType.HuePlus:
List<byte[]> outList = new List<byte[]>();
byte[] SettingsBytes = new byte[] { 0x4b, (byte)Channel.ChannelByte, 0x03, Param1, Param2 };
byte[] final = SettingsBytes.ConcatenateByteArr(Channel.State == false ? new Color().AllOff() : Channel.BuildColorBytes(_Color));
byte[] final = SettingsBytes.ConcatenateByteArr(Channel.State == false ? Color.AllOff() : Channel.BuildColorBytes(_Color));
outList.Add(final);

return outList;
case NZXTDeviceType.KrakenX:
List<byte[]> KrakenXOutList = new List<byte[]>();
byte[] KrakenXSettingsBytes = new byte[] { 0x02, 0x4c, 0x02, 0x03, Param2 };
byte[] KrakenXfinal = KrakenXSettingsBytes.ConcatenateByteArr(Channel.State == false ? new Color().AllOff() : Channel.BuildColorBytes(_Color));
byte[] KrakenXfinal = KrakenXSettingsBytes.ConcatenateByteArr(Channel.State == false ? Color.AllOff() : Channel.BuildColorBytes(_Color));
KrakenXOutList.Add(KrakenXfinal);
return KrakenXOutList;
default:
Expand Down
2 changes: 1 addition & 1 deletion NZXTSharp/Core/Common/Params/CISS.cs
Expand Up @@ -10,7 +10,7 @@ namespace NZXTSharp
/// <summary>
/// Represents a CISS effect param.
/// </summary>
internal class CISS : IParam {
public class CISS : IParam {
private readonly int colorIndex;
private int speed;
private int evaluatedIndex;
Expand Down
18 changes: 15 additions & 3 deletions NZXTSharp/Core/Exceptions/IncompatibleDeviceTypeException.cs
Expand Up @@ -4,22 +4,34 @@

namespace NZXTSharp.Exceptions
{
internal class IncompatibleDeviceTypeException : Exception
/// <summary>
/// Thrown when an <see cref="NZXTDeviceType"/> is passed to a method
/// or constructor that is not compatible with that method or constructor.
/// </summary>
public class IncompatibleDeviceTypeException : Exception
{

/// <summary>
///
/// </summary>
public IncompatibleDeviceTypeException()
: base("Invalid NZXTDeviceType given to USBController.")
{

}

/// <summary>
/// Constructs an <see cref="IncompatibleDeviceTypeException"/> with a custom message.
/// </summary>
/// <param name="message">A custom message.</param>
public IncompatibleDeviceTypeException(string message)
: base(message)
{

}

public IncompatibleDeviceTypeException(string message, Exception innerException) : base(message, innerException)
/// <inheritdoc/>
public IncompatibleDeviceTypeException(string message, Exception innerException)
: base(message, innerException)
{
}
}
Expand Down
16 changes: 15 additions & 1 deletion NZXTSharp/Core/Exceptions/IncompatibleEffectException.cs
Expand Up @@ -3,26 +3,40 @@
using System.Text;

namespace NZXTSharp.Exceptions {
internal class IncompatibleEffectException : Exception {

/// <summary>
/// Thrown when an effect passed to <see cref="INZXTDevice.ApplyEffect(IEffect)"/>
/// is not compatible with that <see cref="INZXTDevice"/>.
/// </summary>
public class IncompatibleEffectException : Exception {

private static string baseString = "NXZTSharp.Exceptions.IncompatibleEffectException; ";

/// <inheritdoc/>
public IncompatibleEffectException()
: base(baseString + "Invalid Effect Supplied To ApplyEffect()") {

}

/// <inheritdoc/>
public IncompatibleEffectException(string message)
: base(message) {

}

/// <summary>
/// Constructs an <see cref="IncompatibleEffectException"/> with more information
/// about the <see cref="INZXTDevice"/> and <see cref="IEffect"/>.
/// </summary>
/// <param name="DeviceName"></param>
/// <param name="EffectName"></param>
public IncompatibleEffectException(string DeviceName, string EffectName)
: base(string.Format(baseString + "Invalid Effect \"{0}\" Supplied To ApplyEffect() Of Device \"{1}\"",
EffectName, DeviceName)){

}

/// <inheritdoc/>
public IncompatibleEffectException(string message, Exception innerException)
: base(message, innerException)
{
Expand Down
20 changes: 16 additions & 4 deletions NZXTSharp/Core/Exceptions/IncompatibleParamException.cs
Expand Up @@ -2,17 +2,29 @@
using System.Collections.Generic;
using System.Text;

namespace NZXTSharp.Exceptions {
internal class IncompatibleParamException : Exception {
public IncompatibleParamException() {
namespace NZXTSharp.Exceptions
{
/// <summary>
/// Thrown when a param object passed to an <see cref="IEffect"/>
/// constructor is not compatible with that <see cref="IEffect"/>.
/// </summary>
public class IncompatibleParamException : Exception
{

/// <inheritdoc/>
public IncompatibleParamException()
{

}

/// <inheritdoc/>
public IncompatibleParamException(string message)
: base(message) {
: base(message)
{

}

/// <inheritdoc/>
public IncompatibleParamException(string message, Exception innerException)
: base(message, innerException)
{
Expand Down
27 changes: 23 additions & 4 deletions NZXTSharp/Core/Exceptions/InvalidEffectSpeedException.cs
Expand Up @@ -2,17 +2,36 @@
using System.Collections.Generic;
using System.Text;

namespace NZXTSharp.Exceptions {
internal class InvalidEffectSpeedException : Exception {
namespace NZXTSharp.Exceptions
{
/// <summary>
///Thrown when an invalid speed value is passed to an
/// <see cref="IParam"/> or <see cref="IEffect"/> constructor.
///
/// Speed values must be 0 - 4 (inclusive);
/// 0 being slowest, 2 being normal, and 4 being fastest.
/// </summary>
public class InvalidEffectSpeedException : Exception
{

/// <inheritdoc/>
public InvalidEffectSpeedException()
: base ("NZXTSharp.Exceptions.InvalidEffectSpeedException; Effect Speed Must Be Between 0 and 4 (Inclusive).") {
: base ("NZXTSharp.Exceptions.InvalidEffectSpeedException; Effect Speed Must Be Between 0 and 4 (Inclusive).")
{

}

/// <inheritdoc/>
public InvalidEffectSpeedException(string message)
: base(message) {
: base(message)
{

}

/// <inheritdoc/>
public InvalidEffectSpeedException(string message, Exception innerException)
: base(message, innerException)
{
}
}
}

0 comments on commit 968d3d3

Please sign in to comment.