Skip to content

Commit

Permalink
Merge pull request #55 from CoraleStudios/develop
Browse files Browse the repository at this point in the history
Release 2.2
  • Loading branch information
Sharparam committed Sep 22, 2015
2 parents 798df63 + 05a995c commit 1c7ec4f
Show file tree
Hide file tree
Showing 22 changed files with 836 additions and 173 deletions.
5 changes: 5 additions & 0 deletions Corale.Colore/Corale.Colore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@
<Compile Include="Core\Chroma.cs" />
<Compile Include="Core\Color.cs" />
<Compile Include="Core\Device.cs" />
<Compile Include="Core\Headset.Obsoletes.cs" />
<Compile Include="Core\Keyboard.Obsoletes.cs" />
<Compile Include="Core\Keypad.Obsoletes.cs" />
<Compile Include="Core\Mouse.Obsoletes.cs" />
<Compile Include="Core\Mousepad.Obsoletes.cs" />
<Compile Include="EnvironmentHelper.cs" />
<Compile Include="Core\GenericDevice.cs" />
<Compile Include="Core\Headset.cs" />
Expand Down
6 changes: 3 additions & 3 deletions Corale.Colore/Core/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ public abstract class Device : IDevice
/// </summary>
public void Clear()
{
Set(Color.Black);
SetAll(Color.Black);
}

/// <summary>
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
public abstract void Set(Color color);
public abstract void SetAll(Color color);

/// <summary>
/// Updates the device to use the effect pointed to by the specified GUID.
/// </summary>
/// <param name="guid">GUID to set.</param>
public void Set(Guid guid)
public void SetGuid(Guid guid)
{
if (CurrentEffectId != Guid.Empty)
{
Expand Down
12 changes: 6 additions & 6 deletions Corale.Colore/Core/GenericDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@ public static IGenericDevice Get(Guid deviceId)
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
public override void Set(Color color)
public override void SetAll(Color color)
{
var colorPtr = Marshal.AllocHGlobal(Marshal.SizeOf(color));
Marshal.StructureToPtr(color, colorPtr, false);

try
{
Set(NativeWrapper.CreateEffect(DeviceId, Effect.Static, colorPtr));
SetGuid(NativeWrapper.CreateEffect(DeviceId, Effect.Static, colorPtr));
}
finally
{
Expand All @@ -124,19 +124,19 @@ public override void Set(Color color)
/// Sets a parameter-less effect on this device.
/// </summary>
/// <param name="effect">Effect to set.</param>
public void Set(Effect effect)
public void SetEffect(Effect effect)
{
Set(effect, IntPtr.Zero);
SetEffect(effect, IntPtr.Zero);
}

/// <summary>
/// Sets an effect on this device, taking a parameter.
/// </summary>
/// <param name="effect">Effect to set.</param>
/// <param name="param">Effect-specific parameter to use.</param>
public void Set(Effect effect, IntPtr param)
public void SetEffect(Effect effect, IntPtr param)
{
Set(NativeWrapper.CreateEffect(DeviceId, effect, param));
SetGuid(NativeWrapper.CreateEffect(DeviceId, effect, param));
}
}
}
79 changes: 79 additions & 0 deletions Corale.Colore/Core/Headset.Obsoletes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
// ---------------------------------------------------------------------------------------
// <copyright file="Headset.Obsoletes.cs" company="Corale">
// Copyright © 2015 by Adam Hellberg and Brandon Scott.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of
// this software and associated documentation files (the "Software"), to deal in
// the Software without restriction, including without limitation the rights to
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
// of the Software, and to permit persons to whom the Software is furnished to do
// so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// Disclaimer: Corale and/or Colore is in no way affiliated with Razer and/or any
// of its employees and/or licensors. Corale, Adam Hellberg, and/or Brandon Scott
// do not take responsibility for any harm caused, direct or indirect, to any
// Razer peripherals via the use of Colore.
//
// "Razer" is a trademark of Razer USA Ltd.
// </copyright>
// ---------------------------------------------------------------------------------------

namespace Corale.Colore.Core
{
using System;
using Corale.Colore.Razer.Headset.Effects;

/// <summary>
/// Class for interacting with Chroma Headsets.
/// </summary>
public sealed partial class Headset : Device, IHeadset
{
/// <summary>
/// Sets an effect on the headset that doesn't
/// take any parameters, currently only valid
/// for the <see cref="Effect.SpectrumCycling" /> effect.
/// </summary>
/// <param name="effect">The type of effect to set.</param>
[Obsolete("Set is deprecated, please use SetEffect(Effect).", false)]
public void Set(Effect effect)
{
SetEffect(effect);
}

/// <summary>
/// Sets a new static effect on the headset.
/// </summary>
/// <param name="effect">
/// An instance of the <see cref="Static" /> struct
/// describing the effect.
/// </param>
[Obsolete("Set is deprecated, please use SetStatic(Static).", false)]
public void Set(Static effect)
{
SetStatic(effect);
}

/// <summary>
/// Sets a new breathing effect on the headset.
/// </summary>
/// <param name="effect">
/// An instance of the <see cref="Breathing" /> struct
/// describing the effect.
/// </param>
[Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)]
public void Set(Breathing effect)
{
SetBreathing(effect);
}
}
}
18 changes: 9 additions & 9 deletions Corale.Colore/Core/Headset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Corale.Colore.Core
/// <summary>
/// Class for interacting with Chroma Headsets.
/// </summary>
public sealed class Headset : Device, IHeadset
public sealed partial class Headset : Device, IHeadset
{
/// <summary>
/// Loggers instance for this class.
Expand Down Expand Up @@ -73,9 +73,9 @@ public static IHeadset Instance
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
public override void Set(Color color)
public override void SetAll(Color color)
{
Set(new Static(color));
SetStatic(new Static(color));
}

/// <summary>
Expand All @@ -84,9 +84,9 @@ public override void Set(Color color)
/// for the <see cref="Effect.SpectrumCycling" /> effect.
/// </summary>
/// <param name="effect">The type of effect to set.</param>
public void Set(Effect effect)
public void SetEffect(Effect effect)
{
Set(NativeWrapper.CreateHeadsetEffect(effect));
SetGuid(NativeWrapper.CreateHeadsetEffect(effect));
}

/// <summary>
Expand All @@ -96,9 +96,9 @@ public void Set(Effect effect)
/// An instance of the <see cref="Static" /> struct
/// describing the effect.
/// </param>
public void Set(Static effect)
public void SetStatic(Static effect)
{
Set(NativeWrapper.CreateHeadsetEffect(effect));
SetGuid(NativeWrapper.CreateHeadsetEffect(effect));
}

/// <summary>
Expand All @@ -108,9 +108,9 @@ public void Set(Static effect)
/// An instance of the <see cref="Breathing" /> struct
/// describing the effect.
/// </param>
public void Set(Breathing effect)
public void SetBreathing(Breathing effect)
{
Set(NativeWrapper.CreateHeadsetEffect(effect));
SetGuid(NativeWrapper.CreateHeadsetEffect(effect));
}
}
}
4 changes: 2 additions & 2 deletions Corale.Colore/Core/IDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,13 @@ public interface IDevice
/// </summary>
/// <param name="color">Color to set.</param>
[PublicAPI]
void Set(Color color);
void SetAll(Color color);

/// <summary>
/// Updates the device to use the effect pointed to by the specified GUID.
/// </summary>
/// <param name="guid">GUID to set.</param>
[PublicAPI]
void Set(Guid guid);
void SetGuid(Guid guid);
}
}
4 changes: 2 additions & 2 deletions Corale.Colore/Core/IGenericDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ public interface IGenericDevice : IDevice
/// Sets a parameter-less effect on this device.
/// </summary>
/// <param name="effect">Effect to set.</param>
void Set(Effect effect);
void SetEffect(Effect effect);

/// <summary>
/// Sets an effect on this device, taking a parameter.
/// </summary>
/// <param name="effect">Effect to set.</param>
/// <param name="param">Effect-specific parameter to use.</param>
void Set(Effect effect, IntPtr param);
void SetEffect(Effect effect, IntPtr param);
}
}
6 changes: 3 additions & 3 deletions Corale.Colore/Core/IHeadset.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public interface IHeadset : IDevice
/// for the <see cref="Effect.SpectrumCycling" /> effect.
/// </summary>
/// <param name="effect">The type of effect to set.</param>
void Set(Effect effect);
void SetEffect(Effect effect);

/// <summary>
/// Sets a new static effect on the headset.
Expand All @@ -52,7 +52,7 @@ public interface IHeadset : IDevice
/// An instance of the <see cref="Static" /> struct
/// describing the effect.
/// </param>
void Set(Static effect);
void SetStatic(Static effect);

/// <summary>
/// Sets a new breathing effect on the headset.
Expand All @@ -61,6 +61,6 @@ public interface IHeadset : IDevice
/// An instance of the <see cref="Breathing" /> struct
/// describing the effect.
/// </param>
void Set(Breathing effect);
void SetBreathing(Breathing effect);
}
}
28 changes: 14 additions & 14 deletions Corale.Colore/Core/IKeyboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public interface IKeyboard : IDevice
/// </summary>
/// <param name="effect">Effect options.</param>
[PublicAPI]
void Set(Breathing effect);
void SetBreathing(Breathing effect);

/// <summary>
/// Sets a breathing effect on the keyboard, fading between the
Expand All @@ -81,7 +81,7 @@ public interface IKeyboard : IDevice
/// <param name="first">Color to start from.</param>
/// <param name="second">Color to reach, before going back to <paramref name="first" />.</param>
[PublicAPI]
void Set(Color first, Color second);
void SetBreathing(Color first, Color second);

/// <summary>
/// Sets a reactive effect on the keyboard with the specified
Expand All @@ -90,7 +90,7 @@ public interface IKeyboard : IDevice
/// <param name="color">Color to emit on key press.</param>
/// <param name="duration">How long to illuminate the key after being pressed.</param>
[PublicAPI]
void Set(Color color, Duration duration);
void SetReactive(Color color, Duration duration);

/// <summary>
/// Sets a custom grid effect on the keyboard using
Expand All @@ -105,7 +105,7 @@ public interface IKeyboard : IDevice
/// struct in the <see cref="Keyboard" /> class.
/// </remarks>
[PublicAPI]
void Set(Color[][] colors);
void SetGrid(Color[][] colors);

/// <summary>
/// Sets a custom grid effect on the keyboard.
Expand All @@ -116,22 +116,22 @@ public interface IKeyboard : IDevice
/// struct in the <see cref="Keyboard" /> class.
/// </remarks>
[PublicAPI]
void Set(Custom effect);
void SetCustom(Custom effect);

/// <summary>
/// Sets a wave effect on the keyboard in the specified direction.
/// </summary>
/// <param name="direction">Direction of the wave.</param>
[PublicAPI]
void Set(Direction direction);
void SetWave(Direction direction);

/// <summary>
/// Sets an effect without any parameters.
/// Currently, this only works for the <see cref="Effect.None" /> and <see cref="Effect.SpectrumCycling" /> effects.
/// </summary>
/// <param name="effect">Effect options.</param>
[PublicAPI]
void Set(Effect effect);
void SetEffect(Effect effect);

/// <summary>
/// Sets the color on a specific row and column on the keyboard grid.
Expand All @@ -141,7 +141,7 @@ public interface IKeyboard : IDevice
/// <param name="color">Color to set.</param>
/// <param name="clear">Whether or not to clear the existing colors before setting this one.</param>
[PublicAPI]
void Set(Size row, Size column, Color color, bool clear = false);
void SetPosition(Size row, Size column, Color color, bool clear = false);

/// <summary>
/// Sets the color of a specific key on the keyboard.
Expand All @@ -150,7 +150,7 @@ public interface IKeyboard : IDevice
/// <param name="color">Color to set.</param>
/// <param name="clear">If <c>true</c>, the keyboard will first be cleared before setting the key.</param>
[PublicAPI]
void Set(Key key, Color color, bool clear = false);
void SetKey(Key key, Color color, bool clear = false);

/// <summary>
/// Sets the specified color on a set of keys.
Expand All @@ -159,7 +159,7 @@ public interface IKeyboard : IDevice
/// <param name="key">First key to change.</param>
/// <param name="keys">Additional keys that should also have the color applied.</param>
[PublicAPI]
void Set(Color color, Key key, params Key[] keys);
void SetKeys(Color color, Key key, params Key[] keys);

/// <summary>
/// Sets a color on a collection of keys.
Expand All @@ -168,27 +168,27 @@ public interface IKeyboard : IDevice
/// <param name="color">The <see cref="Color" /> to apply.</param>
/// <param name="clear">If <c>true</c>, the keyboard will first be cleared before setting the keys.</param>
[PublicAPI]
void Set(IEnumerable<Key> keys, Color color, bool clear = false);
void SetKeys(IEnumerable<Key> keys, Color color, bool clear = false);

/// <summary>
/// Sets a reactive effect on the keyboard.
/// </summary>
/// <param name="effect">Effect options.</param>
[PublicAPI]
void Set(Reactive effect);
void SetReactive(Reactive effect);

/// <summary>
/// Sets a static color on the keyboard.
/// </summary>
/// <param name="effect">Effect options.</param>
[PublicAPI]
void Set(Static effect);
void SetStatic(Static effect);

/// <summary>
/// Sets a wave effect on the keyboard.
/// </summary>
/// <param name="effect">Effect options.</param>
[PublicAPI]
void Set(Wave effect);
void SetWave(Wave effect);
}
}
Loading

4 comments on commit 1c7ec4f

@sharpblade-ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Colore :: Release Build Build 76 is now running

@sharpblade-ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Colore :: Release Build Build 76 outcome was FAILURE
Summary: Skipping master branch Build time: 0:0:25

@sharpblade-ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Colore :: Release Build Build 77 is now running

@sharpblade-ci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Colore :: Release Build Build 2.2.0.77 outcome was FAILURE
Summary: Tests passed: 111; exit code 1 (new) Build time: 0:3:10

Please sign in to comment.