From 6f794e963b94811c42ae10969ecb2c43e6fdbfd0 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Tue, 22 Sep 2015 23:11:12 +0100 Subject: [PATCH 01/10] Add deprecated methods onto obsolete interfaces. In Colore 2.2.0 it was found that despite the object classes having correct deprecated methods, the corresponding interfaces didn't not, causing an error. References #58. --- Corale.Colore/Core/IHeadset.Obsoletes.cs | 40 ++++++ Corale.Colore/Core/IHeadset.cs | 2 +- Corale.Colore/Core/IKeyboard.Obsoletes.cs | 152 ++++++++++++++++++++++ Corale.Colore/Core/IKeyboard.cs | 2 +- Corale.Colore/Core/IKeypad.Obsoletes.cs | 62 +++++++++ Corale.Colore/Core/IKeypad.cs | 2 +- Corale.Colore/Core/IMouse.Obsoletes.cs | 75 +++++++++++ Corale.Colore/Core/IMouse.cs | 2 +- Corale.Colore/Core/IMousepad.Obsoletes.cs | 53 ++++++++ Corale.Colore/Core/IMousepad.cs | 2 +- 10 files changed, 387 insertions(+), 5 deletions(-) create mode 100644 Corale.Colore/Core/IHeadset.Obsoletes.cs create mode 100644 Corale.Colore/Core/IKeyboard.Obsoletes.cs create mode 100644 Corale.Colore/Core/IKeypad.Obsoletes.cs create mode 100644 Corale.Colore/Core/IMouse.Obsoletes.cs create mode 100644 Corale.Colore/Core/IMousepad.Obsoletes.cs diff --git a/Corale.Colore/Core/IHeadset.Obsoletes.cs b/Corale.Colore/Core/IHeadset.Obsoletes.cs new file mode 100644 index 00000000..f65afcc9 --- /dev/null +++ b/Corale.Colore/Core/IHeadset.Obsoletes.cs @@ -0,0 +1,40 @@ +using System; +using Corale.Colore.Razer.Headset.Effects; + +namespace Corale.Colore.Core +{ + /// + /// Interface for headset functionality. + /// + public partial interface IHeadset : IDevice + { + /// + /// Sets an effect on the headset that doesn't + /// take any parameters, currently only valid + /// for the effect. + /// + /// The type of effect to set. + [Obsolete("Set is deprecated, please use SetEffect(Effect).", false)] + void Set(Effect effect); + + /// + /// Sets a new static effect on the headset. + /// + /// + /// An instance of the struct + /// describing the effect. + /// + [Obsolete("Set is deprecated, please use SetStatic(Static).", false)] + void Set(Static effect); + + /// + /// Sets a new breathing effect on the headset. + /// + /// + /// An instance of the struct + /// describing the effect. + /// + [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] + void Set(Breathing effect); + } +} \ No newline at end of file diff --git a/Corale.Colore/Core/IHeadset.cs b/Corale.Colore/Core/IHeadset.cs index 76f5ddff..8770c6db 100644 --- a/Corale.Colore/Core/IHeadset.cs +++ b/Corale.Colore/Core/IHeadset.cs @@ -35,7 +35,7 @@ namespace Corale.Colore.Core /// /// Interface for headset functionality. /// - public interface IHeadset : IDevice + public partial interface IHeadset : IDevice { /// /// Sets an effect on the headset that doesn't diff --git a/Corale.Colore/Core/IKeyboard.Obsoletes.cs b/Corale.Colore/Core/IKeyboard.Obsoletes.cs new file mode 100644 index 00000000..c052cf11 --- /dev/null +++ b/Corale.Colore/Core/IKeyboard.Obsoletes.cs @@ -0,0 +1,152 @@ +using System; +using System.Collections.Generic; +using Corale.Colore.Annotations; +using Corale.Colore.Razer.Keyboard; +using Corale.Colore.Razer.Keyboard.Effects; + +namespace Corale.Colore.Core +{ + /// + /// Interface for keyboard functionality. + /// + public partial interface IKeyboard : IDevice + { + /// + /// Sets a breathing effect on the keyboard. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] + [PublicAPI] + void Set(Breathing effect); + + /// + /// Sets a breathing effect on the keyboard, fading between the + /// two specified colors. + /// + /// Color to start from. + /// Color to reach, before going back to . + [Obsolete("Set is deprecated, please use SetBreathing(Color, Color).", false)] + [PublicAPI] + void Set(Color first, Color second); + + /// + /// Sets a reactive effect on the keyboard with the specified + /// color and duration. + /// + /// Color to emit on key press. + /// How long to illuminate the key after being pressed. + [Obsolete("Set is deprecated, please use SetReactive(Color, Duration).", false)] + [PublicAPI] + void Set(Color color, Duration duration); + + /// + /// Sets a custom grid effect on the keyboard using + /// a two dimensional array of color values. + /// + /// The grid of colors to use. + /// + /// The passed in arrays cannot have more than rows and + /// not more than columns in any row. + /// + /// This will overwrite the internal + /// struct in the class. + /// + [Obsolete("Set is deprecated, please use SetGrid(Color[][]).", false)] + [PublicAPI] + void Set(Color[][] colors); + + /// + /// Sets a custom grid effect on the keyboard. + /// + /// Effect options. + /// + /// This will overwrite the current internal + /// struct in the class. + /// + [Obsolete("Set is deprecated, please use SetCustom(Custom).", false)] + [PublicAPI] + void Set(Custom effect); + + /// + /// Sets a wave effect on the keyboard in the specified direction. + /// + /// Direction of the wave. + [Obsolete("Set is deprecated, please use SetWave(Direction).", false)] + [PublicAPI] + void Set(Direction direction); + + /// + /// Sets an effect without any parameters. + /// Currently, this only works for the and effects. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetEffect(Effect).", false)] + [PublicAPI] + void Set(Effect effect); + + /// + /// Sets the color on a specific row and column on the keyboard grid. + /// + /// Row to set, between 1 and . + /// Column to set, between 1 and . + /// Color to set. + /// Whether or not to clear the existing colors before setting this one. + [Obsolete("Set is deprecated, please use SetPosition(Size, Size, Color, bool).", false)] + [PublicAPI] + void Set(Size row, Size column, Color color, bool clear = false); + + /// + /// Sets the color of a specific key on the keyboard. + /// + /// Key to modify. + /// Color to set. + /// If true, the keyboard will first be cleared before setting the key. + [Obsolete("Set is deprecated, please use SetKey(Key, Color, bool).", false)] + [PublicAPI] + void Set(Key key, Color color, bool clear = false); + + /// + /// Sets the specified color on a set of keys. + /// + /// The to apply. + /// First key to change. + /// Additional keys that should also have the color applied. + [Obsolete("Set is deprecated, please use SetKeys(Color, Key, Key[][]).", false)] + [PublicAPI] + void Set(Color color, Key key, params Key[] keys); + + /// + /// Sets a color on a collection of keys. + /// + /// The keys which should have their color changed. + /// The to apply. + /// If true, the keyboard will first be cleared before setting the keys. + [Obsolete("Set is deprecated, please use SetKeys(INumerable, Color, bool).", false)] + [PublicAPI] + void Set(IEnumerable keys, Color color, bool clear = false); + + /// + /// Sets a reactive effect on the keyboard. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetReactive(Reactive).", false)] + [PublicAPI] + void Set(Reactive effect); + + /// + /// Sets a static color on the keyboard. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetStatic(Static).", false)] + [PublicAPI] + void Set(Static effect); + + /// + /// Sets a wave effect on the keyboard. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetWave(Wave).", false)] + [PublicAPI] + void Set(Wave effect); + } +} \ No newline at end of file diff --git a/Corale.Colore/Core/IKeyboard.cs b/Corale.Colore/Core/IKeyboard.cs index e6104126..6149bd82 100644 --- a/Corale.Colore/Core/IKeyboard.cs +++ b/Corale.Colore/Core/IKeyboard.cs @@ -39,7 +39,7 @@ namespace Corale.Colore.Core /// /// Interface for keyboard functionality. /// - public interface IKeyboard : IDevice + public partial interface IKeyboard : IDevice { /// /// Gets or sets the for a specific on the keyboard. diff --git a/Corale.Colore/Core/IKeypad.Obsoletes.cs b/Corale.Colore/Core/IKeypad.Obsoletes.cs new file mode 100644 index 00000000..e6a7b080 --- /dev/null +++ b/Corale.Colore/Core/IKeypad.Obsoletes.cs @@ -0,0 +1,62 @@ +using System; +using Corale.Colore.Annotations; +using Corale.Colore.Razer.Keypad; +using Corale.Colore.Razer.Keypad.Effects; + +namespace Corale.Colore.Core +{ + /// + /// Interface for keypad functions. + /// + public partial interface IKeypad : IDevice + { + /// + /// Sets a effect on the keypad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] + [PublicAPI] + void Set(Breathing effect); + + /// + /// Sets a effect on the keypad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetCustom(Custom).", false)] + [PublicAPI] + void Set(Custom effect); + + /// + /// Sets a effect on the keypad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetReactive(Reactive).", false)] + [PublicAPI] + void Set(Reactive effect); + + /// + /// Sets a effect on the keypad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetStatic(Static).", false)] + [PublicAPI] + void Set(Static effect); + + /// + /// Sets a effect on the keypad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetWave(Wave).", false)] + [PublicAPI] + void Set(Wave effect); + + /// + /// Sets an effect without any parameters. + /// Currently, this only works for the effect. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetEffect(Effect).", false)] + [PublicAPI] + void Set(Effect effect); + } +} \ No newline at end of file diff --git a/Corale.Colore/Core/IKeypad.cs b/Corale.Colore/Core/IKeypad.cs index 104c559a..16e561f3 100644 --- a/Corale.Colore/Core/IKeypad.cs +++ b/Corale.Colore/Core/IKeypad.cs @@ -37,7 +37,7 @@ namespace Corale.Colore.Core /// /// Interface for keypad functions. /// - public interface IKeypad : IDevice + public partial interface IKeypad : IDevice { /// /// Gets or sets a color at the specified position in the keypad's diff --git a/Corale.Colore/Core/IMouse.Obsoletes.cs b/Corale.Colore/Core/IMouse.Obsoletes.cs new file mode 100644 index 00000000..85f7fb71 --- /dev/null +++ b/Corale.Colore/Core/IMouse.Obsoletes.cs @@ -0,0 +1,75 @@ +using System; +using Corale.Colore.Annotations; +using Corale.Colore.Razer.Mouse; +using Corale.Colore.Razer.Mouse.Effects; + +namespace Corale.Colore.Core +{ + /// + /// Interface for mouse functionality. + /// + public partial interface IMouse : IDevice + { + /// + /// Sets the color of a specific LED on the mouse. + /// + /// Which LED to modify. + /// Color to set. + [Obsolete("Set is deprecated, please use SetLed(Led, Color).", false)] + [PublicAPI] + void Set(Led led, Color color); + + /// + /// Sets an effect without any parameters. + /// Currently, this only works for the effect. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetEffect(Effect).", false)] + [PublicAPI] + void Set(Effect effect); + + /// + /// Sets a breathing effect on the mouse. + /// + /// An instance of the effect. + [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] + [PublicAPI] + void Set(Breathing effect); + + /// + /// Sets a static color on the mouse. + /// + /// An instance of the effect. + [Obsolete("Set is deprecated, please use SetStatic(Static).", false)] + [PublicAPI] + void Set(Static effect); + + /// + /// Starts a blinking effect on the specified LED. + /// + /// An instance of the effect. + [Obsolete("Set is deprecated, please use SetBlinking(Blinking).", false)] + void Set(Blinking effect); + + /// + /// Sets a reactive effect on the mouse. + /// + /// Effect options struct. + [Obsolete("Set is deprecated, please use SetReactive(Reactive).", false)] + void Set(Reactive effect); + + /// + /// Sets a spectrum cycling effect on the mouse. + /// + /// Effect options struct. + [Obsolete("Set is deprecated, please use SetSpectrumCycling(SpectrumCycling).", false)] + void Set(SpectrumCycling effect); + + /// + /// Sets a wave effect on the mouse. + /// + /// Effect options struct. + [Obsolete("Set is deprecated, please use SetWave(Wave).", false)] + void Set(Wave effect); + } +} \ No newline at end of file diff --git a/Corale.Colore/Core/IMouse.cs b/Corale.Colore/Core/IMouse.cs index 5c337978..f9768969 100644 --- a/Corale.Colore/Core/IMouse.cs +++ b/Corale.Colore/Core/IMouse.cs @@ -37,7 +37,7 @@ namespace Corale.Colore.Core /// /// Interface for mouse functionality. /// - public interface IMouse : IDevice + public partial interface IMouse : IDevice { /// /// Sets the color of a specific LED on the mouse. diff --git a/Corale.Colore/Core/IMousepad.Obsoletes.cs b/Corale.Colore/Core/IMousepad.Obsoletes.cs new file mode 100644 index 00000000..6b49321c --- /dev/null +++ b/Corale.Colore/Core/IMousepad.Obsoletes.cs @@ -0,0 +1,53 @@ +using System; +using Corale.Colore.Annotations; +using Corale.Colore.Razer.Mousepad.Effects; + +namespace Corale.Colore.Core +{ + /// + /// Interface for mouse pad functionality. + /// + public partial interface IMousepad : IDevice + { + /// + /// Sets a breathing effect on the mouse pad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] + [PublicAPI] + void Set(Breathing effect); + + /// + /// Sets a static color effect on the mouse pad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetStatic(Static).", false)] + [PublicAPI] + void Set(Static effect); + + /// + /// Sets a wave effect on the mouse pad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetWave(Wave).", false)] + [PublicAPI] + void Set(Wave effect); + + /// + /// Sets a custom effect on the mouse pad. + /// + /// An instance of the struct. + [Obsolete("Set is deprecated, please use SetCustom(Custom).", false)] + [PublicAPI] + void Set(Custom effect); + + /// + /// Sets an effect without any parameters. + /// Currently, this only works for the effect. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetEffect(Effect).", false)] + [PublicAPI] + void Set(Effect effect); + } +} \ No newline at end of file diff --git a/Corale.Colore/Core/IMousepad.cs b/Corale.Colore/Core/IMousepad.cs index 0422c4ed..83250045 100644 --- a/Corale.Colore/Core/IMousepad.cs +++ b/Corale.Colore/Core/IMousepad.cs @@ -36,7 +36,7 @@ namespace Corale.Colore.Core /// /// Interface for mouse pad functionality. /// - public interface IMousepad : IDevice + public partial interface IMousepad : IDevice { /// /// Sets a breathing effect on the mouse pad. From a04c22f051d27ffe88cb69f07835a40826d39891 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Tue, 22 Sep 2015 23:16:30 +0100 Subject: [PATCH 02/10] Fix code styling issues and StyleCop warnings. --- Corale.Colore/Core/IHeadset.Obsoletes.cs | 36 +++++++++++++++++-- Corale.Colore/Core/IKeyboard.Obsoletes.cs | 42 +++++++++++++++++++---- Corale.Colore/Core/IKeypad.Obsoletes.cs | 42 +++++++++++++++++++---- Corale.Colore/Core/IMouse.Obsoletes.cs | 40 ++++++++++++++++++--- Corale.Colore/Core/IMousepad.Obsoletes.cs | 38 +++++++++++++++++--- 5 files changed, 174 insertions(+), 24 deletions(-) diff --git a/Corale.Colore/Core/IHeadset.Obsoletes.cs b/Corale.Colore/Core/IHeadset.Obsoletes.cs index f65afcc9..16e7813f 100644 --- a/Corale.Colore/Core/IHeadset.Obsoletes.cs +++ b/Corale.Colore/Core/IHeadset.Obsoletes.cs @@ -1,8 +1,38 @@ -using System; -using Corale.Colore.Razer.Headset.Effects; +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- namespace Corale.Colore.Core { + using System; + using Corale.Colore.Razer.Headset.Effects; + /// /// Interface for headset functionality. /// @@ -37,4 +67,4 @@ public partial interface IHeadset : IDevice [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] void Set(Breathing effect); } -} \ No newline at end of file +} diff --git a/Corale.Colore/Core/IKeyboard.Obsoletes.cs b/Corale.Colore/Core/IKeyboard.Obsoletes.cs index c052cf11..bc60a0bc 100644 --- a/Corale.Colore/Core/IKeyboard.Obsoletes.cs +++ b/Corale.Colore/Core/IKeyboard.Obsoletes.cs @@ -1,11 +1,41 @@ -using System; -using System.Collections.Generic; -using Corale.Colore.Annotations; -using Corale.Colore.Razer.Keyboard; -using Corale.Colore.Razer.Keyboard.Effects; +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- namespace Corale.Colore.Core { + using System; + using System.Collections.Generic; + using Corale.Colore.Annotations; + using Corale.Colore.Razer.Keyboard; + using Corale.Colore.Razer.Keyboard.Effects; + /// /// Interface for keyboard functionality. /// @@ -149,4 +179,4 @@ public partial interface IKeyboard : IDevice [PublicAPI] void Set(Wave effect); } -} \ No newline at end of file +} diff --git a/Corale.Colore/Core/IKeypad.Obsoletes.cs b/Corale.Colore/Core/IKeypad.Obsoletes.cs index e6a7b080..5ceb81be 100644 --- a/Corale.Colore/Core/IKeypad.Obsoletes.cs +++ b/Corale.Colore/Core/IKeypad.Obsoletes.cs @@ -1,10 +1,40 @@ -using System; -using Corale.Colore.Annotations; -using Corale.Colore.Razer.Keypad; -using Corale.Colore.Razer.Keypad.Effects; +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- namespace Corale.Colore.Core -{ +{ + using System; + using Corale.Colore.Annotations; + using Corale.Colore.Razer.Keypad; + using Corale.Colore.Razer.Keypad.Effects; + /// /// Interface for keypad functions. /// @@ -59,4 +89,4 @@ public partial interface IKeypad : IDevice [PublicAPI] void Set(Effect effect); } -} \ No newline at end of file +} diff --git a/Corale.Colore/Core/IMouse.Obsoletes.cs b/Corale.Colore/Core/IMouse.Obsoletes.cs index 85f7fb71..2d39952d 100644 --- a/Corale.Colore/Core/IMouse.Obsoletes.cs +++ b/Corale.Colore/Core/IMouse.Obsoletes.cs @@ -1,10 +1,40 @@ -using System; -using Corale.Colore.Annotations; -using Corale.Colore.Razer.Mouse; -using Corale.Colore.Razer.Mouse.Effects; +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- namespace Corale.Colore.Core { + using System; + using Corale.Colore.Annotations; + using Corale.Colore.Razer.Mouse; + using Corale.Colore.Razer.Mouse.Effects; + /// /// Interface for mouse functionality. /// @@ -72,4 +102,4 @@ public partial interface IMouse : IDevice [Obsolete("Set is deprecated, please use SetWave(Wave).", false)] void Set(Wave effect); } -} \ No newline at end of file +} diff --git a/Corale.Colore/Core/IMousepad.Obsoletes.cs b/Corale.Colore/Core/IMousepad.Obsoletes.cs index 6b49321c..9f2f0495 100644 --- a/Corale.Colore/Core/IMousepad.Obsoletes.cs +++ b/Corale.Colore/Core/IMousepad.Obsoletes.cs @@ -1,9 +1,39 @@ -using System; -using Corale.Colore.Annotations; -using Corale.Colore.Razer.Mousepad.Effects; +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- namespace Corale.Colore.Core { + using System; + using Corale.Colore.Annotations; + using Corale.Colore.Razer.Mousepad.Effects; + /// /// Interface for mouse pad functionality. /// @@ -50,4 +80,4 @@ public partial interface IMousepad : IDevice [PublicAPI] void Set(Effect effect); } -} \ No newline at end of file +} From ecc9b4c22d9a525c48e2e33b60ae812d5fa9f4ea Mon Sep 17 00:00:00 2001 From: brandonscott Date: Tue, 22 Sep 2015 23:34:16 +0100 Subject: [PATCH 03/10] Update project file. --- Corale.Colore/Corale.Colore.csproj | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Corale.Colore/Corale.Colore.csproj b/Corale.Colore/Corale.Colore.csproj index 27887480..03d4ca12 100644 --- a/Corale.Colore/Corale.Colore.csproj +++ b/Corale.Colore/Corale.Colore.csproj @@ -93,6 +93,11 @@ + + + + + From f26c297c5d40a16162e362946c88c1cb6adb9dad Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:09:00 +0100 Subject: [PATCH 04/10] Fix rest of interface files that have obsolete methods related to them. --- Corale.Colore/Corale.Colore.csproj | 4 + Corale.Colore/Core/Device.Obsoletes.cs | 54 +++++++++++ Corale.Colore/Core/Device.cs | 2 +- Corale.Colore/Core/GenericDevice.Obsoletes.cs | 93 +++++++++++++++++++ Corale.Colore/Core/GenericDevice.cs | 2 +- Corale.Colore/Core/Headset.Obsoletes.cs | 27 ++++++ Corale.Colore/Core/IDevice.Obsoletes.cs | 57 ++++++++++++ Corale.Colore/Core/IDevice.cs | 2 +- .../Core/IGenericDevice.Obsoletes.cs | 54 +++++++++++ Corale.Colore/Core/IGenericDevice.cs | 2 +- Corale.Colore/Core/Keyboard.Obsoletes.cs | 37 ++++++-- Corale.Colore/Core/Keypad.Obsoletes.cs | 27 ++++++ Corale.Colore/Core/Mouse.Obsoletes.cs | 27 ++++++ Corale.Colore/Core/Mousepad.Obsoletes.cs | 27 ++++++ 14 files changed, 401 insertions(+), 14 deletions(-) create mode 100644 Corale.Colore/Core/Device.Obsoletes.cs create mode 100644 Corale.Colore/Core/GenericDevice.Obsoletes.cs create mode 100644 Corale.Colore/Core/IDevice.Obsoletes.cs create mode 100644 Corale.Colore/Core/IGenericDevice.Obsoletes.cs diff --git a/Corale.Colore/Corale.Colore.csproj b/Corale.Colore/Corale.Colore.csproj index 03d4ca12..2f61c801 100644 --- a/Corale.Colore/Corale.Colore.csproj +++ b/Corale.Colore/Corale.Colore.csproj @@ -92,7 +92,11 @@ + + + + diff --git a/Corale.Colore/Core/Device.Obsoletes.cs b/Corale.Colore/Core/Device.Obsoletes.cs new file mode 100644 index 00000000..509ff7f6 --- /dev/null +++ b/Corale.Colore/Core/Device.Obsoletes.cs @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- + +namespace Corale.Colore.Core +{ + using System; + + /// + /// Base class for devices, containing code common between all devices. + /// + public abstract partial class Device + { + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public abstract void Set(Color color); + + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public abstract void Set(Guid guid); + } +} diff --git a/Corale.Colore/Core/Device.cs b/Corale.Colore/Core/Device.cs index 7a14413a..a463ea6b 100644 --- a/Corale.Colore/Core/Device.cs +++ b/Corale.Colore/Core/Device.cs @@ -35,7 +35,7 @@ namespace Corale.Colore.Core /// /// Base class for devices, containing code common between all devices. /// - public abstract class Device : IDevice + public abstract partial class Device : IDevice { /// /// Gets or sets the ID of the currently active effect. diff --git a/Corale.Colore/Core/GenericDevice.Obsoletes.cs b/Corale.Colore/Core/GenericDevice.Obsoletes.cs new file mode 100644 index 00000000..5a47d2c7 --- /dev/null +++ b/Corale.Colore/Core/GenericDevice.Obsoletes.cs @@ -0,0 +1,93 @@ +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- + +namespace Corale.Colore.Core +{ + using System; + using System.Collections.Generic; + using System.Runtime.InteropServices; + using Corale.Colore.Annotations; + using Corale.Colore.Razer; + using log4net; + + /// + /// A generic device. + /// + public sealed partial class GenericDevice + { + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public override void Set(Color color) + { + SetAll(color); + } + + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public override void Set(Guid guid) + { + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } + + /// + /// Sets a parameter-less effect on this device. + /// + /// Effect to set. + [Obsolete("Set is deprecated, please use SetEffect(Effect).", false)] + public void Set(Effect effect) + { + SetEffect(effect, IntPtr.Zero); + } + + /// + /// Sets an effect on this device, taking a parameter. + /// + /// Effect to set. + /// Effect-specific parameter to use. + [Obsolete("Set is deprecated, please use SetEffect(Effect, IntPtr).", false)] + public void Set(Effect effect, IntPtr param) + { + SetGuid(NativeWrapper.CreateEffect(DeviceId, effect, param)); + } + } +} diff --git a/Corale.Colore/Core/GenericDevice.cs b/Corale.Colore/Core/GenericDevice.cs index 25609fcc..d22b2b27 100644 --- a/Corale.Colore/Core/GenericDevice.cs +++ b/Corale.Colore/Core/GenericDevice.cs @@ -42,7 +42,7 @@ namespace Corale.Colore.Core /// /// A generic device. /// - public sealed class GenericDevice : Device, IGenericDevice + public sealed partial class GenericDevice : Device, IGenericDevice { /// /// Logger instance for this class. diff --git a/Corale.Colore/Core/Headset.Obsoletes.cs b/Corale.Colore/Core/Headset.Obsoletes.cs index 3255bc9e..def9cc9a 100644 --- a/Corale.Colore/Core/Headset.Obsoletes.cs +++ b/Corale.Colore/Core/Headset.Obsoletes.cs @@ -38,6 +38,33 @@ namespace Corale.Colore.Core /// public sealed partial class Headset : Device, IHeadset { + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public override void Set(Guid guid) + { + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } + + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public override void Set(Color color) + { + SetAll(color); + } + /// /// Sets an effect on the headset that doesn't /// take any parameters, currently only valid diff --git a/Corale.Colore/Core/IDevice.Obsoletes.cs b/Corale.Colore/Core/IDevice.Obsoletes.cs new file mode 100644 index 00000000..f1ff856e --- /dev/null +++ b/Corale.Colore/Core/IDevice.Obsoletes.cs @@ -0,0 +1,57 @@ +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- + +namespace Corale.Colore.Core +{ + using System; + using Corale.Colore.Annotations; + + /// + /// Interface for functionality common with all devices. + /// + public partial interface IDevice + { + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Color).", false)] + [PublicAPI] + void Set(Color color); + + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + [PublicAPI] + void Set(Guid guid); + } +} \ No newline at end of file diff --git a/Corale.Colore/Core/IDevice.cs b/Corale.Colore/Core/IDevice.cs index 4d97e980..af12eb8e 100644 --- a/Corale.Colore/Core/IDevice.cs +++ b/Corale.Colore/Core/IDevice.cs @@ -37,7 +37,7 @@ namespace Corale.Colore.Core /// /// Interface for functionality common with all devices. /// - public interface IDevice + public partial interface IDevice { /// /// Gets the ID of the currently active effect. diff --git a/Corale.Colore/Core/IGenericDevice.Obsoletes.cs b/Corale.Colore/Core/IGenericDevice.Obsoletes.cs new file mode 100644 index 00000000..3d9c294a --- /dev/null +++ b/Corale.Colore/Core/IGenericDevice.Obsoletes.cs @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------------------------- +// +// 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. +// +// --------------------------------------------------------------------------------------- + +namespace Corale.Colore.Core +{ + using System; + using Corale.Colore.Razer; + + /// + /// Interface for generic devices. + /// + public partial interface IGenericDevice + { + /// + /// Sets a parameter-less effect on this device. + /// + /// Effect to set. + void Set(Effect effect); + + /// + /// Sets an effect on this device, taking a parameter. + /// + /// Effect to set. + /// Effect-specific parameter to use. + void Set(Effect effect, IntPtr param); + } +} diff --git a/Corale.Colore/Core/IGenericDevice.cs b/Corale.Colore/Core/IGenericDevice.cs index f8e2a78d..2d032195 100644 --- a/Corale.Colore/Core/IGenericDevice.cs +++ b/Corale.Colore/Core/IGenericDevice.cs @@ -37,7 +37,7 @@ namespace Corale.Colore.Core /// /// Interface for generic devices. /// - public interface IGenericDevice : IDevice + public partial interface IGenericDevice : IDevice { /// /// Gets the of this device. diff --git a/Corale.Colore/Core/Keyboard.Obsoletes.cs b/Corale.Colore/Core/Keyboard.Obsoletes.cs index 7e1a59f9..4c54ecf2 100644 --- a/Corale.Colore/Core/Keyboard.Obsoletes.cs +++ b/Corale.Colore/Core/Keyboard.Obsoletes.cs @@ -42,23 +42,40 @@ namespace Corale.Colore.Core public sealed partial class Keyboard { /// - /// Sets a breathing effect on the keyboard. + /// Sets the color of all components on this device. /// - /// Effect options. - [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] - public void Set(Breathing effect) + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public override void Set(Color color) { - SetBreathing(effect); + SetAll(color); } /// - /// Sets the color of all keys on the keyboard. + /// Updates the device to use the effect pointed to by the specified GUID. /// - /// Color to set. - [Obsolete("Set is deprecated, please use SetAll(Color).", false)] - public void Set(Color color) + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public override void Set(Guid guid) { - SetAll(color); + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } + + /// + /// Sets a breathing effect on the keyboard. + /// + /// Effect options. + [Obsolete("Set is deprecated, please use SetBreathing(Breathing).", false)] + public void Set(Breathing effect) + { + SetBreathing(effect); } /// diff --git a/Corale.Colore/Core/Keypad.Obsoletes.cs b/Corale.Colore/Core/Keypad.Obsoletes.cs index 5bfc991c..ab2f0d70 100644 --- a/Corale.Colore/Core/Keypad.Obsoletes.cs +++ b/Corale.Colore/Core/Keypad.Obsoletes.cs @@ -38,6 +38,33 @@ namespace Corale.Colore.Core /// public sealed partial class Keypad : Device, IKeypad { + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public override void Set(Color color) + { + SetAll(color); + } + + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public override void Set(Guid guid) + { + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } + /// /// Sets an effect without any parameters. /// Currently, this only works for the effect. diff --git a/Corale.Colore/Core/Mouse.Obsoletes.cs b/Corale.Colore/Core/Mouse.Obsoletes.cs index 4a64889f..3b37f6a2 100644 --- a/Corale.Colore/Core/Mouse.Obsoletes.cs +++ b/Corale.Colore/Core/Mouse.Obsoletes.cs @@ -40,6 +40,33 @@ namespace Corale.Colore.Core /// public sealed partial class Mouse { + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public override void Set(Guid guid) + { + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } + + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public override void Set(Color color) + { + SetAll(color); + } + /// /// Sets the color of a specific LED on the mouse. /// diff --git a/Corale.Colore/Core/Mousepad.Obsoletes.cs b/Corale.Colore/Core/Mousepad.Obsoletes.cs index 29478b6d..01f9fc1d 100644 --- a/Corale.Colore/Core/Mousepad.Obsoletes.cs +++ b/Corale.Colore/Core/Mousepad.Obsoletes.cs @@ -38,6 +38,33 @@ namespace Corale.Colore.Core /// public sealed partial class Mousepad { + /// + /// Updates the device to use the effect pointed to by the specified GUID. + /// + /// GUID to set. + [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] + public override void Set(Guid guid) + { + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } + + /// + /// Sets the color of all components on this device. + /// + /// Color to set. + [Obsolete("Set is deprecated, please use SetAll(Effect).", false)] + public override void Set(Color color) + { + SetAll(color); + } + /// /// Sets an effect without any parameters. /// Currently, this only works for the effect. From 1f7db2204ac33d506ae3f3b337ccf25515f63786 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:26:27 +0100 Subject: [PATCH 05/10] Stop redeclaring method body for Set(Guid). The method body for Set(Guid) was being redeclared in each class where it was possible to implement the new method. --- Corale.Colore/Core/GenericDevice.Obsoletes.cs | 9 +-------- Corale.Colore/Core/Headset.Obsoletes.cs | 9 +-------- Corale.Colore/Core/Keyboard.Obsoletes.cs | 9 +-------- Corale.Colore/Core/Keypad.Obsoletes.cs | 9 +-------- Corale.Colore/Core/Mouse.Obsoletes.cs | 9 +-------- Corale.Colore/Core/Mousepad.Obsoletes.cs | 9 +-------- 6 files changed, 6 insertions(+), 48 deletions(-) diff --git a/Corale.Colore/Core/GenericDevice.Obsoletes.cs b/Corale.Colore/Core/GenericDevice.Obsoletes.cs index 5a47d2c7..0928fc13 100644 --- a/Corale.Colore/Core/GenericDevice.Obsoletes.cs +++ b/Corale.Colore/Core/GenericDevice.Obsoletes.cs @@ -59,14 +59,7 @@ public override void Set(Color color) [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public override void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } /// diff --git a/Corale.Colore/Core/Headset.Obsoletes.cs b/Corale.Colore/Core/Headset.Obsoletes.cs index def9cc9a..78cb8176 100644 --- a/Corale.Colore/Core/Headset.Obsoletes.cs +++ b/Corale.Colore/Core/Headset.Obsoletes.cs @@ -45,14 +45,7 @@ public sealed partial class Headset : Device, IHeadset [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public override void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } /// diff --git a/Corale.Colore/Core/Keyboard.Obsoletes.cs b/Corale.Colore/Core/Keyboard.Obsoletes.cs index 4c54ecf2..34d6e59e 100644 --- a/Corale.Colore/Core/Keyboard.Obsoletes.cs +++ b/Corale.Colore/Core/Keyboard.Obsoletes.cs @@ -58,14 +58,7 @@ public override void Set(Color color) [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public override void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } /// diff --git a/Corale.Colore/Core/Keypad.Obsoletes.cs b/Corale.Colore/Core/Keypad.Obsoletes.cs index ab2f0d70..116d66a8 100644 --- a/Corale.Colore/Core/Keypad.Obsoletes.cs +++ b/Corale.Colore/Core/Keypad.Obsoletes.cs @@ -55,14 +55,7 @@ public override void Set(Color color) [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public override void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } /// diff --git a/Corale.Colore/Core/Mouse.Obsoletes.cs b/Corale.Colore/Core/Mouse.Obsoletes.cs index 3b37f6a2..c1b4407a 100644 --- a/Corale.Colore/Core/Mouse.Obsoletes.cs +++ b/Corale.Colore/Core/Mouse.Obsoletes.cs @@ -47,14 +47,7 @@ public sealed partial class Mouse [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public override void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } /// diff --git a/Corale.Colore/Core/Mousepad.Obsoletes.cs b/Corale.Colore/Core/Mousepad.Obsoletes.cs index 01f9fc1d..a66b5694 100644 --- a/Corale.Colore/Core/Mousepad.Obsoletes.cs +++ b/Corale.Colore/Core/Mousepad.Obsoletes.cs @@ -45,14 +45,7 @@ public sealed partial class Mousepad [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public override void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } /// From 912a8ecbb63c6270214aba8429738d08d1706956 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:27:33 +0100 Subject: [PATCH 06/10] Fix newline at EOF. --- Corale.Colore/Core/Keyboard.Obsoletes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Corale.Colore/Core/Keyboard.Obsoletes.cs b/Corale.Colore/Core/Keyboard.Obsoletes.cs index 34d6e59e..74586972 100644 --- a/Corale.Colore/Core/Keyboard.Obsoletes.cs +++ b/Corale.Colore/Core/Keyboard.Obsoletes.cs @@ -231,4 +231,4 @@ public void Set(Wave effect) SetWave(effect); } } -} \ No newline at end of file +} From 39ce9763c8bf62a1be9b555e872f55b935cf18b5 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:32:26 +0100 Subject: [PATCH 07/10] Fix SetGuid(Guid) implementation. --- Corale.Colore/Core/Device.Obsoletes.cs | 12 +++++++++++- Corale.Colore/Core/GenericDevice.Obsoletes.cs | 10 ---------- Corale.Colore/Core/Headset.Obsoletes.cs | 10 ---------- Corale.Colore/Core/Keyboard.Obsoletes.cs | 10 ---------- Corale.Colore/Core/Keypad.Obsoletes.cs | 10 ---------- Corale.Colore/Core/Mouse.Obsoletes.cs | 10 ---------- Corale.Colore/Core/Mousepad.Obsoletes.cs | 10 ---------- 7 files changed, 11 insertions(+), 61 deletions(-) diff --git a/Corale.Colore/Core/Device.Obsoletes.cs b/Corale.Colore/Core/Device.Obsoletes.cs index 509ff7f6..5b01f92c 100644 --- a/Corale.Colore/Core/Device.Obsoletes.cs +++ b/Corale.Colore/Core/Device.Obsoletes.cs @@ -49,6 +49,16 @@ public abstract partial class Device /// /// GUID to set. [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public abstract void Set(Guid guid); + public void Set(Guid guid) + { + if (CurrentEffectId != Guid.Empty) + { + NativeWrapper.DeleteEffect(CurrentEffectId); + CurrentEffectId = Guid.Empty; + } + + NativeWrapper.SetEffect(guid); + CurrentEffectId = guid; + } } } diff --git a/Corale.Colore/Core/GenericDevice.Obsoletes.cs b/Corale.Colore/Core/GenericDevice.Obsoletes.cs index 0928fc13..46997b17 100644 --- a/Corale.Colore/Core/GenericDevice.Obsoletes.cs +++ b/Corale.Colore/Core/GenericDevice.Obsoletes.cs @@ -52,16 +52,6 @@ public override void Set(Color color) SetAll(color); } - /// - /// Updates the device to use the effect pointed to by the specified GUID. - /// - /// GUID to set. - [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public override void Set(Guid guid) - { - SetGuid(guid); - } - /// /// Sets a parameter-less effect on this device. /// diff --git a/Corale.Colore/Core/Headset.Obsoletes.cs b/Corale.Colore/Core/Headset.Obsoletes.cs index 78cb8176..1502d45d 100644 --- a/Corale.Colore/Core/Headset.Obsoletes.cs +++ b/Corale.Colore/Core/Headset.Obsoletes.cs @@ -38,16 +38,6 @@ namespace Corale.Colore.Core /// public sealed partial class Headset : Device, IHeadset { - /// - /// Updates the device to use the effect pointed to by the specified GUID. - /// - /// GUID to set. - [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public override void Set(Guid guid) - { - SetGuid(guid); - } - /// /// Sets the color of all components on this device. /// diff --git a/Corale.Colore/Core/Keyboard.Obsoletes.cs b/Corale.Colore/Core/Keyboard.Obsoletes.cs index 74586972..b7ced253 100644 --- a/Corale.Colore/Core/Keyboard.Obsoletes.cs +++ b/Corale.Colore/Core/Keyboard.Obsoletes.cs @@ -51,16 +51,6 @@ public override void Set(Color color) SetAll(color); } - /// - /// Updates the device to use the effect pointed to by the specified GUID. - /// - /// GUID to set. - [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public override void Set(Guid guid) - { - SetGuid(guid); - } - /// /// Sets a breathing effect on the keyboard. /// diff --git a/Corale.Colore/Core/Keypad.Obsoletes.cs b/Corale.Colore/Core/Keypad.Obsoletes.cs index 116d66a8..9f7b407f 100644 --- a/Corale.Colore/Core/Keypad.Obsoletes.cs +++ b/Corale.Colore/Core/Keypad.Obsoletes.cs @@ -48,16 +48,6 @@ public override void Set(Color color) SetAll(color); } - /// - /// Updates the device to use the effect pointed to by the specified GUID. - /// - /// GUID to set. - [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public override void Set(Guid guid) - { - SetGuid(guid); - } - /// /// Sets an effect without any parameters. /// Currently, this only works for the effect. diff --git a/Corale.Colore/Core/Mouse.Obsoletes.cs b/Corale.Colore/Core/Mouse.Obsoletes.cs index c1b4407a..24041d02 100644 --- a/Corale.Colore/Core/Mouse.Obsoletes.cs +++ b/Corale.Colore/Core/Mouse.Obsoletes.cs @@ -40,16 +40,6 @@ namespace Corale.Colore.Core /// public sealed partial class Mouse { - /// - /// Updates the device to use the effect pointed to by the specified GUID. - /// - /// GUID to set. - [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public override void Set(Guid guid) - { - SetGuid(guid); - } - /// /// Sets the color of all components on this device. /// diff --git a/Corale.Colore/Core/Mousepad.Obsoletes.cs b/Corale.Colore/Core/Mousepad.Obsoletes.cs index a66b5694..6bb492c2 100644 --- a/Corale.Colore/Core/Mousepad.Obsoletes.cs +++ b/Corale.Colore/Core/Mousepad.Obsoletes.cs @@ -38,16 +38,6 @@ namespace Corale.Colore.Core /// public sealed partial class Mousepad { - /// - /// Updates the device to use the effect pointed to by the specified GUID. - /// - /// GUID to set. - [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] - public override void Set(Guid guid) - { - SetGuid(guid); - } - /// /// Sets the color of all components on this device. /// From 50ab78c0587d1475279db267b67bb14f2b8c6197 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:34:30 +0100 Subject: [PATCH 08/10] Fix SetGuid(Guid) implementation on Device.Obsoletes where there was still an issue post review. --- Corale.Colore/Core/Device.Obsoletes.cs | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Corale.Colore/Core/Device.Obsoletes.cs b/Corale.Colore/Core/Device.Obsoletes.cs index 5b01f92c..baa50aa9 100644 --- a/Corale.Colore/Core/Device.Obsoletes.cs +++ b/Corale.Colore/Core/Device.Obsoletes.cs @@ -51,14 +51,7 @@ public abstract partial class Device [Obsolete("Set is deprecated, please use SetGuid(Guid).", false)] public void Set(Guid guid) { - if (CurrentEffectId != Guid.Empty) - { - NativeWrapper.DeleteEffect(CurrentEffectId); - CurrentEffectId = Guid.Empty; - } - - NativeWrapper.SetEffect(guid); - CurrentEffectId = guid; + SetGuid(guid); } } } From 6e24230a59728d2f48cc7aee142154ec764e52b8 Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:44:28 +0100 Subject: [PATCH 09/10] Remove duplicated code. --- Corale.Colore/Core/GenericDevice.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Corale.Colore/Core/GenericDevice.cs b/Corale.Colore/Core/GenericDevice.cs index d22b2b27..d16a428e 100644 --- a/Corale.Colore/Core/GenericDevice.cs +++ b/Corale.Colore/Core/GenericDevice.cs @@ -112,7 +112,7 @@ public override void SetAll(Color color) try { - SetGuid(NativeWrapper.CreateEffect(DeviceId, Effect.Static, colorPtr)); + SetEffect(Effect.Static, colorPtr); } finally { From 7860fce8a0642b22bc180f0ba1ad8819eb7269df Mon Sep 17 00:00:00 2001 From: brandonscott Date: Wed, 23 Sep 2015 00:47:22 +0100 Subject: [PATCH 10/10] Add EOF newline to IDevice.Obsoletes.cs. --- Corale.Colore/Core/IDevice.Obsoletes.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Corale.Colore/Core/IDevice.Obsoletes.cs b/Corale.Colore/Core/IDevice.Obsoletes.cs index f1ff856e..f21eea23 100644 --- a/Corale.Colore/Core/IDevice.Obsoletes.cs +++ b/Corale.Colore/Core/IDevice.Obsoletes.cs @@ -54,4 +54,4 @@ public partial interface IDevice [PublicAPI] void Set(Guid guid); } -} \ No newline at end of file +}