diff --git a/Artemis/Artemis/App.config b/Artemis/Artemis/App.config index c92565735..af623241d 100644 --- a/Artemis/Artemis/App.config +++ b/Artemis/Artemis/App.config @@ -2,19 +2,44 @@ - -
-
-
-
-
-
-
-
-
-
-
-
+ +
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs index 1146be31e..270aa7e15 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/K70.cs @@ -1,9 +1,10 @@ using System.Drawing; using CUE.NET; +using CUE.NET.Brushes; using CUE.NET.Devices.Generic.Enums; using CUE.NET.Devices.Keyboard; -using CUE.NET.Brushes; using CUE.NET.Devices.Keyboard.Keys; +using CUE.NET.Exceptions; namespace Artemis.KeyboardProviders.Corsair { @@ -15,8 +16,9 @@ namespace Artemis.KeyboardProviders.Corsair { Name = "Corsair Gaming K70 RGB"; } + /// - /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. + /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. /// public override void Enable() { @@ -24,10 +26,13 @@ namespace Artemis.KeyboardProviders.Corsair { CueSDK.Initialize(); } - catch (CUE.NET.Exceptions.WrapperException) {/*CUE is already initialized*/} + catch (WrapperException) + { +/*CUE is already initialized*/ + } _keyboard = CueSDK.KeyboardSDK; - Height = (int)_keyboard.KeyboardRectangle.Height; - Width = (int)_keyboard.KeyboardRectangle.Width; + Height = (int) _keyboard.KeyboardRectangle.Height; + Width = (int) _keyboard.KeyboardRectangle.Width; _keyboard.UpdateMode = UpdateMode.Manual; _keyboard.Brush = new SolidColorBrush(Color.Black); @@ -39,21 +44,32 @@ namespace Artemis.KeyboardProviders.Corsair } /// - /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap size. - /// Does not reset the color each time. Uncomment line 48 for collor reset. + /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap + /// size. + /// Does not reset the color each time. Uncomment line 48 for collor reset. /// /// public override void DrawBitmap(Bitmap bitmap) { - RectangleF[,] ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; - RectangleKeyGroup[,] ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; + var ledRectangles = new RectangleF[bitmap.Width, bitmap.Height]; + var ledGroups = new RectangleKeyGroup[bitmap.Width, bitmap.Height]; //_keyboard.Brush = new SolidColorBrush(Color.Black); for (var x = 0; x < bitmap.Width; x++) { for (var y = 0; y < bitmap.Height; y++) { - ledRectangles[x, y] = new RectangleF(_keyboard.KeyboardRectangle.X * (x * (_keyboard.KeyboardRectangle.Width / bitmap.Width / _keyboard.KeyboardRectangle.X)), _keyboard.KeyboardRectangle.Y * (y * (_keyboard.KeyboardRectangle.Height / bitmap.Height / _keyboard.KeyboardRectangle.Y)), _keyboard.KeyboardRectangle.Width / bitmap.Width, _keyboard.KeyboardRectangle.Height / bitmap.Height); - ledGroups[x, y] = new RectangleKeyGroup(_keyboard, ledRectangles[x, y], 0.01f) { Brush = new SolidColorBrush(bitmap.GetPixel(x, y)) }; + ledRectangles[x, y] = + new RectangleF( + _keyboard.KeyboardRectangle.X* + (x*(_keyboard.KeyboardRectangle.Width/bitmap.Width/_keyboard.KeyboardRectangle.X)), + _keyboard.KeyboardRectangle.Y* + (y*(_keyboard.KeyboardRectangle.Height/bitmap.Height/_keyboard.KeyboardRectangle.Y)), + _keyboard.KeyboardRectangle.Width/bitmap.Width, + _keyboard.KeyboardRectangle.Height/bitmap.Height); + ledGroups[x, y] = new RectangleKeyGroup(_keyboard, ledRectangles[x, y], 0.01f) + { + Brush = new SolidColorBrush(bitmap.GetPixel(x, y)) + }; } } _keyboard.Update(); diff --git a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs index faa59df4b..cf9800f98 100644 --- a/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs +++ b/Artemis/Artemis/KeyboardProviders/Corsair/K95.cs @@ -1,9 +1,8 @@ -using System; -using System.Drawing; +using System.Drawing; +using Artemis.Utilities; using CUE.NET; using CUE.NET.Devices.Keyboard; -using Artemis.Utilities; -using CUE.NET.Brushes; +using CUE.NET.Exceptions; namespace Artemis.KeyboardProviders.Corsair { @@ -17,7 +16,7 @@ namespace Artemis.KeyboardProviders.Corsair } /// - /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. + /// Enables the SDK and sets updatemode to manual as well as the color of the background to black. /// public override void Enable() { @@ -25,12 +24,15 @@ namespace Artemis.KeyboardProviders.Corsair { CueSDK.Initialize(); } - catch (CUE.NET.Exceptions.WrapperException){/*CUE is already initialized*/} + catch (WrapperException) + { +/*CUE is already initialized*/ + } _keyboard = CueSDK.KeyboardSDK; - Height = (int)_keyboard.KeyboardRectangle.Height; - Width = (int)_keyboard.KeyboardRectangle.Width; + Height = (int) _keyboard.KeyboardRectangle.Height; + Width = (int) _keyboard.KeyboardRectangle.Width; - // _keyboard.UpdateMode = UpdateMode.Manual; + // _keyboard.UpdateMode = UpdateMode.Manual; _keyboard.Update(true); } @@ -39,28 +41,28 @@ namespace Artemis.KeyboardProviders.Corsair } /// - /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap size. - /// Does not reset the color each time. Uncomment line 48 for collor reset. + /// Properly resizes any size bitmap to the keyboard by creating a rectangle whose size is dependent on the bitmap + /// size. + /// Does not reset the color each time. Uncomment line 48 for collor reset. /// /// public override void DrawBitmap(Bitmap bitmap) { using ( var resized = ImageUtilities.ResizeImage(bitmap, - (int)_keyboard.KeyboardRectangle.Width, - (int)_keyboard.KeyboardRectangle.Height) - ) + (int) _keyboard.KeyboardRectangle.Width, + (int) _keyboard.KeyboardRectangle.Height) + ) { foreach (var item in _keyboard.Keys) { - Color ledColor = resized.GetPixel((int)item.KeyRectangle.X, (int)item.KeyRectangle.Y); + var ledColor = resized.GetPixel((int) item.KeyRectangle.X, (int) item.KeyRectangle.Y); if (ledColor == Color.FromArgb(0, 0, 0, 0)) ledColor = Color.Black; item.Led.Color = ledColor; } } _keyboard.Update(true); - } /* diff --git a/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs b/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs index b1f3dd154..149ee63ca 100644 --- a/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs +++ b/Artemis/Artemis/KeyboardProviders/KeyboardProvider.cs @@ -13,13 +13,13 @@ namespace Artemis.KeyboardProviders public abstract void DrawBitmap(Bitmap bitmap); /// - /// Returns a bitmap matching the keyboard's dimensions + /// Returns a bitmap matching the keyboard's dimensions /// /// public Bitmap KeyboardBitmap() => new Bitmap(Width, Height); /// - /// Returns a bitmap matching the keyboard's dimensions using the provided scale + /// Returns a bitmap matching the keyboard's dimensions using the provided scale /// /// public Bitmap KeyboardBitmap(int scale) => new Bitmap(Width*scale, Height*scale); diff --git a/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/KeyboardNames.cs b/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/KeyboardNames.cs index 57f1ec167..32da4051d 100644 --- a/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/KeyboardNames.cs +++ b/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/KeyboardNames.cs @@ -107,5 +107,5 @@ namespace Artemis.KeyboardProviders.Logitech.Utilities NUM_ZERO = 0x52, NUM_PERIOD = 0x53, TEST = 0x1 - }; + } } \ No newline at end of file diff --git a/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/LogitechGSDK.cs b/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/LogitechGSDK.cs index 71a47313d..87495914c 100644 --- a/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/LogitechGSDK.cs +++ b/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/LogitechGSDK.cs @@ -11,9 +11,9 @@ namespace Artemis.KeyboardProviders.Logitech.Utilities private const int LOGI_DEVICETYPE_RGB_ORD = 1; private const int LOGI_DEVICETYPE_PERKEY_RGB_ORD = 2; - public const int LOGI_DEVICETYPE_MONOCHROME = (1 << LOGI_DEVICETYPE_MONOCHROME_ORD); - public const int LOGI_DEVICETYPE_RGB = (1 << LOGI_DEVICETYPE_RGB_ORD); - public const int LOGI_DEVICETYPE_PERKEY_RGB = (1 << LOGI_DEVICETYPE_PERKEY_RGB_ORD); + public const int LOGI_DEVICETYPE_MONOCHROME = 1 << LOGI_DEVICETYPE_MONOCHROME_ORD; + public const int LOGI_DEVICETYPE_RGB = 1 << LOGI_DEVICETYPE_RGB_ORD; + public const int LOGI_DEVICETYPE_PERKEY_RGB = 1 << LOGI_DEVICETYPE_PERKEY_RGB_ORD; public const int LOGI_LED_BITMAP_WIDTH = 21; public const int LOGI_LED_BITMAP_HEIGHT = 6; public const int LOGI_LED_BITMAP_BYTES_PER_KEY = 4; diff --git a/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/OrionUtilities.cs b/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/OrionUtilities.cs index 41682dd9b..2ab8a1418 100644 --- a/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/OrionUtilities.cs +++ b/Artemis/Artemis/KeyboardProviders/Logitech/Utilities/OrionUtilities.cs @@ -17,7 +17,7 @@ namespace Artemis.KeyboardProviders.Logitech.Utilities var depth = Image.GetPixelFormatSize(b.PixelFormat); var step = depth/8; - var pixels = new byte[(21*6)*step]; + var pixels = new byte[21*6*step]; var iptr = bitmapData.Scan0; // Copy data from pointer to array diff --git a/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs b/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs index 5bc986d26..0c17f834c 100644 --- a/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs +++ b/Artemis/Artemis/KeyboardProviders/Razer/BlackWidow.cs @@ -15,8 +15,8 @@ namespace Artemis.KeyboardProviders.Razer public override void Enable() { Chroma.Instance.Initialize(); - Height = (int)Constants.MaxRows; - Width = (int)Constants.MaxColumns; + Height = (int) Constants.MaxRows; + Width = (int) Constants.MaxColumns; } public override void Disable() diff --git a/Artemis/Artemis/Models/EffectModel.cs b/Artemis/Artemis/Models/EffectModel.cs index 72679de3e..f2623faa1 100644 --- a/Artemis/Artemis/Models/EffectModel.cs +++ b/Artemis/Artemis/Models/EffectModel.cs @@ -15,10 +15,10 @@ namespace Artemis.Models MainModel = mainModel; } - public event SettingsUpdateHandler SettingsUpdateEvent; - public abstract void Dispose(); + public event SettingsUpdateHandler SettingsUpdateEvent; + // Called on creation public abstract void Enable(); diff --git a/Artemis/Artemis/Models/MainModel.cs b/Artemis/Artemis/Models/MainModel.cs index 63fc3f3fa..031544dba 100644 --- a/Artemis/Artemis/Models/MainModel.cs +++ b/Artemis/Artemis/Models/MainModel.cs @@ -182,7 +182,7 @@ namespace Artemis.Models } // Sleep according to time left this frame - var sleep = (int) ((1000/Fps) - sw.ElapsedMilliseconds); + var sleep = (int) (1000/Fps - sw.ElapsedMilliseconds); if (sleep > 0) Thread.Sleep(sleep); sw.Reset(); diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings index 4c8f5d200..aef505bd4 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualization.settings @@ -1,5 +1,7 @@  - + + diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs index 705a33f0a..8cd1329f4 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerModel.cs @@ -70,7 +70,6 @@ namespace Artemis.Modules.Effects.AudioVisualizer ColorHelpers.ToDrawingColor(Settings.BottomColor) }, LinearGradientMode.Vertical) {ContainedBrush = false}); - } _sampleAggregator.FftCalculated += FftCalculated; @@ -109,7 +108,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer // Apply Sensitivity setting height = height*Settings.Sensitivity; - var keyboardHeight = (int) Math.Round(((MainModel.ActiveKeyboard.Height/100.00)*height)*Scale); + var keyboardHeight = (int) Math.Round(MainModel.ActiveKeyboard.Height/100.00*height*Scale); if (keyboardHeight > SoundRectangles[i].Height) SoundRectangles[i].Height = keyboardHeight; else @@ -119,7 +118,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer SoundRectangles[i].Width = Scale; if (Settings.FromBottom) - SoundRectangles[i].Y = (MainModel.ActiveKeyboard.Height*Scale) - SoundRectangles[i].Height; + SoundRectangles[i].Y = MainModel.ActiveKeyboard.Height*Scale - SoundRectangles[i].Height; } _generating = false; } diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs index b0935fc28..22f2b6cfc 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerSettings.cs @@ -18,7 +18,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer public Color MiddleColor { get; set; } public Color BottomColor { get; set; } - public override sealed void Load() + public sealed override void Load() { Sensitivity = AudioVisualization.Default.Sensitivity; Bars = AudioVisualization.Default.Bars; @@ -29,7 +29,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer BottomColor = AudioVisualization.Default.BottomColor; } - public override sealed void Save() + public sealed override void Save() { AudioVisualization.Default.Sensitivity = Sensitivity; AudioVisualization.Default.Bars = Bars; @@ -42,7 +42,7 @@ namespace Artemis.Modules.Effects.AudioVisualizer AudioVisualization.Default.Save(); } - public override sealed void ToDefault() + public sealed override void ToDefault() { Sensitivity = 4; Bars = 21; diff --git a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml index 85737bc35..539452e50 100644 --- a/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml +++ b/Artemis/Artemis/Modules/Effects/AudioVisualizer/AudioVisualizerView.xaml @@ -90,7 +90,7 @@ HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1" Value="{Binding Path=AudioVisualizerSettings.Bars, Mode=TwoWay}" Minimum="2" Maximum="21" SmallChange="1" IsSnapToTickEnabled="True" /> - + diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs index 2ed1a0325..3d65ec62a 100644 --- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs +++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectModel.cs @@ -28,15 +28,15 @@ namespace Artemis.Modules.Effects.Debug public override void Enable() { KeyboardRectangle = new KeyboardRectangle(MainModel.ActiveKeyboard, 0, 0, new List - { - Color.Red, - Color.OrangeRed, - Color.Yellow, - Color.Green, - Color.Blue, - Color.Purple, - Color.DeepPink - }, LinearGradientMode.Horizontal); + { + Color.Red, + Color.OrangeRed, + Color.Yellow, + Color.Green, + Color.Blue, + Color.Purple, + Color.DeepPink + }, LinearGradientMode.Horizontal); } public override void Update() diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectSettings.cs b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectSettings.cs index a891a5115..5075b73cf 100644 --- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectSettings.cs +++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectSettings.cs @@ -16,16 +16,16 @@ namespace Artemis.Modules.Effects.Debug public int Scale { get; set; } public LinearGradientMode Type { get; set; } - public override sealed void Load() + public sealed override void Load() { ToDefault(); } - public override sealed void Save() + public sealed override void Save() { } - public override sealed void ToDefault() + public sealed override void ToDefault() { Width = 84; Height = 24; diff --git a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml index f3e11d40d..4456af08a 100644 --- a/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml +++ b/Artemis/Artemis/Modules/Effects/Debug/DebugEffectView.xaml @@ -76,7 +76,7 @@ HorizontalAlignment="Right" Width="110" TickPlacement="BottomRight" TickFrequency="1" Value="{Binding Path=DebugEffectSettings.Scale, Mode=TwoWay}" Minimum="1" Maximum="4" SmallChange="1" IsSnapToTickEnabled="True" /> - + @@ -100,7 +100,7 @@ - +