Skip to content

Commit

Permalink
Merge pull request #60 from CoraleStudios/hotfix/interface-deprecatio…
Browse files Browse the repository at this point in the history
…n-issue

Add methods for deprecation to obsolete interfaces.
  • Loading branch information
Sharparam committed Sep 22, 2015
2 parents 1c7ec4f + 7860fce commit 16c9b0a
Show file tree
Hide file tree
Showing 24 changed files with 846 additions and 21 deletions.
9 changes: 9 additions & 0 deletions Corale.Colore/Corale.Colore.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,16 @@
<Compile Include="Core\Chroma.cs" />
<Compile Include="Core\Color.cs" />
<Compile Include="Core\Device.cs" />
<Compile Include="Core\Device.Obsoletes.cs" />
<Compile Include="Core\GenericDevice.Obsoletes.cs" />
<Compile Include="Core\Headset.Obsoletes.cs" />
<Compile Include="Core\IDevice.Obsoletes.cs" />
<Compile Include="Core\IGenericDevice.Obsoletes.cs" />
<Compile Include="Core\IHeadset.Obsoletes.cs" />
<Compile Include="Core\IKeyboard.Obsoletes.cs" />
<Compile Include="Core\IKeypad.Obsoletes.cs" />
<Compile Include="Core\IMouse.Obsoletes.cs" />
<Compile Include="Core\IMousepad.Obsoletes.cs" />
<Compile Include="Core\Keyboard.Obsoletes.cs" />
<Compile Include="Core\Keypad.Obsoletes.cs" />
<Compile Include="Core\Mouse.Obsoletes.cs" />
Expand Down
57 changes: 57 additions & 0 deletions Corale.Colore/Core/Device.Obsoletes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// ---------------------------------------------------------------------------------------
// <copyright file="Device.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;

/// <summary>
/// Base class for devices, containing code common between all devices.
/// </summary>
public abstract partial class Device
{
/// <summary>
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
[Obsolete("Set is deprecated, please use SetAll(Effect).", false)]
public abstract void Set(Color color);

/// <summary>
/// Updates the device to use the effect pointed to by the specified GUID.
/// </summary>
/// <param name="guid">GUID to set.</param>
[Obsolete("Set is deprecated, please use SetGuid(Guid).", false)]
public void Set(Guid guid)
{
SetGuid(guid);
}
}
}
2 changes: 1 addition & 1 deletion Corale.Colore/Core/Device.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace Corale.Colore.Core
/// <summary>
/// Base class for devices, containing code common between all devices.
/// </summary>
public abstract class Device : IDevice
public abstract partial class Device : IDevice
{
/// <summary>
/// Gets or sets the ID of the currently active effect.
Expand Down
76 changes: 76 additions & 0 deletions Corale.Colore/Core/GenericDevice.Obsoletes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
// ---------------------------------------------------------------------------------------
// <copyright file="GenericDevice.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 System.Collections.Generic;
using System.Runtime.InteropServices;
using Corale.Colore.Annotations;
using Corale.Colore.Razer;
using log4net;

/// <summary>
/// A generic device.
/// </summary>
public sealed partial class GenericDevice
{
/// <summary>
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
[Obsolete("Set is deprecated, please use SetAll(Effect).", false)]
public override void Set(Color color)
{
SetAll(color);
}

/// <summary>
/// Sets a parameter-less effect on this device.
/// </summary>
/// <param name="effect">Effect to set.</param>
[Obsolete("Set is deprecated, please use SetEffect(Effect).", false)]
public void Set(Effect effect)
{
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>
[Obsolete("Set is deprecated, please use SetEffect(Effect, IntPtr).", false)]
public void Set(Effect effect, IntPtr param)
{
SetGuid(NativeWrapper.CreateEffect(DeviceId, effect, param));
}
}
}
4 changes: 2 additions & 2 deletions Corale.Colore/Core/GenericDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ namespace Corale.Colore.Core
/// <summary>
/// A generic device.
/// </summary>
public sealed class GenericDevice : Device, IGenericDevice
public sealed partial class GenericDevice : Device, IGenericDevice
{
/// <summary>
/// Logger instance for this class.
Expand Down Expand Up @@ -112,7 +112,7 @@ public override void SetAll(Color color)

try
{
SetGuid(NativeWrapper.CreateEffect(DeviceId, Effect.Static, colorPtr));
SetEffect(Effect.Static, colorPtr);
}
finally
{
Expand Down
10 changes: 10 additions & 0 deletions Corale.Colore/Core/Headset.Obsoletes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ namespace Corale.Colore.Core
/// </summary>
public sealed partial class Headset : Device, IHeadset
{
/// <summary>
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
[Obsolete("Set is deprecated, please use SetAll(Effect).", false)]
public override void Set(Color color)
{
SetAll(color);
}

/// <summary>
/// Sets an effect on the headset that doesn't
/// take any parameters, currently only valid
Expand Down
57 changes: 57 additions & 0 deletions Corale.Colore/Core/IDevice.Obsoletes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// ---------------------------------------------------------------------------------------
// <copyright file="IDevice.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.Annotations;

/// <summary>
/// Interface for functionality common with all devices.
/// </summary>
public partial interface IDevice
{
/// <summary>
/// Sets the color of all components on this device.
/// </summary>
/// <param name="color">Color to set.</param>
[Obsolete("Set is deprecated, please use SetAll(Color).", false)]
[PublicAPI]
void Set(Color color);

/// <summary>
/// Updates the device to use the effect pointed to by the specified GUID.
/// </summary>
/// <param name="guid">GUID to set.</param>
[Obsolete("Set is deprecated, please use SetGuid(Guid).", false)]
[PublicAPI]
void Set(Guid guid);
}
}
2 changes: 1 addition & 1 deletion Corale.Colore/Core/IDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Corale.Colore.Core
/// <summary>
/// Interface for functionality common with all devices.
/// </summary>
public interface IDevice
public partial interface IDevice
{
/// <summary>
/// Gets the ID of the currently active effect.
Expand Down
54 changes: 54 additions & 0 deletions Corale.Colore/Core/IGenericDevice.Obsoletes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// ---------------------------------------------------------------------------------------
// <copyright file="IGenericDevice.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;

/// <summary>
/// Interface for generic devices.
/// </summary>
public partial interface IGenericDevice
{
/// <summary>
/// Sets a parameter-less effect on this device.
/// </summary>
/// <param name="effect">Effect to set.</param>
void Set(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);
}
}
2 changes: 1 addition & 1 deletion Corale.Colore/Core/IGenericDevice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Corale.Colore.Core
/// <summary>
/// Interface for generic devices.
/// </summary>
public interface IGenericDevice : IDevice
public partial interface IGenericDevice : IDevice
{
/// <summary>
/// Gets the <see cref="Guid" /> of this device.
Expand Down
70 changes: 70 additions & 0 deletions Corale.Colore/Core/IHeadset.Obsoletes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
// ---------------------------------------------------------------------------------------
// <copyright file="IHeadset.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>
/// Interface for headset functionality.
/// </summary>
public partial interface IHeadset : IDevice
{
/// <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)]
void Set(Effect 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)]
void Set(Static 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)]
void Set(Breathing effect);
}
}
Loading

4 comments on commit 16c9b0a

@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 78 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.1.78 outcome was SUCCESS
Summary: Tests passed: 111 Build time: 0:3:26

@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 79 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 79 outcome was SUCCESS
Summary: Skipping master branch Build time: 0:0:4

Please sign in to comment.