diff --git a/.all-contributorsrc b/.all-contributorsrc index bbda21bd0..a076c205f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -233,8 +233,29 @@ "profile": "https://github.com/xQwexx", "contributions": [ "code" + "question", + "maintenance", + "doc", + "design", + "review" + "ideas" + ] + }, + { + "login": "Predator4578", + "name": "Codename-Antares", + "avatar_url": "https://avatars.githubusercontent.com/Predator4578", + "profile": "https://github.com/Predator4578", + "contributions": [ + "code" + "question", + "maintenance", + "doc", + "design", + "review" + "ideas" ] - } + } ], "contributorsPerLine": 7 } diff --git a/.github/workflows/aurora-dev.yml b/.github/workflows/aurora-dev.yml new file mode 100644 index 000000000..f02d57ccc --- /dev/null +++ b/.github/workflows/aurora-dev.yml @@ -0,0 +1,87 @@ +name: Aurora CD + +on: + push: + branches: [ dev ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Release] + + runs-on: windows-2019 # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + + env: + Solution_Name: Project-Aurora/Project-Aurora.sln + + steps: + - name: Generate build number + id: buildnumber + uses: einaregilsson/build-number@v3 + with: + token: ${{secrets.github_token}} + + - uses: rishabhgupta/split-by@v1 + id: split + with: + string: ${{github.repository}} + split-by: '/' + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: true + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 + + # Restore the application to populate the obj folder with RuntimeIdentifiers + - name: Restore the application + run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + - name: Build + run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration + env: + APPVEYOR_BUILD_VERSION: v${{steps.buildnumber.outputs.build_number}} + OWNER: ${{ steps.split.outputs._0 }} + REPOSITORY: ${{ steps.split.outputs._1 }} + Configuration: ${{ matrix.configuration }} + + # Create the app package by building and packaging the Windows Application Packaging project + - name: Building the installer + run: | + "%programfiles(x86)%\Inno Setup 6\iscc.exe" /DEXTERNAL_VERSION=${{steps.buildnumber.outputs.build_number}} Installer\installer.iss + shell: cmd + + - name: Archive Build + shell: pwsh + run: | + Compress-Archive .\Build\Release\* Aurora-v${{steps.buildnumber.outputs.build_number}}.zip + + - name: Installer Release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + target_commitish: dev + draft: true + files: | + Aurora-setup-v${{steps.buildnumber.outputs.build_number}}.exe + Aurora-v${{steps.buildnumber.outputs.build_number}}.zip + tag_name: v${{steps.buildnumber.outputs.build_number}} + allow_override: false + prerelease: true + diff --git a/.github/workflows/aurora-release.yml b/.github/workflows/aurora-release.yml new file mode 100644 index 000000000..b0b42b990 --- /dev/null +++ b/.github/workflows/aurora-release.yml @@ -0,0 +1,91 @@ +name: Aurora CD + +on: + push: + branches: [ master ] + +jobs: + + build: + + strategy: + matrix: + configuration: [Release] + + runs-on: windows-2019 # For a list of available runner types, refer to + # https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on + + env: + Solution_Name: Project-Aurora/Project-Aurora.sln + + steps: + - name: Generate build number + id: buildnumber + uses: einaregilsson/build-number@v3 + with: + token: ${{secrets.github_token}} + + - uses: rishabhgupta/split-by@v1 + id: split + with: + string: ${{github.repository}} + split-by: '/' + + - name: Checkout + uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: true + + # Install the .NET Core workload + - name: Install .NET Core + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 5.0.x + + # Add MSBuild to the PATH: https://github.com/microsoft/setup-msbuild + - name: Setup MSBuild.exe + uses: microsoft/setup-msbuild@v1.0.2 + + # Restore the application to populate the obj folder with RuntimeIdentifiers + - name: Restore the application + run: msbuild $env:Solution_Name /t:Restore /p:Configuration=$env:Configuration + env: + Configuration: ${{ matrix.configuration }} + + - name: Build + run: msbuild $env:Solution_Name /p:Configuration=$env:Configuration + env: + APPVEYOR_BUILD_VERSION: v${{steps.buildnumber.outputs.build_number}} + OWNER: ${{ steps.split.outputs._0 }} + REPOSITORY: ${{ steps.split.outputs._1 }} + Configuration: ${{ matrix.configuration }} + + # Decode the base 64 encoded pfx and save the Signing_Certificate + #- name: Decode the pfx + # run: | + # $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.Base64_Encoded_Pfx }}") + # $certificatePath = Join-Path -Path $env:Wap_Project_Directory -ChildPath GitHubActionsWorkflow.pfx + # [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) + + # Create the app package by building and packaging the Windows Application Packaging project + - name: Building the installer + run: | + "%programfiles(x86)%\Inno Setup 6\iscc.exe" /DEXTERNAL_VERSION=${{steps.buildnumber.outputs.build_number}} Installer\installer.iss + shell: cmd + + - name: Archive Build + shell: pwsh + run: | + Compress-Archive .\Build\Release\* Aurora-v${{steps.buildnumber.outputs.build_number}}.zip + + - name: Release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + draft: true + files: | + Aurora-setup-v${{steps.buildnumber.outputs.build_number}}.exe + Aurora-v${{steps.buildnumber.outputs.build_number}}.zip + tag_name: v${{steps.buildnumber.outputs.build_number}} + allow_override: true diff --git a/Project-Aurora/Aurora-Updater/Aurora-Updater.csproj b/Project-Aurora/Aurora-Updater/Aurora-Updater.csproj index c45859826..0d855c201 100644 --- a/Project-Aurora/Aurora-Updater/Aurora-Updater.csproj +++ b/Project-Aurora/Aurora-Updater/Aurora-Updater.csproj @@ -56,20 +56,20 @@ - + false - 12.0.3 + 13.0.1 - 0.47.0 + 0.50.0 - 1.2.2 + 1.3.0 diff --git a/Project-Aurora/Aurora-Updater/Program.cs b/Project-Aurora/Aurora-Updater/Program.cs index 4f9216a61..06f8d5889 100755 --- a/Project-Aurora/Aurora-Updater/Program.cs +++ b/Project-Aurora/Aurora-Updater/Program.cs @@ -4,6 +4,7 @@ using System.Security.Principal; using System.Windows.Forms; using System.Linq; +using System.Reflection; using Version = SemVer.Version; namespace Aurora_Updater @@ -82,10 +83,13 @@ static void Main(string[] args) MessageBoxButtons.OK); return; } - versionMajor = new Version(_maj, true); + versionMajor = new Version(_maj.TrimStart('v') + ".0.0", true); + + string owner = FileVersionInfo.GetVersionInfo(auroraPath).CompanyName; + string repository = FileVersionInfo.GetVersionInfo(auroraPath).ProductName; //Initialize UpdateManager - StaticStorage.Manager = new UpdateManager(versionMajor); + StaticStorage.Manager = new UpdateManager(versionMajor, owner, repository); //Check if update retrieval was successful. if (StaticStorage.Manager.updateState == UpdateStatus.Error) @@ -109,7 +113,7 @@ static void Main(string[] args) } else { - Version latestV = new Version(StaticStorage.Manager.LatestRelease.TagName.TrimStart('v'), true); + Version latestV = new Version(StaticStorage.Manager.LatestRelease.TagName.TrimStart('v') + ".0.0", true); if (latestV > versionMajor) { diff --git a/Project-Aurora/Aurora-Updater/UpdateManager.cs b/Project-Aurora/Aurora-Updater/UpdateManager.cs index 54aec18df..7cace90f3 100755 --- a/Project-Aurora/Aurora-Updater/UpdateManager.cs +++ b/Project-Aurora/Aurora-Updater/UpdateManager.cs @@ -75,11 +75,11 @@ public class UpdateManager private GitHubClient gClient = new GitHubClient(new ProductHeaderValue("aurora-updater")); public Release LatestRelease; - public UpdateManager(Version version) + public UpdateManager(Version version, string author, string repoName) { LoadSettings(); PerformCleanup(); - FetchData(version); + FetchData(version, author, repoName); } public void LoadSettings() @@ -109,20 +109,23 @@ public int GetTotalProgress() return (int)((downloadProgess + extractProgess) / 2.0f * 100.0f); } - private bool FetchData(Version version) + private bool FetchData(Version version, string owner, string repositoryName) { try { if (Config.GetDevReleases || !String.IsNullOrWhiteSpace(version.PreRelease)) - LatestRelease = gClient.Repository.Release.GetAll("Aurora-RGB", "Aurora", new ApiOptions { PageCount = 1, PageSize = 1 }).Result[0]; + LatestRelease = gClient.Repository.Release.GetAll(owner, repositoryName, new ApiOptions { PageCount = 1, PageSize = 1 }).Result[0]; else - LatestRelease = gClient.Repository.Release.GetLatest("Aurora-RGB", "Aurora").Result; + LatestRelease = gClient.Repository.Release.GetLatest(owner, repositoryName).Result; //Console.WriteLine(reply); } catch (Exception exc) { updateState = UpdateStatus.Error; + MessageBox.Show( + $"Could not find update.\r\nError:\r\n{exc}", + "Aurora Updater - Error"); return false; } @@ -242,11 +245,11 @@ private bool ExtractUpdate() for (int i = 0; i < countOfEntries; i++) { - float percentage = ((float)i / (float)countOfEntries); + float percentage = i / (float)countOfEntries; var fileEntry = updateFile.Entries[i]; log.Enqueue(new LogEntry($"[{Math.Truncate(percentage * 100)}%] Updating: {fileEntry.FullName}")); - this.extractProgess = (float)(Math.Truncate(percentage * 100) / 100.0f); + extractProgess = (float)(Math.Truncate(percentage * 100) / 100.0f); if (ignoreFiles.Contains(fileEntry.FullName)) continue; @@ -256,6 +259,7 @@ private bool ExtractUpdate() var filePath = Path.Combine(Program.exePath, fileEntry.FullName); if (File.Exists(filePath)) File.Move(filePath, $"{filePath}.updateremove"); + Directory.CreateDirectory(Path.GetDirectoryName(filePath)); fileEntry.ExtractToFile(filePath); } catch (IOException e) @@ -264,7 +268,6 @@ private bool ExtractUpdate() MessageBox.Show($"{fileEntry.FullName} is inaccessible.\r\nPlease close Aurora.\r\n\r\n {e.Message}"); i--; - continue; } } diff --git a/Project-Aurora/Project-Aurora/App.xaml.cs b/Project-Aurora/Project-Aurora/App.xaml.cs index d8d696750..0f2f2caf0 100755 --- a/Project-Aurora/Project-Aurora/App.xaml.cs +++ b/Project-Aurora/Project-Aurora/App.xaml.cs @@ -116,7 +116,7 @@ public static void LogLine(this NLog.Logger logger, string text, Logging_Level l public static NetworkListener net_listener; public static Configuration Configuration; public static DeviceManager dev_manager; - public static KeyboardLayoutManager kbLayout; + public static DeviceLayoutManager devicesLayout; public static Effects effengine; public static KeyRecorder key_recorder; public static RzSdkManager razerSdkManager; @@ -313,9 +313,9 @@ protected override void OnStartup(StartupEventArgs e) Global.logger.Info("Loading Plugins"); (Global.PluginManager = new PluginManager()).Initialize(); - Global.logger.Info("Loading KB Layouts"); - Global.kbLayout = new KeyboardLayoutManager(); - Global.kbLayout.LoadBrandDefault(); + + Global.devicesLayout = new DeviceLayoutManager(); + Global.logger.Info("Loading Input Hooking"); Global.InputEvents = new InputEvents(); @@ -405,8 +405,11 @@ protected override void OnStartup(StartupEventArgs e) Global.logger.Info("Loading ConfigUI..."); MainWindow = new ConfigUI(); + Global.LightingStateManager.InitUpdate(); ((ConfigUI)MainWindow).Display(); + Global.logger.Info("Loading Device Layouts"); + //Debug Windows on Startup if (Global.Configuration.BitmapWindowOnStartUp) Window_BitmapView.Open(); @@ -461,9 +464,12 @@ private static void InterceptVolumeAsBrightness(object sender, InputInterceptor. { if (e.KeyDown) { - float brightness = Global.Configuration.GlobalBrightness; - brightness += keys == Keys.VolumeUp ? 0.05f : -0.05f; - Global.Configuration.GlobalBrightness = Math.Max(0f, Math.Min(1f, brightness)); + float brightness = Global.Configuration.KeyboardBrightness; // Changed Global to Keyboard (for OpenRGB devices) + brightness += keys == Keys.VolumeUp ? 0.01f : -0.01f; +// Global.Configuration.GlobalBrightness = Math.Max(0f, Math.Min(1f, brightness)); + Global.Configuration.GlobalBrightness = Math.Max(0f, Math.Min(1f, brightness)); // Added Global Brightness for SDK Devices + Global.Configuration.KeyboardBrightness = Math.Max(0f, Math.Min(1f, brightness)); // Added Keyboard for Brightness too (for OpenRGB devices + Global.Configuration.PeripheralBrightness = Math.Max(0f, Math.Min(1f, brightness)); // Added Pheripheral for Brightness too (for Pheripheral devices) ConfigManager.Save(Global.Configuration); } @@ -517,28 +523,33 @@ protected override void OnExit(ExitEventArgs e) private static void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e) { Exception exc = (Exception)e.ExceptionObject; - Global.logger.Fatal("Fatal Exception caught : " + exc); + Global.logger.Fatal("Fatal Exception caught : " + exc, exc); Global.logger.Fatal(String.Format("Runtime terminating: {0}", e.IsTerminating)); LogManager.Flush(); - - System.Windows.MessageBox.Show("Aurora fatally crashed. Please report the follow to author: \r\n\r\n" + exc, "Aurora has stopped working"); - //Perform exit operations - System.Windows.Application.Current.Shutdown(); + if (Global.Configuration.CloseProgramOnException) + { + System.Windows.MessageBox.Show("Aurora fatally crashed. Please report the follow to author: \r\n\r\n" + exc, "Aurora has stopped working"); + //Perform exit operations + System.Windows.Application.Current.Shutdown(); + } } private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e) { - Exception exc = (Exception)e.Exception; - Global.logger.Fatal("Fatal Exception caught : " + exc); + Exception exc = e.Exception; + Global.logger.Fatal("Fatal Exception caught : " + exc, exc); LogManager.Flush(); if (!Global.isDebug) e.Handled = true; else throw exc; - System.Windows.MessageBox.Show("Aurora fatally crashed. Please report the follow to author: \r\n\r\n" + exc, "Aurora has stopped working"); - //Perform exit operations - System.Windows.Application.Current.Shutdown(); + if (Global.Configuration.CloseProgramOnException) + { + System.Windows.MessageBox.Show("Aurora fatally crashed. Please report the follow to author: \r\n\r\n" + exc, "Aurora has stopped working"); + //Perform exit operations + System.Windows.Application.Current.Shutdown(); + } } public static void InstallLogitech() diff --git a/Project-Aurora/Project-Aurora/ConfigUI.xaml b/Project-Aurora/Project-Aurora/ConfigUI.xaml index f682fe89c..8214d9745 100755 --- a/Project-Aurora/Project-Aurora/ConfigUI.xaml +++ b/Project-Aurora/Project-Aurora/ConfigUI.xaml @@ -6,7 +6,7 @@ xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" xmlns:local="clr-namespace:Aurora" xmlns:tb="http://www.hardcodet.net/taskbar" - xmlns:Controls="clr-namespace:Aurora.Controls" xmlns:Settings="clr-namespace:Aurora.Settings" x:Class="Aurora.ConfigUI" + xmlns:Controls="clr-namespace:Aurora.Controls" xmlns:Settings="clr-namespace:Aurora.Settings" xmlns:DeviceLayout="clr-namespace:Aurora.Settings.DeviceLayoutViewer" x:Class="Aurora.ConfigUI" mc:Ignorable="d" Height="656" Width="1000" Title="Aurora" Loaded="Window_Loaded" Initialized="Window_Initialized" Closing="Window_Closing" Activated="Window_Activated" Deactivated="Window_Deactivated" HorizontalContentAlignment="Stretch" MinWidth="926" MinHeight="575" DataContext="{Binding RelativeSource={RelativeSource Self}}" SizeChanged="Window_SizeChanged"> @@ -87,18 +87,7 @@ - - - - - - - - - - - + diff --git a/Project-Aurora/Project-Aurora/ConfigUI.xaml.cs b/Project-Aurora/Project-Aurora/ConfigUI.xaml.cs index 01133260d..d278c9519 100755 --- a/Project-Aurora/Project-Aurora/ConfigUI.xaml.cs +++ b/Project-Aurora/Project-Aurora/ConfigUI.xaml.cs @@ -15,11 +15,9 @@ using Aurora.Controls; using Aurora.Profiles.Generic_Application; using System.IO; -using Aurora.Settings.Keycaps; using Aurora.Profiles; using Aurora.Settings.Layers; using Aurora.Profiles.Aurora_Wrapper; -using System.Collections.ObjectModel; using System.ComponentModel; using System.Runtime.CompilerServices; using PropertyChanged; @@ -27,42 +25,35 @@ namespace Aurora { [DoNotNotify] - partial class ConfigUI : Window, INotifyPropertyChanged + partial class ConfigUI : INotifyPropertyChanged { - Control_Settings settingsControl = new Control_Settings(); - Control_LayerControlPresenter layerPresenter = new Control_LayerControlPresenter(); - Control_ProfileControlPresenter profilePresenter = new Control_ProfileControlPresenter(); + Control_Settings settingsControl = new(); + Control_LayerControlPresenter layerPresenter = new(); + Control_ProfileControlPresenter profilePresenter = new(); - EffectColor desktop_color_scheme = new EffectColor(0, 0, 0); + EffectColor desktop_color_scheme = new(0, 0, 0); - EffectColor transition_color = new EffectColor(); - EffectColor current_color = new EffectColor(); + EffectColor transition_color = new(); + EffectColor current_color = new(); - private float transitionamount = 0.0f; + private float transitionamount; - private FrameworkElement selected_item = null; - private FrameworkElement _selectedManager = null; + private FrameworkElement selected_item; + private FrameworkElement _selectedManager; - private bool settingsloaded = false; - private bool shownHiddenMessage = false; + private bool settingsloaded; + private bool shownHiddenMessage; private string saved_preview_key = ""; private Timer virtual_keyboard_timer; - private Stopwatch recording_stopwatch = new Stopwatch(); - private Grid virtial_kb = new Grid(); - private readonly double virtual_keyboard_width; - private readonly double virtual_keyboard_height; - - private readonly double width; - private readonly double height; public static readonly DependencyProperty FocusedApplicationProperty = DependencyProperty.Register("FocusedApplication", typeof(Profiles.Application), typeof(ConfigUI), new PropertyMetadata(null, new PropertyChangedCallback(FocusedProfileChanged))); public Profiles.Application FocusedApplication { - get { return (Profiles.Application)GetValue(FocusedApplicationProperty); } + get => (Profiles.Application)GetValue(FocusedApplicationProperty); set { SetValue(FocusedApplicationProperty, value); @@ -70,17 +61,15 @@ public Profiles.Application FocusedApplication } } - LayerEditor layer_editor = new LayerEditor(); - - private bool _ShowHidden = false; + private bool _ShowHidden; public bool ShowHidden { - get { return _ShowHidden; } + get => _ShowHidden; set { _ShowHidden = value; - this.ShowHiddenChanged(value); + ShowHiddenChanged(value); } } @@ -88,34 +77,24 @@ public ConfigUI() { InitializeComponent(); - virtual_keyboard_height = this.keyboard_grid.Height; - virtual_keyboard_width = this.keyboard_grid.Width; - - width = Width; - height = Height; - - Global.kbLayout.KeyboardLayoutUpdated += KbLayout_KeyboardLayoutUpdated; - ctrlProfileManager.ProfileSelected += CtrlProfileManager_ProfileSelected; GenerateProfileStack(); settingsControl.DataContext = this; - - } internal void Display() { if (App.isSilent || Global.Configuration.StartSilently) { - this.Visibility = Visibility.Hidden; - this.WindowStyle = WindowStyle.None; - this.ShowInTaskbar = false; + Visibility = Visibility.Hidden; + WindowStyle = WindowStyle.None; + ShowInTaskbar = false; Hide(); } else { - this.Show(); + Show(); } } @@ -123,7 +102,7 @@ private void CtrlProfileManager_ProfileSelected(ApplicationProfile profile) { profilePresenter.Profile = profile; - if (_selectedManager.Equals(this.ctrlProfileManager)) + if (_selectedManager.Equals(ctrlProfileManager)) SelectedControl = profilePresenter; } @@ -141,28 +120,7 @@ private void Layer_manager_NewLayer(Layer layer) SelectedControl = layerPresenter; } - private void KbLayout_KeyboardLayoutUpdated(object sender) - { - virtial_kb = Global.kbLayout.Virtual_keyboard; - - keyboard_grid.Children.Clear(); - keyboard_grid.Children.Add(virtial_kb); - keyboard_grid.Children.Add(new LayerEditor()); - - keyboard_grid.Width = virtial_kb.Width; - this.Width = width + (virtial_kb.Width - virtual_keyboard_width); - - keyboard_grid.Height = virtial_kb.Height; - this.Height = height + (virtial_kb.Height - virtual_keyboard_height); - - keyboard_grid.UpdateLayout(); - - keyboard_viewbox.MaxWidth = virtial_kb.Width + 50; - keyboard_viewbox.MaxHeight = virtial_kb.Height + 50; - keyboard_viewbox.UpdateLayout(); - - this.UpdateLayout(); - } + private void Window_Loaded(object sender, RoutedEventArgs e) { @@ -170,45 +128,26 @@ private void Window_Loaded(object sender, RoutedEventArgs e) if (!settingsloaded) { - virtual_keyboard_timer = new Timer(33); - virtual_keyboard_timer.Elapsed += new ElapsedEventHandler(virtual_keyboard_timer_Tick); + virtual_keyboard_timer = new Timer(8); + virtual_keyboard_timer.Elapsed += LayoutRenderTimerTick; virtual_keyboard_timer.Start(); settingsloaded = true; } - this.keyboard_record_message.Visibility = Visibility.Hidden; - current_color = desktop_color_scheme; bg_grid.Background = new SolidColorBrush(Color.FromRgb(desktop_color_scheme.Red, desktop_color_scheme.Green, desktop_color_scheme.Blue)); - virtial_kb = Global.kbLayout.Virtual_keyboard; - - keyboard_grid.Children.Clear(); - keyboard_grid.Children.Add(virtial_kb); - keyboard_grid.Children.Add(new LayerEditor()); - - keyboard_grid.Width = virtial_kb.Width; - this.Width = width + (virtial_kb.Width - virtual_keyboard_width); - - keyboard_grid.Height = virtial_kb.Height; - this.Height = height + (virtial_kb.Height - virtual_keyboard_height); - - keyboard_grid.UpdateLayout(); - - keyboard_viewbox.MaxWidth = virtial_kb.Width + 50; - keyboard_viewbox.MaxHeight = virtial_kb.Height + 50; - keyboard_viewbox.UpdateLayout(); UpdateManagerStackFocus(ctrlLayerManager); - this.UpdateLayout(); + UpdateLayout(); - foreach (Image child in this.profiles_stack.Children) + foreach (Image child in profiles_stack.Children) { if (child.Visibility == Visibility.Visible) { - this.ProfileImage_MouseDown(child, null); + ProfileImage_MouseDown(child, null); break; } } @@ -233,7 +172,7 @@ public static bool ApplicationIsActivated() [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto, SetLastError = true)] private static extern int GetWindowThreadProcessId(IntPtr handle, out int processId); - private void virtual_keyboard_timer_Tick(object sender, EventArgs e) + private void LayoutRenderTimerTick(object sender, EventArgs e) { if (!ApplicationIsActivated()) return; @@ -249,20 +188,11 @@ private void virtual_keyboard_timer_Tick(object sender, EventArgs e) bg_grid.UpdateLayout(); } - - Dictionary keylights = new Dictionary(); - if (IsActive) { - keylights = Global.effengine.GetKeyboardLights(); - Global.kbLayout.SetKeyboardColors(keylights); + deviceLayerPresenter.Refresh(); } - if (Global.key_recorder.IsRecording()) - this.keyboard_record_message.Visibility = Visibility.Visible; - else - this.keyboard_record_message.Visibility = Visibility.Hidden; - }); } @@ -280,9 +210,9 @@ private void trayicon_menu_quit_Click(object sender, RoutedEventArgs e) private void trayicon_menu_settings_Click(object sender, RoutedEventArgs e) { - this.ShowInTaskbar = true; - this.WindowStyle = WindowStyle.SingleBorderWindow; - this.Show(); + ShowInTaskbar = true; + WindowStyle = WindowStyle.SingleBorderWindow; + Show(); } private void Window_Initialized(object sender, EventArgs e) @@ -290,7 +220,7 @@ private void Window_Initialized(object sender, EventArgs e) } - private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) + private void Window_Closing(object sender, CancelEventArgs e) { if (Global.Configuration.CloseMode == AppExitMode.Ask) { @@ -326,7 +256,7 @@ private void exitApp() private void minimizeApp() { - this.FocusedApplication?.SaveAll(); + FocusedApplication?.SaveAll(); if (!shownHiddenMessage) { @@ -360,13 +290,13 @@ private void Window_Deactivated(object sender, EventArgs e) private Image profile_hidden; - private BitmapImage _visible = new BitmapImage(new Uri(@"Resources/Visible.png", UriKind.Relative)); - private BitmapImage _not_visible = new BitmapImage(new Uri(@"Resources/Not Visible.png", UriKind.Relative)); + private BitmapImage _visible = new(new Uri(@"Resources/Visible.png", UriKind.Relative)); + private BitmapImage _not_visible = new(new Uri(@"Resources/Not Visible.png", UriKind.Relative)); private void GenerateProfileStack(string focusedKey = null) { selected_item = null; - this.profiles_stack.Children.Clear(); + profiles_stack.Children.Clear(); /*Image profile_desktop = new Image { @@ -428,7 +358,7 @@ private void GenerateProfileStack(string focusedKey = null) profile_grid.Children.Add(profile_image); profile_grid.Children.Add(profile_remove); - this.profiles_stack.Children.Add(profile_grid); + profiles_stack.Children.Add(profile_grid); } else { @@ -441,13 +371,13 @@ private void GenerateProfileStack(string focusedKey = null) Visibility = application.Settings.Hidden ? Visibility.Collapsed : Visibility.Visible }; profile_image.MouseDown += ProfileImage_MouseDown; - this.profiles_stack.Children.Add(profile_image); + profiles_stack.Children.Add(profile_image); } if (application.Config.ID.Equals(focusedKey)) { - this.FocusedApplication = application; - this.TransitionToProfile(profile_image); + FocusedApplication = application; + TransitionToProfile(profile_image); } } } @@ -460,7 +390,7 @@ private void GenerateProfileStack(string focusedKey = null) Margin = new Thickness(0, 5, 0, 0) }; profile_add.MouseDown += AddProfile_MouseDown; - this.profiles_stack.Children.Add(profile_add); + profiles_stack.Children.Add(profile_add); //Show hidden profiles button profile_hidden = new Image @@ -470,12 +400,12 @@ private void GenerateProfileStack(string focusedKey = null) Margin = new Thickness(0, 5, 0, 0) }; profile_hidden.MouseDown += HiddenProfile_MouseDown; - this.profiles_stack.Children.Add(profile_hidden); + profiles_stack.Children.Add(profile_hidden); } private void HiddenProfile_MouseDown(object sender, EventArgs e) { - this.ShowHidden = !this.ShowHidden; + ShowHidden = !ShowHidden; } protected void ShowHiddenChanged(bool value) @@ -502,13 +432,13 @@ protected void ShowHiddenChanged(bool value) private void mbtnHidden_Checked(object sender, RoutedEventArgs e) { MenuItem btn = sender as MenuItem; - Image img = this.cmenuProfiles.PlacementTarget as Image; + Image img = cmenuProfiles.PlacementTarget as Image; if (img != null) { img.Opacity = btn.IsChecked ? 0.5 : 1; - if (!this.ShowHidden && btn.IsChecked) + if (!ShowHidden && btn.IsChecked) img.Visibility = Visibility.Collapsed; (img.Tag as Profiles.Application)?.SaveProfiles(); @@ -537,14 +467,6 @@ private void ContextMenu_Opened(object sender, RoutedEventArgs e) } - private void ProfileImage_Edit_MouseUp(object sender, MouseEventArgs e) - { - Image img = sender as Image; - Profiles.Application profile = img.Tag as Profiles.Application; - profile.Settings.Hidden = !profile.Settings.Hidden; - img.Opacity = profile.Settings.Hidden ? 0.5 : 1; - } - private void Profile_grid_MouseLeave(object sender, MouseEventArgs e) { if ((sender as Grid)?.Tag is Image) @@ -559,7 +481,7 @@ private void Profile_grid_MouseEnter(object sender, MouseEventArgs e) private void TransitionToProfile(Image source) { - this.FocusedApplication = source.Tag as Profiles.Application; + FocusedApplication = source.Tag as Profiles.Application; var bitmap = (BitmapSource)source.Source; var color = Utils.ColorUtils.GetAverageColor(bitmap); @@ -577,11 +499,11 @@ private void ProfileImage_MouseDown(object sender, MouseButtonEventArgs e) if (image != null && image.Tag != null && image.Tag is Profiles.Application) { if (e == null || e.LeftButton == MouseButtonState.Pressed) - this.TransitionToProfile(image); + TransitionToProfile(image); else if (e.RightButton == MouseButtonState.Pressed) { - this.cmenuProfiles.PlacementTarget = (Image)sender; - this.cmenuProfiles.IsOpen = true; + cmenuProfiles.PlacementTarget = (Image)sender; + cmenuProfiles.IsOpen = true; } } } @@ -626,7 +548,7 @@ private void RemoveProfile_MouseDown(object sender, MouseButtonEventArgs e) var idx = Math.Max(eventList.FindIndex(x => x.Key == name), 0); Global.LightingStateManager.RemoveGenericProfile(name); //ConfigManager.Save(Global.Configuration); - this.GenerateProfileStack(eventList[idx].Key); + GenerateProfileStack(eventList[idx].Key); } } } @@ -674,7 +596,7 @@ private void AddProfile_MouseDown(object sender, MouseButtonEventArgs e) private void DesktopControl_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { - this.FocusedApplication = null; + FocusedApplication = null; SelectedControl = settingsControl; current_color = desktop_color_scheme; @@ -755,18 +677,18 @@ private void UpdateProfileStackBackground(FrameworkElement item) public void ShowWindow() { Global.logger.Info("Show Window called"); - this.Visibility = Visibility.Visible; - this.WindowStyle = WindowStyle.SingleBorderWindow; - this.ShowInTaskbar = true; + Visibility = Visibility.Visible; + WindowStyle = WindowStyle.SingleBorderWindow; + ShowInTaskbar = true; //this.Topmost = true; - this.Show(); - this.Activate(); + Show(); + Activate(); } private void trayicon_TrayMouseDoubleClick(object sender, RoutedEventArgs e) { - this.ShowInTaskbar = true; - this.ShowWindow(); + ShowInTaskbar = true; + ShowWindow(); } private void ScrollViewer_ScrollChanged(object sender, ScrollChangedEventArgs e) @@ -802,13 +724,13 @@ private void UpdateManagerStackFocus(object focusedElement, bool forced = false) private void ctrlLayerManager_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (!sender.Equals(_selectedManager)) - SelectedControl = this.FocusedApplication.Profile.Layers.Count > 0 ? layerPresenter : this.FocusedApplication.Control; + SelectedControl = FocusedApplication.Profile.Layers.Count > 0 ? layerPresenter : FocusedApplication.Control; UpdateManagerStackFocus(sender); } private void ctrlOverlayLayerManager_PreviewMouseDown(object sender, MouseButtonEventArgs e) { if (!sender.Equals(_selectedManager)) - SelectedControl = this.FocusedApplication.Profile.OverlayLayers.Count > 0 ? layerPresenter : this.FocusedApplication.Control; + SelectedControl = FocusedApplication.Profile.OverlayLayers.Count > 0 ? layerPresenter : FocusedApplication.Control; UpdateManagerStackFocus(sender); } @@ -821,7 +743,7 @@ private void ctrlProfileManager_PreviewMouseDown(object sender, MouseButtonEvent private void brdOverview_PreviewMouseDown(object sender, MouseButtonEventArgs e) { - this._selectedManager = SelectedControl = this.FocusedApplication.Control; + _selectedManager = SelectedControl = FocusedApplication.Control; } diff --git a/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml b/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml index 3f9a01541..37ff25097 100644 --- a/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml +++ b/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml @@ -4,6 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Aurora.Controls" + xmlns:DeviceLayout="clr-namespace:Aurora.Settings.DeviceLayoutViewer" mc:Ignorable="d" d:DesignHeight="414" d:DesignWidth="535" Loaded="UserControl_Loaded" PreviewKeyDown="UserControl_PreviewKeyDown"> @@ -11,20 +12,14 @@ - - - - - - - - - - - - - - + + + + + + + + diff --git a/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml.cs b/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml.cs index aa69a1fa9..56781528a 100644 --- a/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml.cs +++ b/Project-Aurora/Project-Aurora/Controls/Control_AnimationEditor.xaml.cs @@ -1,5 +1,6 @@ using Aurora.Devices; using Aurora.EffectsEngine.Animations; +using Aurora.Settings; using System; using System.Collections.Generic; using System.ComponentModel; @@ -57,55 +58,25 @@ public Control_AnimationEditor() { InitializeComponent(); - UpdateVirtualKeyboard(); - - Global.kbLayout.KeyboardLayoutUpdated += KbLayout_KeyboardLayoutUpdated; - } - - private void KbLayout_KeyboardLayoutUpdated(object sender) - { - UpdateVirtualKeyboard(); } private void UserControl_Loaded(object sender, RoutedEventArgs e) { - } - - private void UpdateVirtualKeyboard() - { - Grid virtial_kb = Global.kbLayout.AbstractVirtualKeyboard; - - keyboard_grid.Children.Clear(); - keyboard_grid.Children.Add(virtial_kb); - keyboard_grid.Children.Add(new LayerEditor()); - - keyboard_grid.Width = virtial_kb.Width; - keyboard_grid.Height = virtial_kb.Height; - - keyboard_grid.UpdateLayout(); - - viewbxAnimationView.MaxWidth = virtial_kb.Width + 50; - viewbxAnimationView.MaxHeight = virtial_kb.Height + 50; - viewbxAnimationView.UpdateLayout(); - - this.UpdateLayout(); - - //Generate a new mapping - foreach (FrameworkElement Child in virtial_kb.Children) + foreach (Settings.DeviceLayoutViewer.Control_Keycap key in deviceLayerPresenter.Keycaps) { - if (Child is Settings.Keycaps.IKeycap && (Child as Settings.Keycaps.IKeycap).GetKey() != DeviceKeys.NONE) + if (key.GetKey() != DeviceKeys.NONE) { - Child.PreviewMouseLeftButtonDown += KeyboardKey_PreviewMouseLeftButtonDown; - Child.PreviewMouseRightButtonDown += KeyboardKey_PreviewMouseRightButtonDown; + key.PreviewMouseLeftButtonDown += KeyboardKey_PreviewMouseLeftButtonDown; + key.PreviewMouseRightButtonDown += KeyboardKey_PreviewMouseRightButtonDown; } } } private void KeyboardKey_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { - if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.Keycaps.IKeycap) + if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.DeviceLayoutViewer.Keycaps.KeycapViewer keycapViewer) { - SetKeyColor((sender as Settings.Keycaps.IKeycap).GetKey(), _PrimaryManualColor); + SetKeyColor(keycapViewer.GetKey(), _PrimaryManualColor); this.animMixer.UpdatePlaybackTime(); } @@ -113,15 +84,15 @@ private void KeyboardKey_PreviewMouseLeftButtonDown(object sender, MouseButtonEv private void KeyboardKey_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e) { - if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.Keycaps.IKeycap) + if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame && sender is Settings.DeviceLayoutViewer.Keycaps.KeycapViewer keycapViewer) { - SetKeyColor((sender as Settings.Keycaps.IKeycap).GetKey(), _SecondaryManualColor); + SetKeyColor(keycapViewer.GetKey(), _SecondaryManualColor); this.animMixer.UpdatePlaybackTime(); } } - private void SetKeyColor(DeviceKeys key, System.Drawing.Color color) + private void SetKeyColor(DeviceKey key, System.Drawing.Color color) { if (_selectedFrameItem != null && (_selectedFrameItem as Control_AnimationFrameItem).ContextFrame is AnimationManualColorFrame) { @@ -136,7 +107,9 @@ private void animMixer_AnimationMixRendered(object sender) { using (MemoryStream memory = new MemoryStream()) { - (sender as Control_AnimationMixPresenter).RenderedBitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Bmp); + Bitmap renderedBitmap = (sender as Control_AnimationMixPresenter).RenderedBitmap; + renderedBitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Bmp); + memory.Position = 0; BitmapImage bitmapimage = new BitmapImage(); bitmapimage.BeginInit(); @@ -158,17 +131,28 @@ private void keyboard_overlayPreview_SizeChanged(object sender, SizeChangedEvent UpdateScale(e.NewSize.Width); } + private float _prevScale = 0; private void UpdateScale(double width) { - float scale = (float)(width / Effects.canvas_width); - + float scale = (float)(width / Effects.CanvasWidth); if (scale < 1.0f) scale = 1.0f; + if(_prevScale == 0) + { + animMixer.AnimationScale = scale; - animMixer.AnimationScale = scale; + _prevScale = scale; + } + else if (_prevScale != scale) + { + + animMixer.AnimationScale = scale; - rulerHorizontalPixels.MarkSize = scale; - rulerVerticalPixels.MarkSize = scale; + rulerHorizontalPixels.MarkSize = scale; + rulerVerticalPixels.MarkSize = scale; + + _prevScale = scale; + } } private void animMixer_AnimationFrameItemSelected(object sender, AnimationFrame frame) @@ -443,7 +427,7 @@ private void BtnClearColors_Click(object sender, RoutedEventArgs e) { AnimationManualColorFrame frame = ((_selectedFrameItem as Control_AnimationFrameItem).ContextFrame as AnimationManualColorFrame); - frame.SetBitmapColors(new Dictionary()); + frame.SetBitmapColors(new Dictionary()); this.animMixer.UpdatePlaybackTime(); } diff --git a/Project-Aurora/Project-Aurora/Controls/Control_AnimationMixPresenter.xaml.cs b/Project-Aurora/Project-Aurora/Controls/Control_AnimationMixPresenter.xaml.cs index c4322eb1e..75f498072 100644 --- a/Project-Aurora/Project-Aurora/Controls/Control_AnimationMixPresenter.xaml.cs +++ b/Project-Aurora/Project-Aurora/Controls/Control_AnimationMixPresenter.xaml.cs @@ -1,4 +1,5 @@ using Aurora.EffectsEngine.Animations; +using Aurora.Profiles; using System; using System.Collections.Generic; using System.ComponentModel; @@ -49,6 +50,7 @@ public AnimationMix ContextMix //stkPanelTracks.Children.Add(new Separator()); } + ContextMix.SetScale(AnimationScale); AnimationMixUpdated?.Invoke(this, ContextMix); } } @@ -92,37 +94,65 @@ private void NewTrack_AnimationTrackUpdated(object sender, AnimationTrack track) public Bitmap RenderedBitmap; - public float AnimationScale = 1.0f; + private float _animationScale = 1.0f; + public float AnimationScale { + get { + return _animationScale; + } + set { + _animationScale = value; + if(ContextMix != null) + ContextMix.SetScale(AnimationScale); + } + } private float _currentPlaybackTime = 0.0f; - private Timer _playbackTimer = new Timer(33); + private Timer _playbackTimer = new Timer(Global.Configuration.UpdateDelay); public Control_AnimationMixPresenter() { InitializeComponent(); - RenderedBitmap = new Bitmap(Effects.canvas_width, Effects.canvas_height); - _playbackTimer.Elapsed += _playbackTimer_Elapsed; } private void _playbackTimer_Elapsed(object sender, ElapsedEventArgs e) { Dispatcher.Invoke(() => + { + var cm = ContextMix; + Task.Run(() => { - _currentPlaybackTime += 0.033f; + _currentPlaybackTime += (float)Global.Configuration.UpdateDelay / 1000; - if (!ContextMix.AnyActiveTracksAt(_currentPlaybackTime)) + if (!cm.AnyActiveTracksAt(_currentPlaybackTime)) { _currentPlaybackTime = 0.0f; _playbackTimer.Stop(); } - gridScrubber.Margin = new Thickness(ConvertToLocation(_currentPlaybackTime) + 100.0, 0, 0, 0); + Bitmap newBitmap = new Bitmap((int)(Effects.CanvasWidth * AnimationScale), (int)(Effects.CanvasHeight * AnimationScale)); + RenderedBitmap = newBitmap; + + using (Graphics g = Graphics.FromImage(newBitmap)) + { + g.Clear(System.Drawing.Color.Black); + cm.Draw(g, _currentPlaybackTime); + } + + Dispatcher.Invoke(() => + { + + if (chkbxDrawToDevices.IsChecked.Value) + Global.effengine.ForceImageRender(newBitmap); - UpdatePlaybackTime(); + AnimationMixRendered?.Invoke(this); + + UpdatePlaybackTime(); + }); }); + }); } private void btnPlayStop_Click(object sender, RoutedEventArgs e) @@ -154,26 +184,13 @@ private void grdsplitrScrubber_DragDelta(object sender, System.Windows.Controls. public void UpdatePlaybackTime() { + + gridScrubber.Margin = new Thickness(ConvertToLocation(_currentPlaybackTime) + 100.0, 0, 0, 0); + int seconds = (int)_currentPlaybackTime; int milliseconds = (int)((_currentPlaybackTime - seconds) * 1000.0); this.txtblkCurrentTime.Text = $"{seconds};{milliseconds}"; - - Bitmap newBitmap = new Bitmap((int)(Effects.canvas_width * AnimationScale), (int)(Effects.canvas_height * AnimationScale)); - - using (Graphics g = Graphics.FromImage(newBitmap)) - { - g.Clear(System.Drawing.Color.Black); - - ContextMix.Draw(g, _currentPlaybackTime, AnimationScale); - } - - RenderedBitmap = newBitmap; - - if (chkbxDrawToDevices.IsChecked.Value) - Global.effengine.ForceImageRender(RenderedBitmap); - - AnimationMixRendered?.Invoke(this); } private double ConvertToLocation(float time) diff --git a/Project-Aurora/Project-Aurora/Controls/EditorResources/ResizeDecorator.xaml b/Project-Aurora/Project-Aurora/Controls/EditorResources/ResizeDecorator.xaml index 05e2d7309..39ecdc79f 100644 --- a/Project-Aurora/Project-Aurora/Controls/EditorResources/ResizeDecorator.xaml +++ b/Project-Aurora/Project-Aurora/Controls/EditorResources/ResizeDecorator.xaml @@ -3,24 +3,26 @@ xmlns:s="clr-namespace:Aurora.Controls.EditorResources"> + - - - - - - - - + + + + + + + + + \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Controls/EditorResources/RotateDecorator.xaml b/Project-Aurora/Project-Aurora/Controls/EditorResources/RotateDecorator.xaml index 9f0bee33e..ead7cd844 100644 --- a/Project-Aurora/Project-Aurora/Controls/EditorResources/RotateDecorator.xaml +++ b/Project-Aurora/Project-Aurora/Controls/EditorResources/RotateDecorator.xaml @@ -22,18 +22,18 @@ - - + + - + - + diff --git a/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml b/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml index 7fb9bb7de..0ca0b0687 100644 --- a/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml +++ b/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml @@ -3,20 +3,15 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" - xmlns:EnumValueConverters="clr-namespace:Aurora.Utils" mc:Ignorable="d" MinWidth="230" MinHeight="111" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded" IsEnabledChanged="UserControl_IsEnabledChanged" IsVisibleChanged="UserControl_IsVisibleChanged"> - - - - - - - - + + + + diff --git a/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml.cs b/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml.cs index d4bd8b644..1e78b7055 100644 --- a/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml.cs +++ b/Project-Aurora/Project-Aurora/Controls/KeySequence.xaml.cs @@ -1,4 +1,5 @@ -using System; +using Aurora.Settings; +using System; using System.Collections.Generic; using System.ComponentModel; using System.Linq; @@ -8,7 +9,7 @@ namespace Aurora.Controls { - public partial class KeySequence : UserControl + public partial class KeySequence { [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(UserControl)); @@ -30,17 +31,11 @@ public string Title public string RecordingTag { - get - { - return (string)GetValue(RecordingTagProperty); - } - set - { - SetValue(RecordingTagProperty, value); - } + get => (string)GetValue(RecordingTagProperty); + set => SetValue(RecordingTagProperty, value); } - public List List + public List List { get { @@ -53,39 +48,44 @@ public List List { if (Sequence == null) Sequence = new Settings.KeySequence(value.ToArray()); - else { + else + { Sequence.keys = value; } - SequenceKeysChange?.Invoke(this, new EventArgs()); + SequenceKeysChange?.Invoke(this, EventArgs.Empty); } } - private bool allowListRefresh = true; + private bool _allowListRefresh = true; #region Sequence Dependency Property [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public static readonly DependencyProperty SequenceProperty = DependencyProperty.Register("Sequence", typeof(Settings.KeySequence), typeof(UserControl), new PropertyMetadata(new Settings.KeySequence(), SequencePropertyChanged)); - public Settings.KeySequence Sequence { + public Settings.KeySequence Sequence + { get => (Settings.KeySequence)GetValue(SequenceProperty); set => SetValue(SequenceProperty, value); } - private static void SequencePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) { + private static void SequencePropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) + { var source = (KeySequence)sender; - if (!(e.NewValue is Settings.KeySequence@new)) { + if (e.NewValue is not Settings.KeySequence @new) + { source.Sequence = new Settings.KeySequence(); return; } // If the old sequence is a region, remove that region from the editor - if (e.OldValue is Settings.KeySequence old && old.type == Settings.KeySequenceType.FreeForm) + if (e.OldValue is Settings.KeySequence {type: Settings.KeySequenceType.FreeForm} old) LayerEditor.RemoveKeySequenceElement(old.freeform); // Handle the new sequence. If a region, this will add it to the editor source.sequence_updateToLayerEditor(); // Manually update the keysequence list. Gross - if (source.allowListRefresh) { + if (source._allowListRefresh) + { source.keys_keysequence.Items.Clear(); foreach (var key in @new.keys) source.keys_keysequence.Items.Add(key); @@ -95,7 +95,7 @@ private static void SequencePropertyChanged(DependencyObject sender, DependencyP source.sequence_freestyle_checkbox.IsChecked = @new.type == Settings.KeySequenceType.FreeForm; // Fire an event? Dunno if this is really neccessary but since it was already there I feel like I should keep it - source.SequenceUpdated?.Invoke(source, new EventArgs()); + source.SequenceUpdated?.Invoke(source, EventArgs.Empty); } #endregion @@ -106,23 +106,20 @@ private static void SequencePropertyChanged(DependencyObject sender, DependencyP public bool FreestyleEnabled { - get - { - return (bool)GetValue(FreestyleEnabledProperty); - } + get => (bool)GetValue(FreestyleEnabledProperty); set { SetValue(FreestyleEnabledProperty, value); - this.sequence_freestyle_checkbox.IsEnabled = value; - this.sequence_freestyle_checkbox.ToolTip = (value ? null : "Freestyle has been disabled."); - + sequence_freestyle_checkbox.IsEnabled = value; + sequence_freestyle_checkbox.ToolTip = value ? null : "Freestyle has been disabled."; } } #region ShowOnCanvas property // Drawn freeform object bounds will only appear if this is true. - public bool ShowOnCanvas { + public bool ShowOnCanvas + { get => (bool)GetValue(ShowOnCanvasProperty); set => SetValue(ShowOnCanvasProperty, value); } @@ -159,9 +156,9 @@ private void sequence_remove_keys_Click(object sender, RoutedEventArgs e) { if (Utils.UIUtils.ListBoxRemoveSelected(this.keys_keysequence)) { - allowListRefresh = false; + _allowListRefresh = false; List = Utils.UIUtils.SequenceToList(this.keys_keysequence.Items); - allowListRefresh = true; + _allowListRefresh = true; } } @@ -169,9 +166,9 @@ private void sequence_up_keys_Click(object sender, RoutedEventArgs e) { if (Utils.UIUtils.ListBoxMoveSelectedUp(this.keys_keysequence)) { - allowListRefresh = false; + _allowListRefresh = false; List = Utils.UIUtils.SequenceToList(this.keys_keysequence.Items); - allowListRefresh = true; + _allowListRefresh = true; } } @@ -179,9 +176,9 @@ private void sequence_down_keys_Click(object sender, RoutedEventArgs e) { if (Utils.UIUtils.ListBoxMoveSelectedDown(this.keys_keysequence)) { - allowListRefresh = false; + _allowListRefresh = false; List = Utils.UIUtils.SequenceToList(this.keys_keysequence.Items); - allowListRefresh = true; + _allowListRefresh = true; } } @@ -189,9 +186,9 @@ private void btnReverseOrder_Click(object sender, RoutedEventArgs e) { if (Utils.UIUtils.ListBoxReverseOrder(this.keys_keysequence)) { - allowListRefresh = false; + _allowListRefresh = false; List = Utils.UIUtils.SequenceToList(this.keys_keysequence.Items); - allowListRefresh = true; + _allowListRefresh = true; } } @@ -199,9 +196,9 @@ private void btnReverseOrder_Click(object sender, RoutedEventArgs e) private void sequence_record_keys_Click(object sender, RoutedEventArgs e) { RecordKeySequence(RecordingTag, (sender as Button), this.keys_keysequence); - allowListRefresh = false; + _allowListRefresh = false; List = Utils.UIUtils.SequenceToList(this.keys_keysequence.Items); - allowListRefresh = true; + _allowListRefresh = true; } private void RecordKeySequence(string whoisrecording, Button button, ListBox sequence_listbox) @@ -214,7 +211,7 @@ private void RecordKeySequence(string whoisrecording, Button button, ListBox seq button.Content = "Assign Keys"; - Devices.DeviceKeys[] recorded_keys = Global.key_recorder.GetKeys(); + DeviceKey[] recorded_keys = Global.key_recorder.GetKeys(); if (sequence_listbox.SelectedIndex > 0 && sequence_listbox.SelectedIndex < (sequence_listbox.Items.Count - 1)) { @@ -250,14 +247,14 @@ private void sequence_freestyle_checkbox_Checked(object sender, RoutedEventArgs Settings.KeySequence seq = Sequence; if (seq != null && sender is CheckBox && (sender as CheckBox).IsChecked.HasValue) { - seq.type = ((sender as CheckBox).IsChecked.Value ? Settings.KeySequenceType.FreeForm : Settings.KeySequenceType.Sequence); + seq.type = (sender as CheckBox).IsChecked.Value ? Settings.KeySequenceType.FreeForm : Settings.KeySequenceType.Sequence; Sequence = seq; sequence_updateToLayerEditor(); } } - public void sequence_updateToLayerEditor() + private void sequence_updateToLayerEditor() { if (Sequence != null && IsInitialized && IsVisible && IsEnabled) { @@ -274,14 +271,13 @@ public void sequence_updateToLayerEditor() } } - private void freeform_updated(Settings.FreeFormObject newfreeform) + private void freeform_updated(object sender, FreeFormChangedArgs args) { - if(newfreeform != null) + if (args.FreeForm != null) { - Sequence.freeform = newfreeform; + Sequence.freeform = args.FreeForm; - if (SequenceUpdated != null) - SequenceUpdated(this, new EventArgs()); + SequenceUpdated?.Invoke(this, EventArgs.Empty); } } @@ -309,7 +305,7 @@ private void UserControl_Unloaded(object sender, RoutedEventArgs e) private void UserControl_IsEnabledChanged(object sender, DependencyPropertyChangedEventArgs e) { - if(e.NewValue is bool) + if (e.NewValue is bool) { this.keys_keysequence.IsEnabled = (bool)e.NewValue; this.sequence_record.IsEnabled = (bool)e.NewValue; @@ -328,7 +324,7 @@ private void UserControl_IsEnabledChanged(object sender, DependencyPropertyChang private void keys_keysequence_SelectionChanged(object sender, SelectionChangedEventArgs e) { - if(keys_keysequence.SelectedItems.Count <= 1) + if (keys_keysequence.SelectedItems.Count <= 1) { this.sequence_up.IsEnabled = IsEnabled && true; this.sequence_down.IsEnabled = IsEnabled && true; @@ -361,7 +357,7 @@ private void UserControl_IsVisibleChanged(object sender, DependencyPropertyChang else sequence_removeFromLayerEditor(); } - + } } -} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml b/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml index fb8c7c075..d60ecab43 100644 --- a/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml +++ b/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml @@ -12,7 +12,4 @@ - - - diff --git a/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml.cs b/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml.cs index 1752ea900..108624140 100644 --- a/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml.cs +++ b/Project-Aurora/Project-Aurora/Controls/LayerEditor.xaml.cs @@ -16,16 +16,16 @@ public partial class LayerEditor : UserControl { //static FreeFormObject activeLayer = new FreeFormObject(); - private static Canvas static_canvas = new Canvas(); + private static Canvas static_canvas; private static Style style = new Style(); //public static event EventHandler SequenceUpdated; - public LayerEditor() + public LayerEditor(Canvas editorCanvas) { InitializeComponent(); - static_canvas = editor_canvas; + static_canvas = editorCanvas; style = this.FindResource("DesignerItemStyle") as Style; } diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_backlights.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_backlights.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_backlights.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_backlights.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_body.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_body.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_body.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_body.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_wheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_wheel.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_Pugio_wheel.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_Pugio_wheel.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Asus_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Asus_logo.png diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Bloody_Logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Bloody_Logo.png new file mode 100644 index 000000000..b995ae12b Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Bloody_Logo.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Bloody_W60_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Bloody_W60_outline.png new file mode 100644 index 000000000..a8755fa8d Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Bloody_W60_outline.png differ diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_Katar.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_Katar.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_Katar.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_Katar.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_Katar_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_Katar_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_Katar_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_Katar_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_Katar_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_Katar_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_Katar_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_Katar_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65_scrollwheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65_scrollwheel.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_M65_scrollwheel.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_M65_scrollwheel.png diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_iCue.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_iCue.png new file mode 100644 index 000000000..c05575a18 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_iCue.png differ diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_strafe_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_strafe_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_strafe_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_strafe_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_strafe_mk2_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_strafe_mk2_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Corsair_strafe_mk2_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Corsair_strafe_mk2_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502.pdn b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502.pdn similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502.pdn rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502.pdn diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502_dpi.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502_dpi.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502_dpi.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502_dpi.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G502_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G502_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G810.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G810.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G810.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G810.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G810_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G810_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G810_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G810_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G900.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G900.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G900.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G900.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G900_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G900_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G900_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G900_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G900_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G900_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G900_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G900_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G910_badge.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G910_badge.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G910_badge.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G910_badge.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G910_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G910_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_G910_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_G910_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_g900_dpi.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_g900_dpi.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Logi_g900_dpi.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Logi_g900_dpi.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_logo.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_logo.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_logo.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_logo.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_0.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_0.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_0.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_0.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_1.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_1.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_1.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_2.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_2.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_2.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_3.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Omen_zone_3.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Omen_zone_3.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L1.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L1.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L1.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L2.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L2.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L2.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L3.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L3.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L3.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L4.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L4.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L4.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L4.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L5.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L5.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L5.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L5.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L6.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L6.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L6.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L6.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L7.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L7.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_L7.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_L7.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_Logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_Logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_Logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_Logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R1.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R1.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R1.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R2.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R2.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R2.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R3.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R3.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R3.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R4.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R4.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R4.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R4.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R5.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R5.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R5.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R5.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R6.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R6.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R6.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R6.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R7.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R7.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_R7.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_R7.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_Scroll_Wheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_Scroll_Wheel.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_Scroll_Wheel.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_Scroll_Wheel.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_Mamba_TE_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_Mamba_TE_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_logo.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_logo.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Razer_logo.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Razer_logo.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Roccat_Kone_Pure_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Kone_Pure_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Roccat_Kone_Pure_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Kone_Pure_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Roccat_Kone_Pure_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Kone_Pure_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Roccat_Kone_Pure_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Kone_Pure_outline.png diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Vulcan_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Vulcan_logo.png new file mode 100644 index 000000000..eae1e8b7a Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Roccat_Vulcan_logo.png differ diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre_front_lights.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre_front_lights.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre_front_lights.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre_front_lights.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre_scrollwheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre_scrollwheel.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/Sabre_scrollwheel.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/Sabre_scrollwheel.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SoundBlasterX_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SoundBlasterX_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SoundBlasterX_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SoundBlasterX_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Apex_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Apex_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Apex_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Apex_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_logo.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_logo.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_logo.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_logo.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_outline.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_outline.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_outline.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_outline.psd diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_scrollwheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_scrollwheel.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_scrollwheel.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_scrollwheel.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_scrollwheel.psd b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_scrollwheel.psd similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/SteelSeries_Rival_300_scrollwheel.psd rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_300_scrollwheel.psd diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L1.png new file mode 100644 index 000000000..ac4dfc79a Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L1.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L2.png new file mode 100644 index 000000000..8853ce875 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L2.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L3.png new file mode 100644 index 000000000..539900b88 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_L3.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R1.png new file mode 100644 index 000000000..d26fb1841 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R1.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R2.png new file mode 100644 index 000000000..24a889721 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R2.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R3.png new file mode 100644 index 000000000..cd8a2edc4 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_R3.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_outline.png new file mode 100644 index 000000000..57ac12af7 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_outline.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_wheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_wheel.png new file mode 100644 index 000000000..3a9bde1fc Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/SteelSeries_Rival_650_wheel.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Bottom Lights.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Bottom Lights.png new file mode 100644 index 000000000..58749186b Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Bottom Lights.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Left Stripe.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Left Stripe.png new file mode 100644 index 000000000..c41a1402a Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Left Stripe.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Mid Stripe.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Mid Stripe.png new file mode 100644 index 000000000..09378816d Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Mid Stripe.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Scroll_Led.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Scroll_Led.png new file mode 100644 index 000000000..3edbd4626 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_Scroll_Led.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_1.png new file mode 100644 index 000000000..fc9e4b9a6 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_1.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_2.png new file mode 100644 index 000000000..17d3f2220 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_2.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_3.png new file mode 100644 index 000000000..42ffc17e6 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_3.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_4.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_4.png new file mode 100644 index 000000000..4273aa574 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_bl_4.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_1.png new file mode 100644 index 000000000..1ef1c26b0 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_1.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_2.png new file mode 100644 index 000000000..59bdc654c Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_2.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_3.png new file mode 100644 index 000000000..bc0975a23 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ls_3.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_1.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_1.png new file mode 100644 index 000000000..771e62905 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_1.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_2.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_2.png new file mode 100644 index 000000000..ef1ce34a8 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_2.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_3.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_3.png new file mode 100644 index 000000000..8a5edac04 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/bloody_w60_ms_3.png differ diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_outpost_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_outpost_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_outpost_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_outpost_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_outpost_plus_photon_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_outpost_plus_photon_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_outpost_plus_photon_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_outpost_plus_photon_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_photon_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_photon_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_photon_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_photon_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_photon_scrollwheel.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_photon_scrollwheel.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_photon_scrollwheel.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_photon_scrollwheel.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_sequencer_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_sequencer_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_sequencer_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_sequencer_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_vector_essentials_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_vector_essentials_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_vector_essentials_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_vector_essentials_outline.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_vector_logo.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_vector_logo.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_vector_logo.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_vector_logo.png diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_vector_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_vector_outline.png similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/images/omen_vector_outline.png rename to Project-Aurora/Project-Aurora/DeviceLayouts/Images/omen_vector_outline.png diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/razer_naga_pro_12_button_side_plate.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/razer_naga_pro_12_button_side_plate.png new file mode 100644 index 000000000..590baf160 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/razer_naga_pro_12_button_side_plate.png differ diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Images/razer_naga_pro_outline.png b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/razer_naga_pro_outline.png new file mode 100644 index 000000000..828892827 Binary files /dev/null and b/Project-Aurora/Project-Aurora/DeviceLayouts/Images/razer_naga_pro_outline.png differ diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/asus_strix_flare_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/asus_strix_flare_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/asus_strix_flare_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/asus_strix_flare_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_bottom_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_bottom_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_bottom_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_bottom_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_top_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_top_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/cooler_master_sk650_top_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/cooler_master_sk650_top_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k65_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k65_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k65_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k65_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k68_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k68_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k68_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k68_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k70_mk2_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k70_mk2_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k70_mk2_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k70_mk2_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k95_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k95_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k95_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k95_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k95_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k95_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_k95_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_k95_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_mk2_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_mk2_left_features.json similarity index 98% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_mk2_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_mk2_left_features.json index 71ff6cf7a..86b4f55ab 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_mk2_left_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_mk2_left_features.json @@ -15,7 +15,7 @@ "margin_left_bits": 0, "margin_top_bits": -3, "image": "Corsair_strafe_mk2_logo.png", - "enabled": false, + "enabled": true, "absolute_location": true }, { diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_mk2_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_mk2_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_mk2_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_mk2_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_strafe_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/corsair_strafe_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/drevo_blademaster_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/drevo_blademaster_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/drevo_blademaster_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/drevo_blademaster_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/ducky_shine_7_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/ducky_shine_7_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/ducky_shine_7_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/ducky_shine_7_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/hyperx_alloy_elite_rgb_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/hyperx_alloy_elite_rgb_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/hyperx_alloy_elite_rgb_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/hyperx_alloy_elite_rgb_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_gpro_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g810_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_gpro_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g810_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g815_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g815_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g815_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g815_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g910_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g910_features.json similarity index 95% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g910_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g910_features.json index a41d1fadd..6cae013ca 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g910_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g910_features.json @@ -1,157 +1,157 @@ -{ - "group_tag": "keyboard", - "origin_region": 1, - "grouped_keys": [ - { - "visualName": "G6", - "tag": 113, - "margin_left": 62.0, - "margin_top": -37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 5, - "margin_top_bits": -3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G7", - "tag": 114, - "margin_left": 99.0, - "margin_top": -37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 8, - "margin_top_bits": -3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G8", - "tag": 115, - "margin_left": 136.0, - "margin_top": -37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 11, - "margin_top_bits": -3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G9", - "tag": 116, - "margin_left": 173.0, - "margin_top": -37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 14, - "margin_top_bits": -3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "LOGO", - "tag": 128, - "margin_left": -45.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 0, - "image": "Logi_G910_logo.png", - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G1", - "tag": 108, - "margin_left": -45.0, - "margin_top": 37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G2", - "tag": 109, - "margin_left": -45.0, - "margin_top": 74.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 6, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G3", - "tag": 110, - "margin_left": -45.0, - "margin_top": 111.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 9, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G4", - "tag": 111, - "margin_left": -45.0, - "margin_top": 148.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 12, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "G5", - "tag": 112, - "margin_left": -45.0, - "margin_top": 185.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 15, - "enabled": true, - "absolute_location": true - } - ] +{ + "group_tag": "keyboard", + "origin_region": 1, + "grouped_keys": [ + { + "visualName": "G6", + "tag": 113, + "margin_left": 62.0, + "margin_top": -37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": 5, + "margin_top_bits": -3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G7", + "tag": 114, + "margin_left": 99.0, + "margin_top": -37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": 8, + "margin_top_bits": -3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G8", + "tag": 115, + "margin_left": 136.0, + "margin_top": -37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": 11, + "margin_top_bits": -3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G9", + "tag": 116, + "margin_left": 173.0, + "margin_top": -37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": 14, + "margin_top_bits": -3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "LOGO", + "tag": 128, + "margin_left": -45.0, + "margin_top": 0.0, + "width": 30.0, + "height": 30.0, + "font_size": 9.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 0, + "image": "Logi_G910_logo.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G1", + "tag": 108, + "margin_left": -45.0, + "margin_top": 37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G2", + "tag": 109, + "margin_left": -45.0, + "margin_top": 74.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G3", + "tag": 110, + "margin_left": -45.0, + "margin_top": 111.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 9, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G4", + "tag": 111, + "margin_left": -45.0, + "margin_top": 148.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 12, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "G5", + "tag": 112, + "margin_left": -45.0, + "margin_top": 185.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 15, + "enabled": true, + "absolute_location": true + } + ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g910_left_bottom_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g910_left_bottom_features.json similarity index 95% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g910_left_bottom_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g910_left_bottom_features.json index 2d5ac5530..4b3b6c013 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g910_left_bottom_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_g910_left_bottom_features.json @@ -1,22 +1,22 @@ -{ - "group_tag": "keyboard", - "origin_region": 3, - "grouped_keys": [ - { - "visualName": "BADGE", - "tag": 129, - "margin_left": 92.5, - "margin_top": 0.0, - "width": 79.0, - "height": 10.0, - "font_size": 9.0, - "width_bits": 8, - "height_bits": 1, - "margin_left_bits": 8, - "margin_top_bits": 0, - "image": "Logi_G910_badge.png", - "enabled": true, - "absolute_location": true - } - ] +{ + "group_tag": "keyboard", + "origin_region": 3, + "grouped_keys": [ + { + "visualName": "BADGE", + "tag": 129, + "margin_left": 92.5, + "margin_top": 0.0, + "width": 79.0, + "height": 10.0, + "font_size": 9.0, + "width_bits": 8, + "height_bits": 1, + "margin_left_bits": 8, + "margin_top_bits": 0, + "image": "Logi_G910_badge.png", + "enabled": true, + "absolute_location": true + } + ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g810_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_gpro_features.json similarity index 95% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g810_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_gpro_features.json index a0436cbaf..50e607a25 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/logitech_g810_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/logitech_gpro_features.json @@ -1,22 +1,22 @@ -{ - "group_tag": "keyboard", - "origin_region": 1, - "grouped_keys": [ - { - "visualName": "LOGO", - "tag": 128, - "margin_left": 0.0, - "margin_top": -37.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": -3, - "image": "Logi_G810_logo.png", - "enabled": true, - "absolute_location": true - }, - ] +{ + "group_tag": "keyboard", + "origin_region": 1, + "grouped_keys": [ + { + "visualName": "LOGO", + "tag": 128, + "margin_left": 0.0, + "margin_top": -37.0, + "width": 30.0, + "height": 30.0, + "font_size": 9.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": 0, + "margin_top_bits": -3, + "image": "Logi_G810_logo.png", + "enabled": true, + "absolute_location": true + }, + ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk730_bottom_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk730_bottom_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk730_bottom_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk730_bottom_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk730_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk730_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk730_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk730_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk730_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk730_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk730_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk730_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk750_bottom_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk750_bottom_features.json old mode 100755 new mode 100644 similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk750_bottom_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk750_bottom_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk750_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk750_left_features.json old mode 100755 new mode 100644 similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk750_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk750_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk750_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk750_right_features.json old mode 100755 new mode 100644 similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_mk750_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_mk750_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_pro_l_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_pro_l_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_pro_l_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_pro_l_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_pro_m_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_pro_m_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/masterkeys_pro_m_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/masterkeys_pro_m_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_four_zone_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_four_zone_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_four_zone_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_four_zone_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_outpost_plus_photon_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_outpost_plus_photon_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_outpost_plus_photon_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_outpost_plus_photon_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_photon_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_photon_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_photon_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_photon_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_sequencer_bottom_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_sequencer_bottom_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_sequencer_bottom_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_sequencer_bottom_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_sequencer_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_sequencer_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_sequencer_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_sequencer_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_sequencer_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_sequencer_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_sequencer_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_sequencer_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_vector_essentials_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_vector_essentials_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_vector_essentials_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_vector_essentials_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_vector_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_vector_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/omen_vector_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/omen_vector_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/razer_blackwidow_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/razer_blackwidow_features.json similarity index 95% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/razer_blackwidow_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/razer_blackwidow_features.json index 8709abd7a..c46bad3b3 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/razer_blackwidow_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/razer_blackwidow_features.json @@ -1,81 +1,81 @@ -{ - "group_tag": "keyboard", - "origin_region": 1, - "grouped_keys": [ - { - "visualName": "M1", - "tag": 108, - "margin_left": -38.0, - "margin_top": 37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M2", - "tag": 109, - "margin_left": -38.0, - "margin_top": 74.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 6, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M3", - "tag": 110, - "margin_left": -38.0, - "margin_top": 111.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 9, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M4", - "tag": 111, - "margin_left": -38.0, - "margin_top": 148.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 12, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M5", - "tag": 112, - "margin_left": -38.0, - "margin_top": 185.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 15, - "enabled": true, - "absolute_location": true - } - ] +{ + "group_tag": "keyboard", + "origin_region": 1, + "grouped_keys": [ + { + "visualName": "M1", + "tag": 108, + "margin_left": -38.0, + "margin_top": 37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M2", + "tag": 109, + "margin_left": -38.0, + "margin_top": 74.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M3", + "tag": 110, + "margin_left": -38.0, + "margin_top": 111.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 9, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M4", + "tag": 111, + "margin_left": -38.0, + "margin_top": 148.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 12, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M5", + "tag": 112, + "margin_left": -38.0, + "margin_top": 185.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 15, + "enabled": true, + "absolute_location": true + } + ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/razer_blackwidow_left_bottom_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/razer_blackwidow_left_bottom_features.json similarity index 95% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/razer_blackwidow_left_bottom_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/razer_blackwidow_left_bottom_features.json index 581152de8..f156b475b 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/razer_blackwidow_left_bottom_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/razer_blackwidow_left_bottom_features.json @@ -1,22 +1,22 @@ -{ - "group_tag": "keyboard", - "origin_region": 3, - "grouped_keys": [ - { - "visualName": "LOGO", - "tag": 128, - "margin_left": 395.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 32, - "margin_top_bits": 0, - "image": "Razer_logo.png", - "enabled": true, - "absolute_location": true - } - ] +{ + "group_tag": "keyboard", + "origin_region": 3, + "grouped_keys": [ + { + "visualName": "LOGO", + "tag": 128, + "margin_left": 395.0, + "margin_top": 0.0, + "width": 30.0, + "height": 30.0, + "font_size": 9.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": 32, + "margin_top_bits": 0, + "image": "Razer_logo.png", + "enabled": true, + "absolute_location": true + } + ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/roccat_ryos_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/roccat_ryos_features.json similarity index 95% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/roccat_ryos_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/roccat_ryos_features.json index 8709abd7a..c46bad3b3 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/roccat_ryos_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/roccat_ryos_features.json @@ -1,81 +1,81 @@ -{ - "group_tag": "keyboard", - "origin_region": 1, - "grouped_keys": [ - { - "visualName": "M1", - "tag": 108, - "margin_left": -38.0, - "margin_top": 37.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 3, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M2", - "tag": 109, - "margin_left": -38.0, - "margin_top": 74.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 6, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M3", - "tag": 110, - "margin_left": -38.0, - "margin_top": 111.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 9, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M4", - "tag": 111, - "margin_left": -38.0, - "margin_top": 148.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 12, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "M5", - "tag": 112, - "margin_left": -38.0, - "margin_top": 185.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": -4, - "margin_top_bits": 15, - "enabled": true, - "absolute_location": true - } - ] +{ + "group_tag": "keyboard", + "origin_region": 1, + "grouped_keys": [ + { + "visualName": "M1", + "tag": 108, + "margin_left": -38.0, + "margin_top": 37.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 3, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M2", + "tag": 109, + "margin_left": -38.0, + "margin_top": 74.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M3", + "tag": 110, + "margin_left": -38.0, + "margin_top": 111.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 9, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M4", + "tag": 111, + "margin_left": -38.0, + "margin_top": 148.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 12, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "M5", + "tag": 112, + "margin_left": -38.0, + "margin_top": 185.0, + "width": 30.0, + "height": 30.0, + "font_size": 12.0, + "width_bits": 3, + "height_bits": 3, + "margin_left_bits": -4, + "margin_top_bits": 15, + "enabled": true, + "absolute_location": true + } + ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/soundblasterx_vanguardk08_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/soundblasterx_vanguardk08_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/soundblasterx_vanguardk08_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/soundblasterx_vanguardk08_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/soundblasterx_vanguardk08_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/soundblasterx_vanguardk08_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/soundblasterx_vanguardk08_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/soundblasterx_vanguardk08_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m750_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m750_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m750_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m750_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m750_tkl_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m750_tkl_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m750_tkl_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m750_tkl_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m800_left_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m800_left_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m800_left_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m800_left_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m800_right_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m800_right_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_apex_m800_right_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_apex_m800_right_features.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_qck_prism_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_qck_prism_features.json similarity index 86% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_qck_prism_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_qck_prism_features.json index bab45fe22..3ddd82505 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/steelseries_qck_prism_features.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/steelseries_qck_prism_features.json @@ -1,5 +1,5 @@ { - "group_tag": "mouse", + "group_tag": "mousepad", "origin_region": 4, "grouped_keys": [ { @@ -15,34 +15,6 @@ "enabled": true, "absolute_location": true }, - { - "visualName": "Mouse Logo", - "tag": 160, - "margin_left": 90.0, - "margin_top": -111.0, - "width": 50.0, - "height": 50.0, - "width_bits": 2, - "height_bits": 2, - "margin_left_bits": 2, - "margin_top_bits": -6, - "enabled": true, - "absolute_location": true - }, - { - "visualName": "Scroll Wheel", - "tag": 161, - "margin_left": 90.0, - "margin_top": -171.0, - "width": 50.0, - "height": 50.0, - "width_bits": 2, - "height_bits": 2, - "margin_left_bits": 2, - "margin_top_bits": -6, - "enabled": true, - "absolute_location": true - }, { "visualName": "", "tag": 201, diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/wooting_two_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/wooting_two_features.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/wooting_two_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Extra Features/wooting_two_features.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/abnt2_layout.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/abnt2_layout.json new file mode 100644 index 000000000..381f80665 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/abnt2_layout.json @@ -0,0 +1,1276 @@ +{ + "keys": [ + { + "Key": { + "tag": 1, + "visual_name": "ESC" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 2, + "visual_name": "F1" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 62, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 3, + "visual_name": "F2" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 99, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 4, + "visual_name": "F3" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 136, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 5, + "visual_name": "F4" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 173, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 6, + "visual_name": "F5" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 237, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 7, + "visual_name": "F6" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 274, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 8, + "visual_name": "F7" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 311, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 9, + "visual_name": "F8" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 348, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 10, + "visual_name": "F9" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 407, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 11, + "visual_name": "F10" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 444, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 12, + "visual_name": "F11" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 481, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 13, + "visual_name": "F12" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 518, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 14, + "visual_name": "PRINT" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 562, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 15, + "visual_name": "SCRL\r\nLOCK" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 599, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 16, + "visual_name": "PAUSE" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 636, + "Y": 0, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 17, + "visual_name": "~" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 18, + "visual_name": "1" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 37, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 19, + "visual_name": "2" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 74, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 20, + "visual_name": "3" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 111, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 21, + "visual_name": "4" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 148, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 22, + "visual_name": "5" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 185, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 23, + "visual_name": "6" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 222, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 24, + "visual_name": "7" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 259, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 25, + "visual_name": "8" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 296, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 26, + "visual_name": "9" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 333, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 27, + "visual_name": "0" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 370, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 28, + "visual_name": "-" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 407, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 29, + "visual_name": "=" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 444, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 30, + "visual_name": "BACKSPACE" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 481, + "Y": 37, + "Width": 67, + "Height": 30 + }, + { + "Key": { + "tag": 31, + "visual_name": "INSERT" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 562, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 32, + "visual_name": "HOME" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 599, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 33, + "visual_name": "PAGE\r\nUP" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 636, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 34, + "visual_name": "NUM\r\nLOCK" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 680, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 35, + "visual_name": "/" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 717, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 36, + "visual_name": "*" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 754, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 37, + "visual_name": "-" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 791, + "Y": 37, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 38, + "visual_name": "TAB" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 74, + "Width": 50, + "Height": 30 + }, + { + "Key": { + "tag": 39, + "visual_name": "Q" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 57, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 40, + "visual_name": "W" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 94, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 41, + "visual_name": "E" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 131, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 42, + "visual_name": "R" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 168, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 43, + "visual_name": "T" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 205, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 44, + "visual_name": "Y" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 242, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 45, + "visual_name": "U" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 279, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 46, + "visual_name": "I" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 316, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 47, + "visual_name": "O" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 353, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 48, + "visual_name": "P" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 390, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 49, + "visual_name": "´" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 427, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 50, + "visual_name": "[" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 464, + "Y": 74, + "Width": 40, + "Height": 30 + }, + { + "Key": { + "tag": 52, + "visual_name": "DEL" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 562, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 53, + "visual_name": "END" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 599, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 54, + "visual_name": "PAGE\r\nDOWN" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 636, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 55, + "visual_name": "7" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 680, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 56, + "visual_name": "8" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 717, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 57, + "visual_name": "9" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 754, + "Y": 74, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 58, + "visual_name": "+" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 791, + "Y": 74, + "Width": 30, + "Height": 67 + }, + { + "Key": { + "tag": 59, + "visual_name": "CAPS\r\nLOCK" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 0, + "Y": 111, + "Width": 60, + "Height": 30 + }, + { + "Key": { + "tag": 60, + "visual_name": "A" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 67, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 61, + "visual_name": "S" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 104, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 62, + "visual_name": "D" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 141, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 63, + "visual_name": "F" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 178, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 64, + "visual_name": "G" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 215, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 65, + "visual_name": "H" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 252, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 66, + "visual_name": "J" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 289, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 67, + "visual_name": "K" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 326, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 68, + "visual_name": "L" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 363, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 69, + "visual_name": "Ç" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 400, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 70, + "visual_name": "~" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 437, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 71, + "visual_name": "]" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 474, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 72, + "visual_name": "ENTER" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 511, + "Y": 74, + "Width": 38, + "Height": 67 + }, + { + "Key": { + "tag": 73, + "visual_name": "4" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 680, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 74, + "visual_name": "5" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 717, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 75, + "visual_name": "6" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 754, + "Y": 111, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 76, + "visual_name": "SHIFT" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 148, + "Width": 48, + "Height": 30 + }, + { + "Key": { + "tag": 77, + "visual_name": "\\" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 55, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 78, + "visual_name": "Z" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 92, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 79, + "visual_name": "X" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 129, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 80, + "visual_name": "C" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 166, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 81, + "visual_name": "V" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 203, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 82, + "visual_name": "B" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 240, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 83, + "visual_name": "N" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 277, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 84, + "visual_name": "M" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 314, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 85, + "visual_name": "<" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 351, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 86, + "visual_name": ">" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 388, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 87, + "visual_name": ";" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 425, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 159, + "visual_name": "/" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 462, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 88, + "visual_name": "SHIFT" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 499, + "Y": 148, + "Width": 50, + "Height": 30 + }, + { + "Key": { + "tag": 89, + "visual_name": "↑" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 598, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 90, + "visual_name": "1" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 680, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 91, + "visual_name": "2" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 717, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 92, + "visual_name": "3" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 754, + "Y": 148, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 93, + "visual_name": "ENTER" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 791, + "Y": 148, + "Width": 30, + "Height": 67 + }, + { + "Key": { + "tag": 94, + "visual_name": "CTRL" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 185, + "Width": 51, + "Height": 30 + }, + { + "Key": { + "tag": 95, + "visual_name": "WIN" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 56, + "Y": 185, + "Width": 39, + "Height": 30 + }, + { + "Key": { + "tag": 96, + "visual_name": "ALT" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 100, + "Y": 185, + "Width": 42, + "Height": 30 + }, + { + "Key": { + "tag": 97, + "visual_name": "SPACE" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 149, + "Y": 185, + "Width": 208, + "Height": 30 + }, + { + "Key": { + "tag": 98, + "visual_name": "ALT Gr" + }, + "FontSize": 9.0, + "Enabled": true, + "X": 362, + "Y": 185, + "Width": 41, + "Height": 30 + }, + { + "Key": { + "tag": 99, + "visual_name": "WIN" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 408, + "Y": 185, + "Width": 41, + "Height": 30 + }, + { + "Key": { + "tag": 100, + "visual_name": "APP" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 454, + "Y": 185, + "Width": 40, + "Height": 30 + }, + { + "Key": { + "tag": 101, + "visual_name": "CTRL" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 499, + "Y": 185, + "Width": 50, + "Height": 30 + }, + { + "Key": { + "tag": 102, + "visual_name": "←" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 561, + "Y": 185, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 103, + "visual_name": "↓" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 598, + "Y": 185, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 104, + "visual_name": "→" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 635, + "Y": 185, + "Width": 30, + "Height": 30 + }, + { + "Key": { + "tag": 105, + "visual_name": "0" + }, + "FontSize": 12.0, + "Enabled": true, + "X": 680, + "Y": 185, + "Width": 67, + "Height": 30 + }, + { + "Key": { + "tag": 106, + "visual_name": "." + }, + "FontSize": 12.0, + "Enabled": true, + "X": 754, + "Y": 185, + "Width": 30, + "Height": 30 + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/ansi_layout.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/ansi_layout.json new file mode 100644 index 000000000..a7d63b135 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/ansi_layout.json @@ -0,0 +1,1462 @@ +{ + "layout_width":0, + "layout_height":0, + "keys":[ + { + "Key":{ + "visual_name":"ESC", + "tag":1, + "device_id":null + }, + "X":0, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F1", + "tag":2, + "device_id":null + }, + "X":62, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F2", + "tag":3, + "device_id":null + }, + "X":99, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F3", + "tag":4, + "device_id":null + }, + "X":136, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F4", + "tag":5, + "device_id":null + }, + "X":173, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F5", + "tag":6, + "device_id":null + }, + "X":237, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F6", + "tag":7, + "device_id":null + }, + "X":274, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F7", + "tag":8, + "device_id":null + }, + "X":311, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F8", + "tag":9, + "device_id":null + }, + "X":348, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F9", + "tag":10, + "device_id":null + }, + "X":407, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F10", + "tag":11, + "device_id":null + }, + "X":444, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F11", + "tag":12, + "device_id":null + }, + "X":481, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F12", + "tag":13, + "device_id":null + }, + "X":518, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"PRINT", + "tag":14, + "device_id":null + }, + "X":563, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"SCRL\r\nLOCK", + "tag":15, + "device_id":null + }, + "X":600, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"PAUSE", + "tag":16, + "device_id":null + }, + "X":637, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"~", + "tag":17, + "device_id":null + }, + "X":0, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"1", + "tag":18, + "device_id":null + }, + "X":37, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"2", + "tag":19, + "device_id":null + }, + "X":74, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"3", + "tag":20, + "device_id":null + }, + "X":111, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"4", + "tag":21, + "device_id":null + }, + "X":148, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"5", + "tag":22, + "device_id":null + }, + "X":185, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"6", + "tag":23, + "device_id":null + }, + "X":222, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"7", + "tag":24, + "device_id":null + }, + "X":259, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"8", + "tag":25, + "device_id":null + }, + "X":296, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"9", + "tag":26, + "device_id":null + }, + "X":333, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"0", + "tag":27, + "device_id":null + }, + "X":370, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"-", + "tag":28, + "device_id":null + }, + "X":407, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"=", + "tag":29, + "device_id":null + }, + "X":444, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"BACKSPACE", + "tag":30, + "device_id":null + }, + "X":481, + "Y":37, + "Width":67, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"INSERT", + "tag":31, + "device_id":null + }, + "X":563, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"HOME", + "tag":32, + "device_id":null + }, + "X":600, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"PAGE\r\nUP", + "tag":33, + "device_id":null + }, + "X":637, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"NUM\r\nLOCK", + "tag":34, + "device_id":null + }, + "X":682, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"/", + "tag":35, + "device_id":null + }, + "X":719, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"*", + "tag":36, + "device_id":null + }, + "X":756, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"-", + "tag":37, + "device_id":null + }, + "X":793, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"TAB", + "tag":38, + "device_id":null + }, + "X":0, + "Y":74, + "Width":50, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"Q", + "tag":39, + "device_id":null + }, + "X":57, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"W", + "tag":40, + "device_id":null + }, + "X":94, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"E", + "tag":41, + "device_id":null + }, + "X":131, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"R", + "tag":42, + "device_id":null + }, + "X":168, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"T", + "tag":43, + "device_id":null + }, + "X":205, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"Y", + "tag":44, + "device_id":null + }, + "X":242, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"U", + "tag":45, + "device_id":null + }, + "X":279, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"I", + "tag":46, + "device_id":null + }, + "X":316, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"O", + "tag":47, + "device_id":null + }, + "X":353, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"P", + "tag":48, + "device_id":null + }, + "X":390, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"{", + "tag":49, + "device_id":null + }, + "X":427, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"}", + "tag":50, + "device_id":null + }, + "X":464, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"\\", + "tag":51, + "device_id":null + }, + "X":501, + "Y":74, + "Width":47, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"DEL", + "tag":52, + "device_id":null + }, + "X":563, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"END", + "tag":53, + "device_id":null + }, + "X":600, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"PAGE\r\nDOWN", + "tag":54, + "device_id":null + }, + "X":637, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"7", + "tag":55, + "device_id":null + }, + "X":682, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"8", + "tag":56, + "device_id":null + }, + "X":719, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"9", + "tag":57, + "device_id":null + }, + "X":756, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"+", + "tag":58, + "device_id":null + }, + "X":793, + "Y":74, + "Width":30, + "Height":67, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"CAPS\r\nLOCK", + "tag":59, + "device_id":null + }, + "X":0, + "Y":111, + "Width":60, + "Height":30, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"A", + "tag":60, + "device_id":null + }, + "X":67, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"S", + "tag":61, + "device_id":null + }, + "X":104, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"D", + "tag":62, + "device_id":null + }, + "X":141, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"F", + "tag":63, + "device_id":null + }, + "X":178, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"G", + "tag":64, + "device_id":null + }, + "X":215, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"H", + "tag":65, + "device_id":null + }, + "X":252, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"J", + "tag":66, + "device_id":null + }, + "X":289, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"K", + "tag":67, + "device_id":null + }, + "X":326, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"L", + "tag":68, + "device_id":null + }, + "X":363, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":":", + "tag":69, + "device_id":null + }, + "X":400, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"\"", + "tag":70, + "device_id":null + }, + "X":437, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":72, + "device_id":null + }, + "X":474, + "Y":111, + "Width":74, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"4", + "tag":73, + "device_id":null + }, + "X":681, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"5", + "tag":74, + "device_id":null + }, + "X":718, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"6", + "tag":75, + "device_id":null + }, + "X":755, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":76, + "device_id":null + }, + "X":0, + "Y":148, + "Width":78, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"Z", + "tag":78, + "device_id":null + }, + "X":85, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"X", + "tag":79, + "device_id":null + }, + "X":122, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"C", + "tag":80, + "device_id":null + }, + "X":159, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"V", + "tag":81, + "device_id":null + }, + "X":196, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"B", + "tag":82, + "device_id":null + }, + "X":233, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"N", + "tag":83, + "device_id":null + }, + "X":270, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"M", + "tag":84, + "device_id":null + }, + "X":307, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"<", + "tag":85, + "device_id":null + }, + "X":344, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":">", + "tag":86, + "device_id":null + }, + "X":381, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"?", + "tag":87, + "device_id":null + }, + "X":418, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":88, + "device_id":null + }, + "X":455, + "Y":148, + "Width":93, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"↑", + "tag":89, + "device_id":null + }, + "X":600, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"1", + "tag":90, + "device_id":null + }, + "X":681, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"2", + "tag":91, + "device_id":null + }, + "X":718, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"3", + "tag":92, + "device_id":null + }, + "X":755, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":93, + "device_id":null + }, + "X":792, + "Y":148, + "Width":30, + "Height":67, + "Image":"", + "FontSize":9.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":94, + "device_id":null + }, + "X":0, + "Y":185, + "Width":51, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"WIN", + "tag":95, + "device_id":null + }, + "X":56, + "Y":185, + "Width":39, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"ALT", + "tag":96, + "device_id":null + }, + "X":100, + "Y":185, + "Width":42, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"SPACE", + "tag":97, + "device_id":null + }, + "X":149, + "Y":185, + "Width":208, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"ALT", + "tag":98, + "device_id":null + }, + "X":362, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"WIN", + "tag":99, + "device_id":null + }, + "X":408, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"APP", + "tag":100, + "device_id":null + }, + "X":454, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":101, + "device_id":null + }, + "X":500, + "Y":185, + "Width":48, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"←", + "tag":102, + "device_id":null + }, + "X":563, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"↓", + "tag":103, + "device_id":null + }, + "X":600, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"→", + "tag":104, + "device_id":null + }, + "X":637, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":"0", + "tag":105, + "device_id":null + }, + "X":681, + "Y":185, + "Width":67, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + }, + { + "Key":{ + "visual_name":".", + "tag":106, + "device_id":null + }, + "X":755, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "FontSize":12.0, + "Enabled":true + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/iso_layout.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/iso_layout.json new file mode 100644 index 000000000..8d00a4633 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/iso_layout.json @@ -0,0 +1,1581 @@ +{ + "layout_width":800, + "layout_height":400, + "keys":[ + { + "Key":{ + "visual_name":"ESC", + "tag":1, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F1", + "tag":2, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":62, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F2", + "tag":3, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":99, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F3", + "tag":4, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":136, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F4", + "tag":5, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":173, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F5", + "tag":6, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":237, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F6", + "tag":7, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":274, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F7", + "tag":8, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":311, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F8", + "tag":9, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":348, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F9", + "tag":10, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":407, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F10", + "tag":11, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":444, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F11", + "tag":12, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":481, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F12", + "tag":13, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":518, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PRINT", + "tag":14, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SCRL\r\nLOCK", + "tag":15, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAUSE", + "tag":16, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"`", + "tag":17, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"1", + "tag":18, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":37, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"2", + "tag":19, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":74, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"3", + "tag":20, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":111, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"4", + "tag":21, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":148, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"5", + "tag":22, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":185, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"6", + "tag":23, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":222, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"7", + "tag":24, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":259, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"8", + "tag":25, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":296, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"9", + "tag":26, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":333, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"0", + "tag":27, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":370, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"-", + "tag":28, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":407, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"=", + "tag":29, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":444, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"BACKSPACE", + "tag":30, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":481, + "Y":37, + "Width":67, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"INSERT", + "tag":31, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"HOME", + "tag":32, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAGE\r\nUP", + "tag":33, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"NUM\r\nLOCK", + "tag":34, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":680, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"/", + "tag":35, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"*", + "tag":36, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"-", + "tag":37, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":791, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"TAB", + "tag":38, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":74, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Q", + "tag":39, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":57, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"W", + "tag":40, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":94, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"E", + "tag":41, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":131, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"R", + "tag":42, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":168, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"T", + "tag":43, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":205, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Y", + "tag":44, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":242, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"U", + "tag":45, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":279, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"I", + "tag":46, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":316, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"O", + "tag":47, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":353, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"P", + "tag":48, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":390, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"{", + "tag":49, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":427, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"}", + "tag":50, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":464, + "Y":74, + "Width":40, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"DEL", + "tag":52, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"END", + "tag":53, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAGE\r\nDOWN", + "tag":54, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"7", + "tag":55, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"8", + "tag":56, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"9", + "tag":57, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"+", + "tag":58, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":791, + "Y":74, + "Width":30, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CAPS\r\nLOCK", + "tag":59, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":0, + "Y":111, + "Width":60, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"A", + "tag":60, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":67, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"S", + "tag":61, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":104, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"D", + "tag":62, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":141, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F", + "tag":63, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":178, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"G", + "tag":64, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":215, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"H", + "tag":65, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":252, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"J", + "tag":66, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":289, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"K", + "tag":67, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":326, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"L", + "tag":68, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":363, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":":", + "tag":69, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":400, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"'", + "tag":70, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":437, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"#", + "tag":71, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":474, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":72, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":511, + "Y":74, + "Width":38, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"4", + "tag":73, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"5", + "tag":74, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"6", + "tag":75, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":76, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":148, + "Width":48, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"\\", + "tag":77, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":55, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Z", + "tag":78, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":92, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"X", + "tag":79, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":129, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"C", + "tag":80, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":166, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"V", + "tag":81, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":203, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"B", + "tag":82, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":240, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"N", + "tag":83, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":277, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"M", + "tag":84, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":314, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"<", + "tag":85, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":351, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":">", + "tag":86, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":388, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"?", + "tag":87, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":425, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":88, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":462, + "Y":148, + "Width":87, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"↑", + "tag":89, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":598, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"1", + "tag":90, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"2", + "tag":91, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"3", + "tag":92, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":93, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":791, + "Y":148, + "Width":30, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":94, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":185, + "Width":51, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"WIN", + "tag":95, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":56, + "Y":185, + "Width":39, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ALT", + "tag":96, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":100, + "Y":185, + "Width":42, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SPACE", + "tag":97, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":149, + "Y":185, + "Width":208, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ALT Gr", + "tag":98, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":362, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"WIN", + "tag":99, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":408, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"APP", + "tag":100, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":454, + "Y":185, + "Width":40, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":101, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":499, + "Y":185, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"←", + "tag":102, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":561, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"↓", + "tag":103, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":598, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"→", + "tag":104, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":635, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"0", + "tag":105, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":185, + "Width":67, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":".", + "tag":106, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/isocafr_layout.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/isocafr_layout.json new file mode 100644 index 000000000..efbc2a8aa --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/isocafr_layout.json @@ -0,0 +1,1581 @@ +{ + "layout_width":800, + "layout_height":400, + "keys":[ + { + "Key":{ + "visual_name":"ESC", + "tag":1, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F1", + "tag":2, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":62, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F2", + "tag":3, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":99, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F3", + "tag":4, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":136, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F4", + "tag":5, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":173, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F5", + "tag":6, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":237, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F6", + "tag":7, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":274, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F7", + "tag":8, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":311, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F8", + "tag":9, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":348, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F9", + "tag":10, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":407, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F10", + "tag":11, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":444, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F11", + "tag":12, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":481, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F12", + "tag":13, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":518, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PRINT", + "tag":14, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SCRL\r\nLOCK", + "tag":15, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAUSE", + "tag":16, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"`", + "tag":71, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"1", + "tag":18, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":37, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"2", + "tag":19, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":74, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"3", + "tag":20, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":111, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"4", + "tag":21, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":148, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"5", + "tag":22, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":185, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"6", + "tag":23, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":222, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"7", + "tag":24, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":259, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"8", + "tag":25, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":296, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"9", + "tag":26, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":333, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"0", + "tag":27, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":370, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"-", + "tag":28, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":407, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"=", + "tag":29, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":444, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"BACKSPACE", + "tag":30, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":481, + "Y":37, + "Width":67, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"INSERT", + "tag":31, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"HOME", + "tag":32, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAGE\r\nUP", + "tag":33, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"NUM\r\nLOCK", + "tag":34, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":680, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"/", + "tag":35, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"*", + "tag":36, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"-", + "tag":37, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":791, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"TAB", + "tag":38, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":74, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Q", + "tag":39, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":57, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"W", + "tag":40, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":94, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"E", + "tag":41, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":131, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"R", + "tag":42, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":168, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"T", + "tag":43, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":205, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Y", + "tag":44, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":242, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"U", + "tag":45, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":279, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"I", + "tag":46, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":316, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"O", + "tag":47, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":353, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"P", + "tag":48, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":390, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"{", + "tag":49, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":427, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"}", + "tag":50, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":464, + "Y":74, + "Width":40, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"DEL", + "tag":52, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"END", + "tag":53, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAGE\r\nDOWN", + "tag":54, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"7", + "tag":55, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"8", + "tag":56, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"9", + "tag":57, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"+", + "tag":58, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":791, + "Y":74, + "Width":30, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CAPS\r\nLOCK", + "tag":59, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":0, + "Y":111, + "Width":60, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"A", + "tag":60, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":67, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"S", + "tag":61, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":104, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"D", + "tag":62, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":141, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F", + "tag":63, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":178, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"G", + "tag":64, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":215, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"H", + "tag":65, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":252, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"J", + "tag":66, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":289, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"K", + "tag":67, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":326, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"L", + "tag":68, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":363, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":":", + "tag":69, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":400, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"'", + "tag":70, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":437, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"#", + "tag":17, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":474, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":72, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":511, + "Y":74, + "Width":38, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"4", + "tag":73, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"5", + "tag":74, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"6", + "tag":75, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":76, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":148, + "Width":48, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"\\", + "tag":77, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":55, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Z", + "tag":78, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":92, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"X", + "tag":79, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":129, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"C", + "tag":80, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":166, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"V", + "tag":81, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":203, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"B", + "tag":82, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":240, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"N", + "tag":83, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":277, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"M", + "tag":84, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":314, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"<", + "tag":85, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":351, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":">", + "tag":86, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":388, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"?", + "tag":87, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":425, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":88, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":462, + "Y":148, + "Width":87, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"↑", + "tag":89, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":598, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"1", + "tag":90, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"2", + "tag":91, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"3", + "tag":92, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":93, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":791, + "Y":148, + "Width":30, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":94, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":185, + "Width":51, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"WIN", + "tag":95, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":56, + "Y":185, + "Width":39, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ALT", + "tag":96, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":100, + "Y":185, + "Width":42, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SPACE", + "tag":97, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":149, + "Y":185, + "Width":208, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ALT Gr", + "tag":98, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":362, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"WIN", + "tag":99, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":408, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"APP", + "tag":100, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":454, + "Y":185, + "Width":40, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":101, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":499, + "Y":185, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"←", + "tag":102, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":561, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"↓", + "tag":103, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":598, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"→", + "tag":104, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":635, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"0", + "tag":105, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":185, + "Width":67, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":".", + "tag":106, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/jpn_layout.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/jpn_layout.json new file mode 100644 index 000000000..3e0d7770d --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Plain Keyboard/jpn_layout.json @@ -0,0 +1,1626 @@ +{ + "layout_width":0, + "layout_height":0, + "keys":[ + { + "Key":{ + "visual_name":"ESC", + "tag":1, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F1", + "tag":2, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":62, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F2", + "tag":3, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":99, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F3", + "tag":4, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":136, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F4", + "tag":5, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":173, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F5", + "tag":6, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":237, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F6", + "tag":7, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":274, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F7", + "tag":8, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":311, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F8", + "tag":9, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":348, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F9", + "tag":10, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":407, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F10", + "tag":11, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":444, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F11", + "tag":12, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":481, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F12", + "tag":13, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":518, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PRINT", + "tag":14, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SCRL\r\nLOCK", + "tag":15, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAUSE", + "tag":16, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":0, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"半角/\r\n全角", + "tag":17, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":0, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"1", + "tag":18, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":37, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"2", + "tag":19, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":74, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"3", + "tag":20, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":111, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"4", + "tag":21, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":148, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"5", + "tag":22, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":185, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"6", + "tag":23, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":222, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"7", + "tag":24, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":259, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"8", + "tag":25, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":296, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"9", + "tag":26, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":333, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"0", + "tag":27, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":370, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"-", + "tag":28, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":407, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"^", + "tag":29, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":444, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"¥", + "tag":156, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":481, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"BACK", + "tag":30, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":518, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"INSERT", + "tag":31, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"HOME", + "tag":32, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAGE\r\nUP", + "tag":33, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"NUM\r\nLOCK", + "tag":34, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":680, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"/", + "tag":35, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"*", + "tag":36, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"-", + "tag":37, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":791, + "Y":37, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"TAB", + "tag":38, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":74, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Q", + "tag":39, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":57, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"W", + "tag":40, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":94, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"E", + "tag":41, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":131, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"R", + "tag":42, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":168, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"T", + "tag":43, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":205, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Y", + "tag":44, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":242, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"U", + "tag":45, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":279, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"I", + "tag":46, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":316, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"O", + "tag":47, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":353, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"P", + "tag":48, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":390, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"@", + "tag":49, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":427, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"[", + "tag":50, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":464, + "Y":74, + "Width":40, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"DEL", + "tag":52, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":562, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"END", + "tag":53, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":599, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"PAGE\r\nDOWN", + "tag":54, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":636, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"7", + "tag":55, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"8", + "tag":56, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"9", + "tag":57, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":74, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"+", + "tag":58, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":791, + "Y":74, + "Width":30, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CAPS\r\nLOCK", + "tag":59, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":0, + "Y":111, + "Width":60, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"A", + "tag":60, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":67, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"S", + "tag":61, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":104, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"D", + "tag":62, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":141, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"F", + "tag":63, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":178, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"G", + "tag":64, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":215, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"H", + "tag":65, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":252, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"J", + "tag":66, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":289, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"K", + "tag":67, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":326, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"L", + "tag":68, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":363, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":";", + "tag":69, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":400, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":":", + "tag":70, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":437, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"]", + "tag":71, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":474, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":72, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":511, + "Y":74, + "Width":38, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"4", + "tag":73, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"5", + "tag":74, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"6", + "tag":75, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":111, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":76, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":148, + "Width":85, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"Z", + "tag":78, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":92, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"X", + "tag":79, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":129, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"C", + "tag":80, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":166, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"V", + "tag":81, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":203, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"B", + "tag":82, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":240, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"N", + "tag":83, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":277, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"M", + "tag":84, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":314, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"<", + "tag":85, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":351, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":">", + "tag":86, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":388, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"/", + "tag":87, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":425, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"\\", + "tag":77, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":462, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SHIFT", + "tag":88, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":499, + "Y":148, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"↑", + "tag":89, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":598, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"1", + "tag":90, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"2", + "tag":91, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":717, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"3", + "tag":92, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":148, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ENTER", + "tag":93, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":791, + "Y":148, + "Width":30, + "Height":67, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":94, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":0, + "Y":185, + "Width":51, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"WIN", + "tag":95, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":56, + "Y":185, + "Width":39, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ALT", + "tag":96, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":100, + "Y":185, + "Width":42, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"無変換", + "tag":153, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":147, + "Y":185, + "Width":42, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"SPACE", + "tag":97, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":196, + "Y":185, + "Width":133, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"変換", + "tag":98, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":336, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"カタカナ/\r\nひらがな", + "tag":155, + "device_id":null + }, + "FontSize":9.0, + "Enabled":true, + "X":373, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"ALT", + "tag":99, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":408, + "Y":185, + "Width":41, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"APP", + "tag":100, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":454, + "Y":185, + "Width":40, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"CTRL", + "tag":101, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":499, + "Y":185, + "Width":50, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"←", + "tag":102, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":561, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"↓", + "tag":103, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":598, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"→", + "tag":104, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":635, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":"0", + "tag":105, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":680, + "Y":185, + "Width":67, + "Height":30, + "Image":"", + "IsImage":false + }, + { + "Key":{ + "visual_name":".", + "tag":106, + "device_id":null + }, + "FontSize":12.0, + "Enabled":true, + "X":754, + "Y":185, + "Width":30, + "Height":30, + "Image":"", + "IsImage":false + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2ND_35X.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2ND_35X.json new file mode 100644 index 000000000..21b755c2d --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2ND_35X.json @@ -0,0 +1,508 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 14, + 15, + 16, + 99 + ], + "key_modifications": { + "2": { + "VisualName": null, + "X": 37, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "3": { + "VisualName": null, + "X": 74, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "4": { + "VisualName": null, + "X": 111, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "5": { + "VisualName": null, + "X": 148, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "6": { + "VisualName": null, + "X": 185, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "7": { + "VisualName": null, + "X": 222, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "8": { + "VisualName": null, + "X": 259, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "9": { + "VisualName": null, + "X": 296, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "10": { + "VisualName": null, + "X": 333, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "11": { + "VisualName": null, + "X": 370, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "12": { + "VisualName": null, + "X": 407, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "13": { + "VisualName": null, + "X": 444, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "31": { + "VisualName": null, + "X": 481, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "32": { + "VisualName": "Home", + "X": 555, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "33": { + "VisualName": "PGUP", + "X": 629, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "34": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "35": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "36": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "37": { + "VisualName": null, + "X": 666, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "51": { + "VisualName": null, + "X": null, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": 9.0, + "Enabled": null + }, + "52": { + "VisualName": null, + "X": 518, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "53": { + "VisualName": null, + "X": 592, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "54": { + "VisualName": "PGDN", + "X": 666, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "55": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "56": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "57": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "58": { + "VisualName": null, + "X": 666, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "73": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "74": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "75": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "88": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -37, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "89": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "90": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "91": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "92": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "93": { + "VisualName": null, + "X": 666, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "94": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -10, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "95": { + "VisualName": null, + "X": 85, + "Y": null, + "Width": -9, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "96": { + "VisualName": null, + "X": 122, + "Y": null, + "Width": -12, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "97": { + "VisualName": null, + "X": 159, + "Y": null, + "Width": -30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "98": { + "VisualName": null, + "X": 344, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "100": { + "VisualName": "App", + "X": 381, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "101": { + "VisualName": null, + "X": 418, + "Y": null, + "Width": 8, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "102": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "103": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "104": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "105": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": -37, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "106": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "107": { + "Key": { + "visual_name": "FN", + "tag": 107, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 48, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2P1_550.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2P1_550.json new file mode 100644 index 000000000..4afd44610 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2P1_550.json @@ -0,0 +1,365 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 15, + 16, + 34, + 35, + 36, + 37, + 55, + 56, + 57, + 58, + 73, + 74, + 75, + 90, + 91, + 92, + 93, + 99, + 105, + 106 + ], + "key_modifications": { + "2": { + "VisualName": null, + "X": 37, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "3": { + "VisualName": null, + "X": 74, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "4": { + "VisualName": null, + "X": 111, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "5": { + "VisualName": null, + "X": 148, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "6": { + "VisualName": null, + "X": 185, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "7": { + "VisualName": null, + "X": 222, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "8": { + "VisualName": null, + "X": 259, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "9": { + "VisualName": null, + "X": 296, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "10": { + "VisualName": null, + "X": 333, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "11": { + "VisualName": null, + "X": 370, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "12": { + "VisualName": null, + "X": 407, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "13": { + "VisualName": null, + "X": 444, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "14": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "31": { + "VisualName": null, + "X": 481, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "32": { + "VisualName": "Home", + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "33": { + "VisualName": "PGUP", + "X": 555, + "Y": 74, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "51": { + "VisualName": null, + "X": null, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": 9.0, + "Enabled": null + }, + "52": { + "VisualName": null, + "X": 555, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "53": { + "VisualName": null, + "X": 555, + "Y": 148, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "54": { + "VisualName": "PGDN", + "X": 555, + "Y": 111, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "88": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -37, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "89": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "94": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -10, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "95": { + "VisualName": null, + "X": 85, + "Y": null, + "Width": -9, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "96": { + "VisualName": null, + "X": 122, + "Y": null, + "Width": -12, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "97": { + "VisualName": null, + "X": 159, + "Y": null, + "Width": -30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "98": { + "VisualName": null, + "X": 344, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "100": { + "VisualName": "App", + "X": 381, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "101": { + "VisualName": null, + "X": 418, + "Y": null, + "Width": 8, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "102": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "103": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "104": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "107": { + "Key": { + "visual_name": "FN", + "tag": 107, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 48, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + }, + "jis_key_modifications": {} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2P2_650.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2P2_650.json new file mode 100644 index 000000000..c81b277ab --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/Uniwill2P2_650.json @@ -0,0 +1,473 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 15, + 31, + 32, + 33, + 53, + 54, + 93, + 99 + ], + "key_modifications": { + "2": { + "VisualName": null, + "X": 37, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "3": { + "VisualName": null, + "X": 74, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "4": { + "VisualName": null, + "X": 111, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "5": { + "VisualName": null, + "X": 148, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "6": { + "VisualName": null, + "X": 185, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "7": { + "VisualName": null, + "X": 222, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "8": { + "VisualName": null, + "X": 259, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "9": { + "VisualName": null, + "X": 296, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "10": { + "VisualName": null, + "X": 333, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "11": { + "VisualName": null, + "X": 370, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "12": { + "VisualName": null, + "X": 407, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "13": { + "VisualName": null, + "X": 444, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "14": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "16": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "34": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "35": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "36": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "37": { + "VisualName": null, + "X": 592, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "51": { + "VisualName": null, + "X": null, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": 9.0, + "Enabled": null + }, + "52": { + "VisualName": null, + "X": 555, + "Y": 0, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "55": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "56": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "57": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "58": { + "VisualName": null, + "X": 629, + "Y": 0, + "Width": null, + "Height": -37, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "73": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "74": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "75": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "88": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -37, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "89": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "90": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "91": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "92": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "94": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -10, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "95": { + "VisualName": null, + "X": 85, + "Y": null, + "Width": -9, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "96": { + "VisualName": null, + "X": 122, + "Y": null, + "Width": -12, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "97": { + "VisualName": null, + "X": 159, + "Y": null, + "Width": -30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "98": { + "VisualName": null, + "X": 344, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "100": { + "VisualName": "App", + "X": 381, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "101": { + "VisualName": null, + "X": 418, + "Y": null, + "Width": 8, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "102": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "103": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "104": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "105": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": -37, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "106": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "107": { + "Key": { + "visual_name": "FN", + "tag": 107, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 48, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } +}, + "jis_key_modifications": {} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/asus_strix_flare.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/asus_strix_flare.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/asus_strix_flare.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/asus_strix_flare.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/asus_strix_scope.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/asus_strix_scope.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/asus_strix_scope.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/asus_strix_scope.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/cooler_master_sk650.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/cooler_master_sk650.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/cooler_master_sk650.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/cooler_master_sk650.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_k65.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k65.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_k65.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k65.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_k68.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k68.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_k68.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k68.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_k70.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k70.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_k70.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k70.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_k70_mk2.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k70_mk2.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_k70_mk2.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k70_mk2.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_k95.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k95.json similarity index 52% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_k95.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k95.json index a2459c37e..60eebda8e 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/corsair_k95.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k95.json @@ -2,7 +2,7 @@ "keys_to_remove": [], "key_modifications": {}, "included_features": [ - "corsair_k95_left_features.json", - "corsair_k95_right_features.json" + "corsair_k95_right_features.json", + "corsair_k95_left_features.json" ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k95_platinum.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k95_platinum.json new file mode 100644 index 000000000..25615a03d --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_k95_platinum.json @@ -0,0 +1,487 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "139": { + "Key": { + "visual_name": "MUTE", + "tag": 139, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 717, + "Y": -37, + "Width": 30, + "Height": 24, + "Image": "", + "IsImage": false + }, + "136": { + "Key": { + "visual_name": "STOP", + "tag": 136, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 680, + "Y": 0, + "Width": 30, + "Height": 24, + "Image": "", + "IsImage": false + }, + "137": { + "Key": { + "visual_name": "PREV", + "tag": 137, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 717, + "Y": 0, + "Width": 30, + "Height": 24, + "Image": "", + "IsImage": false + }, + "133": { + "Key": { + "visual_name": "PLAY", + "tag": 133, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 754, + "Y": 0, + "Width": 30, + "Height": 24, + "Image": "", + "IsImage": false + }, + "138": { + "Key": { + "visual_name": "NEXT", + "tag": 138, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 791, + "Y": 0, + "Width": 30, + "Height": 24, + "Image": "", + "IsImage": false + }, + "142": { + "Key": { + "visual_name": "", + "tag": 142, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -47, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "143": { + "Key": { + "visual_name": "", + "tag": 143, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -1, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "144": { + "Key": { + "visual_name": "", + "tag": 144, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 45, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "145": { + "Key": { + "visual_name": "", + "tag": 145, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 91, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "146": { + "Key": { + "visual_name": "", + "tag": 146, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 137, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "147": { + "Key": { + "visual_name": "", + "tag": 147, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 183, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "148": { + "Key": { + "visual_name": "", + "tag": 148, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 229, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "149": { + "Key": { + "visual_name": "", + "tag": 149, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 275, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "150": { + "Key": { + "visual_name": "", + "tag": 150, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 321, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "151": { + "Key": { + "visual_name": "", + "tag": 151, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 367, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "172": { + "Key": { + "visual_name": "", + "tag": 172, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 413, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "173": { + "Key": { + "visual_name": "", + "tag": 173, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 459, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "174": { + "Key": { + "visual_name": "", + "tag": 174, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 505, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "175": { + "Key": { + "visual_name": "", + "tag": 175, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 551, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "176": { + "Key": { + "visual_name": "", + "tag": 176, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 597, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "177": { + "Key": { + "visual_name": "", + "tag": 177, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 643, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "178": { + "Key": { + "visual_name": "", + "tag": 178, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 689, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "179": { + "Key": { + "visual_name": "", + "tag": 179, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 735, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "180": { + "Key": { + "visual_name": "", + "tag": 180, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 781, + "Y": -54, + "Width": 46, + "Height": 10, + "Image": "", + "IsImage": false + }, + "131": { + "Key": { + "visual_name": "LIGHTS", + "tag": 131, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 104, + "Y": -37, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "132": { + "Key": { + "visual_name": "LOCK", + "tag": 132, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 141, + "Y": -37, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "108": { + "Key": { + "visual_name": "G1", + "tag": 108, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -43, + "Y": 0, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "109": { + "Key": { + "visual_name": "G2", + "tag": 109, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -43, + "Y": 37, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "110": { + "Key": { + "visual_name": "G3", + "tag": 110, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -43, + "Y": 74, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "111": { + "Key": { + "visual_name": "G4", + "tag": 111, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -43, + "Y": 111, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "112": { + "Key": { + "visual_name": "G5", + "tag": 112, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -43, + "Y": 148, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "113": { + "Key": { + "visual_name": "G6", + "tag": 113, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": -43, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_sabre.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_sabre.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_sabre.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_sabre.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_strafe.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_strafe.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_strafe.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_strafe.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/corsair_strafe_mk2.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_strafe_mk2.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/corsair_strafe_mk2.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/corsair_strafe_mk2.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/drevo_blademaster.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/drevo_blademaster.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/drevo_blademaster.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/drevo_blademaster.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/ducky_one_2_rgb_tkl.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/ducky_one_2_rgb_tkl.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/ducky_one_2_rgb_tkl.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/ducky_one_2_rgb_tkl.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/ducky_shine_7.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/ducky_shine_7.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/ducky_shine_7.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/ducky_shine_7.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/generic_laptop.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/generic_laptop.json new file mode 100644 index 000000000..4adb42d18 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/generic_laptop.json @@ -0,0 +1,315 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 16, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 73, + 74, + 75, + 90, + 91, + 92, + 93, + 99, + 100, + 105, + 106 + ], + "key_modifications": { + "2": { + "VisualName": null, + "X": 37, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "3": { + "VisualName": null, + "X": 74, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "4": { + "VisualName": null, + "X": 111, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "5": { + "VisualName": null, + "X": 148, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "6": { + "VisualName": null, + "X": 185, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "7": { + "VisualName": null, + "X": 222, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "8": { + "VisualName": null, + "X": 259, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "9": { + "VisualName": null, + "X": 296, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "10": { + "VisualName": null, + "X": 333, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "11": { + "VisualName": null, + "X": 370, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "12": { + "VisualName": null, + "X": 407, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "13": { + "VisualName": null, + "X": 444, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "14": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "15": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "51": { + "VisualName": null, + "X": null, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": 9.0, + "Enabled": null + }, + "89": { + "VisualName": null, + "X": 486, + "Y": 185, + "Width": null, + "Height": -17, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "94": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -10, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "95": { + "VisualName": null, + "X": 85, + "Y": null, + "Width": -9, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "96": { + "VisualName": null, + "X": 122, + "Y": null, + "Width": -12, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "97": { + "VisualName": null, + "X": 159, + "Y": null, + "Width": -30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "98": { + "VisualName": null, + "X": 344, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "101": { + "VisualName": null, + "X": 418, + "Y": null, + "Width": -18, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "102": { + "VisualName": null, + "X": 455, + "Y": null, + "Width": -6, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "103": { + "VisualName": null, + "X": 486, + "Y": 202, + "Width": null, + "Height": -17, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "104": { + "VisualName": null, + "X": 523, + "Y": null, + "Width": -6, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "107": { + "Key": { + "visual_name": "FN", + "tag": 107, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 381, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "171": { + "Key": { + "visual_name": "FN", + "tag": 171, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 48, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/generic_laptop_numpad.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/generic_laptop_numpad.json new file mode 100644 index 000000000..dbed1a2bc --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/generic_laptop_numpad.json @@ -0,0 +1,468 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 16, + 31, + 32, + 33, + 52, + 53, + 54, + 99, + 100 + ], + "key_modifications": { + "2": { + "VisualName": null, + "X": 37, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "3": { + "VisualName": null, + "X": 74, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "4": { + "VisualName": null, + "X": 111, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "5": { + "VisualName": null, + "X": 148, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "6": { + "VisualName": null, + "X": 185, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "7": { + "VisualName": null, + "X": 222, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "8": { + "VisualName": null, + "X": 259, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "9": { + "VisualName": null, + "X": 296, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "10": { + "VisualName": null, + "X": 333, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "11": { + "VisualName": null, + "X": 370, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "12": { + "VisualName": null, + "X": 407, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "13": { + "VisualName": null, + "X": 444, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "14": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "15": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "34": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "35": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "36": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "37": { + "VisualName": null, + "X": 666, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "51": { + "VisualName": null, + "X": null, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": 9.0, + "Enabled": null + }, + "55": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "56": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "57": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "58": { + "VisualName": null, + "X": 666, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "73": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "74": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "75": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "89": { + "VisualName": null, + "X": 486, + "Y": 185, + "Width": null, + "Height": -17, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "90": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "91": { + "VisualName": null, + "X": 592, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "92": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "93": { + "VisualName": null, + "X": 666, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "94": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -10, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "95": { + "VisualName": null, + "X": 85, + "Y": null, + "Width": -9, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "96": { + "VisualName": null, + "X": 122, + "Y": null, + "Width": -12, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "97": { + "VisualName": null, + "X": 159, + "Y": null, + "Width": -30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "98": { + "VisualName": null, + "X": 344, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "101": { + "VisualName": null, + "X": 418, + "Y": null, + "Width": -18, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "102": { + "VisualName": null, + "X": 455, + "Y": null, + "Width": -6, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "103": { + "VisualName": null, + "X": 486, + "Y": 202, + "Width": null, + "Height": -17, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "104": { + "VisualName": null, + "X": 523, + "Y": null, + "Width": -6, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "105": { + "VisualName": null, + "X": 555, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "106": { + "VisualName": null, + "X": 629, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "171": { + "Key": { + "visual_name": "FN", + "tag": 171, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 48, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "107": { + "Key": { + "visual_name": "FN", + "tag": 107, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 381, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/hyperx_alloy_elite_rgb.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/hyperx_alloy_elite_rgb.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/hyperx_alloy_elite_rgb.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/hyperx_alloy_elite_rgb.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Plain Keyboard/layout.dvorak.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/keychron_q1_knob_ansi.json similarity index 73% rename from Project-Aurora/Project-Aurora/kb_layouts/Plain Keyboard/layout.dvorak.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/keychron_q1_knob_ansi.json index 481f596a4..bab051016 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Plain Keyboard/layout.dvorak.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/keychron_q1_knob_ansi.json @@ -1,41 +1,32 @@ -{ - "key_conversion": { - 70: 39, - 85: 40, - 86: 41, - 48: 42, - 44: 43, - 63: 44, - 64: 45, - 80: 46, - 42: 47, - 68: 48, - 87: 49, - 29: 50, - 47: 61, - 41: 62, - 45: 63, - 46: 64, - 62: 65, - 65: 66, - 43: 67, - 83: 68, - 61: 69, - 28: 70, - 51: 71, - 69: 78, - 39: 79, - 66: 80, - 67: 81, - 79: 82, - 82: 83, - 84: 84, - 40: 85, - 81: 86, - 78: 87 - }, - "keys": [ - { +{ + "keys_to_remove": [ + 14, + 15, + 16, + 31, + 34, + 35, + 36, + 37, + 53, + 55, + 56, + 57, + 58, + 73, + 74, + 75, + 90, + 91, + 92, + 93, + 99, + 100, + 105, + 106 + ], + "key_modifications": { + "1": { "visualName": "ESC", "tag": 1, "line_break": false, @@ -50,22 +41,22 @@ "margin_top_bits": 0, "enabled": true }, - { + "2": { "visualName": "F1", "tag": 2, "line_break": false, - "margin_left": 32.0, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, "font_size": 12.0, "width_bits": 3, "height_bits": 3, - "margin_left_bits": 2, + "margin_left_bits": 1, "margin_top_bits": 0, "enabled": true }, - { + "3": { "visualName": "F2", "tag": 3, "line_break": false, @@ -80,7 +71,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "4": { "visualName": "F3", "tag": 4, "line_break": false, @@ -95,7 +86,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "5": { "visualName": "F4", "tag": 5, "line_break": false, @@ -110,22 +101,22 @@ "margin_top_bits": 0, "enabled": true }, - { + "6": { "visualName": "F5", "tag": 6, "line_break": false, - "margin_left": 34.0, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, "font_size": 12.0, "width_bits": 3, "height_bits": 3, - "margin_left_bits": 2, + "margin_left_bits": 1, "margin_top_bits": 0, "enabled": true }, - { + "7": { "visualName": "F6", "tag": 7, "line_break": false, @@ -140,7 +131,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "8": { "visualName": "F7", "tag": 8, "line_break": false, @@ -155,7 +146,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "9": { "visualName": "F8", "tag": 9, "line_break": false, @@ -170,22 +161,22 @@ "margin_top_bits": 0, "enabled": true }, - { + "10": { "visualName": "F9", "tag": 10, "line_break": false, - "margin_left": 29.0, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, "font_size": 12.0, "width_bits": 3, "height_bits": 3, - "margin_left_bits": 2, + "margin_left_bits": 1, "margin_top_bits": 0, "enabled": true }, - { + "11": { "visualName": "F10", "tag": 11, "line_break": false, @@ -200,7 +191,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "12": { "visualName": "F11", "tag": 12, "line_break": false, @@ -215,7 +206,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "13": { "visualName": "F12", "tag": 13, "line_break": false, @@ -230,52 +221,26 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "PRINT", - "tag": 14, - "line_break": false, - "margin_left": 15.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 1, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "SCRL\r\nLOCK", + "52": { "tag": 15, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true + "margin_left": 7.0 }, - { - "visualName": "PAUSE", - "tag": 16, + "15": { + "visualName": "DEL", + "tag": 52, "line_break": true, - "margin_left": 7.0, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, - "font_size": 9.0, + "font_size": 12.0, "width_bits": 3, "height_bits": 3, - "margin_left_bits": 0, + "margin_left_bits": 1, "margin_top_bits": 0, "enabled": true }, - { + "17": { "visualName": "~", "tag": 17, "line_break": false, @@ -290,7 +255,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "18": { "visualName": "1", "tag": 18, "line_break": false, @@ -305,7 +270,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "19": { "visualName": "2", "tag": 19, "line_break": false, @@ -320,7 +285,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "20": { "visualName": "3", "tag": 20, "line_break": false, @@ -335,7 +300,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "21": { "visualName": "4", "tag": 21, "line_break": false, @@ -350,7 +315,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "22": { "visualName": "5", "tag": 22, "line_break": false, @@ -365,7 +330,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "23": { "visualName": "6", "tag": 23, "line_break": false, @@ -380,7 +345,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "24": { "visualName": "7", "tag": 24, "line_break": false, @@ -395,7 +360,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "25": { "visualName": "8", "tag": 25, "line_break": false, @@ -410,7 +375,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "26": { "visualName": "9", "tag": 26, "line_break": false, @@ -425,7 +390,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "27": { "visualName": "0", "tag": 27, "line_break": false, @@ -440,7 +405,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "28": { "visualName": "-", "tag": 28, "line_break": false, @@ -455,7 +420,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "29": { "visualName": "=", "tag": 29, "line_break": false, @@ -470,71 +435,26 @@ "margin_top_bits": 0, "enabled": true }, - { + "30": { "visualName": "BACKSPACE", "tag": 30, "line_break": false, "margin_left": 7.0, "margin_top": 0.0, - "width": 67.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 6, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "INSERT", - "tag": 31, - "line_break": false, - "margin_left": 15.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 1, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "HOME", - "tag": 32, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, + "width": 60.0, "height": 30.0, "font_size": 9.0, - "width_bits": 3, + "width_bits": 6, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "33": { "visualName": "PAGE\r\nUP", "tag": 33, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "NUM\r\nLOCK", - "tag": 34, - "line_break": false, - "margin_left": 15.0, + "line_break": true, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, @@ -545,58 +465,13 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "/", - "tag": 35, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "*", - "tag": 36, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "-", - "tag": 37, - "line_break": true, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { + "38": { "visualName": "TAB", "tag": 38, "line_break": false, "margin_left": 0.0, "margin_top": 0.0, - "width": 50.0, + "width": 45.0, "height": 30.0, "font_size": 12.0, "width_bits": 4, @@ -605,8 +480,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "'", + "39": { + "visualName": "Q", "tag": 39, "line_break": false, "margin_left": 7.0, @@ -620,8 +495,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": ",", + "40": { + "visualName": "W", "tag": 40, "line_break": false, "margin_left": 7.0, @@ -635,8 +510,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": ".", + "41": { + "visualName": "E", "tag": 41, "line_break": false, "margin_left": 7.0, @@ -650,8 +525,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "P", + "42": { + "visualName": "R", "tag": 42, "line_break": false, "margin_left": 7.0, @@ -665,8 +540,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "Y", + "43": { + "visualName": "T", "tag": 43, "line_break": false, "margin_left": 7.0, @@ -680,8 +555,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "F", + "44": { + "visualName": "Y", "tag": 44, "line_break": false, "margin_left": 7.0, @@ -695,8 +570,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "G", + "45": { + "visualName": "U", "tag": 45, "line_break": false, "margin_left": 7.0, @@ -710,8 +585,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "C", + "46": { + "visualName": "I", "tag": 46, "line_break": false, "margin_left": 7.0, @@ -725,8 +600,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "R", + "47": { + "visualName": "O", "tag": 47, "line_break": false, "margin_left": 7.0, @@ -740,8 +615,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "L", + "48": { + "visualName": "P", "tag": 48, "line_break": false, "margin_left": 7.0, @@ -755,8 +630,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "/", + "49": { + "visualName": "{", "tag": 49, "line_break": false, "margin_left": 7.0, @@ -770,8 +645,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "=", + "50": { + "visualName": "}", "tag": 50, "line_break": false, "margin_left": 7.0, @@ -785,133 +660,43 @@ "margin_top_bits": 0, "enabled": true }, - { + "51": { "visualName": "\\", "tag": 51, "line_break": false, "margin_left": 7.0, "margin_top": 0.0, - "width": 47.0, + "width": 45.0, "height": 30.0, "font_size": 12.0, - "width_bits": 5, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "DEL", - "tag": 52, - "line_break": false, - "margin_left": 15.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 1, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "END", - "tag": 53, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 9.0, - "width_bits": 3, + "width_bits": 4, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "54": { "visualName": "PAGE\r\nDOWN", "tag": 54, - "line_break": false, - "margin_left": 7.0, + "line_break": true, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, "font_size": 9.0, "width_bits": 3, "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "7", - "tag": 55, - "line_break": false, - "margin_left": 15.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, "margin_left_bits": 1, "margin_top_bits": 0, "enabled": true }, - { - "visualName": "8", - "tag": 56, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "9", - "tag": 57, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "+", - "tag": 58, - "line_break": true, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 67.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 6, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { + "59": { "visualName": "CAPS\r\nLOCK", "tag": 59, "line_break": false, "margin_left": 0.0, "margin_top": 0.0, - "width": 60.0, + "width": 52.5, "height": 30.0, "font_size": 9.0, "width_bits": 5, @@ -920,7 +705,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "60": { "visualName": "A", "tag": 60, "line_break": false, @@ -935,8 +720,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "O", + "61": { + "visualName": "S", "tag": 61, "line_break": false, "margin_left": 7.0, @@ -950,8 +735,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "E", + "62": { + "visualName": "D", "tag": 62, "line_break": false, "margin_left": 7.0, @@ -965,8 +750,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "U", + "63": { + "visualName": "F", "tag": 63, "line_break": false, "margin_left": 7.0, @@ -980,8 +765,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "I", + "64": { + "visualName": "G", "tag": 64, "line_break": false, "margin_left": 7.0, @@ -995,8 +780,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "D", + "65": { + "visualName": "H", "tag": 65, "line_break": false, "margin_left": 7.0, @@ -1010,8 +795,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "H", + "66": { + "visualName": "J", "tag": 66, "line_break": false, "margin_left": 7.0, @@ -1025,8 +810,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "T", + "67": { + "visualName": "K", "tag": 67, "line_break": false, "margin_left": 7.0, @@ -1040,8 +825,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "N", + "68": { + "visualName": "L", "tag": 68, "line_break": false, "margin_left": 7.0, @@ -1055,8 +840,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "S", + "69": { + "visualName": ":", "tag": 69, "line_break": false, "margin_left": 7.0, @@ -1070,8 +855,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "-", + "70": { + "visualName": "\"", "tag": 70, "line_break": false, "margin_left": 7.0, @@ -1085,7 +870,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "72": { "visualName": "ENTER", "tag": 72, "line_break": false, @@ -1100,68 +885,42 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "4", + "32": { "tag": 73, - "line_break": false, - "margin_left": 133.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 11, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "5", - "tag": 74, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true + "margin_left": 7.0 }, - { - "visualName": "6", - "tag": 75, + "73": { + "visualName": "HOME", + "tag": 32, "line_break": true, - "margin_left": 7.0, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, - "font_size": 12.0, + "font_size": 9.0, "width_bits": 3, "height_bits": 3, - "margin_left_bits": 0, + "margin_left_bits": 1, "margin_top_bits": 0, "enabled": true }, - { + "76": { "visualName": "SHIFT", "tag": 76, "line_break": false, "margin_left": 0.0, "margin_top": 0.0, - "width": 78.0, + "width": 67.5, "height": 30.0, "font_size": 12.0, - "width_bits": 7, + "width_bits": 6, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { - "visualName": ";", + "78": { + "visualName": "Z", "tag": 78, "line_break": false, "margin_left": 7.0, @@ -1175,8 +934,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "Q", + "79": { + "visualName": "X", "tag": 79, "line_break": false, "margin_left": 7.0, @@ -1190,8 +949,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "J", + "80": { + "visualName": "C", "tag": 80, "line_break": false, "margin_left": 7.0, @@ -1205,8 +964,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "K", + "81": { + "visualName": "V", "tag": 81, "line_break": false, "margin_left": 7.0, @@ -1220,8 +979,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "X", + "82": { + "visualName": "B", "tag": 82, "line_break": false, "margin_left": 7.0, @@ -1235,8 +994,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "B", + "83": { + "visualName": "N", "tag": 83, "line_break": false, "margin_left": 7.0, @@ -1250,7 +1009,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "84": { "visualName": "M", "tag": 84, "line_break": false, @@ -1265,8 +1024,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "W", + "85": { + "visualName": "<", "tag": 85, "line_break": false, "margin_left": 7.0, @@ -1280,8 +1039,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "V", + "86": { + "visualName": ">", "tag": 86, "line_break": false, "margin_left": 7.0, @@ -1295,8 +1054,8 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "Z", + "87": { + "visualName": "?", "tag": 87, "line_break": false, "margin_left": 7.0, @@ -1310,55 +1069,25 @@ "margin_top_bits": 0, "enabled": true }, - { + "88": { "visualName": "SHIFT", "tag": 88, "line_break": false, "margin_left": 7.0, "margin_top": 0.0, - "width": 93.0, + "width": 52.5, "height": 30.0, "font_size": 12.0, - "width_bits": 8, + "width_bits": 5, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "89": { "visualName": "↑", "tag": 89, - "line_break": false, - "margin_left": 52.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 4, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "1", - "tag": 90, - "line_break": false, - "margin_left": 51.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 4, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "2", - "tag": 91, - "line_break": false, + "line_break": true, "margin_left": 7.0, "margin_top": 0.0, "width": 30.0, @@ -1370,13 +1099,13 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "3", - "tag": 92, + "101": { + "visualName": "CTRL", + "tag": 101, "line_break": false, "margin_left": 7.0, "margin_top": 0.0, - "width": 30.0, + "width": 37.5, "height": 30.0, "font_size": 12.0, "width_bits": 3, @@ -1385,146 +1114,101 @@ "margin_top_bits": 0, "enabled": true }, - { - "visualName": "ENTER", - "tag": 93, - "line_break": true, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 67.0, - "font_size": 9.0, - "width_bits": 3, - "height_bits": 6, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "CTRL", - "tag": 94, + "96": { + "visualName": "ALT", + "tag": 96, "line_break": false, - "margin_left": 0.0, + "margin_left": 7.0, "margin_top": 0.0, - "width": 51.0, + "width": 37.5, "height": 30.0, "font_size": 12.0, - "width_bits": 4, + "width_bits": 3, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "95": { "visualName": "WIN", "tag": 95, "line_break": false, - "margin_left": 5.0, - "margin_top": 0.0, - "width": 39.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 4, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "ALT", - "tag": 96, - "line_break": false, - "margin_left": 5.0, + "margin_left": 7.0, "margin_top": 0.0, - "width": 42.0, + "width": 37.5, "height": 30.0, "font_size": 12.0, - "width_bits": 4, + "width_bits": 3, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "97": { "visualName": "SPACE", "tag": 97, "line_break": false, "margin_left": 7.0, "margin_top": 0.0, - "width": 208.0, + "width": 187.5, "height": 30.0, "font_size": 12.0, - "width_bits": 17, + "width_bits": 18, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "98": { "visualName": "ALT", "tag": 98, "line_break": false, - "margin_left": 5.0, - "margin_top": 0.0, - "width": 41.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 4, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "WIN", - "tag": 99, - "line_break": false, - "margin_left": 5.0, + "margin_left": 7.0, "margin_top": 0.0, - "width": 41.0, + "width": 30.0, "height": 30.0, "font_size": 12.0, - "width_bits": 4, + "width_bits": 3, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { - "visualName": "APP", - "tag": 100, + "99": { + "visualName": "FN", + "tag": 107, "line_break": false, - "margin_left": 5.0, + "margin_left": 7.0, "margin_top": 0.0, - "width": 41.0, + "width": 30.0, "height": 30.0, "font_size": 12.0, - "width_bits": 4, + "width_bits": 3, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "101": { "visualName": "CTRL", "tag": 101, "line_break": false, - "margin_left": 5.0, + "margin_left": 7.0, "margin_top": 0.0, - "width": 48.0, + "width": 30.0, "height": 30.0, "font_size": 12.0, - "width_bits": 4, + "width_bits": 3, "height_bits": 3, "margin_left_bits": 0, "margin_top_bits": 0, "enabled": true }, - { + "102": { "visualName": "←", "tag": 102, "line_break": false, - "margin_left": 15.0, + "margin_left": 14.0, "margin_top": 0.0, "width": 30.0, "height": 30.0, @@ -1535,7 +1219,7 @@ "margin_top_bits": 0, "enabled": true }, - { + "103": { "visualName": "↓", "tag": 103, "line_break": false, @@ -1550,39 +1234,9 @@ "margin_top_bits": 0, "enabled": true }, - { + "104": { "visualName": "→", "tag": 104, - "line_break": false, - "margin_left": 7.0, - "margin_top": 0.0, - "width": 30.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 3, - "height_bits": 3, - "margin_left_bits": 0, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": "0", - "tag": 105, - "line_break": false, - "margin_left": 14.0, - "margin_top": 0.0, - "width": 67.0, - "height": 30.0, - "font_size": 12.0, - "width_bits": 6, - "height_bits": 3, - "margin_left_bits": 1, - "margin_top_bits": 0, - "enabled": true - }, - { - "visualName": ".", - "tag": 106, "line_break": true, "margin_left": 7.0, "margin_top": 0.0, @@ -1595,5 +1249,5 @@ "margin_top_bits": 0, "enabled": true } - ] + } } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_g213.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g213.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_g213.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g213.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_g410.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g410.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_g410.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g410.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_g513.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g513.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_g513.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g513.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_g810.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g810.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_g810.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g810.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_g815.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g815.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_g815.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g815.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_g910.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g910.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_g910.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g910.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g915.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g915.json new file mode 100644 index 000000000..070e2a133 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_g915.json @@ -0,0 +1,7 @@ +{ + "keys_to_remove": [], + "key_modifications": {}, + "included_features": [ + "logitech_g915_features.json" + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/logitech_gpro.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_gpro.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/logitech_gpro.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/logitech_gpro.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/masterkeys_mk730.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_mk730.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/masterkeys_mk730.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_mk730.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/masterkeys_mk750.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_mk750.json old mode 100755 new mode 100644 similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/masterkeys_mk750.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_mk750.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_l.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_l.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_l.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_l.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_m.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_m.json new file mode 100644 index 000000000..8f1bc8568 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_m.json @@ -0,0 +1,207 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 14, + 15, + 16, + 31, + 32, + 33, + 52, + 53, + 54, + 89, + 102, + 103, + 104 + ], + "key_modifications": { + "34": { + "VisualName": null, + "X": 563, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "35": { + "VisualName": null, + "X": 600, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "36": { + "VisualName": null, + "X": 637, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "37": { + "VisualName": null, + "X": 674, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "55": { + "VisualName": null, + "X": 563, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "56": { + "VisualName": null, + "X": 600, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "57": { + "VisualName": null, + "X": 637, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "58": { + "VisualName": null, + "X": 674, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "73": { + "VisualName": null, + "X": 563, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "74": { + "VisualName": null, + "X": 600, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "75": { + "VisualName": null, + "X": 637, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "90": { + "VisualName": null, + "X": 563, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "91": { + "VisualName": null, + "X": 600, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "92": { + "VisualName": null, + "X": 637, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "93": { + "VisualName": null, + "X": 674, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "105": { + "VisualName": null, + "X": 563, + "Y": null, + "Width": 30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "106": { + "VisualName": null, + "X": 637, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "169": { + "Key": { + "visual_name": "00", + "tag": 169, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 600, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_s.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_s.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_s.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/masterkeys_pro_s.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Uniwill2P1_550_US.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/msi_gp66_us.json similarity index 68% rename from Project-Aurora/Project-Aurora/kb_layouts/Uniwill2P1_550_US.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/msi_gp66_us.json index ae6e72223..1e2f122a2 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/Uniwill2P1_550_US.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/msi_gp66_us.json @@ -29,77 +29,106 @@ 92, 93, 99, + 100, 105, 106 ], "key_modifications": { + "1": { + "tag": 1, + "height": 15 + }, "2": { "tag": 2, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "3": { "tag": 3, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "4": { "tag": 4, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "5": { "tag": 5, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "6": { "tag": 6, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "7": { "tag": 7, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "8": { "tag": 8, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "9": { "tag": 9, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "10": { "tag": 10, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "11": { "tag": 11, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "12": { "tag": 12, - "margin_left": 7.0 + "margin_left": 9.5, + "height": 15 }, "13": { "tag": 13, "line_break": true, - "margin_left": 7.0 + "margin_left": 7.0, + "height": 15 + }, + + "17": { + "visualName": "`", + "tag": 17, + "width": 15 }, "30": { "tag": 30, "line_break": true, - "margin_left": 7.0 + "margin_left": 7.0, + "width": 80 }, + "38": { + "width": 35 + }, + "49": { + "visualName": "[" + }, "50": { + "visualName": "]", "line_break": true, "width": 30 }, - "51": { - "margin_left": 7, - - "width": 30 + "59": { + "width": 48.0 }, //key ~ @@ -115,23 +144,16 @@ "line_break": true, "margin_left": 7.0, "margin_top": 0, - "width": 76.0, + "width": 85.0, "height": 30.0, "font_size": 12.0 }, - //"73": { - // "margin_left": 7 - //}, - ////number 6 - //"75": { - // "line_break": true - //}, //left shift "76": { "tag": 76, "margin_left": 0.0, "margin_top": 0.0, - "width": 77.0, + "width": 68.0, "height": 30.0, "font_size": 12.0 }, @@ -146,7 +168,7 @@ "88": { "tag": 88, "line_break": null, - "width": 57 + "width": 65 }, //"↑" @@ -158,18 +180,14 @@ "90": { "margin_left": 7.0 }, - ////Number enter - //"93": { - // "line_break": true - //}, //LeftControl "94": { "tag": 94, - "width": 41 + "width": 68 }, "95": { "tag": 95, - "margin_left": 44, + "margin_left": 7, "width": 30 }, "96": { @@ -186,42 +204,24 @@ "margin_left": 7, "width": 30 }, - "100": { - "visualName": "App", - "tag": 100, - "margin_left": 7, - "width": 30 - }, //Rith control "101": { "tag": 101, - "margin_left": 7, - "width": 58 + "margin_left": 80, + "width": 30 }, "102": { "tag": 102, "margin_left": 7.0 - }, "104": { "tag": 104, "line_break": true } - //"105": { - // "margin_left": 7.0, - // "width": 30 - //}, - //"106": { - // "line_break": true - //} - - }, "included_features": [ - "keyboard21_numpad_left_bottom_features.json", - "keyboard21us_numpad_right_features.json" - + "msi_gp66_features.json" ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/omen_four_zone.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/omen_four_zone.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/omen_four_zone.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/omen_four_zone.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/omen_sequencer.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/omen_sequencer.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/omen_sequencer.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/omen_sequencer.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/razer_blackwidow.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blackwidow.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/razer_blackwidow.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blackwidow.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/razer_blackwidow_te.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blackwidow_te.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/razer_blackwidow_te.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blackwidow_te.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/razer_blackwidow_x.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blackwidow_x.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/razer_blackwidow_x.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blackwidow_x.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blade.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blade.json new file mode 100644 index 000000000..4adb42d18 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/razer_blade.json @@ -0,0 +1,315 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [ + 16, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 73, + 74, + 75, + 90, + 91, + 92, + 93, + 99, + 100, + 105, + 106 + ], + "key_modifications": { + "2": { + "VisualName": null, + "X": 37, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "3": { + "VisualName": null, + "X": 74, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "4": { + "VisualName": null, + "X": 111, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "5": { + "VisualName": null, + "X": 148, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "6": { + "VisualName": null, + "X": 185, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "7": { + "VisualName": null, + "X": 222, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "8": { + "VisualName": null, + "X": 259, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "9": { + "VisualName": null, + "X": 296, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "10": { + "VisualName": null, + "X": 333, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "11": { + "VisualName": null, + "X": 370, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "12": { + "VisualName": null, + "X": 407, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "13": { + "VisualName": null, + "X": 444, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "14": { + "VisualName": null, + "X": 481, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "15": { + "VisualName": null, + "X": 518, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "51": { + "VisualName": null, + "X": null, + "Y": null, + "Width": null, + "Height": null, + "Image": null, + "FontSize": 9.0, + "Enabled": null + }, + "89": { + "VisualName": null, + "X": 486, + "Y": 185, + "Width": null, + "Height": -17, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "94": { + "VisualName": null, + "X": null, + "Y": null, + "Width": -10, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "95": { + "VisualName": null, + "X": 85, + "Y": null, + "Width": -9, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "96": { + "VisualName": null, + "X": 122, + "Y": null, + "Width": -12, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "97": { + "VisualName": null, + "X": 159, + "Y": null, + "Width": -30, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "98": { + "VisualName": null, + "X": 344, + "Y": null, + "Width": -11, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "101": { + "VisualName": null, + "X": 418, + "Y": null, + "Width": -18, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "102": { + "VisualName": null, + "X": 455, + "Y": null, + "Width": -6, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "103": { + "VisualName": null, + "X": 486, + "Y": 202, + "Width": null, + "Height": -17, + "Image": null, + "FontSize": null, + "Enabled": null + }, + "104": { + "VisualName": null, + "X": 523, + "Y": null, + "Width": -6, + "Height": null, + "Image": null, + "FontSize": null, + "Enabled": null + } + }, + "key_to_add": { + "107": { + "Key": { + "visual_name": "FN", + "tag": 107, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 381, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + }, + "171": { + "Key": { + "visual_name": "FN", + "tag": 171, + "device_id": null + }, + "FontSize": 9.0, + "Enabled": true, + "X": 48, + "Y": 185, + "Width": 30, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/roccat_ryos.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/roccat_ryos.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/roccat_ryos.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/roccat_ryos.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_m.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/roccat_vulcan_tkl.json old mode 100755 new mode 100644 similarity index 66% rename from Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_m.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/roccat_vulcan_tkl.json index 575469c7f..f21b686a6 --- a/Project-Aurora/Project-Aurora/kb_layouts/masterkeys_pro_m.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/roccat_vulcan_tkl.json @@ -1,47 +1,34 @@ { "keys_to_remove": [ - 14, 15, 16, - 31, - 32, - 33, - 52, - 53, - 54, - 89, - 102, - 103, - 104 + 34, + 35, + 36, + 37, + 55, + 56, + 57, + 58, + 73, + 74, + 75, + 90, + 91, + 92, + 93, + 105, + 106 ], - "key_conversion": { - 14: 35, - 15: 36, - 16: 37, - - - 31: 55, - 32: 56, - 33: 57, - - 52: 73, - 53: 74, - 54: 75, - - 89: 91, - 102: 105, - 103: 169, - 104: 106 - }, "key_modifications": { - "13": { - "visualName": null, - "tag": 13, + "14": { + "visualName": "MUTE", + "tag": 139, "line_break": true, - "margin_left": null, - "margin_top": null, - "width": null, - "height": null, + "margin_left": 16, + "margin_top": 8, + "width": 26, + "height": 14, "font_size": null, "width_bits": null, "height_bits": null, @@ -49,9 +36,9 @@ "margin_top_bits": null, "enabled": null }, - "37": { + "33": { "visualName": null, - "tag": 37, + "tag": 33, "line_break": true, "margin_left": null, "margin_top": null, @@ -64,9 +51,9 @@ "margin_top_bits": null, "enabled": null }, - "58": { + "54": { "visualName": null, - "tag": 58, + "tag": 54, "line_break": true, "margin_left": null, "margin_top": null, @@ -79,24 +66,9 @@ "margin_top_bits": null, "enabled": null }, - "73": { - "visualName": null, - "tag": 73, - "line_break": null, - "margin_left": 15, - "margin_top": null, - "width": null, - "height": null, - "font_size": null, - "width_bits": null, - "height_bits": null, - "margin_left_bits": 1, - "margin_top_bits": null, - "enabled": null - }, - "75": { + "72": { "visualName": null, - "tag": 75, + "tag": 72, "line_break": true, "margin_left": null, "margin_top": null, @@ -109,24 +81,24 @@ "margin_top_bits": null, "enabled": null }, - "90": { + "89": { "visualName": null, - "tag": 90, - "line_break": null, - "margin_left": 15, + "tag": 89, + "line_break": true, + "margin_left": null, "margin_top": null, "width": null, "height": null, "font_size": null, "width_bits": null, "height_bits": null, - "margin_left_bits": 1, + "margin_left_bits": null, "margin_top_bits": null, "enabled": null }, - "93": { + "104": { "visualName": null, - "tag": 93, + "tag": 104, "line_break": true, "margin_left": null, "margin_top": null, @@ -139,13 +111,13 @@ "margin_top_bits": null, "enabled": null }, - "105": { - "visualName": null, - "tag": 105, + "99": { + "visualName": "FN", + "tag": 107, "line_break": null, "margin_left": null, "margin_top": null, - "width": 30.0, + "width": null, "height": null, "font_size": null, "width_bits": null, @@ -154,11 +126,11 @@ "margin_top_bits": null, "enabled": null }, - "106": { - "visualName": null, - "tag": 106, + "97": { + "visualName": "SPACE", + "tag": 97, "line_break": null, - "margin_left": 44.0, + "margin_left": null, "margin_top": null, "width": null, "height": null, @@ -167,10 +139,10 @@ "height_bits": null, "margin_left_bits": null, "margin_top_bits": null, - "enabled": null + "enabled": true } }, "included_features": [ - "masterkeys_pro_m_features.json" + "roccat_vulcan_tkl_features.json" ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/soundblasterx_vanguardk08.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/soundblasterx_vanguardk08.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/soundblasterx_vanguardk08.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/soundblasterx_vanguardk08.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m750.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m750.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m750.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m750.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m750_tkl.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m750_tkl.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m750_tkl.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m750_tkl.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m800.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m800.json similarity index 89% rename from Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m800.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m800.json index 08c84f7f8..49557166e 100644 --- a/Project-Aurora/Project-Aurora/kb_layouts/steelseries_apex_m800.json +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/steelseries_apex_m800.json @@ -33,7 +33,7 @@ } }, "included_features": [ - "steelseries_apex_m800_left_features.json", - "steelseries_apex_m800_right_features.json" + "steelseries_apex_m800_right_features.json", + "steelseries_apex_m800_left_features.json" ] } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/wooting_one.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/wooting_one.json old mode 100755 new mode 100644 similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/wooting_one.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/wooting_one.json diff --git a/Project-Aurora/Project-Aurora/kb_layouts/wooting_two.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/wooting_two.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/wooting_two.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Keyboard/wooting_two.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Asus - Pugio.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Asus - Pugio.json new file mode 100644 index 000000000..9526bbcac --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Asus - Pugio.json @@ -0,0 +1,67 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 128, + "Height": 232, + "Image": "Asus_Pugio_body.png", + "IsImage": true + }, + "161": { + "Key": { + "visual_name": "Scroll Wheel", + "tag": 161, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 56, + "Y": 22, + "Width": 14, + "Height": 41, + "Image": "Asus_Pugio_wheel.png", + "IsImage": true + }, + "162": { + "Key": { + "visual_name": "Bottom Light", + "tag": 162, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": -1, + "Y": 130, + "Width": 128, + "Height": 103, + "Image": "Asus_Pugio_backlights.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 41, + "Y": 187, + "Width": 46, + "Height": 24, + "Image": "Asus_Pugio_logo.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Clevo - Touchpad.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Clevo - Touchpad.json new file mode 100644 index 000000000..402cfebd1 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Clevo - Touchpad.json @@ -0,0 +1,22 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "0": { + "Key": { + "visual_name": "TOUCHPAD", + "tag": 0, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 208, + "Height": 30, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - Katar.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - Katar.json new file mode 100644 index 000000000..8c99e3f12 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - Katar.json @@ -0,0 +1,37 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 153, + "Height": 232, + "Image": "Corsair_Katar_outline.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 58, + "Y": 187, + "Width": 35, + "Height": 22, + "Image": "Corsair_Katar_logo.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - M65.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - M65.json new file mode 100644 index 000000000..ae34fa393 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - M65.json @@ -0,0 +1,52 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 158, + "Height": 232, + "Image": "Corsair_M65_outline.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 70, + "Y": 156, + "Width": 27, + "Height": 27, + "Image": "Corsair_M65_logo.png", + "IsImage": true + }, + "161": { + "Key": { + "visual_name": "Scroll Wheel", + "tag": 161, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 74, + "Y": 10, + "Width": 21, + "Height": 60, + "Image": "Corsair_M65_scrollwheel.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_sabre_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - Sabre.json similarity index 100% rename from Project-Aurora/Project-Aurora/kb_layouts/Extra Features/corsair_sabre_features.json rename to Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Corsair - Sabre.json diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Generic Peripheral.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Generic Peripheral.json new file mode 100644 index 000000000..63470335b --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Generic Peripheral.json @@ -0,0 +1,37 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 90, + "Height": 90, + "Image": "", + "IsImage": false + }, + "0": { + "Key": { + "visual_name": "Mouse/\r\nHeadset", + "tag": 0, + "device_id": null + }, + "FontSize": 12.0, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 90, + "Height": 90, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Logitech - G502.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Logitech - G502.json new file mode 100644 index 000000000..4a7fdc53d --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Logitech - G502.json @@ -0,0 +1,37 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 143, + "Height": 232, + "Image": "Logi_G502_outline.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 30, + "Y": 107, + "Width": 45, + "Height": 65, + "Image": "Logi_G502_logo.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Logitech - G900.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Logitech - G900.json new file mode 100644 index 000000000..a40cf792a --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Logitech - G900.json @@ -0,0 +1,37 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 123, + "Height": 232, + "Image": "Logi_G900_outline.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 50, + "Y": 163, + "Width": 22, + "Height": 24, + "Image": "Logi_G900_logo.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Razer - Mamba TE.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Razer - Mamba TE.json new file mode 100644 index 000000000..060b347b1 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Razer - Mamba TE.json @@ -0,0 +1,229 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "tag": -1, + "visual_name": "NONE" + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 130, + "Height": 232, + "Image": "Razer_Mamba_TE_outline.png" + }, + "161": { + "Key": { + "tag": 161, + "visual_name": "Scroll Wheel" + }, + "FontSize": null, + "Enabled": true, + "X": 54, + "Y": 28, + "Width": 16, + "Height": 38, + "Image": "Razer_Mamba_TE_Scroll_Wheel.png" + }, + "160": { + "Key": { + "tag": 160, + "visual_name": "Peripheral Logo" + }, + "FontSize": null, + "Enabled": true, + "X": 41, + "Y": 162, + "Width": 38, + "Height": 39, + "Image": "Razer_Mamba_TE_Logo.png" + }, + "217": { + "Key": { + "tag": 217, + "visual_name": "Left Side 1" + }, + "FontSize": null, + "Enabled": true, + "X": 3, + "Y": 46, + "Width": 6, + "Height": 22, + "Image": "Razer_Mamba_TE_L1.png" + }, + "229": { + "Key": { + "tag": 229, + "visual_name": "Right Side 1" + }, + "FontSize": null, + "Enabled": true, + "X": 117, + "Y": 48, + "Width": 6, + "Height": 20, + "Image": "Razer_Mamba_TE_R1.png" + }, + "218": { + "Key": { + "tag": 218, + "visual_name": "Left Side 2" + }, + "FontSize": null, + "Enabled": true, + "X": 4, + "Y": 67, + "Width": 10, + "Height": 24, + "Image": "Razer_Mamba_TE_L2.png" + }, + "230": { + "Key": { + "tag": 230, + "visual_name": "Right Side 2" + }, + "FontSize": null, + "Enabled": true, + "X": 113, + "Y": 67, + "Width": 7, + "Height": 24, + "Image": "Razer_Mamba_TE_R2.png" + }, + "219": { + "Key": { + "tag": 219, + "visual_name": "Left Side 3" + }, + "FontSize": null, + "Enabled": true, + "X": 10, + "Y": 90, + "Width": 8, + "Height": 23, + "Image": "Razer_Mamba_TE_L3.png" + }, + "231": { + "Key": { + "tag": 231, + "visual_name": "Right Side 3" + }, + "FontSize": null, + "Enabled": true, + "X": 112, + "Y": 90, + "Width": 6, + "Height": 23, + "Image": "Razer_Mamba_TE_R3.png" + }, + "220": { + "Key": { + "tag": 220, + "visual_name": "Left Side 4" + }, + "FontSize": null, + "Enabled": true, + "X": 13, + "Y": 113, + "Width": 6, + "Height": 24, + "Image": "Razer_Mamba_TE_L4.png" + }, + "232": { + "Key": { + "tag": 232, + "visual_name": "Right Side 4" + }, + "FontSize": null, + "Enabled": true, + "X": 112, + "Y": 113, + "Width": 6, + "Height": 24, + "Image": "Razer_Mamba_TE_R4.png" + }, + "221": { + "Key": { + "tag": 221, + "visual_name": "Left Side 5" + }, + "FontSize": null, + "Enabled": true, + "X": 10, + "Y": 137, + "Width": 8, + "Height": 23, + "Image": "Razer_Mamba_TE_L5.png" + }, + "233": { + "Key": { + "tag": 233, + "visual_name": "Right Side 5" + }, + "FontSize": null, + "Enabled": true, + "X": 113, + "Y": 137, + "Width": 7, + "Height": 23, + "Image": "Razer_Mamba_TE_R5.png" + }, + "222": { + "Key": { + "tag": 222, + "visual_name": "Left Side 6" + }, + "FontSize": null, + "Enabled": true, + "X": 7, + "Y": 159, + "Width": 7, + "Height": 23, + "Image": "Razer_Mamba_TE_L6.png" + }, + "234": { + "Key": { + "tag": 234, + "visual_name": "Right Side 6" + }, + "FontSize": null, + "Enabled": true, + "X": 114, + "Y": 159, + "Width": 6, + "Height": 23, + "Image": "Razer_Mamba_TE_R6.png" + }, + "223": { + "Key": { + "tag": 223, + "visual_name": "Left Side 7" + }, + "FontSize": null, + "Enabled": true, + "X": 7, + "Y": 181, + "Width": 9, + "Height": 24, + "Image": "Razer_Mamba_TE_L7.png" + }, + "235": { + "Key": { + "tag": 235, + "visual_name": "Right Side 7" + }, + "FontSize": null, + "Enabled": true, + "X": 108, + "Y": 180, + "Width": 10, + "Height": 23, + "Image": "Razer_Mamba_TE_R7.png" + } + }, + "jis_key_modifications": {} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/RazerICorsair Mousepad + Mouse.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/RazerICorsair Mousepad + Mouse.json new file mode 100644 index 000000000..b3dc78318 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/RazerICorsair Mousepad + Mouse.json @@ -0,0 +1,262 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 10, + "Y": 0, + "Width": 200, + "Height": 168, + "Image": "", + "IsImage": false + }, + "160": { + "Key": { + "visual_name": "Mouse Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 90, + "Y": 60, + "Width": 50, + "Height": 50, + "Image": "", + "IsImage": false + }, + "201": { + "Key": { + "visual_name": "", + "tag": 201, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "202": { + "Key": { + "visual_name": "", + "tag": 202, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 34, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "203": { + "Key": { + "visual_name": "", + "tag": 203, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 68, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "204": { + "Key": { + "visual_name": "", + "tag": 204, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 101, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "205": { + "Key": { + "visual_name": "", + "tag": 205, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 135, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "206": { + "Key": { + "visual_name": "", + "tag": 206, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 10, + "Y": 168, + "Width": 40, + "Height": 10, + "Image": "", + "IsImage": false + }, + "207": { + "Key": { + "visual_name": "", + "tag": 207, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 50, + "Y": 168, + "Width": 40, + "Height": 10, + "Image": "", + "IsImage": false + }, + "208": { + "Key": { + "visual_name": "", + "tag": 208, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 90, + "Y": 168, + "Width": 40, + "Height": 10, + "Image": "", + "IsImage": false + }, + "209": { + "Key": { + "visual_name": "", + "tag": 209, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 130, + "Y": 168, + "Width": 40, + "Height": 10, + "Image": "", + "IsImage": false + }, + "210": { + "Key": { + "visual_name": "", + "tag": 210, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 170, + "Y": 168, + "Width": 40, + "Height": 10, + "Image": "", + "IsImage": false + }, + "211": { + "Key": { + "visual_name": "", + "tag": 211, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 210, + "Y": 135, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "212": { + "Key": { + "visual_name": "", + "tag": 212, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 210, + "Y": 101, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "213": { + "Key": { + "visual_name": "", + "tag": 213, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 210, + "Y": 68, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "214": { + "Key": { + "visual_name": "", + "tag": 214, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 210, + "Y": 34, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + }, + "215": { + "Key": { + "visual_name": "", + "tag": 215, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 210, + "Y": 0, + "Width": 10, + "Height": 33, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Roccat - Kone Pure.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Roccat - Kone Pure.json new file mode 100644 index 000000000..a6269a41c --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Roccat - Kone Pure.json @@ -0,0 +1,34 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "tag": -1, + "visual_name": "NONE" + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 153, + "Height": 232, + "Image": "Roccat_Kone_Pure_outline.png" + }, + "160": { + "Key": { + "tag": 160, + "visual_name": "Logo" + }, + "FontSize": null, + "Enabled": true, + "X": 54, + "Y": 166, + "Width": 66, + "Height": 59, + "Image": "Roccat_Kone_Pure_logo.png" + } + }, + "jis_key_modifications": {} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - QcK Prism Mousepad + Mouse.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - QcK Prism Mousepad + Mouse.json new file mode 100644 index 000000000..fe3db83c4 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - QcK Prism Mousepad + Mouse.json @@ -0,0 +1,232 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 200, + "Height": 168, + "Image": "", + "IsImage": false + }, + "160": { + "Key": { + "visual_name": "Mouse Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 75, + "Y": 89, + "Width": 50, + "Height": 50, + "Image": "", + "IsImage": false + }, + "161": { + "Key": { + "visual_name": "Scroll Wheel", + "tag": 161, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 75, + "Y": 29, + "Width": 50, + "Height": 50, + "Image": "", + "IsImage": false + }, + "201": { + "Key": { + "visual_name": "", + "tag": 201, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 56, + "Width": 16, + "Height": 56, + "Image": "", + "IsImage": false + }, + "202": { + "Key": { + "visual_name": "", + "tag": 202, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 112, + "Width": 16, + "Height": 56, + "Image": "", + "IsImage": false + }, + "203": { + "Key": { + "visual_name": "", + "tag": 203, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 16, + "Y": 152, + "Width": 56, + "Height": 16, + "Image": "", + "IsImage": false + }, + "204": { + "Key": { + "visual_name": "", + "tag": 204, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 72, + "Y": 152, + "Width": 56, + "Height": 16, + "Image": "", + "IsImage": false + }, + "205": { + "Key": { + "visual_name": "", + "tag": 205, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 127, + "Y": 152, + "Width": 56, + "Height": 16, + "Image": "", + "IsImage": false + }, + "206": { + "Key": { + "visual_name": "", + "tag": 206, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 185, + "Y": 112, + "Width": 16, + "Height": 56, + "Image": "", + "IsImage": false + }, + "207": { + "Key": { + "visual_name": "", + "tag": 207, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 185, + "Y": 56, + "Width": 16, + "Height": 56, + "Image": "", + "IsImage": false + }, + "208": { + "Key": { + "visual_name": "", + "tag": 208, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 185, + "Y": 0, + "Width": 16, + "Height": 56, + "Image": "", + "IsImage": false + }, + "209": { + "Key": { + "visual_name": "", + "tag": 209, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 127, + "Y": 0, + "Width": 56, + "Height": 16, + "Image": "", + "IsImage": false + }, + "210": { + "Key": { + "visual_name": "", + "tag": 210, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 72, + "Y": 0, + "Width": 56, + "Height": 16, + "Image": "", + "IsImage": false + }, + "211": { + "Key": { + "visual_name": "", + "tag": 211, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 16, + "Y": 0, + "Width": 56, + "Height": 16, + "Image": "", + "IsImage": false + }, + "212": { + "Key": { + "visual_name": "", + "tag": 212, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 16, + "Height": 56, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Rival 300 HP OMEN Edition.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Rival 300 HP OMEN Edition.json new file mode 100644 index 000000000..f59266f61 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Rival 300 HP OMEN Edition.json @@ -0,0 +1,52 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 128, + "Height": 232, + "Image": "SteelSeries_Rival_300_outline.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 41, + "Y": 177, + "Width": 40, + "Height": 40, + "Image": "Omen_logo.png", + "IsImage": true + }, + "161": { + "Key": { + "visual_name": "Scroll Wheel", + "tag": 161, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 53, + "Y": 43, + "Width": 16, + "Height": 31, + "Image": "SteelSeries_Rival_300_scrollwheel.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Rival 300.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Rival 300.json new file mode 100644 index 000000000..853945e2f --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Rival 300.json @@ -0,0 +1,52 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 128, + "Height": 232, + "Image": "SteelSeries_Rival_300_outline.png", + "IsImage": true + }, + "160": { + "Key": { + "visual_name": "Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 41, + "Y": 177, + "Width": 40, + "Height": 40, + "Image": "SteelSeries_Rival_300_logo.png", + "IsImage": true + }, + "161": { + "Key": { + "visual_name": "Scroll Wheel", + "tag": 161, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 53, + "Y": 43, + "Width": 16, + "Height": 31, + "Image": "SteelSeries_Rival_300_scrollwheel.png", + "IsImage": true + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Two-zone QcK Mousepad + Mouse.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Two-zone QcK Mousepad + Mouse.json new file mode 100644 index 000000000..086463bb9 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/SteelSeries - Two-zone QcK Mousepad + Mouse.json @@ -0,0 +1,82 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "visual_name": "NONE", + "tag": -1, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 200, + "Height": 168, + "Image": "", + "IsImage": false + }, + "160": { + "Key": { + "visual_name": "Mouse Logo", + "tag": 160, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 75, + "Y": 89, + "Width": 50, + "Height": 50, + "Image": "", + "IsImage": false + }, + "161": { + "Key": { + "visual_name": "Scroll Wheel", + "tag": 161, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 75, + "Y": 29, + "Width": 50, + "Height": 50, + "Image": "", + "IsImage": false + }, + "201": { + "Key": { + "visual_name": "", + "tag": 201, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 16, + "Height": 168, + "Image": "", + "IsImage": false + }, + "202": { + "Key": { + "visual_name": "", + "tag": 202, + "device_id": null + }, + "FontSize": null, + "Enabled": true, + "X": 185, + "Y": 0, + "Width": 16, + "Height": 168, + "Image": "", + "IsImage": false + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Steelseries - Rival 650.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Steelseries - Rival 650.json new file mode 100644 index 000000000..4e21ef589 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/Steelseries - Rival 650.json @@ -0,0 +1,125 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "-1": { + "Key": { + "tag": -1, + "visual_name": "NONE" + }, + "FontSize": null, + "Enabled": true, + "X": 1, + "Y": 0, + "Width": 122, + "Height": 232, + "Image": "SteelSeries_Rival_650_outline.png" + }, + "1": { + "Key": { + "tag": 1, + "visual_name": "NONE" + }, + "FontSize": null, + "Enabled": true, + "X": 52, + "Y": 36, + "Width": 14, + "Height": 36, + "Image": "SteelSeries_Rival_650_wheel.png" + }, + "0": { + "Key": { + "tag": 0, + "visual_name": "Logo" + }, + "FontSize": null, + "Enabled": true, + "X": 30, + "Y": 170, + "Width": 45, + "Height": 45, + "Image": "SteelSeries_Rival_300_logo.png" + }, + "2": { + "Key": { + "tag": 2, + "visual_name": "L1" + }, + "FontSize": null, + "Enabled": true, + "X": 31, + "Y": 103, + "Width": 12, + "Height": 37, + "Image": "SteelSeries_Rival_650_L1.png" + }, + "3": { + "Key": { + "tag": 3, + "visual_name": "L2" + }, + "FontSize": null, + "Enabled": true, + "X": 20, + "Y": 138, + "Width": 17, + "Height": 14, + "Image": "SteelSeries_Rival_650_L2.png" + }, + "4": { + "Key": { + "tag": 4, + "visual_name": "L3" + }, + "FontSize": null, + "Enabled": true, + "X": 8, + "Y": 151, + "Width": 13, + "Height": 14, + "Image": "SteelSeries_Rival_650_L3.png" + }, + "5": { + "Key": { + "tag": 5, + "visual_name": "R1" + }, + "FontSize": null, + "Enabled": true, + "X": 76, + "Y": 103, + "Width": 13, + "Height": 37, + "Image": "SteelSeries_Rival_650_R1.png" + }, + "6": { + "Key": { + "tag": 6, + "visual_name": "R2" + }, + "FontSize": null, + "Enabled": true, + "X": 85, + "Y": 139, + "Width": 17, + "Height": 14, + "Image": "SteelSeries_Rival_650_R2.png" + }, + "7": { + "Key": { + "tag": 7, + "visual_name": "R3" + }, + "FontSize": null, + "Enabled": true, + "X": 98, + "Y": 152, + "Width": 14, + "Height": 14, + "Image": "SteelSeries_Rival_650_R3.png" + } + }, + "jis_key_modifications": {} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/bloody_w60_features.json b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/bloody_w60_features.json new file mode 100644 index 000000000..6e97f914b --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/Mouse/bloody_w60_features.json @@ -0,0 +1,153 @@ +{ + "group_tag": "mouse", + "origin_region": 4, + "grouped_keys": [ + { + "tag": -1, + "margin_left": 0.0, + "margin_top": -232.0, + "width": 150.0, + "height": 210.0, + "margin_left_bits": 1, + "margin_top_bits": -19, + "width_bits": 13, + "height_bits": 19, + "image": "Bloody_W60_outline.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Scroll Wheel", + "tag": 161, + "margin_left": 79.0, + "margin_top": -204.0, + "width": 8.0, + "height": 20.0, + "image": "bloody_w60_Scroll_Led.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Peripheral Logo", + "tag": 160, + "margin_left": 61.0, + "margin_top": -85.0, + "width": 38.0, + "height": 39.0, + "image": "Bloody_Logo.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Left Side 1", + "tag": 217, + "margin_left": 19.0, + "margin_top": -146.0, + "width": 15.0, + "height": 40.0, + "image": "bloody_w60_ls_1.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Left Side 2", + "tag": 218, + "margin_left": 28.0, + "margin_top": -117.0, + "width": 10.0, + "height": 30.0, + "image": "bloody_w60_ls_2.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Left Side 3", + "tag": 219, + "margin_left": 37.0, + "margin_top": -114.0, + "width": 8.0, + "height": 23.0, + "margin_left_bits": 1, + "image": "bloody_w60_ls_3.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Mid 1", + "tag": 220, + "margin_left": 46.0, + "margin_top": -118.0, + "width": 40.0, + "height": 16.0, + "image": "bloody_w60_ms_1.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Mid 2", + "tag": 221, + "margin_left": 65.0, + "margin_top": -128.0, + "width": 50.0, + "height": 12.0, + "image": "bloody_w60_ms_2.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Mid 3", + "tag": 222, + "margin_left": 96.0, + "margin_top": -139.0, + "width": 40.0, + "height": 14.0, + "image": "bloody_w60_ms_3.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Bottom 1", + "tag": 223, + "margin_left": 7.0, + "margin_top": -80.0, + "width": 38.0, + "height": 50.0, + "image": "bloody_w60_bl_1.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Bottom 2", + "tag": 229, + "margin_left": 38.0, + "margin_top": -37.0, + "width": 36.0, + "height": 18.0, + "image": "bloody_w60_bl_2.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Bottom 3", + "tag": 230, + "margin_left": 70.0, + "margin_top": -38.0, + "width": 36.0, + "height": 19.0, + "image": "bloody_w60_bl_3.png", + "enabled": true, + "absolute_location": true + }, + { + "visualName": "Bottom 4", + "tag": 231, + "margin_left": 106.0, + "margin_top": -86.0, + "width": 22.0, + "height": 58.0, + "image": "bloody_w60_bl_4.png", + "enabled": true, + "absolute_location": true + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/Ram.json b/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/Ram.json new file mode 100644 index 000000000..f8cfa8cf0 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/Ram.json @@ -0,0 +1,68 @@ +{ + "IsNewFormat": true, + "keys_to_remove": [], + "key_modifications": {}, + "key_to_add": { + "0": { + "Key": { + "tag": 0, + "visual_name": "." + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 0, + "Width": 30, + "Height": 30 + }, + "1": { + "Key": { + "tag": 1, + "visual_name": "." + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 37, + "Width": 30, + "Height": 30 + }, + "2": { + "Key": { + "tag": 2, + "visual_name": "." + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 74, + "Width": 30, + "Height": 30 + }, + "3": { + "Key": { + "tag": 3, + "visual_name": "." + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 111, + "Width": 30, + "Height": 30 + }, + "4": { + "Key": { + "tag": 4, + "visual_name": "." + }, + "FontSize": null, + "Enabled": true, + "X": 0, + "Y": 148, + "Width": 30, + "Height": 30 + } + }, + "jis_key_modifications": {} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/bloody_mp-50rs.json b/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/bloody_mp-50rs.json new file mode 100644 index 000000000..c14cd4813 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/bloody_mp-50rs.json @@ -0,0 +1,169 @@ +{ + "group_tag": "mousepad", + "origin_region": 4, + "grouped_keys": [ + { + "visualName": "1", + "tag": 201, + "margin_left": 126, + "margin_top": -48.0, + "width": 63.0, + "height": 16.0, + "width_bits": 6, + + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "2", + "tag": 202, + "margin_left": 190.0, + "margin_top": -88.0, + "width": 48.0, + "height": 56.0, + + "width_bits": 6, + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "3", + "tag": 203, + "margin_left": 222.0, + "margin_top": -144.0, + + "width": 16.0, + "height": 56.0, + "width_bits": 6, + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "tag": 204, + "visualName": "4", + "margin_left": 190.0, + "margin_top": -200.0, + "width": 48.0, + "height": 56.0, + "width_bits": 6, + "height_bits": 6, + "margin_left_bits": 2, + + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "5", + "tag": 205, + "margin_left": 126, + "margin_top": -200.0, + "width": 63.0, + "height": 16.0, + "width_bits": 6, + + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "6", + "tag": 206, + "margin_left": 64, + "margin_top": -200.0, + "width": 63.0, + "height": 16.0, + "width_bits": 6, + + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "7", + "tag": 207, + "margin_left": 15.0, + "margin_top": -200.0, + "width": 48.0, + "height": 56.0, + "width_bits": 2, + "height_bits": 2, + + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "8", + "tag": 208, + "margin_left": 15.0, + "margin_top": -144.0, + "width": 16.0, + "height": 56.0, + "width_bits": 6, + + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "9", + "tag": 209, + "margin_left": 15.0, + "margin_top": -88.0, + "width": 48.0, + "height": 56.0, + "width_bits": 6, + + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "10", + "tag": 210, + "margin_left": 64, + "margin_top": -48.0, + "width": 63.0, + "height": 16.0, + "width_bits": 6, + "height_bits": 6, + + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": true, + "absolute_location": true + }, + { + "tag": -1, + "margin_left": 31.0, + "margin_top": -184.0, + "width": 190.0, + "height": 136.0, + "width_bits": 6, + "height_bits": 6, + "margin_left_bits": 2, + "margin_top_bits": -6, + "enabled": false, + "absolute_location": true + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/monitor_leds.json b/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/monitor_leds.json new file mode 100644 index 000000000..52ab71763 --- /dev/null +++ b/Project-Aurora/Project-Aurora/DeviceLayouts/OtherDevices/monitor_leds.json @@ -0,0 +1,906 @@ +{ + "group_tag": "keyboard", + "origin_region": 1, + "grouped_keys": [ + { + "visualName": "", + "tag": 142, + "margin_left": 792.8399999999996, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 143, + "margin_left": 756.6799999999996, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 144, + "margin_left": 720.5199999999996, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 145, + "margin_left": 684.3599999999997, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 146, + "margin_left": 648.1999999999997, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 147, + "margin_left": 612.0399999999997, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 148, + "margin_left": 575.8799999999998, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 149, + "margin_left": 539.7199999999998, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 150, + "margin_left": 503.55999999999983, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 151, + "margin_left": 467.39999999999986, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 172, + "margin_left": 431.2399999999999, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 173, + "margin_left": 395.0799999999999, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 174, + "margin_left": 358.91999999999996, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 175, + "margin_left": 322.76, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 176, + "margin_left": 286.59999999999997, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 177, + "margin_left": 250.43999999999997, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 178, + "margin_left": 214.27999999999997, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 179, + "margin_left": 178.11999999999998, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 180, + "margin_left": 141.95999999999998, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 181, + "margin_left": 105.79999999999998, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 182, + "margin_left": 69.63999999999999, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 183, + "margin_left": 33.47999999999999, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 184, + "margin_left": -2.680000000000007, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 185, + "margin_left": -38.84, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 186, + "margin_left": -75, + "margin_top": 342.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 36, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 187, + "margin_left": -75, + "margin_top": 305, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 32, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 188, + "margin_left": -75, + "margin_top": 267.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 28, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 189, + "margin_left": -75, + "margin_top": 230, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 24, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 190, + "margin_left": -75, + "margin_top": 192.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 20, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 191, + "margin_left": -75, + "margin_top": 155, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 16, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 192, + "margin_left": -75, + "margin_top": 117.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 12, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 193, + "margin_left": -75, + "margin_top": 80, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 8, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 250, + "margin_left": -75, + "margin_top": 42.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 4, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 251, + "margin_left": -75, + "margin_top": 5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 252, + "margin_left": -75, + "margin_top": -32.5, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": -4, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 253, + "margin_left": -75, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": -4, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 254, + "margin_left": -38.84, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 0, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 255, + "margin_left": -2.680000000000007, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 4, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 256, + "margin_left": 33.47999999999999, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 8, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 257, + "margin_left": 69.63999999999999, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 12, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 258, + "margin_left": 105.79999999999998, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 16, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 259, + "margin_left": 141.95999999999998, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 20, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 260, + "margin_left": 178.11999999999998, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 24, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 261, + "margin_left": 214.27999999999997, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 28, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 262, + "margin_left": 250.43999999999997, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 32, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 263, + "margin_left": 286.59999999999997, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 36, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 264, + "margin_left": 322.76, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 40, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 265, + "margin_left": 358.91999999999996, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 44, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 266, + "margin_left": 395.0799999999999, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 48, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 267, + "margin_left": 431.2399999999999, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 52, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 268, + "margin_left": 467.39999999999986, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 56, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 269, + "margin_left": 503.55999999999983, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 60, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 270, + "margin_left": 539.7199999999998, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 64, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 271, + "margin_left": 575.8799999999998, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 68, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 272, + "margin_left": 612.0399999999997, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 72, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 273, + "margin_left": 648.1999999999997, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 76, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 274, + "margin_left": 684.3599999999997, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 80, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 275, + "margin_left": 720.5199999999996, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 84, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 276, + "margin_left": 756.6799999999996, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 88, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + }, + { + "visualName": "", + "tag": 277, + "margin_left": 792.8399999999996, + "margin_top": -70, + "width": 36.16, + "height": 37.5, + "font_size": 24, + "width_bits": 10, + "height_bits": 10, + "margin_left_bits": 92, + "margin_top_bits": 0, + "enabled": true, + "absolute_location": true + } + ] +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Asus/AsusDevice.cs b/Project-Aurora/Project-Aurora/Devices/Asus/AsusDevice.cs index 212293d29..f465100e2 100644 --- a/Project-Aurora/Project-Aurora/Devices/Asus/AsusDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Asus/AsusDevice.cs @@ -1,7 +1,9 @@ using System.Collections.Generic; using System.ComponentModel; +using System.Diagnostics; using System.Drawing; using Aurora.Settings; +using Aurora.Utils; using Microsoft.Win32; namespace Aurora.Devices.Asus @@ -12,6 +14,13 @@ public class AsusDevice : IDevice private AsusHandler asusHandler = new AsusHandler(); private bool isActive = false; + private readonly Stopwatch watch = new Stopwatch(); + private long lastUpdateTime; + private long updateTime; + public string DeviceUpdatePerformance => IsInitialized + ? lastUpdateTime + "(" + updateTime + ")" + " ms" + : ""; + private VariableRegistry defaultRegistry = null; /// public VariableRegistry RegisteredVariables @@ -23,6 +32,7 @@ public VariableRegistry RegisteredVariables defaultRegistry = new VariableRegistry(); defaultRegistry.Register($"{DeviceName}_enable_unsupported_version", false, "Enable Unsupported Asus SDK Version"); defaultRegistry.Register($"{DeviceName}_force_initialize", false, "Force initialization"); + defaultRegistry.Register($"{DeviceName}_color_cal", new RealColor(Color.FromArgb(255, 255, 255, 255)), "Color Calibration"); return defaultRegistry; } } @@ -44,9 +54,6 @@ private string GetDeviceStatus() return "Initialized: " + asusHandler?.GetDevicePerformance(); } - /// - public string DeviceUpdatePerformance => ""; - /// public bool Initialize() { @@ -56,6 +63,7 @@ public bool Initialize() Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_enable_unsupported_version"), Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_force_initialize")); isActive = asusHandler.Start(); + return isActive; } @@ -103,16 +111,17 @@ public bool IsPeripheralConnected() } /// - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) - { - asusHandler.UpdateColors(keyColors); - return true; - } - - /// + Stopwatch _tempStopWatch = new Stopwatch(); public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArgs e, bool forced = false) { - asusHandler.UpdateColors(colorComposition.keyColors); + _tempStopWatch.Restart(); + + asusHandler.UpdateColors(colorComposition.KeyColors); + + lastUpdateTime = watch.ElapsedMilliseconds; + updateTime = _tempStopWatch.ElapsedMilliseconds; + watch.Restart(); + return true; } diff --git a/Project-Aurora/Project-Aurora/Devices/Asus/AsusHandler.cs b/Project-Aurora/Project-Aurora/Devices/Asus/AsusHandler.cs index 40034e098..0382159dd 100644 --- a/Project-Aurora/Project-Aurora/Devices/Asus/AsusHandler.cs +++ b/Project-Aurora/Project-Aurora/Devices/Asus/AsusHandler.cs @@ -98,7 +98,7 @@ public bool Start() { if (AuraSdk == null) return false; - + //return false; lock (deviceLock) { try @@ -188,6 +188,7 @@ public void Stop() { var device = devices[i]; device.Stop(false); + device.Dispose(); } devices.Clear(); @@ -195,7 +196,7 @@ public void Stop() } } - public void UpdateColors(Dictionary colors) + public void UpdateColors(Dictionary colors) { lock (deviceLock) { diff --git a/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncClaymoreDevice.cs b/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncClaymoreDevice.cs index e08525e2f..7f705d3bf 100644 --- a/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncClaymoreDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncClaymoreDevice.cs @@ -13,7 +13,7 @@ public class AsusSyncClaymoreDevice : AuraSyncDevice public AsusSyncClaymoreDevice(AsusHandler asusHandler, IAuraSyncDevice device, int frameRate = 30) : base( asusHandler, device, frameRate) { } - protected override void ApplyColors(Dictionary colors) + protected override void ApplyColors(Dictionary colors) { if (Global.Configuration.DevicesDisableKeyboard) return; @@ -22,8 +22,8 @@ protected override void ApplyColors(Dictionary colors) { var light = DeviceKeyToClaymore(i); - if (colors.ContainsKey(light)) - SetRgbLight(Device.Lights[i], colors[light]); + if (colors.ContainsKey((int)light)) + SetRgbLight(Device.Lights[i], colors[(int)light]); } } diff --git a/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncConfiguredDevice.cs b/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncConfiguredDevice.cs index d92cbfc53..ac091a734 100644 --- a/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncConfiguredDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Asus/AsusSyncConfiguredDevice.cs @@ -12,20 +12,20 @@ public class AsusSyncConfiguredDevice : AuraSyncDevice private static readonly List allConfigDevices = new List(); /// - public AsusSyncConfiguredDevice(AsusHandler asusHandler, IAuraSyncDevice device, AsusConfig.AsusConfigDevice config, int frameRate = 30) : base(asusHandler, device, frameRate) + public AsusSyncConfiguredDevice(AsusHandler asusHandler, IAuraSyncDevice device, AsusConfig.AsusConfigDevice config, int frameRate = 60) : base(asusHandler, device, frameRate) { this.config = config; allConfigDevices.Add(this); } /// - protected override void ApplyColors(Dictionary colors) + protected override void ApplyColors(Dictionary colors) { lock (configLock) { foreach (var keyPair in config.KeyMapper) { - if (colors.TryGetValue(keyPair.Value, out var color)) + if (colors.TryGetValue((int)keyPair.Value, out var color)) SetRgbLight(keyPair.Key, color); } } diff --git a/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncDevice.cs b/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncDevice.cs index 9261c184b..33d2ac2c6 100644 --- a/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncDevice.cs @@ -6,6 +6,8 @@ using System.Threading; using System.Threading.Tasks; using AuraServiceLib; +using Aurora.Settings; +using Aurora.Utils; namespace Aurora.Devices.Asus { @@ -19,10 +21,10 @@ public class AuraSyncDevice : IDisposable private readonly IAuraSyncDevice device; public IAuraSyncDevice Device => device; private readonly AsusHandler asusHandler; - private readonly ConcurrentQueue> colorQueue = new ConcurrentQueue>(); + private readonly ConcurrentQueue> colorQueue = new ConcurrentQueue>(); private CancellationTokenSource tokenSource = new CancellationTokenSource(); - private readonly int frameRateMillis; - private readonly DeviceKeys[] defaultKeys = { DeviceKeys.Peripheral, DeviceKeys.Peripheral_Logo, DeviceKeys.SPACE }; + private readonly long frameRateMillis; + private readonly int[] defaultKeys = { (int)DeviceKeys.Peripheral, (int)DeviceKeys.Peripheral_Logo, (int)DeviceKeys.SPACE }; private readonly Stopwatch stopwatch = new Stopwatch(); @@ -30,14 +32,14 @@ public class AuraSyncDevice : IDisposable private const int DiscountTries = 3; private int disconnectCounter = 0; - public AuraSyncDevice(AsusHandler asusHandler, IAuraSyncDevice device, int frameRate = 30) + public AuraSyncDevice(AsusHandler asusHandler, IAuraSyncDevice device, int frameRate = 60) { this.asusHandler = asusHandler; this.device = device; frameRateMillis = (int)((1f / frameRate) * 1000f); } - public void UpdateColors(Dictionary colors) + public void UpdateColors(Dictionary colors) { if (DeviceType == AsusHandler.AsusDeviceType.Mouse && Global.Configuration.DevicesDisableMouse) return; @@ -46,8 +48,7 @@ public void UpdateColors(Dictionary colors) while (!colorQueue.IsEmpty) colorQueue.TryDequeue(out _); - // queue a clone of the colors - colorQueue.Enqueue(new Dictionary(colors)); + colorQueue.Enqueue(colors); } public void Start() @@ -83,7 +84,7 @@ private async void Thread(CancellationToken token) { try { - await Task.Delay(frameRateMillis, token); + await Task.Delay((int)Math.Max(frameRateMillis - LastUpdateMillis, 5), token); // wait for the next tick before drawing var colors = GetLatestColors(); if (colors == null) continue; @@ -114,7 +115,7 @@ private async void Thread(CancellationToken token) } catch (TaskCanceledException) { - asusHandler.DisconnectDevice(this); + //asusHandler.DisconnectDevice(this); return; } catch (Exception exception) @@ -132,7 +133,7 @@ private async void Thread(CancellationToken token) /// Try to apply the aurora color collection to this device /// /// The colors to apply - protected virtual void ApplyColors(Dictionary colors) + protected virtual void ApplyColors(Dictionary colors) { // simple implementation is to assign all colors to DefaultKey foreach (var defaultKey in defaultKeys) @@ -146,12 +147,6 @@ protected virtual void ApplyColors(Dictionary colors) } } - //0x00BBGGRR - protected void SetRgbLight(IAuraRgbKey rgbLight, Color color) - { - rgbLight.Color = (uint)(color.R | color.G << 8 | color.B << 16); - } - //0x00BBGGRR protected void SetRgbLight(IAuraRgbLight rgbLight, Color color) { @@ -160,12 +155,19 @@ protected void SetRgbLight(IAuraRgbLight rgbLight, Color color) protected void SetRgbLight(int index, Color color) { - SetRgbLight(device.Lights[index], color); + //calibrate for led and fans + var colorCal = Global.Configuration.VarRegistry.GetVariable($"Asus_color_cal"); + var calibratedColor = Color.FromArgb( + color.A, + color.R * colorCal.GetDrawingColor().R / 255, + color.G * colorCal.GetDrawingColor().G / 255, + color.B * colorCal.GetDrawingColor().B / 255); + SetRgbLight(device.Lights[index], calibratedColor); } - private Dictionary GetLatestColors() + private Dictionary GetLatestColors() { - Dictionary colors = null; + Dictionary colors = null; while (colorQueue.Count > 0) colorQueue.TryDequeue(out colors); diff --git a/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncKeyboardDevice.cs b/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncKeyboardDevice.cs index b36c62a0c..291105101 100644 --- a/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncKeyboardDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Asus/AuraSyncKeyboardDevice.cs @@ -26,7 +26,8 @@ public AuraSyncKeyboardDevice(AsusHandler asusHandler, IAuraSyncKeyboard device, // BackSlash Key deviceKeyToKey[DeviceKeys.BACKSLASH_UK] = keyboard.Lights[(int)(4 * keyboard.Width + 1)]; - if (Global.Configuration.KeyboardBrand == Settings.PreferredKeyboard.Asus_Strix_Scope) + + if (Global.Configuration.KeyboardBrand == Settings.PreferredKeyboard.Asus_Strix_Scope) //"Asus_Strix_Scope") { // Left Windows Key deviceKeyToKey[DeviceKeys.LEFT_WINDOWS] = keyboard.Lights[(int)(5 * keyboard.Width + 2)]; @@ -37,14 +38,14 @@ public AuraSyncKeyboardDevice(AsusHandler asusHandler, IAuraSyncKeyboard device, } /// - protected override void ApplyColors(Dictionary colors) + protected override void ApplyColors(Dictionary colors) { if (Global.Configuration.DevicesDisableKeyboard) return; foreach (var keyPair in colors) { - if (!deviceKeyToKey.TryGetValue(keyPair.Key, out var light)) + if (!deviceKeyToKey.TryGetValue((DeviceKeys)keyPair.Key, out var light)) continue; SetRgbLight(light, keyPair.Value); diff --git a/Project-Aurora/Project-Aurora/Devices/AtmoOrb/AtmoOrbDevice.cs b/Project-Aurora/Project-Aurora/Devices/AtmoOrb/AtmoOrbDevice.cs index b0424e3f1..bf15e38b0 100644 --- a/Project-Aurora/Project-Aurora/Devices/AtmoOrb/AtmoOrbDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/AtmoOrb/AtmoOrbDevice.cs @@ -19,9 +19,9 @@ public class AtmoOrbDevice : IDevice private IPEndPoint ipClientEndpoint; private bool isConnected; private bool isConnecting; - private Stopwatch sw = new Stopwatch(); + private Stopwatch sw = new(); - private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); + private Stopwatch watch = new(); private long lastUpdateTime = 0; private VariableRegistry default_registry = null; @@ -59,16 +59,6 @@ public bool IsConnected() public bool IsInitialized => IsConnected(); - public bool IsKeyboardConnected() - { - throw new NotImplementedException(); - } - - public bool IsPeripheralConnected() - { - throw new NotImplementedException(); - } - public bool Reconnect() { if (socket != null) @@ -159,16 +149,16 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg Global.Configuration.VarRegistry.GetVariable($"{devicename}_send_delay")) { Color averageColor; - lock (colorComposition.bitmapLock) + lock (colorComposition.KeyBitmap) { //Fix conflict with debug bitmap - lock (colorComposition.keyBitmap) + lock (colorComposition.KeyBitmap) { averageColor = Utils.BitmapUtils.GetRegionColor( - (Bitmap)colorComposition.keyBitmap, - new BitmapRectangle(0, 0, colorComposition.keyBitmap.Width, - colorComposition.keyBitmap.Height) + colorComposition.KeyBitmap, + new Rectangle(0, 0, colorComposition.KeyBitmap.Width, + colorComposition.KeyBitmap.Height) ); } } @@ -185,11 +175,6 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg return true; } - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) - { - throw new NotImplementedException(); - } - public void SendColorsToOrb(byte red, byte green, byte blue, DoWorkEventArgs e = null) { if (e?.Cancel ?? false) return; diff --git a/Project-Aurora/Project-Aurora/Devices/AuroraDevice.cs b/Project-Aurora/Project-Aurora/Devices/AuroraDevice.cs new file mode 100644 index 000000000..bf902357e --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/AuroraDevice.cs @@ -0,0 +1,214 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Drawing; +using System.Linq; +using System.Runtime.ExceptionServices; +using System.Security; +using System.Text; +using System.Threading.Tasks; +using Aurora.Settings; +using Newtonsoft.Json; + +namespace Aurora.Devices +{ + public enum AuroraDeviceType + { + Keyboard = 0, + Mouse = 1, + Unkown = 2, + Headset = 3, + OpenRGBKeyboard = 4, + OpenRGBMouse = 5, + OpenRGBUnkown = 6, + OpenRGBHeadset = 7, + } + public class UniqueDeviceId + { + public string ConnectorName = ""; + public string DeviceName { get; set; } = "Generic SDK device"; + public int Index = 0; + [JsonIgnore] + public int? ViewPort = null; + public UniqueDeviceId() + { + } + public UniqueDeviceId(AuroraDeviceConnector connector, AuroraDevice device) + { + ConnectorName = connector.GetConnectorName(); + DeviceName = device.GetDeviceName(); + } + public static bool operator ==(UniqueDeviceId obj1, UniqueDeviceId obj2) + { + return (!(obj1 is null) && !(obj2 is null) + && string.Equals(obj1.ConnectorName, obj2.ConnectorName) + && string.Equals(obj1.DeviceName, obj2.DeviceName) + && obj1.Index == obj2.Index); + } + + public static bool operator !=(UniqueDeviceId obj1, UniqueDeviceId obj2) + { + return !(obj1 == obj2); + } + public override bool Equals(object obj) + { + return this == obj as UniqueDeviceId; + } + + } + public abstract class AuroraDevice + { + private readonly Stopwatch Watch = new Stopwatch(); + private long LastUpdateTime = 0; + private bool UpdateIsOngoing = false; + private bool DeviceIsConnected = false; + private AuroraDeviceConnector connector; + + public UniqueDeviceId id = null; + private VariableRegistry variableRegistry; + + public event EventHandler ConnectionHandler; + public event EventHandler UpdateFinished; + /// + /// Is called every frame (30fps). Update the device here + /// + + //[HandleProcessCorruptedStateExceptions, SecurityCritical] + public async void UpdateDevice(DeviceColorComposition composition) + { + if (IsConnected()) + { + if (Global.Configuration.DevicesDisabled.Contains(GetType())) + { + //Initialized when it's supposed to be disabled? SMACK IT! + Disconnect(); + return; + } + + if (!UpdateIsOngoing) + { + UpdateIsOngoing = true; + Watch.Restart(); + try + { + if (!await Task.Run(() => UpdateDeviceImpl(composition))) + { + LogError(DeviceName + " device, error when updating device."); + } + } + catch (Exception exc) + { + LogError(DeviceName + " device, error when updating device. Exception: " + exc.Message); + } + + + Watch.Stop(); + LastUpdateTime = Watch.ElapsedMilliseconds; + + await Task.Run(() => connector?.DeviceLedUpdateFinished()); + UpdateFinished.Invoke(this, new EventArgs()); + UpdateIsOngoing = false; + } + + } + } + protected abstract bool UpdateDeviceImpl(DeviceColorComposition composition); + + public string GetDeviceUpdatePerformance() + { + return IsConnected() ? LastUpdateTime + " ms" : ""; + } + public async void Connect() + { + /*if (GetDeviceType() == AuroraDeviceType.Keyboard && Global.Configuration.DevicesDisableKeyboard || + GetDeviceType() == AuroraDeviceType.Mouse && Global.Configuration.DevicesDisableMouse || + GetDeviceType() == AuroraDeviceType.Headset && Global.Configuration.DevicesDisableHeadset || + GetDeviceType() == AuroraDeviceType.OpenRGBKeyboard && Global.Configuration.DevicesDisableOpenRGBKeyboard || + GetDeviceType() == AuroraDeviceType.OpenRGBMouse && Global.Configuration.DevicesDisableOpenRGBMouse || + GetDeviceType() == AuroraDeviceType.OpenRGBHeadset && Global.Configuration.DevicesDisableOpenRGBHeadset) + { + Disconnect(); + } + else*/ + { + try + { + if (await Task.Run(() => ConnectImpl())) + { + ConnectionHandler.Invoke(this, new EventArgs()); + DeviceIsConnected = true; + } + } + catch (Exception exc) + { + Global.logger.Info("Device, " + GetDeviceName() + ", throwed exception:" + exc.ToString()); + } + } + } + protected virtual bool ConnectImpl() + { + return true; + } + + public void Disconnect() + { + if (IsConnected()) + { + DisconnectImpl(); + DeviceIsConnected = false; + ConnectionHandler.Invoke(this, new EventArgs()); + } + } + protected virtual void DisconnectImpl() + { + } + + public abstract List GetAllDeviceKey(); + + protected abstract string DeviceName { get; } + public string GetDeviceName() => DeviceName; + + public virtual string GetDeviceDetails() => DeviceName + ": " + (IsConnected() ? "Connected" : "Not connected"); + + protected abstract AuroraDeviceType AuroraDeviceType { get; } + public AuroraDeviceType GetDeviceType() => AuroraDeviceType; + + public VariableRegistry GetRegisteredVariables() + { + if (variableRegistry == null) + { + variableRegistry = new VariableRegistry(); + RegisterVariables(variableRegistry); + } + return variableRegistry; + } + /// + /// Only called once when registering variables. Can be empty if not needed + /// + protected virtual void RegisterVariables(VariableRegistry local) + { + //purposefully empty, if varibles are needed, this should be overridden + } + + public bool IsConnected() => DeviceIsConnected; + + protected void LogInfo(string s) => Global.logger.Info(s); + + protected void LogError(string s) => Global.logger.Error(s); + + protected Color CorrectAlpha(Color clr) => Utils.ColorUtils.CorrectWithAlpha(clr); + + protected VariableRegistry GlobalVarRegistry => Global.Configuration.VarRegistry; + + public void SetConnector(AuroraDeviceConnector connector) + { + this.connector = connector; + } + } + + public abstract class AuroraKeyboardDevice : AuroraDevice + { + protected override AuroraDeviceType AuroraDeviceType => AuroraDeviceType.Keyboard; + + } +} diff --git a/Project-Aurora/Project-Aurora/Devices/AuroraDeviceConnector.cs b/Project-Aurora/Project-Aurora/Devices/AuroraDeviceConnector.cs new file mode 100644 index 000000000..7b884b18b --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/AuroraDeviceConnector.cs @@ -0,0 +1,242 @@ +using Aurora.Settings; +using SharpDX.Direct3D11; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace Aurora.Devices +{ + public class OldAuroraDeviceWrapper : IDevice + { + AuroraDeviceConnector Connector; + public string DeviceName => Connector.GetConnectorName(); + + public string DeviceDetails => string.Join(", ", Connector.Devices.Select(d => d.GetDeviceName())); + + public string DeviceUpdatePerformance => string.Join(", ", Connector.Devices.Select(d => d.GetDeviceUpdatePerformance())); + + public bool IsInitialized => Connector.IsInitialized(); + + public VariableRegistry RegisteredVariables => Connector.GetRegisteredVariables(); + + public OldAuroraDeviceWrapper(AuroraDeviceConnector connector) + { + Connector = connector; + } + + public bool Initialize() + { + Connector.Initialize(); + return true; + } + + public void Reset() + { + Connector.Reset(); + } + + public void Shutdown() + { + Connector.Shutdown(); + } + + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + { + return true; + } + + public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArgs e, bool forced = false) + { + return true; + } + } + public abstract class AuroraDeviceConnector + { + //private Dictionary Devices = new Dictionary(); + private List devices = new List(); + public IReadOnlyList Devices => devices.AsReadOnly(); + private bool isInitialized; + public event EventHandler NewSuccessfulInitiation; + private int DisconnectedDeviceCount = 0; + private int UpdatedDeviceCount = 0; + private SemaphoreSlim SingleThread = new SemaphoreSlim(1, 1); + + protected abstract string ConnectorName { get; } + public string GetConnectorName() => ConnectorName; + public virtual void Reset() + { + Shutdown(); + Initialize(); + } + private void RegisterDeviceId (AuroraDevice dev) + { + UniqueDeviceId id = new UniqueDeviceId(this, dev); + while (Devices.Where(d => d.id == id).Any()) + { + id.Index++; + } + var usedIdConfig = Global.devicesLayout.DevicesConfig.Values.Where(c => c.Id == id); + if(!usedIdConfig.Any()) + { + dev.id = id; + } + else + { + dev.id = usedIdConfig.First().Id; + } + + } + protected void RegisterDevice(AuroraDevice device) + { + device.SetConnector(this); + RegisterDeviceId(device); + devices.Add(device); + Global.Configuration.VarRegistry.Combine(device.GetRegisteredVariables()); + device.ConnectionHandler += ConnectionHandling; + device.UpdateFinished += DeviceUpdated; + device.Connect(); + } + public virtual void DeviceLedUpdateFinished() + { + + } + /// + /// Is called first. Initialize the device here + /// + public async void Initialize() + { + await SingleThread.WaitAsync(); + + if (!IsInitialized() && !Global.Configuration.DevicesDisabled.Contains(GetType())) + { + Global.logger.Info("Start initializing Connector: " + GetConnectorName()); + try + { + /*if (!Global.Configuration.devices_not_first_time.Contains(GetType())) + { + RunFirstTime(); + Global.Configuration.devices_not_first_time.Add(GetType()); + }*/ + if (await Task.Run(() => InitializeImpl())) + { + DisconnectedDeviceCount = 0; + if (Devices.Any()) + { + isInitialized = true; + NewSuccessfulInitiation?.Invoke(this, new EventArgs()); + } + } + } + catch (Exception exc) + { + Global.logger.Info("Connector, " + GetConnectorName() + ", throwed exception:" + exc.ToString()); + } + Global.logger.Info("Connector, " + GetConnectorName() + ", was" + (IsInitialized() ? "" : " not") + " initialized"); + } + SingleThread.Release(); + + } + + protected abstract bool InitializeImpl(); + protected virtual void RunFirstTime() { } + + private void ConnectionHandling(object sender, EventArgs args) + { + AuroraDevice device = sender as AuroraDevice; + if (device.IsConnected()) + { + DisconnectedDeviceCount--; + } + else + { + DisconnectedDeviceCount++; + } + if (DisconnectedDeviceCount == 0) + { + Shutdown(); + } + } + private void DeviceUpdated(object sender, EventArgs args) + { + AuroraDevice device = sender as AuroraDevice; + UpdatedDeviceCount++; + if (UpdatedDeviceCount == Devices.Count) + { + UpdateDevices(); + } + } + protected virtual void UpdateDevices() + { + + } + /// + /// Is called last. Dispose of the devices here + /// + public async void Shutdown() + { + await SingleThread.WaitAsync(); + + try + { + if (IsInitialized()) + { + foreach (var device in Devices) + { + device.Disconnect(); + } + devices.Clear(); + await Task.Run(() => ShutdownImpl()); + isInitialized = false; + Global.logger.Info("Connector, " + GetConnectorName() + ", was shutdown"); + } + } + catch (Exception exc) + { + Global.logger.Info("Connector, " + GetConnectorName() + ", throwed exception:" + exc.ToString()); + } + SingleThread.Release(); + } + + protected abstract void ShutdownImpl(); + + + public bool IsInitialized() => isInitialized; + + public string GetConnectorDetails() => isInitialized ? + ConnectorName + ": " + ConnectorSubDetails : + ConnectorName + ": Not Initialized"; + protected virtual string ConnectorSubDetails => "Initialized"; + + protected void LogInfo(string s) => Global.logger.Info(s); + protected void LogError(string s) => Global.logger.Error(s); + + private VariableRegistry variableRegistry; + public virtual VariableRegistry GetRegisteredVariables() + { + if (variableRegistry == null) + { + variableRegistry = new VariableRegistry(); + RegisterVariables(variableRegistry); + foreach (var dev in Devices) + { + variableRegistry.Combine(dev.GetRegisteredVariables()); + } + } + return variableRegistry; + } + /// + /// Only called once when registering variables. Can be empty if not needed + /// + protected virtual void RegisterVariables(VariableRegistry local) + { + //purposefully empty, if varibles are needed, this should be overridden + } + protected VariableRegistry GlobalVarRegistry => Global.Configuration.VarRegistry; + + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Bloody/Bloody.cs b/Project-Aurora/Project-Aurora/Devices/Bloody/Bloody.cs index f7431961a..d1c2bb356 100644 --- a/Project-Aurora/Project-Aurora/Devices/Bloody/Bloody.cs +++ b/Project-Aurora/Project-Aurora/Devices/Bloody/Bloody.cs @@ -15,34 +15,80 @@ namespace Aurora.Devices.Bloody public class BloodyDevice : DefaultDevice { public override string DeviceName => "Bloody"; + protected override string DeviceInfo => IsInitialized ? GetDeviceNames() : base.DeviceInfo; private BloodyKeyboard keyboard; + private List peripherals; + + private event EventHandler> deviceUpdated; public override bool Initialize() { keyboard = BloodyKeyboard.Initialize(); + if(keyboard != null) + { + deviceUpdated += UpdateKeyboard; + } + + peripherals = BloodyPeripheral.GetDevices(); + deviceUpdated += UpdatePeripherals; - return IsInitialized = (keyboard != null); + return IsInitialized = (keyboard != null) || (peripherals.Any()); } public override void Shutdown() { - keyboard.Disconnect(); + keyboard?.Disconnect(); + deviceUpdated -= UpdateKeyboard; + + peripherals.ForEach(p => p.Disconnect()); + deviceUpdated -= UpdatePeripherals; + IsInitialized = false; } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { + deviceUpdated?.Invoke(this, keyColors); + return true; + } + + private void UpdateKeyboard(object sender, Dictionary keyColors) { - if (!IsInitialized) - return false; + foreach (var (key, clr) in keyColors) + { + if (BloodyKeyMap.KeyMap.TryGetValue((DeviceKeys)key, out var bloodyKey)) + keyboard.SetKeyColor(bloodyKey, ColorUtils.CorrectWithAlpha(clr)); + } + + keyboard.Update(); + } - foreach (var key in keyColors) + private void UpdatePeripherals(object sender, Dictionary keyColors) + { + foreach(var dev in peripherals) { - if (BloodyKeyMap.KeyMap.TryGetValue(key.Key, out var bloodyKey)) - keyboard.SetKeyColor(bloodyKey, ColorUtils.CorrectWithAlpha(key.Value)); + Dictionary keyMap = null; + switch (dev.PeripheralType) + { + case PeripheralType.MOUSE: + keyMap = BloodyKeyMap.MouseLightMap; + break; + case PeripheralType.MOUSEPAD: + keyMap = BloodyKeyMap.MousePadLightMap; + break; + } + foreach (KeyValuePair ledAndKey in keyMap) + { + keyColors.TryGetValue((int)ledAndKey.Value, out var color); + dev.SetKeyColor(ledAndKey.Key, ColorUtils.CorrectWithAlpha(color)); + } + dev.Update(); } + } - return keyboard.Update(); + private string GetDeviceNames() + { + return (keyboard != null ? " Keyboard" : "") + String.Join(" ", peripherals); } } } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyKeyMap.cs b/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyKeyMap.cs index 41fe354de..cf71d69d5 100644 --- a/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyKeyMap.cs +++ b/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyKeyMap.cs @@ -99,7 +99,43 @@ public static class BloodyKeyMap [DeviceKeys.PAGE_DOWN] = Key.PAGE_DOWN, [DeviceKeys.ARROW_RIGHT] = Key.ARROW_RIGHT, [DeviceKeys.ADDITIONALLIGHT1] = Key.LEFT_BAR, - [DeviceKeys.ADDITIONALLIGHT2] = Key.RIGHT_BAR + [DeviceKeys.ADDITIONALLIGHT2] = Key.RIGHT_BAR, + }; + public static Dictionary MouseLightMap = new Dictionary() + { + [BloodyPeripheralLed.L2] = DeviceKeys.PERIPHERAL_LIGHT1, + [BloodyPeripheralLed.L3] = DeviceKeys.PERIPHERAL_LIGHT2, + [BloodyPeripheralLed.L4] = DeviceKeys.PERIPHERAL_LIGHT3, + [BloodyPeripheralLed.L5] = DeviceKeys.PERIPHERAL_LIGHT4, + [BloodyPeripheralLed.L6] = DeviceKeys.PERIPHERAL_LIGHT5, + [BloodyPeripheralLed.L7] = DeviceKeys.PERIPHERAL_LIGHT6, + [BloodyPeripheralLed.L10] = DeviceKeys.PERIPHERAL_LIGHT7, + [BloodyPeripheralLed.L9 ] = DeviceKeys.PERIPHERAL_LIGHT13, + [BloodyPeripheralLed.L8 ] = DeviceKeys.PERIPHERAL_LIGHT14, + [BloodyPeripheralLed.L14] = DeviceKeys.PERIPHERAL_LIGHT15, + [BloodyPeripheralLed.L13] = DeviceKeys.PERIPHERAL_LIGHT16, + + + [BloodyPeripheralLed.L11] = DeviceKeys.Peripheral_Logo, + [BloodyPeripheralLed.L15] = DeviceKeys.Peripheral_ScrollWheel, + }; + public static Dictionary MousePadLightMap = new Dictionary() + { + [BloodyPeripheralLed.L1] = DeviceKeys.MOUSEPADLIGHT1, + [BloodyPeripheralLed.L2] = DeviceKeys.MOUSEPADLIGHT2, + [BloodyPeripheralLed.L3] = DeviceKeys.MOUSEPADLIGHT3, + [BloodyPeripheralLed.L4] = DeviceKeys.MOUSEPADLIGHT4, + [BloodyPeripheralLed.L5] = DeviceKeys.MOUSEPADLIGHT5, + [BloodyPeripheralLed.L6] = DeviceKeys.MOUSEPADLIGHT6, + [BloodyPeripheralLed.L7] = DeviceKeys.MOUSEPADLIGHT7, + [BloodyPeripheralLed.L8] = DeviceKeys.MOUSEPADLIGHT8, + [BloodyPeripheralLed.L9] = DeviceKeys.MOUSEPADLIGHT9, + [BloodyPeripheralLed.L10] = DeviceKeys.MOUSEPADLIGHT10, + [BloodyPeripheralLed.L11] = DeviceKeys.MOUSEPADLIGHT11, + [BloodyPeripheralLed.L12] = DeviceKeys.MOUSEPADLIGHT12, + [BloodyPeripheralLed.L13] = DeviceKeys.MOUSEPADLIGHT13, + [BloodyPeripheralLed.L14] = DeviceKeys.MOUSEPADLIGHT14, + [BloodyPeripheralLed.L15] = DeviceKeys.MOUSEPADLIGHT15, }; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyMouseKey.cs b/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyMouseKey.cs new file mode 100644 index 000000000..e8a38880e --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyMouseKey.cs @@ -0,0 +1,28 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aurora.Devices.Bloody +{ + public enum BloodyPeripheralLed + { + L1 = 0, + L2 = 1, + L3 = 2, + L4 = 3, + L5 = 4, + L6 = 5, + L7 = 6, + L8 = 7, + L9 = 8, + L10 = 9, + L11 = 10, + L12 = 11, + L13 = 12, + L14 = 13, + L15 = 14, + L16 = 15, + } +} diff --git a/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyPeripheral.cs b/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyPeripheral.cs new file mode 100644 index 000000000..e235f9eac --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/Bloody/BloodyPeripheral.cs @@ -0,0 +1,190 @@ +using HidSharp; +using HidSharp.Reports.Encodings; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Aurora.Devices.Bloody +{ + public sealed class BloodyPeripheral : IDisposable + { + private static readonly Dictionary DeviceIds = new() + { + [0x37EA] = PeripheralType.MOUSE, + [0xFA60] = PeripheralType.MOUSEPAD, + [0x356E] = PeripheralType.MOUSEPAD, + }; + private static readonly byte[] ColorPacketHeader = { 0x07, 0x03, 0x06, 0x02, 0x00, 0x00, 0x00, 0x00 }; + + public PeripheralType PeripheralType => _peripheralType; + + private const int VendorId = 0x09DA; + private const uint LedUsagePage = 0x000C; //(ff52,0001,000C) //List of UsagePage+UsageID I found from Windows Device Manager(labed there as Uxxxx&&UPxxxx) + private const uint LedUsage = 0x0001; //(0244,/0080,0001) + + private readonly PeripheralType _peripheralType; + + private readonly byte[] _keyColors = new byte[16 * 3]; + + private readonly HidStream _ctrlStream; + + private BloodyPeripheral(HidStream ctrlStream, PeripheralType peripheralType) + { + _ctrlStream = ctrlStream; + _peripheralType = peripheralType; + } + + public override string ToString() + { + return _peripheralType.ToString(); + } + + public static List GetDevices() + { + List devices = new List(); + foreach(int productId in DeviceIds.Keys) + { + var dev = Initialize(productId); + if (dev != null) + devices.Add(dev); + } + return devices; + } + public static BloodyPeripheral Initialize(int productId) + { + var devices = DeviceList.Local.GetHidDevices(vendorID: VendorId, productID: productId); //Find device with given VID PID + + if (!devices.Any()) + { + return null; + } + try + { + GetFromUsages(devices, LedUsagePage, LedUsage); + HidDevice ctrlDevice = devices.First(d => d.GetMaxFeatureReportLength() > 50); + + HidStream ctrlStream = null; + if ((bool) ctrlDevice?.TryOpen(out ctrlStream)) + { + PeripheralType type; + DeviceIds.TryGetValue(productId, out type); + BloodyPeripheral bp = new BloodyPeripheral(ctrlStream, type); + bp.SetDirect(); + return bp; + } + ctrlStream?.Close(); + } + catch + { } + return null; + } + + private void SetDirect() + { + byte[] a = { 0x07, 0x03, 0x06, 0x01 }; + byte[] b = { 0x07, 0x03, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }; + + var packet = new byte[64]; + try + { + a.CopyTo(packet, 0); + _ctrlStream.SetFeature(packet); + b.CopyTo(packet, 0); + _ctrlStream.SetFeature(packet); + } + catch + { + Disconnect(); + } + } + + #region Set Colors + /// + /// All packets sent to the mouse which invole anything to do with rgb are 64 bytes long. + /// First Packet of rgb data transfer starts with 07030601 and next bytes are empty. + /// Next Packets contain actual rgb data and start with 0703060200000000 + /// + public void SetColors(Dictionary keyColors) + { + foreach (var key in keyColors) + SetKeyColor(key.Key, key.Value); + } + + public void SetColor(Color clr) //Set Color to every key on keyboard + { + foreach (BloodyPeripheralLed key in (BloodyPeripheralLed[])Enum.GetValues(typeof(BloodyPeripheralLed))) + SetKeyColor(key, clr); + } + + public void SetKeyColor(BloodyPeripheralLed key, Color clr) //Puts data for each key into the byte array _keyColors + { + int offset = (int)key * 3; + _keyColors[offset + 0] = clr.R; + _keyColors[offset + 1] = clr.G; + _keyColors[offset + 2] = clr.B; + } + public bool Update() => WriteColorBuffer(); + private bool WriteColorBuffer() + { + byte[] packet = new byte[64]; + try + { + ColorPacketHeader.CopyTo(packet, 0); //Copies Color Header to packet + Array.Copy(_keyColors, 0, packet, 8, 16 * 3); //Copies rgb bytes to the packet + _ctrlStream.SetFeature(packet); //Sends packet as additional data in SetReport USBHID packet + return true; + } + catch (Exception e) + { + Disconnect(); + return false; + } + } + #endregion + private static HidDevice GetFromUsages(IEnumerable devices, uint usagePage, uint usage) + { + foreach (var dev in devices) //For each dev in devices under Vid Pid get dev with right UsageID and UsagePage, if found return it. + { + try + { + var raw = dev.GetRawReportDescriptor(); + var usages = EncodedItem.DecodeItems(raw, 0, raw.Length).Where(t => t.TagForGlobal == GlobalItemTag.UsagePage); + if (usages.Any(g => g.ItemType == ItemType.Global && g.DataValue == usagePage)) + { + if (usages.Any(l => l.ItemType == ItemType.Local && l.DataValue == usage)) + { + return dev; + } + } + } + catch + { + //failed to get the report descriptor, skip + } + } + return null; + } + + public void Disconnect() + { + _ctrlStream?.Close(); + } + + #region IDisposable Support + /// + /// Disconnects the mouse when disposing + /// + public void Dispose() => Disconnect(); + #endregion + } + + public enum PeripheralType + { + MOUSE, + MOUSEPAD, + KEYBOARD, + } +} diff --git a/Project-Aurora/Project-Aurora/Devices/Clevo/ClevoDevice.cs b/Project-Aurora/Project-Aurora/Devices/Clevo/ClevoDevice.cs index 96c629c8f..9baba65e8 100644 --- a/Project-Aurora/Project-Aurora/Devices/Clevo/ClevoDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Clevo/ClevoDevice.cs @@ -1,48 +1,46 @@ -using Aurora.Utils; -using Microsoft.Win32; -using System; +using System; using System.Collections.Generic; +using System.ComponentModel; +using System.Diagnostics; using System.Drawing; -using System.Threading; -using System.Threading.Tasks; using Aurora.Settings; -using System.ComponentModel; +using Aurora.Utils; +using Microsoft.Win32; namespace Aurora.Devices.Clevo { class ClevoDevice : IDevice { // Generic Variables - private string devicename = "Clevo Keyboard"; - private bool isInitialized = false; + private bool _isInitialized; - private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); - private long lastUpdateTime = 0; + private readonly Stopwatch _watch = new(); + private long _lastUpdateTime; // Settings // TODO: Theese settings could be implemented with posibility of configuration from the Aurora GUI (Or external JSON, INI, Settings, etc) - private bool useGlobalPeriphericColors = false; - private bool useTouchpad = true; - private bool updateLightsOnLogon = true; + private bool _useGlobalPeriphericColors = false; + private bool _useTouchpad = true; + private bool _updateLightsOnLogon = true; // Clevo Controll Class - private ClevoSetKBLED clevo = new ClevoSetKBLED(); + private ClevoSetKBLED _clevo = new(); // Color Variables - private Color ColorKBCenter = Color.Black; - private Color ColorKBLeft = Color.Black; - private Color ColorKBRight = Color.Black; - private Color ColorTouchpad = Color.Black; - private bool ColorUpdated; - private Color LastColorKBCenter = Color.Black; - private Color LastColorKBLeft = Color.Black; - private Color LastColorKBRight = Color.Black; - private Color LastColorTouchpad = Color.Black; + private Color _colorKbCenter = Color.Black; + private Color _colorKbLeft = Color.Black; + private Color _colorKbRight = Color.Black; + private Color _colorTouchpad = Color.Black; + private bool _colorUpdated; + private Color _lastColorKbCenter = Color.Black; + private Color _lastColorKbLeft = Color.Black; + private Color _lastColorKbRight = Color.Black; + private Color _lastColorTouchpad = Color.Black; // Session Switch Handler - private SessionSwitchEventHandler sseh; + private SessionSwitchEventHandler _sseh; - public string DeviceName => devicename; + public string DeviceName => "Clevo Keyboard"; public string DeviceDetails => IsInitialized ? "Initialized" @@ -50,249 +48,211 @@ class ClevoDevice : IDevice public bool Initialize() { - if (!isInitialized) + if (_isInitialized) return _isInitialized; + try { - try + // Initialize Clevo WMI Interface Connection + if (!_clevo.Initialize()) { - // Initialize Clevo WMI Interface Connection - if (!clevo.Initialize()) - { - throw new Exception("Could not connect to Clevo WMI Interface"); - } - - // Update Lights on Logon (Clevo sometimes resets the lights when you Hibernate, this would fix wrong colors) - if (updateLightsOnLogon) - { - sseh = new SessionSwitchEventHandler(SystemEvents_SessionSwitch); - SystemEvents.SessionSwitch += sseh; - } - - // Mark Initialized = TRUE - isInitialized = true; - return true; + throw new Exception("Could not connect to Clevo WMI Interface"); } - catch (Exception ex) + + // Update Lights on Logon (Clevo sometimes resets the lights when you Hibernate, this would fix wrong colors) + if (_updateLightsOnLogon) { - Global.logger.Error("Clevo device, Exception! Message:" + ex); + _sseh = SystemEvents_SessionSwitch; + SystemEvents.SessionSwitch += _sseh; } - // Mark Initialized = FALSE - isInitialized = false; - return false; + // Mark Initialized = TRUE + _isInitialized = true; + return true; + } + catch (Exception ex) + { + Global.logger.Error("Clevo device, Exception! Message:" + ex); } - return isInitialized; + // Mark Initialized = FALSE + _isInitialized = false; + return false; } // Handle Logon Event void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) { - if (this.IsInitialized&& e.Reason.Equals(SessionSwitchReason.SessionUnlock)) + if (IsInitialized&& e.Reason.Equals(SessionSwitchReason.SessionUnlock)) { // Only Update when Logged In - this.SendColorsToKeyboard(true); + SendColorsToKeyboard(true); } } public void Shutdown() { - if (this.IsInitialized) - { - // Release Clevo Connection - clevo.ResetKBLEDColors(); - clevo.Release(); - - // Uninstantiate Session Switch - if (sseh != null) - { - SystemEvents.SessionSwitch -= sseh; - sseh = null; - } - } + if (!IsInitialized) return; + // Release Clevo Connection + _clevo.ResetKBLEDColors(); + _clevo.Release(); + + // Uninstantiate Session Switch + if (_sseh == null) return; + SystemEvents.SessionSwitch -= _sseh; + _sseh = null; } public void Reset() { - if (this.IsInitialized) - clevo.ResetKBLEDColors(); + if (IsInitialized) + _clevo.ResetKBLEDColors(); } - public bool Reconnect() - { - throw new NotImplementedException(); - } - - public bool IsInitialized => isInitialized; - - public bool IsConnected() - { - throw new NotImplementedException(); - } - - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) // Is this necessary? - { - throw new NotImplementedException(); - } + public bool IsInitialized => _isInitialized; public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArgs e, bool forced = false) { if (e.Cancel) return false; - watch.Restart(); - bool update_result = false; + _watch.Restart(); + bool updateResult; - Dictionary keyColors = colorComposition.keyColors; + Dictionary keyColors = colorComposition.KeyColors; if (e.Cancel) return false; try { - foreach (KeyValuePair pair in keyColors) + foreach (KeyValuePair pair in keyColors) { if (e.Cancel) return false; - if (useGlobalPeriphericColors) + if (_useGlobalPeriphericColors) { - if (pair.Key == DeviceKeys.Peripheral) // This is not working anymore. Was working in MASTER + if (pair.Key == (int)DeviceKeys.Peripheral) // This is not working anymore. Was working in MASTER { - ColorKBLeft = pair.Value; - ColorKBCenter = pair.Value; - ColorKBRight = pair.Value; - ColorTouchpad = pair.Value; - ColorUpdated = true; + _colorKbLeft = pair.Value; + _colorKbCenter = pair.Value; + _colorKbRight = pair.Value; + _colorTouchpad = pair.Value; + _colorUpdated = true; } } else { // TouchPad (It would be nice to have a Touchpad Peripheral) - if (pair.Key == DeviceKeys.Peripheral) + if (pair.Key == (int)DeviceKeys.Peripheral) { - ColorTouchpad = pair.Value; - ColorUpdated = true; + _colorTouchpad = pair.Value; + _colorUpdated = true; } } } if (e.Cancel) return false; - if (!useGlobalPeriphericColors) + if (!_useGlobalPeriphericColors) { // Clevo 3 region keyboard // Left Side (From ESC to Half Spacebar) - BitmapRectangle keymap_esc = Effects.GetBitmappingFromDeviceKey(DeviceKeys.ESC); - BitmapRectangle keymap_space = Effects.GetBitmappingFromDeviceKey(DeviceKeys.SPACE); - PointF spacebar_center = keymap_space.Center; // Key Center + BitmapRectangle keymapEsc = Effects.GetBitmappingFromDeviceKey(DeviceKeys.ESC); + BitmapRectangle keymapSpace = Effects.GetBitmappingFromDeviceKey(DeviceKeys.SPACE); + PointF spacebarCenter = keymapSpace.Center; // Key Center - int spacebar_x = (int)spacebar_center.X - keymap_esc.Left; - int height = (int)spacebar_center.Y - keymap_esc.Top; + int spacebarX = (int)spacebarCenter.X - keymapEsc.Left; + int height = (int)spacebarCenter.Y - keymapEsc.Top; - BitmapRectangle region_left = - new BitmapRectangle(keymap_esc.Left, keymap_esc.Top, spacebar_x, height); + Rectangle regionLeft = + new Rectangle(keymapEsc.Left, keymapEsc.Top, spacebarX, height); - Color RegionLeftColor; + Color regionLeftColor; - lock (colorComposition.bitmapLock) - RegionLeftColor = Utils.BitmapUtils.GetRegionColor(colorComposition.keyBitmap, region_left); + lock (colorComposition.KeyBitmap) + regionLeftColor = BitmapUtils.GetRegionColor(colorComposition.KeyBitmap, regionLeft); - if (!ColorKBLeft.Equals(RegionLeftColor)) + if (!_colorKbLeft.Equals(regionLeftColor)) { - ColorKBLeft = RegionLeftColor; - ColorUpdated = true; + _colorKbLeft = regionLeftColor; + _colorUpdated = true; } if (e.Cancel) return false; // Center (Other Half of Spacebar to F11) - Clevo keyboards are very compact and the right side color bleeds over to the up/left/right/down keys) - BitmapRectangle keymap_f11 = Effects.GetBitmappingFromDeviceKey(DeviceKeys.F11); + BitmapRectangle keymapF11 = Effects.GetBitmappingFromDeviceKey(DeviceKeys.F11); - int f11_x_width = Convert.ToInt32(keymap_f11.Center.X - spacebar_x); + var f11XWidth = Convert.ToInt32(keymapF11.Center.X - spacebarX); - BitmapRectangle region_center = - new BitmapRectangle(spacebar_x, keymap_esc.Top, f11_x_width, height); + var regionCenter = new Rectangle(spacebarX, keymapEsc.Top, f11XWidth, height); - Color RegionCenterColor; - lock (colorComposition.bitmapLock) - RegionCenterColor = Utils.BitmapUtils.GetRegionColor(colorComposition.keyBitmap, region_center); + Color regionCenterColor; + lock (colorComposition.KeyBitmap) + regionCenterColor = BitmapUtils.GetRegionColor(colorComposition.KeyBitmap, regionCenter); - if (!ColorKBCenter.Equals(RegionCenterColor)) + if (!_colorKbCenter.Equals(regionCenterColor)) { - ColorKBCenter = RegionCenterColor; - ColorUpdated = true; + _colorKbCenter = regionCenterColor; + _colorUpdated = true; } if (e.Cancel) return false; // Right Side - BitmapRectangle keymap_numenter = Effects.GetBitmappingFromDeviceKey(DeviceKeys.NUM_ENTER); - BitmapRectangle region_right = new BitmapRectangle(Convert.ToInt32(keymap_f11.Center.X), - keymap_esc.Top, Convert.ToInt32(keymap_numenter.Center.X - keymap_f11.Center.X), height); + BitmapRectangle keymapNumenter = Effects.GetBitmappingFromDeviceKey(DeviceKeys.NUM_ENTER); + Rectangle regionRight = new Rectangle(Convert.ToInt32(keymapF11.Center.X), + keymapEsc.Top, Convert.ToInt32(keymapNumenter.Center.X - keymapF11.Center.X), height); - Color RegionRightColor; - lock (colorComposition.bitmapLock) - RegionRightColor = Utils.BitmapUtils.GetRegionColor(colorComposition.keyBitmap, region_right); + Color regionRightColor; + lock (colorComposition.KeyBitmap) + regionRightColor = BitmapUtils.GetRegionColor(colorComposition.KeyBitmap, regionRight); - if (!ColorKBRight.Equals(RegionRightColor)) + if (!_colorKbRight.Equals(regionRightColor)) { - ColorKBRight = RegionRightColor; - ColorUpdated = true; + _colorKbRight = regionRightColor; + _colorUpdated = true; } - } if (e.Cancel) return false; SendColorsToKeyboard(forced); - update_result = true; + updateResult = true; } catch (Exception exception) { Global.logger.Error("Clevo device, error when updating device. Error: " + exception); - update_result = false; + updateResult = false; } - watch.Stop(); - lastUpdateTime = watch.ElapsedMilliseconds; + _watch.Stop(); + _lastUpdateTime = _watch.ElapsedMilliseconds; - return update_result; + return updateResult; } private void SendColorsToKeyboard(bool forced = false) { - if (forced || ColorUpdated) + if (!forced && !_colorUpdated) return; + if ((forced || !_lastColorKbLeft.Equals(_colorKbLeft)) && !Global.Configuration.DevicesDisableKeyboard) { - if ((forced || !LastColorKBLeft.Equals(ColorKBLeft)) && !Global.Configuration.DevicesDisableKeyboard) - { - // MYSTERY: // Why is it B,R,G instead of R,G,B? SetKBLED uses R,G,B but only B,R,G returns the correct colors. Is bitshifting different in C# than in C++? - clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorKBLeft, ColorKBLeft.B, ColorKBLeft.R, ColorKBLeft.G, (double)(ColorKBLeft.A / 0xff)); - LastColorKBLeft = ColorKBLeft; - } - if ((forced || !LastColorKBCenter.Equals(ColorKBCenter)) && !Global.Configuration.DevicesDisableKeyboard) - { - clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorKBCenter, ColorKBCenter.B, ColorKBCenter.R, ColorKBCenter.G, (double)(ColorKBCenter.A / 0xff)); - LastColorKBCenter = ColorKBCenter; - } - if ((forced || !LastColorKBRight.Equals(ColorKBRight)) && !Global.Configuration.DevicesDisableKeyboard) - { - clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorKBRight, ColorKBRight.B, ColorKBRight.R, ColorKBRight.G, (double)(ColorKBRight.A / 0xff)); - LastColorKBRight = ColorKBRight; - } - if ((forced || (useTouchpad && !LastColorTouchpad.Equals(ColorTouchpad))) && !Global.Configuration.DevicesDisableMouse) - { - clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorTouchpad, ColorTouchpad.B, ColorTouchpad.R, ColorTouchpad.G, (double)(ColorTouchpad.A / 0xff)); - LastColorTouchpad = ColorTouchpad; - } - ColorUpdated = false; + // MYSTERY: // Why is it B,R,G instead of R,G,B? SetKBLED uses R,G,B but only B,R,G returns the correct colors. Is bitshifting different in C# than in C++? + _clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorKBLeft, _colorKbLeft.B, _colorKbLeft.R, _colorKbLeft.G, _colorKbLeft.A / 0xff); + _lastColorKbLeft = _colorKbLeft; } + if ((forced || !_lastColorKbCenter.Equals(_colorKbCenter)) && !Global.Configuration.DevicesDisableKeyboard) + { + _clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorKBCenter, _colorKbCenter.B, _colorKbCenter.R, _colorKbCenter.G, _colorKbCenter.A / 0xff); + _lastColorKbCenter = _colorKbCenter; + } + if ((forced || !_lastColorKbRight.Equals(_colorKbRight)) && !Global.Configuration.DevicesDisableKeyboard) + { + _clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorKBRight, _colorKbRight.B, _colorKbRight.R, _colorKbRight.G, _colorKbRight.A / 0xff); + _lastColorKbRight = _colorKbRight; + } + if ((forced || (_useTouchpad && !_lastColorTouchpad.Equals(_colorTouchpad))) && !Global.Configuration.DevicesDisableMouse) + { + _clevo.SetKBLED(ClevoSetKBLED.KBLEDAREA.ColorTouchpad, _colorTouchpad.B, _colorTouchpad.R, _colorTouchpad.G, _colorTouchpad.A / 0xff); + _lastColorTouchpad = _colorTouchpad; + } + _colorUpdated = false; } - // Device Status Methods - public bool IsKeyboardConnected() - { - return isInitialized; - } - - public bool IsPeripheralConnected() - { - return isInitialized; - } - - public string DeviceUpdatePerformance => (isInitialized ? lastUpdateTime + " ms" : ""); + public string DeviceUpdatePerformance => (_isInitialized ? _lastUpdateTime + " ms" : ""); - public VariableRegistry RegisteredVariables => new VariableRegistry(); + public VariableRegistry RegisteredVariables => new(); } } diff --git a/Project-Aurora/Project-Aurora/Devices/CoolerMaster/CoolerMasterDevice.cs b/Project-Aurora/Project-Aurora/Devices/CoolerMaster/CoolerMasterDevice.cs index 30b0564b1..65ac7842c 100755 --- a/Project-Aurora/Project-Aurora/Devices/CoolerMaster/CoolerMasterDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/CoolerMaster/CoolerMasterDevice.cs @@ -54,7 +54,7 @@ public override void Shutdown() IsInitialized = false; } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { foreach (var (dev, colors) in InitializedDevices) { @@ -75,11 +75,12 @@ public override bool UpdateDevice(Dictionary keyColors, DoWorkEventAr foreach (var (dk, clr) in keyColors) { - DK key = dk; + DK key = (DeviceKeys)dk; //HACK: the layouts for some reason switch backslash and enter //around between ANSI and ISO needlessly. We swap them around here - if (key == DK.ENTER && !Global.kbLayout.Loaded_Localization.IsANSI()) - key = DK.BACKSLASH; + //TODO fix it to work + /*if (key == DK.ENTER && !Global.kbLayout.Loaded_Localization.IsANSI()) + key = DK.BACKSLASH;*/ if (dict.TryGetValue(key, out var position)) colors.KeyColor[position.row, position.column] = new Native.KEY_COLOR(ColorUtils.CorrectWithAlpha(clr)); diff --git a/Project-Aurora/Project-Aurora/Devices/Corsair/CorsairDevice.cs b/Project-Aurora/Project-Aurora/Devices/Corsair/CorsairDevice.cs index 567319e5e..00e8cf731 100644 --- a/Project-Aurora/Project-Aurora/Devices/Corsair/CorsairDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Corsair/CorsairDevice.cs @@ -1,8 +1,5 @@ using Aurora.Settings; using Aurora.Utils; -using CorsairRGB.NET; -using CorsairRGB.NET.Enums; -using CorsairRGB.NET.Structures; using Mono.CSharp; using System; using System.Collections.Generic; @@ -10,156 +7,174 @@ using System.Drawing; using System.Linq; using System.Text; -using CUESDK = CorsairRGB.NET.CUE; +using Corsair.CUE.SDK; +using IronPython.Runtime; +using SharpDX.Direct3D11; +using System.Threading; +using Aurora.Profiles.Discord.GSI.Nodes; +using NLog.Fluent; namespace Aurora.Devices.Corsair { - public class CorsairDevice : DefaultDevice + public class CorsairDeviceConnector : AuroraDeviceConnector { - public override string DeviceName => "Corsair"; - - protected override string DeviceInfo => string.Join(", ", deviceInfos.Select(d => d.Model)); - - private readonly List deviceInfos = new List(); - - public override bool Initialize() + private SemaphoreSlim allDeviceUpdated; + protected override string ConnectorName => "Corsair"; + private int deviceWaitCounter = 0; + protected override bool InitializeImpl() { - CUESDK.PerformProtocolHandshake(); - var error = CUESDK.GetLastError(); - if (error != CorsairError.Success) + CUESDK.CorsairPerformProtocolHandshake(); + + var error = CUESDK.CorsairGetLastError(); + if (error != CorsairError.CE_Success) { LogError("Error: " + error); - return IsInitialized = false; + return false; } + allDeviceUpdated = new SemaphoreSlim(0, 1); - for (int i = 0; i < CUESDK.GetDeviceCount(); i++) - deviceInfos.Add(CUESDK.GetDeviceInfo(i)); + for (int i = 0; i < CUESDK.CorsairGetDeviceCount(); i++) + { + RegisterDevice(CreateDevice(CUESDK.CorsairGetDeviceInfo(i), i)); + } - if (Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_exclusive") && !CUESDK.RequestControl()) + if (Global.Configuration.VarRegistry.GetVariable($"{ConnectorName}_exclusive") && !CUESDK.CorsairRequestControl(CorsairAccessMode.CAM_ExclusiveLightingControl)) { - LogError("Error requesting cuesdk exclusive control:" + CUESDK.GetLastError()); + LogError("Error requesting cuesdk exclusive control:" + CUESDK.CorsairGetLastError()); } - CUESDK.SetLayerPriority(255); + CUESDK.CorsairSetLayerPriority(255); - return IsInitialized = true; + return true; + } + private CorsairDevice CreateDevice(CorsairDeviceInfo info, int index) + { + switch (info.type) + { + case CorsairDeviceType.CDT_Keyboard: + return new CorsairKeyboard(info, index); + case CorsairDeviceType.CDT_Mouse: + case CorsairDeviceType.CDT_MouseMat: + return new CorsairDevice(info, index, AuroraDeviceType.Mouse); + case CorsairDeviceType.CDT_Headset: + case CorsairDeviceType.CDT_HeadsetStand: + return new CorsairDevice(info, index, AuroraDeviceType.Headset); + case CorsairDeviceType.CDT_CommanderPro: + case CorsairDeviceType.CDT_LightingNodePro: + case CorsairDeviceType.CDT_MemoryModule: + case CorsairDeviceType.CDT_Cooler: + case CorsairDeviceType.CDT_Motherboard: + case CorsairDeviceType.CDT_GraphicsCard: + default: + return new CorsairDevice(info, index); + } } - public override void Shutdown() + protected override void ShutdownImpl() { - CUESDK.SetLayerPriority(0); - deviceInfos.Clear(); - CUESDK.ReleaseControl(); - IsInitialized = false; + CUESDK.CorsairSetLayerPriority(0); + CUESDK.CorsairReleaseControl(CorsairAccessMode.CAM_ExclusiveLightingControl); + allDeviceUpdated.Dispose(); } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public override void DeviceLedUpdateFinished() { - if (deviceInfos.Count != CUESDK.GetDeviceCount()) + if (Devices.Count != CUESDK.CorsairGetDeviceCount()) + { this.Reset(); + return; + } - for (int i = 0; i < deviceInfos.Count; i++) + deviceWaitCounter++; + if (deviceWaitCounter != Devices.Where(d => d.id.ViewPort != null).ToList().Count) { - var deviceInfo = deviceInfos[i]; - if (deviceInfo.Type == CorsairDeviceType.Keyboard && Global.Configuration.DevicesDisableKeyboard) - continue; + allDeviceUpdated.Wait(); + return; + } + CUESDK.CorsairSetLedsColorsFlushBuffer(); + allDeviceUpdated.Release(); + allDeviceUpdated = new SemaphoreSlim(0, 1); + deviceWaitCounter = 0; + } + protected override void RegisterVariables(VariableRegistry variableRegistry) + { + variableRegistry.Register($"{ConnectorName}_exclusive", false, "Request exclusive control"); + } + } - if ((deviceInfo.Type == CorsairDeviceType.Mouse || deviceInfo.Type == CorsairDeviceType.MouseMat) - && Global.Configuration.DevicesDisableMouse) - continue; - if ((deviceInfo.Type == CorsairDeviceType.Headset || deviceInfo.Type == CorsairDeviceType.HeadsetStand) - && Global.Configuration.DevicesDisableHeadset) - continue; + public class CorsairDevice : AuroraDevice + { + protected override string DeviceName => deviceInfo.model; - List colors = new List(); + protected List colors = new List(); + private AuroraDeviceType type; + protected override AuroraDeviceType AuroraDeviceType => type; - if (LedMaps.MapsMap.TryGetValue(deviceInfo.Type, out var dict) && dict.Count != 0) - { - foreach (var led in keyColors) - { - if (dict.TryGetValue(led.Key, out var ledid)) - { - colors.Add(new CorsairLedColor() - { - LedId = ledid, - R = led.Value.R, - G = led.Value.G, - B = led.Value.B - }); - } - } - } - else - { - if (keyColors.TryGetValue(DeviceKeys.Peripheral_Logo, out var clr)) - { - if(deviceInfo.Type == CorsairDeviceType.LightingNodePro || deviceInfo.Type == CorsairDeviceType.CommanderPro) - { - int totalLeds = 0; - for (int j = 0; j < deviceInfo.Channels.ChannelsCount; j++) - { - totalLeds += deviceInfo.Channels.Channels[j].TotalLedsCount; - foreach (var ledid in LedMaps.ChannelLeds[j]) - { - if (colors.Count == totalLeds) - continue; - - colors.Add(new CorsairLedColor() - { - LedId = ledid, - R = clr.R, - G = clr.G, - B = clr.B - }); - } - } - } - else - { - CorsairLedId initial = GetInitialLedIdForDeviceType(deviceInfo.Type); - - if (initial == CorsairLedId.I_Invalid) - continue; - - for(int j = 0; j < deviceInfo.LedsCount; j++) - { - colors.Add(new CorsairLedColor() - { - LedId = initial++, - R = clr.R, - G = clr.G, - B = clr.B - }); - } - } - } - } + protected CorsairDeviceInfo deviceInfo; + protected int deviceIndex; + protected Dictionary KeyMapping = new Dictionary(new DeviceKey.EqualityComparer()); - if (colors.Count == 0) - continue; + protected CorsairDevice() {} + public CorsairDevice(CorsairDeviceInfo deviceInfo, int index, AuroraDeviceType type = AuroraDeviceType.Unkown) + { + this.deviceInfo = deviceInfo; + deviceIndex = index; + this.type = type; + var ledPositions = CUESDK.CorsairGetLedPositionsByDeviceIndex(deviceIndex); - CUESDK.SetDeviceColors(i, colors.ToArray()); + int overIndex = 0; + foreach (var pos in ledPositions.pLedPosition) + { + KeyMapping[new DeviceKey(overIndex++, pos.ledId.ToString())] = pos.ledId; + colors.Add(new CorsairLedColor { ledId = pos.ledId }); } - - return CUESDK.Update(); } - - private CorsairLedId GetInitialLedIdForDeviceType(CorsairDeviceType type) + protected override bool UpdateDeviceImpl(DeviceColorComposition composition) { - return type switch + List colors = new List(); + foreach (var (key, clr) in composition.KeyColors) { - CorsairDeviceType.Headset => CorsairLedId.H_LeftLogo, - CorsairDeviceType.MemoryModule => CorsairLedId.DRAM_1, - CorsairDeviceType.Cooler => CorsairLedId.LC_C1_1, - CorsairDeviceType.Motherboard => CorsairLedId.MB_Zone1, - CorsairDeviceType.GraphicsCard => CorsairLedId.GPU_Zone1, - _ => CorsairLedId.I_Invalid - }; + if (KeyMapping.TryGetValue(key, out var ledid)) + { + colors.Add(new CorsairLedColor() + { + ledId = ledid, + r = clr.R, + g = clr.G, + b = clr.B + }); + } + } + CUESDK.CorsairSetLedsColorsBufferByDeviceIndex(deviceIndex, colors.Count, colors.ToArray()); + return true; } - protected override void RegisterVariables(VariableRegistry variableRegistry) + + public override List GetAllDeviceKey() => KeyMapping.Keys.ToList(); + } + public class CorsairKeyboard : CorsairDevice + { + protected override AuroraDeviceType AuroraDeviceType => AuroraDeviceType.Keyboard; + + public CorsairKeyboard(CorsairDeviceInfo deviceInfo, int index) { - variableRegistry.Register($"{DeviceName}_exclusive", false, "Request exclusive control"); + this.deviceInfo = deviceInfo; + deviceIndex = index; + var ledPositions = CUESDK.CorsairGetLedPositionsByDeviceIndex(deviceIndex); + int overIndex = 0; + foreach (var pos in ledPositions.pLedPosition) + { + if (LedMaps.KeyboardLedMap.TryGetValue(pos.ledId, out var dk)) + { + KeyMapping[new DeviceKey(dk)] = pos.ledId; + } + else + { + KeyMapping[new DeviceKey(500 + overIndex++, pos.ledId.ToString())] = pos.ledId; + } + colors.Add(new CorsairLedColor { ledId = pos.ledId }); + } + } } } diff --git a/Project-Aurora/Project-Aurora/Devices/Corsair/LedMaps.cs b/Project-Aurora/Project-Aurora/Devices/Corsair/LedMaps.cs index 5229f910f..948016601 100644 --- a/Project-Aurora/Project-Aurora/Devices/Corsair/LedMaps.cs +++ b/Project-Aurora/Project-Aurora/Devices/Corsair/LedMaps.cs @@ -1,191 +1,229 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; using Aurora.Utils; -using CorsairRGB.NET.Enums; -using CorsairRGB.NET.Structures; +using Corsair.CUE.SDK; namespace Aurora.Devices.Corsair { internal static class LedMaps { - internal static readonly Dictionary KeyboardLedMap = new Dictionary() + internal static readonly Dictionary KeyboardLedMap = new() { - [DeviceKeys.ESC] = CorsairLedId.K_Escape, - [DeviceKeys.F1] = CorsairLedId.K_F1, - [DeviceKeys.F2] = CorsairLedId.K_F2, - [DeviceKeys.F3] = CorsairLedId.K_F3, - [DeviceKeys.F4] = CorsairLedId.K_F4, - [DeviceKeys.F5] = CorsairLedId.K_F5, - [DeviceKeys.F6] = CorsairLedId.K_F6, - [DeviceKeys.F7] = CorsairLedId.K_F7, - [DeviceKeys.F8] = CorsairLedId.K_F8, - [DeviceKeys.F9] = CorsairLedId.K_F9, - [DeviceKeys.F10] = CorsairLedId.K_F10, - [DeviceKeys.F11] = CorsairLedId.K_F11, - [DeviceKeys.TILDE] = CorsairLedId.K_GraveAccentAndTilde, - [DeviceKeys.ONE] = CorsairLedId.K_1, - [DeviceKeys.TWO] = CorsairLedId.K_2, - [DeviceKeys.THREE] = CorsairLedId.K_3, - [DeviceKeys.FOUR] = CorsairLedId.K_4, - [DeviceKeys.FIVE] = CorsairLedId.K_5, - [DeviceKeys.SIX] = CorsairLedId.K_6, - [DeviceKeys.SEVEN] = CorsairLedId.K_7, - [DeviceKeys.EIGHT] = CorsairLedId.K_8, - [DeviceKeys.NINE] = CorsairLedId.K_9, - [DeviceKeys.ZERO] = CorsairLedId.K_0, - [DeviceKeys.MINUS] = CorsairLedId.K_MinusAndUnderscore, - [DeviceKeys.TAB] = CorsairLedId.K_Tab, - [DeviceKeys.Q] = CorsairLedId.K_Q, - [DeviceKeys.W] = CorsairLedId.K_W, - [DeviceKeys.E] = CorsairLedId.K_E, - [DeviceKeys.R] = CorsairLedId.K_R, - [DeviceKeys.T] = CorsairLedId.K_T, - [DeviceKeys.Y] = CorsairLedId.K_Y, - [DeviceKeys.U] = CorsairLedId.K_U, - [DeviceKeys.I] = CorsairLedId.K_I, - [DeviceKeys.O] = CorsairLedId.K_O, - [DeviceKeys.P] = CorsairLedId.K_P, - [DeviceKeys.OPEN_BRACKET] = CorsairLedId.K_BracketLeft, - [DeviceKeys.CAPS_LOCK] = CorsairLedId.K_CapsLock, - [DeviceKeys.A] = CorsairLedId.K_A, - [DeviceKeys.S] = CorsairLedId.K_S, - [DeviceKeys.D] = CorsairLedId.K_D, - [DeviceKeys.F] = CorsairLedId.K_F, - [DeviceKeys.G] = CorsairLedId.K_G, - [DeviceKeys.H] = CorsairLedId.K_H, - [DeviceKeys.J] = CorsairLedId.K_J, - [DeviceKeys.K] = CorsairLedId.K_K, - [DeviceKeys.L] = CorsairLedId.K_L, - [DeviceKeys.SEMICOLON] = CorsairLedId.K_SemicolonAndColon, - [DeviceKeys.APOSTROPHE] = CorsairLedId.K_ApostropheAndDoubleQuote, - [DeviceKeys.LEFT_SHIFT] = CorsairLedId.K_LeftShift, - [DeviceKeys.BACKSLASH_UK] = CorsairLedId.K_NonUsBackslash, - [DeviceKeys.Z] = CorsairLedId.K_Z, - [DeviceKeys.X] = CorsairLedId.K_X, - [DeviceKeys.C] = CorsairLedId.K_C, - [DeviceKeys.V] = CorsairLedId.K_V, - [DeviceKeys.B] = CorsairLedId.K_B, - [DeviceKeys.N] = CorsairLedId.K_N, - [DeviceKeys.M] = CorsairLedId.K_M, - [DeviceKeys.COMMA] = CorsairLedId.K_CommaAndLessThan, - [DeviceKeys.PERIOD] = CorsairLedId.K_PeriodAndBiggerThan, - [DeviceKeys.FORWARD_SLASH] = CorsairLedId.K_SlashAndQuestionMark, - [DeviceKeys.LEFT_CONTROL] = CorsairLedId.K_LeftCtrl, - [DeviceKeys.LEFT_WINDOWS] = CorsairLedId.K_LeftGui, - [DeviceKeys.LEFT_ALT] = CorsairLedId.K_LeftAlt, - //[DeviceKeys.Lang2] = CorsairLedId.K_Lang2, - [DeviceKeys.SPACE] = CorsairLedId.K_Space, - //[DeviceKeys.Lang1] = CorsairLedId.K_Lang1, - //[DeviceKeys.International2] = CorsairLedId.K_International2, - [DeviceKeys.RIGHT_ALT] = CorsairLedId.K_RightAlt, - [DeviceKeys.RIGHT_WINDOWS] = CorsairLedId.K_RightGui, - [DeviceKeys.APPLICATION_SELECT] = CorsairLedId.K_Application, - //[DeviceKeys.LedProgramming] = CorsairLedId.K_LedProgramming, - [DeviceKeys.BRIGHTNESS_SWITCH] = CorsairLedId.K_Brightness, - [DeviceKeys.F12] = CorsairLedId.K_F12, - [DeviceKeys.PRINT_SCREEN] = CorsairLedId.K_PrintScreen, - [DeviceKeys.SCROLL_LOCK] = CorsairLedId.K_ScrollLock, - [DeviceKeys.PAUSE_BREAK] = CorsairLedId.K_PauseBreak, - [DeviceKeys.INSERT] = CorsairLedId.K_Insert, - [DeviceKeys.HOME] = CorsairLedId.K_Home, - [DeviceKeys.PAGE_UP] = CorsairLedId.K_PageUp, - [DeviceKeys.CLOSE_BRACKET] = CorsairLedId.K_BracketRight, - [DeviceKeys.BACKSLASH] = CorsairLedId.K_Backslash, - [DeviceKeys.HASHTAG] = CorsairLedId.K_NonUsTilde, - [DeviceKeys.ENTER] = CorsairLedId.K_Enter, - //[DeviceKeys.International1] = CorsairLedId.K_International1, - [DeviceKeys.EQUALS] = CorsairLedId.K_EqualsAndPlus, - //[DeviceKeys.International3] = CorsairLedId.K_International3, - [DeviceKeys.BACKSPACE] = CorsairLedId.K_Backspace, - [DeviceKeys.DELETE] = CorsairLedId.K_Delete, - [DeviceKeys.END] = CorsairLedId.K_End, - [DeviceKeys.PAGE_DOWN] = CorsairLedId.K_PageDown, - [DeviceKeys.RIGHT_SHIFT] = CorsairLedId.K_RightShift, - [DeviceKeys.RIGHT_CONTROL] = CorsairLedId.K_RightCtrl, - [DeviceKeys.ARROW_UP] = CorsairLedId.K_UpArrow, - [DeviceKeys.ARROW_LEFT] = CorsairLedId.K_LeftArrow, - [DeviceKeys.ARROW_DOWN] = CorsairLedId.K_DownArrow, - [DeviceKeys.ARROW_RIGHT] = CorsairLedId.K_RightArrow, - [DeviceKeys.LOCK_SWITCH] = CorsairLedId.K_WinLock, - [DeviceKeys.VOLUME_MUTE] = CorsairLedId.K_Mute, - [DeviceKeys.MEDIA_STOP] = CorsairLedId.K_Stop, - [DeviceKeys.MEDIA_PREVIOUS] = CorsairLedId.K_ScanPreviousTrack, - [DeviceKeys.MEDIA_PLAY_PAUSE] = CorsairLedId.K_PlayPause, - [DeviceKeys.MEDIA_NEXT] = CorsairLedId.K_ScanNextTrack, - [DeviceKeys.NUM_LOCK] = CorsairLedId.K_NumLock, - [DeviceKeys.NUM_SLASH] = CorsairLedId.K_KeypadSlash, - [DeviceKeys.NUM_ASTERISK] = CorsairLedId.K_KeypadAsterisk, - [DeviceKeys.NUM_MINUS] = CorsairLedId.K_KeypadMinus, - [DeviceKeys.NUM_PLUS] = CorsairLedId.K_KeypadPlus, - [DeviceKeys.NUM_ENTER] = CorsairLedId.K_KeypadEnter, - [DeviceKeys.NUM_SEVEN] = CorsairLedId.K_Keypad7, - [DeviceKeys.NUM_EIGHT] = CorsairLedId.K_Keypad8, - [DeviceKeys.NUM_NINE] = CorsairLedId.K_Keypad9, - [DeviceKeys.NUM_ZEROZERO] = CorsairLedId.K_KeypadComma, - [DeviceKeys.NUM_FOUR] = CorsairLedId.K_Keypad4, - [DeviceKeys.NUM_FIVE] = CorsairLedId.K_Keypad5, - [DeviceKeys.NUM_SIX] = CorsairLedId.K_Keypad6, - [DeviceKeys.NUM_ONE] = CorsairLedId.K_Keypad1, - [DeviceKeys.NUM_TWO] = CorsairLedId.K_Keypad2, - [DeviceKeys.NUM_THREE] = CorsairLedId.K_Keypad3, - [DeviceKeys.NUM_ZERO] = CorsairLedId.K_Keypad0, - [DeviceKeys.NUM_PERIOD] = CorsairLedId.K_KeypadPeriodAndDelete, - [DeviceKeys.G1] = CorsairLedId.K_G1, - [DeviceKeys.G2] = CorsairLedId.K_G2, - [DeviceKeys.G3] = CorsairLedId.K_G3, - [DeviceKeys.G4] = CorsairLedId.K_G4, - [DeviceKeys.G5] = CorsairLedId.K_G5, - [DeviceKeys.G6] = CorsairLedId.K_G6, - [DeviceKeys.G7] = CorsairLedId.K_G7, - [DeviceKeys.G8] = CorsairLedId.K_G8, - [DeviceKeys.G9] = CorsairLedId.K_G9, - [DeviceKeys.G10] = CorsairLedId.K_G10, - [DeviceKeys.VOLUME_UP] = CorsairLedId.K_VolumeUp, - [DeviceKeys.VOLUME_DOWN] = CorsairLedId.K_VolumeDown, - //[DeviceKeys.MR] = CorsairLedId.K_MR, - //[DeviceKeys.M1] = CorsairLedId.K_M1, - //[DeviceKeys.M2] = CorsairLedId.K_M2, - //[DeviceKeys.M3] = CorsairLedId.K_M3, - [DeviceKeys.G11] = CorsairLedId.K_G11, - [DeviceKeys.G12] = CorsairLedId.K_G12, - [DeviceKeys.G13] = CorsairLedId.K_G13, - [DeviceKeys.G14] = CorsairLedId.K_G14, - [DeviceKeys.G15] = CorsairLedId.K_G15, - [DeviceKeys.G16] = CorsairLedId.K_G16, - [DeviceKeys.G17] = CorsairLedId.K_G17, - [DeviceKeys.G18] = CorsairLedId.K_G18, - //[DeviceKeys.International5] = CorsairLedId.K_International5, - //[DeviceKeys.International4] = CorsairLedId.K_International4, - [DeviceKeys.FN_Key] = CorsairLedId.K_Fn, - [DeviceKeys.LOCK_SWITCH] = CorsairLedId.K_WinLock, - [DeviceKeys.BRIGHTNESS_SWITCH] = CorsairLedId.K_Brightness, - [DeviceKeys.ADDITIONALLIGHT1] = CorsairLedId.KLP_Zone1, - [DeviceKeys.ADDITIONALLIGHT2] = CorsairLedId.KLP_Zone2, - [DeviceKeys.ADDITIONALLIGHT3] = CorsairLedId.KLP_Zone3, - [DeviceKeys.ADDITIONALLIGHT4] = CorsairLedId.KLP_Zone4, - [DeviceKeys.ADDITIONALLIGHT5] = CorsairLedId.KLP_Zone5, - [DeviceKeys.ADDITIONALLIGHT6] = CorsairLedId.KLP_Zone6, - [DeviceKeys.ADDITIONALLIGHT7] = CorsairLedId.KLP_Zone7, - [DeviceKeys.ADDITIONALLIGHT8] = CorsairLedId.KLP_Zone8, - [DeviceKeys.ADDITIONALLIGHT9] = CorsairLedId.KLP_Zone9, - [DeviceKeys.ADDITIONALLIGHT10] = CorsairLedId.KLP_Zone10, - [DeviceKeys.ADDITIONALLIGHT11] = CorsairLedId.KLP_Zone11, - [DeviceKeys.ADDITIONALLIGHT12] = CorsairLedId.KLP_Zone12, - [DeviceKeys.ADDITIONALLIGHT13] = CorsairLedId.KLP_Zone13, - [DeviceKeys.ADDITIONALLIGHT14] = CorsairLedId.KLP_Zone14, - [DeviceKeys.ADDITIONALLIGHT15] = CorsairLedId.KLP_Zone15, - [DeviceKeys.ADDITIONALLIGHT16] = CorsairLedId.KLP_Zone16, - [DeviceKeys.ADDITIONALLIGHT17] = CorsairLedId.KLP_Zone17, - [DeviceKeys.ADDITIONALLIGHT18] = CorsairLedId.KLP_Zone18, - [DeviceKeys.ADDITIONALLIGHT19] = CorsairLedId.KLP_Zone19 + [CorsairLedId.CLK_Escape] = DeviceKeys.ESC, + [CorsairLedId.CLK_F1] = DeviceKeys.F1, + [CorsairLedId.CLK_F2] = DeviceKeys.F2, + [CorsairLedId.CLK_F3] = DeviceKeys.F3, + [CorsairLedId.CLK_F4] = DeviceKeys.F4, + [CorsairLedId.CLK_F5] = DeviceKeys.F5, + [CorsairLedId.CLK_F6] = DeviceKeys.F6, + [CorsairLedId.CLK_F7] = DeviceKeys.F7, + [CorsairLedId.CLK_F8] = DeviceKeys.F8, + [CorsairLedId.CLK_F9] = DeviceKeys.F9, + [CorsairLedId.CLK_F10] = DeviceKeys.F10, + [CorsairLedId.CLK_F11] = DeviceKeys.F11, + [CorsairLedId.CLK_GraveAccentAndTilde] = DeviceKeys.TILDE, + [CorsairLedId.CLK_1] = DeviceKeys.ONE, + [CorsairLedId.CLK_2] = DeviceKeys.TWO, + [CorsairLedId.CLK_3] = DeviceKeys.THREE, + [CorsairLedId.CLK_4] = DeviceKeys.FOUR, + [CorsairLedId.CLK_5] = DeviceKeys.FIVE, + [CorsairLedId.CLK_6] = DeviceKeys.SIX, + [CorsairLedId.CLK_7] = DeviceKeys.SEVEN, + [CorsairLedId.CLK_8] = DeviceKeys.EIGHT, + [CorsairLedId.CLK_9] = DeviceKeys.NINE, + [CorsairLedId.CLK_0] = DeviceKeys.ZERO, + [CorsairLedId.CLK_MinusAndUnderscore] = DeviceKeys.MINUS, + [CorsairLedId.CLK_Tab] = DeviceKeys.TAB, + [CorsairLedId.CLK_Q] = DeviceKeys.Q, + [CorsairLedId.CLK_W] = DeviceKeys.W, + [CorsairLedId.CLK_E] = DeviceKeys.E, + [CorsairLedId.CLK_R] = DeviceKeys.R, + [CorsairLedId.CLK_T] = DeviceKeys.T, + [CorsairLedId.CLK_Y] = DeviceKeys.Y, + [CorsairLedId.CLK_U] = DeviceKeys.U, + [CorsairLedId.CLK_I] = DeviceKeys.I, + [CorsairLedId.CLK_O] = DeviceKeys.O, + [CorsairLedId.CLK_P] = DeviceKeys.P, + [CorsairLedId.CLK_BracketLeft] = DeviceKeys.OPEN_BRACKET, + [CorsairLedId.CLK_CapsLock] = DeviceKeys.CAPS_LOCK, + [CorsairLedId.CLK_A] = DeviceKeys.A, + [CorsairLedId.CLK_S] = DeviceKeys.S, + [CorsairLedId.CLK_D] = DeviceKeys.D, + [CorsairLedId.CLK_F] = DeviceKeys.F, + [CorsairLedId.CLK_G] = DeviceKeys.G, + [CorsairLedId.CLK_H] = DeviceKeys.H, + [CorsairLedId.CLK_J] = DeviceKeys.J, + [CorsairLedId.CLK_K] = DeviceKeys.K, + [CorsairLedId.CLK_L] = DeviceKeys.L, + [CorsairLedId.CLK_SemicolonAndColon] = DeviceKeys.SEMICOLON, + [CorsairLedId.CLK_ApostropheAndDoubleQuote] = DeviceKeys.APOSTROPHE, + [CorsairLedId.CLK_LeftShift] = DeviceKeys.LEFT_SHIFT, + [CorsairLedId.CLK_NonUsBackslash] = DeviceKeys.BACKSLASH_UK, + [CorsairLedId.CLK_Z] = DeviceKeys.Z, + [CorsairLedId.CLK_X] = DeviceKeys.X, + [CorsairLedId.CLK_C] = DeviceKeys.C, + [CorsairLedId.CLK_V] = DeviceKeys.V, + [CorsairLedId.CLK_B] = DeviceKeys.B, + [CorsairLedId.CLK_N] = DeviceKeys.N, + [CorsairLedId.CLK_M] = DeviceKeys.M, + [CorsairLedId.CLK_CommaAndLessThan] = DeviceKeys.COMMA, + [CorsairLedId.CLK_PeriodAndBiggerThan] = DeviceKeys.PERIOD, + [CorsairLedId.CLK_SlashAndQuestionMark] = DeviceKeys.FORWARD_SLASH, + [CorsairLedId.CLK_LeftCtrl] = DeviceKeys.LEFT_CONTROL, + [CorsairLedId.CLK_LeftGui] = DeviceKeys.LEFT_WINDOWS, + [CorsairLedId.CLK_LeftAlt] = DeviceKeys.LEFT_ALT, + //[CorsairLedId.CLK_Lang2] = DeviceKeys.Lang2, + [CorsairLedId.CLK_Space] = DeviceKeys.SPACE, + //[CorsairLedId.CLK_Lang1] = DeviceKeys.Lang1, + // [CorsairLedId.CLK_International2] = DeviceKeys.International2, + [CorsairLedId.CLK_RightAlt] = DeviceKeys.RIGHT_ALT, + [CorsairLedId.CLK_RightGui] = DeviceKeys.RIGHT_WINDOWS, + [CorsairLedId.CLK_Application] = DeviceKeys.APPLICATION_SELECT, + //[CorsairLedId.CLK_LedProgramming] = DeviceKeys.LedProgramming, + [CorsairLedId.CLK_Brightness] = DeviceKeys.BRIGHTNESS_SWITCH, + [CorsairLedId.CLK_F12] = DeviceKeys.F12, + [CorsairLedId.CLK_PrintScreen] = DeviceKeys.PRINT_SCREEN, + [CorsairLedId.CLK_ScrollLock] = DeviceKeys.SCROLL_LOCK, + [CorsairLedId.CLK_PauseBreak] = DeviceKeys.PAUSE_BREAK, + [CorsairLedId.CLK_Insert] = DeviceKeys.INSERT, + [CorsairLedId.CLK_Home] = DeviceKeys.HOME, + [CorsairLedId.CLK_PageUp] = DeviceKeys.PAGE_UP, + [CorsairLedId.CLK_BracketRight] = DeviceKeys.CLOSE_BRACKET, + [CorsairLedId.CLK_Backslash] = DeviceKeys.BACKSLASH, + [CorsairLedId.CLK_NonUsTilde] = DeviceKeys.HASHTAG, + [CorsairLedId.CLK_Enter] = DeviceKeys.ENTER, + //[CorsairLedId.CLK_International1] = DeviceKeys.International1, + [CorsairLedId.CLK_EqualsAndPlus] = DeviceKeys.EQUALS, + //[CorsairLedId.CLK_International3] = DeviceKeys.International3, + [CorsairLedId.CLK_Backspace] = DeviceKeys.BACKSPACE, + [CorsairLedId.CLK_Delete] = DeviceKeys.DELETE, + [CorsairLedId.CLK_End] = DeviceKeys.END, + [CorsairLedId.CLK_PageDown] = DeviceKeys.PAGE_DOWN, + [CorsairLedId.CLK_RightShift] = DeviceKeys.RIGHT_SHIFT, + [CorsairLedId.CLK_RightCtrl] = DeviceKeys.RIGHT_CONTROL, + [CorsairLedId.CLK_UpArrow] = DeviceKeys.ARROW_UP, + [CorsairLedId.CLK_LeftArrow] = DeviceKeys.ARROW_LEFT, + [CorsairLedId.CLK_DownArrow] = DeviceKeys.ARROW_DOWN, + [CorsairLedId.CLK_RightArrow] = DeviceKeys.ARROW_RIGHT, + [CorsairLedId.CLK_WinLock] = DeviceKeys.LOCK_SWITCH, + [CorsairLedId.CLK_Mute] = DeviceKeys.VOLUME_MUTE, + [CorsairLedId.CLK_Stop] = DeviceKeys.MEDIA_STOP, + [CorsairLedId.CLK_ScanPreviousTrack] = DeviceKeys.MEDIA_PREVIOUS, + [CorsairLedId.CLK_PlayPause] = DeviceKeys.MEDIA_PLAY_PAUSE, + [CorsairLedId.CLK_ScanNextTrack] = DeviceKeys.MEDIA_NEXT, + [CorsairLedId.CLK_NumLock] = DeviceKeys.NUM_LOCK, + [CorsairLedId.CLK_KeypadSlash] = DeviceKeys.NUM_SLASH, + [CorsairLedId.CLK_KeypadAsterisk] = DeviceKeys.NUM_ASTERISK, + [CorsairLedId.CLK_KeypadMinus] = DeviceKeys.NUM_MINUS, + [CorsairLedId.CLK_KeypadPlus] = DeviceKeys.NUM_PLUS, + [CorsairLedId.CLK_KeypadEnter] = DeviceKeys.NUM_ENTER, + [CorsairLedId.CLK_Keypad7] = DeviceKeys.NUM_SEVEN, + [CorsairLedId.CLK_Keypad8] = DeviceKeys.NUM_EIGHT, + [CorsairLedId.CLK_Keypad9] = DeviceKeys.NUM_NINE, + [CorsairLedId.CLK_KeypadComma] = DeviceKeys.NUM_ZEROZERO, + [CorsairLedId.CLK_Keypad4] = DeviceKeys.NUM_FOUR, + [CorsairLedId.CLK_Keypad5] = DeviceKeys.NUM_FIVE, + [CorsairLedId.CLK_Keypad6] = DeviceKeys.NUM_SIX, + [CorsairLedId.CLK_Keypad1] = DeviceKeys.NUM_ONE, + [CorsairLedId.CLK_Keypad2] = DeviceKeys.NUM_TWO, + [CorsairLedId.CLK_Keypad3] = DeviceKeys.NUM_THREE, + [CorsairLedId.CLK_Keypad0] = DeviceKeys.NUM_ZERO, + [CorsairLedId.CLK_KeypadPeriodAndDelete] = DeviceKeys.NUM_PERIOD, + [CorsairLedId.CLK_G1] = DeviceKeys.G1, + [CorsairLedId.CLK_G2] = DeviceKeys.G2, + [CorsairLedId.CLK_G3] = DeviceKeys.G3, + [CorsairLedId.CLK_G4] = DeviceKeys.G4, + [CorsairLedId.CLK_G5] = DeviceKeys.G5, + [CorsairLedId.CLK_G6] = DeviceKeys.G6, + [CorsairLedId.CLK_G7] = DeviceKeys.G7, + [CorsairLedId.CLK_G8] = DeviceKeys.G8, + [CorsairLedId.CLK_G9] = DeviceKeys.G9, + [CorsairLedId.CLK_G10] = DeviceKeys.G10, + [CorsairLedId.CLK_VolumeUp] = DeviceKeys.VOLUME_UP, + [CorsairLedId.CLK_VolumeDown] = DeviceKeys.VOLUME_DOWN, + //[CorsairLedId.CLK_MR] = DeviceKeys.MR, + //[CorsairLedId.CLK_M1] = //DeviceKeys.M1, + //[CorsairLedId.CLK_M2] = //DeviceKeys.M2, + //[CorsairLedId.CLK_M3] = //DeviceKeys.M3, + [CorsairLedId.CLK_Logo] = DeviceKeys.LOGO, + [CorsairLedId.CLK_G11] = DeviceKeys.G11, + [CorsairLedId.CLK_G12] = DeviceKeys.G12, + [CorsairLedId.CLK_G13] = DeviceKeys.G13, + [CorsairLedId.CLK_G14] = DeviceKeys.G14, + [CorsairLedId.CLK_G15] = DeviceKeys.G15, + [CorsairLedId.CLK_G16] = DeviceKeys.G16, + [CorsairLedId.CLK_G17] = DeviceKeys.G17, + [CorsairLedId.CLK_G18] = DeviceKeys.G18, + //[CorsairLedId.CLK_International5] = //DeviceKeys.International5, + // [CorsairLedId.CLK_International4] = //DeviceKeys.International4, + [CorsairLedId.CLK_Fn] = DeviceKeys.FN_Key, + [CorsairLedId.CLK_WinLock] = DeviceKeys.LOCK_SWITCH, + [CorsairLedId.CLK_Brightness] = DeviceKeys.BRIGHTNESS_SWITCH, + [CorsairLedId.CLK_Logo] = DeviceKeys.LOGO, + [CorsairLedId.CLKLP_Zone1] = DeviceKeys.ADDITIONALLIGHT1, + [CorsairLedId.CLKLP_Zone2] = DeviceKeys.ADDITIONALLIGHT2, + [CorsairLedId.CLKLP_Zone3] = DeviceKeys.ADDITIONALLIGHT3, + [CorsairLedId.CLKLP_Zone4] = DeviceKeys.ADDITIONALLIGHT4, + [CorsairLedId.CLKLP_Zone5] = DeviceKeys.ADDITIONALLIGHT5, + [CorsairLedId.CLKLP_Zone6] = DeviceKeys.ADDITIONALLIGHT6, + [CorsairLedId.CLKLP_Zone7] = DeviceKeys.ADDITIONALLIGHT7, + [CorsairLedId.CLKLP_Zone8] = DeviceKeys.ADDITIONALLIGHT8, + [CorsairLedId.CLKLP_Zone9] = DeviceKeys.ADDITIONALLIGHT9, + [CorsairLedId.CLKLP_Zone10] = DeviceKeys.ADDITIONALLIGHT10, + [CorsairLedId.CLKLP_Zone11] = DeviceKeys.ADDITIONALLIGHT11, + [CorsairLedId.CLKLP_Zone12] = DeviceKeys.ADDITIONALLIGHT12, + [CorsairLedId.CLKLP_Zone13] = DeviceKeys.ADDITIONALLIGHT13, + [CorsairLedId.CLKLP_Zone14] = DeviceKeys.ADDITIONALLIGHT14, + [CorsairLedId.CLKLP_Zone15] = DeviceKeys.ADDITIONALLIGHT15, + [CorsairLedId.CLKLP_Zone16] = DeviceKeys.ADDITIONALLIGHT16, + [CorsairLedId.CLKLP_Zone17] = DeviceKeys.ADDITIONALLIGHT17, + [CorsairLedId.CLKLP_Zone18] = DeviceKeys.ADDITIONALLIGHT18, + [CorsairLedId.CLKLP_Zone19] = DeviceKeys.ADDITIONALLIGHT19, + [CorsairLedId.CLKLP_Zone20] = DeviceKeys.ADDITIONALLIGHT20, + [CorsairLedId.CLKLP_Zone21] = DeviceKeys.ADDITIONALLIGHT21, + [CorsairLedId.CLKLP_Zone22] = DeviceKeys.ADDITIONALLIGHT22, + [CorsairLedId.CLKLP_Zone23] = DeviceKeys.ADDITIONALLIGHT23, + [CorsairLedId.CLKLP_Zone24] = DeviceKeys.ADDITIONALLIGHT24, + [CorsairLedId.CLKLP_Zone25] = DeviceKeys.ADDITIONALLIGHT25, + [CorsairLedId.CLKLP_Zone26] = DeviceKeys.ADDITIONALLIGHT26, + [CorsairLedId.CLKLP_Zone27] = DeviceKeys.ADDITIONALLIGHT27, + [CorsairLedId.CLKLP_Zone28] = DeviceKeys.ADDITIONALLIGHT28, + [CorsairLedId.CLKLP_Zone29] = DeviceKeys.ADDITIONALLIGHT29, + [CorsairLedId.CLKLP_Zone30] = DeviceKeys.ADDITIONALLIGHT30, + [CorsairLedId.CLKLP_Zone31] = DeviceKeys.ADDITIONALLIGHT31, + [CorsairLedId.CLKLP_Zone32] = DeviceKeys.ADDITIONALLIGHT32, + [CorsairLedId.CLKLP_Zone33] = DeviceKeys.ADDITIONALLIGHT33, + [CorsairLedId.CLKLP_Zone34] = DeviceKeys.ADDITIONALLIGHT34, + [CorsairLedId.CLKLP_Zone35] = DeviceKeys.ADDITIONALLIGHT35, + [CorsairLedId.CLKLP_Zone36] = DeviceKeys.ADDITIONALLIGHT36, + [CorsairLedId.CLKLP_Zone37] = DeviceKeys.ADDITIONALLIGHT37, + [CorsairLedId.CLKLP_Zone38] = DeviceKeys.ADDITIONALLIGHT38, + [CorsairLedId.CLKLP_Zone39] = DeviceKeys.ADDITIONALLIGHT39, + [CorsairLedId.CLKLP_Zone40] = DeviceKeys.ADDITIONALLIGHT40, + [CorsairLedId.CLKLP_Zone41] = DeviceKeys.ADDITIONALLIGHT41, + [CorsairLedId.CLKLP_Zone42] = DeviceKeys.ADDITIONALLIGHT42, + [CorsairLedId.CLKLP_Zone43] = DeviceKeys.ADDITIONALLIGHT43, + [CorsairLedId.CLKLP_Zone44] = DeviceKeys.ADDITIONALLIGHT44, + [CorsairLedId.CLKLP_Zone45] = DeviceKeys.ADDITIONALLIGHT45, + [CorsairLedId.CLH_LeftLogo] = DeviceKeys.LOGOLEFT, + [CorsairLedId.CLI_Oem2] = DeviceKeys.LOGOMIDDLE, + [CorsairLedId.CLI_Oem3] = DeviceKeys.LOGORIGHT, + [CorsairLedId.CLI_Oem4] = DeviceKeys.WHEELCENTER, + [CorsairLedId.CLI_Oem5] = DeviceKeys.WHEEL1, + [CorsairLedId.CLI_Oem6] = DeviceKeys.WHEEL2, + [CorsairLedId.CLI_Oem7] = DeviceKeys.WHEEL3, + [CorsairLedId.CLI_Oem8] = DeviceKeys.WHEEL4, + [CorsairLedId.CLI_Oem9] = DeviceKeys.WHEEL5, + [CorsairLedId.CLI_Oem10] = DeviceKeys.WHEEL6, + [CorsairLedId.CLI_Oem11] = DeviceKeys.WHEEL7 , + [CorsairLedId.CLI_Oem12] = DeviceKeys.WHEEL8, + [CorsairLedId.CLK_Profile] = DeviceKeys.PROFILESWITCH, }; - internal static readonly Dictionary MouseMatLedMap = new Dictionary() + /*internal static readonly Dictionary MouseMatLedMap = new Dictionary() { - [DeviceKeys.MOUSEPADLIGHT1] = CorsairLedId.MM_Zone1, + [DeviceKeys.MOUSEPADLIGHT1] = CorsairLedId.CLMM_Zone1, [DeviceKeys.MOUSEPADLIGHT2] = CorsairLedId.MM_Zone2, [DeviceKeys.MOUSEPADLIGHT3] = CorsairLedId.MM_Zone3, [DeviceKeys.MOUSEPADLIGHT4] = CorsairLedId.MM_Zone4, @@ -223,14 +261,14 @@ internal static class LedMaps [DeviceKeys.ADDITIONALLIGHT1] = CorsairLedId.M_4,//TODO [DeviceKeys.ADDITIONALLIGHT2] = CorsairLedId.M_5, [DeviceKeys.ADDITIONALLIGHT3] = CorsairLedId.M_6 - }; + };*/ - internal static readonly Dictionary> MapsMap = new Dictionary>() + internal static readonly Dictionary> MapsMap = new Dictionary>() { - [CorsairDeviceType.Keyboard] = KeyboardLedMap, - [CorsairDeviceType.Mouse] = MouseLedMap, - [CorsairDeviceType.MouseMat] = MouseMatLedMap, - [CorsairDeviceType.HeadsetStand] = HeadsetStandLedMap, + [CorsairDeviceType.CDT_Keyboard] = KeyboardLedMap, + /*[CorsairDeviceType.CDT_Mouse] = MouseLedMap, + [CorsairDeviceType.CDT_MouseMat] = MouseMatLedMap, + [CorsairDeviceType.CDT_HeadsetStand] = HeadsetStandLedMap,*/ }; internal static readonly List Channel1LedIds = EnumUtils.GetEnumValues() @@ -252,6 +290,6 @@ internal static class LedMaps Channel3LedIds }; - public static string ToString(this CorsairLedColor corsairLedColor) => $"{corsairLedColor.LedId}, ({corsairLedColor.R},{corsairLedColor.G},{corsairLedColor.B})"; + public static string ToString(this CorsairLedColor corsairLedColor) => $"{corsairLedColor.ledId}, ({corsairLedColor.r},{corsairLedColor.g},{corsairLedColor.b})"; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Creative/SoundBlasterXDevice.cs b/Project-Aurora/Project-Aurora/Devices/Creative/SoundBlasterXDevice.cs index 80e2b2271..160fa891f 100644 --- a/Project-Aurora/Project-Aurora/Devices/Creative/SoundBlasterXDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Creative/SoundBlasterXDevice.cs @@ -317,7 +317,7 @@ public bool IsConnected() public bool IsInitialized => (sbKeyboard != null || sbMouse != null); - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { uint maxKbLength = 0; Dictionary> kbIndices = null; @@ -325,13 +325,13 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg kbIndices = new Dictionary>(); LedColour[] mouseColors = null; - foreach (KeyValuePair kv in keyColors) + foreach (KeyValuePair kv in keyColors) { if (e.Cancel) return false; if (kbIndices != null) { - var kbLedIdx = GetKeyboardMappingLedIndex(kv.Key); + var kbLedIdx = GetKeyboardMappingLedIndex((DeviceKeys)kv.Key); if (kbLedIdx != Keyboard_LEDIndex.NotApplicable) { if (!kbIndices.ContainsKey(kv.Value)) @@ -345,7 +345,7 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg } if (sbMouse != null) { - int moosIdx = GetMouseMappingIndex(kv.Key); + int moosIdx = GetMouseMappingIndex((DeviceKeys)kv.Key); if (moosIdx >= 0 && moosIdx <= MouseMapping.Length) { if (mouseColors == null) @@ -491,7 +491,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; diff --git a/Project-Aurora/Project-Aurora/Devices/DefaultDevice.cs b/Project-Aurora/Project-Aurora/Devices/DefaultDevice.cs index d2d2f730a..7b5d3b94d 100644 --- a/Project-Aurora/Project-Aurora/Devices/DefaultDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/DefaultDevice.cs @@ -12,8 +12,9 @@ namespace Aurora.Devices { public abstract class DefaultDevice : IDevice { - private readonly Stopwatch watch = new Stopwatch(); + private readonly Stopwatch watch = new(); private long lastUpdateTime; + private long updateTime; public abstract string DeviceName { get; } @@ -24,7 +25,7 @@ public abstract class DefaultDevice : IDevice : "Not Initialized"; public string DeviceUpdatePerformance => IsInitialized - ? lastUpdateTime + " ms" + ? lastUpdateTime + "(" + updateTime + ")" + " ms" : ""; public virtual bool IsInitialized { get; protected set; } @@ -38,18 +39,20 @@ public virtual void Reset() Initialize(); } - public abstract bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false); + protected abstract bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false); + private readonly Stopwatch _tempStopWatch = new(); public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArgs e, bool forced = false) { - watch.Restart(); - - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + _tempStopWatch.Restart(); + var updateResult = UpdateDevice(colorComposition.KeyColors, e, forced); - watch.Stop(); + if (!updateResult) return updateResult; lastUpdateTime = watch.ElapsedMilliseconds; + updateTime = _tempStopWatch.ElapsedMilliseconds; + watch.Restart(); - return update_result; + return updateResult; } #region Variables diff --git a/Project-Aurora/Project-Aurora/Devices/DeviceKeys.cs b/Project-Aurora/Project-Aurora/Devices/DeviceKeys.cs old mode 100644 new mode 100755 index 96b758d91..1023bd8e3 --- a/Project-Aurora/Project-Aurora/Devices/DeviceKeys.cs +++ b/Project-Aurora/Project-Aurora/Devices/DeviceKeys.cs @@ -1295,7 +1295,13 @@ public enum DeviceKeys /// Calculator Key /// [Description("Calculator")] - CALC = 216, + CALC = 216, + + /// + /// Power Key + /// + [Description("Power")] + POWER = 217, /// /// Peripheral Light 1 @@ -1303,6 +1309,7 @@ public enum DeviceKeys [Description("Peripheral Light 1")] PERIPHERAL_LIGHT1 = 217, + /// /// Peripheral Light 2 /// @@ -1574,10 +1581,107 @@ public enum DeviceKeys [Description("Additional Light 57")] ADDITIONALLIGHT57 = 274, + /// + /// Additional Light 58 + /// + [Description("Additional Light 58")] + ADDITIONALLIGHT58 = 275, + + /// + /// Additional Light 59 + /// + [Description("Additional Light 59")] + ADDITIONALLIGHT59 = 276, + + /// + /// Additional Light 60 + /// + [Description("Additional Light 60")] + ADDITIONALLIGHT60 = 277, + + /// + /// Left Part of Logo + /// + [Description("Left Part of Logo")] + LOGOLEFT = 278, + + /// + /// Middle Part of Logo + /// + [Description("Middle Part of Logo")] + LOGOMIDDLE = 279, + + /// + /// Right Part of Logo + /// + [Description("Right Part of Logo")] + LOGORIGHT = 280, + + /// + /// Wheel Center + /// + [Description("Wheel Center")] + WHEELCENTER = 281, + + /// + /// Wheel 1 + /// + [Description("Wheel 1")] + WHEEL1 = 282, + + /// + /// Wheel 2 + /// + [Description("Wheel 2")] + WHEEL2 = 283, + + /// + /// Wheel 3 + /// + [Description("Wheel 3")] + WHEEL3 = 284, + + /// + /// Wheel4 + /// + [Description("Wheel 4")] + WHEEL4 = 285, + + /// + /// Wheel 5 + /// + [Description("Wheel 5")] + WHEEL5 = 286, + + /// + /// Wheel 6 + /// + [Description("Wheel 6")] + WHEEL6 = 287, + + /// + /// Wheel 7 + /// + [Description("Wheel 7")] + WHEEL7 = 288, + + /// + /// Wheel 8 + /// + [Description("Wheel 8")] + WHEEL8 = 289, + + /// + /// Profile Switch + /// + [Description("Profile Switch")] + PROFILESWITCH = 290, + /// /// None /// [Description("None")] NONE = -1, }; + } diff --git a/Project-Aurora/Project-Aurora/Devices/DeviceManager.cs b/Project-Aurora/Project-Aurora/Devices/DeviceManager.cs index 1d799df90..c31c0ef38 100644 --- a/Project-Aurora/Project-Aurora/Devices/DeviceManager.cs +++ b/Project-Aurora/Project-Aurora/Devices/DeviceManager.cs @@ -10,64 +10,53 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; +using Amib.Threading; namespace Aurora.Devices { public class DeviceContainer { - public IDevice Device { get; set; } + public IDevice Device { get; } - public BackgroundWorker Worker = new BackgroundWorker(); - public Thread UpdateThread { get; set; } = null; + private readonly SmartThreadPool _worker = new(1000, 1); - private Tuple currentComp = null; - private bool newFrame = false; + private Tuple currentComp; - public readonly object actionLock = new object(); + public readonly object actionLock = new(); + private readonly Action _updateAction; public DeviceContainer(IDevice device) { - this.Device = device; - Worker.DoWork += WorkerOnDoWork; - Worker.RunWorkerCompleted += (sender, args) => + Device = device; + var args = new DoWorkEventArgs(null); + _updateAction = () => { - lock (Worker) - { - if (newFrame && !Worker.IsBusy) - Worker.RunWorkerAsync(); - } + WorkerOnDoWork(this, args); }; - //Worker.WorkerSupportsCancellation = true; } private void WorkerOnDoWork(object sender, DoWorkEventArgs doWorkEventArgs) { - newFrame = false; lock(actionLock) { Device.UpdateDevice(currentComp.Item1, doWorkEventArgs, currentComp.Item2); } } - public void UpdateDevice(DeviceColorComposition composition, bool forced = false) { - newFrame = true; currentComp = new Tuple(composition, forced); - lock (Worker) + if (_worker.WaitingCallbacks < 1) { - if (Worker.IsBusy) - return; - else - Worker.RunWorkerAsync(); + _worker.QueueWorkItem(_updateAction); } } } public class DeviceManager { - private const int RETRY_INTERVAL = 10000; - private const int RETRY_ATTEMPTS = 5; + private const int RETRY_INTERVAL = 2000; + private const int RETRY_ATTEMPTS = 6; private bool _InitializeOnceAllowed; private bool suspended; private bool resumed; @@ -82,8 +71,9 @@ private set } } - public List DeviceContainers { get; } = new List(); - + public List DeviceContainers { get; } = new(); + public List DeviceConnectors { get; } = new List(); + public IEnumerable IndividualDevices => DeviceConnectors.SelectMany(d => d.Devices); public IEnumerable InitializedDeviceContainers => DeviceContainers.Where(d => d.Device.IsInitialized); public event EventHandler RetryAttemptsChanged; @@ -167,6 +157,7 @@ private void AddDevicesFromAssembly() where typeof(IDevice).IsAssignableFrom(type) && !type.IsAbstract && type != typeof(ScriptedDevice.ScriptedDevice) + && type != typeof(OldAuroraDeviceWrapper) let inst = (IDevice)Activator.CreateInstance(type) orderby inst.DeviceName select inst; @@ -175,6 +166,12 @@ orderby inst.DeviceName { DeviceContainers.Add(new DeviceContainer(inst)); } + var CorsairConnector = new Corsair.CorsairDeviceConnector(); + DeviceContainers.Add(new DeviceContainer(new OldAuroraDeviceWrapper(CorsairConnector))); + DeviceConnectors.Add(CorsairConnector); + var OpenRGBConnector = new OpenRGB.OpenRGBDeviceConnector(); + DeviceContainers.Add(new DeviceContainer(new OldAuroraDeviceWrapper(OpenRGBConnector))); + DeviceConnectors.Add(OpenRGBConnector); } private void AddDevicesFromDlls(string dllFolder) @@ -251,8 +248,7 @@ private void RetryAll() { if (dc.Device.IsInitialized || Global.Configuration.DevicesDisabled.Contains(dc.Device.GetType())) continue; - - lock(dc.actionLock) + lock (dc.actionLock) dc.Device.Initialize(); } RetryAttempts--; @@ -295,6 +291,7 @@ public void InitializeDevices() Global.logger.Info(s); } + DeviceConnectors.ForEach(dc => dc.Initialize()); if (devicesToRetry > 0) Task.Run(RetryAll); @@ -307,9 +304,12 @@ public void ShutdownDevices() foreach (var dc in InitializedDeviceContainers) { lock (dc.actionLock) + { dc.Device.Shutdown(); + } Global.logger.Info($"[Device][{dc.Device.DeviceName}] Shutdown"); } + DeviceConnectors.ForEach(dc => dc.Shutdown()); } public void ResetDevices() @@ -317,16 +317,49 @@ public void ResetDevices() foreach (var dc in InitializedDeviceContainers) { lock (dc.actionLock) + { dc.Device.Reset(); + } } + DeviceConnectors.ForEach(dc => dc.Reset()); } - public void UpdateDevices(DeviceColorComposition composition, bool forced = false) + public void RegisterViewPort(ref UniqueDeviceId devicId, int viewPort) + { + foreach (var dc in IndividualDevices) + { + if (dc.id?.ViewPort == viewPort) + dc.id.ViewPort = null; + } + devicId.ViewPort = viewPort; + foreach (var dc in IndividualDevices) + { + if (dc.id == devicId) + dc.id = devicId; + } + } + public void UpdateDevices(Dictionary compositionList, bool forced = false) { foreach (var dc in InitializedDeviceContainers) { lock (dc.actionLock) - dc.UpdateDevice(composition, forced); + { + + foreach (var composition in compositionList) + { + if (!IndividualDevices.Where(dc => dc.id?.ViewPort == composition.Key).Any()) + dc.UpdateDevice(composition.Value, forced); + } + + } + } + foreach (var item in compositionList) + { + var dc = IndividualDevices.Where(d => d.IsConnected() && d.id.ViewPort == item.Key); + if (dc.Any()) + { + dc.First().UpdateDevice(item.Value); + } } } diff --git a/Project-Aurora/Project-Aurora/Devices/Drevo/DrevoDevice.cs b/Project-Aurora/Project-Aurora/Devices/Drevo/DrevoDevice.cs index f93dee4ae..14394340a 100644 --- a/Project-Aurora/Project-Aurora/Devices/Drevo/DrevoDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Drevo/DrevoDevice.cs @@ -1,4 +1,5 @@ -using System; +using Aurora.Utils; +using System; using DrevoRadi; using System.Collections.Generic; using System.ComponentModel; @@ -54,10 +55,11 @@ public override void Shutdown() } } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + /// Updates the device with a specified color arrangement. + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { - if (!IsInitialized) - return false; + if (e.Cancel) return false; + if (!IsInitialized) return false; try { @@ -68,15 +70,15 @@ public override bool UpdateDevice(Dictionary keyColors, DoWor bitmap[3] = 0x7F; int index = 0; - foreach (var key in keyColors) + foreach (var (dk, clr) in keyColors) { - index = DrevoRadiSDK.ToDrevoBitmap((int)key.Key); + index = DrevoRadiSDK.ToDrevoBitmap(dk); if (index != -1) { index = index * 3 + 4; - bitmap[index] = key.Value.R; - bitmap[index + 1] = key.Value.G; - bitmap[index + 2] = key.Value.B; + bitmap[index] = clr.R; + bitmap[index + 1] = clr.G; + bitmap[index + 2] = clr.B; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Dualshock4/Dualshock4Device.cs b/Project-Aurora/Project-Aurora/Devices/Dualshock4/Dualshock4Device.cs index ea8738188..af764ae1e 100755 --- a/Project-Aurora/Project-Aurora/Devices/Dualshock4/Dualshock4Device.cs +++ b/Project-Aurora/Project-Aurora/Devices/Dualshock4/Dualshock4Device.cs @@ -122,7 +122,6 @@ private void DeviceListChanged(object sender, HidSharp.DeviceListChangedEventArg if (DS4Devices.getDS4Controllers().Count() != devices.Count) Reset(); } - public override bool Initialize() { if (IsInitialized) @@ -154,9 +153,10 @@ public override void Shutdown() isDisconnecting = false; } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { - if (keyColors.TryGetValue(key, out var clr)) + if (keyColors.TryGetValue((int)key, out var clr)) { foreach (var dev in devices) { diff --git a/Project-Aurora/Project-Aurora/Devices/Ducky/DuckyDevice.cs b/Project-Aurora/Project-Aurora/Devices/Ducky/DuckyDevice.cs index be09db173..7f856da12 100644 --- a/Project-Aurora/Project-Aurora/Devices/Ducky/DuckyDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Ducky/DuckyDevice.cs @@ -129,16 +129,16 @@ public bool IsPeripheralConnected() return isInitialized; } - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { - foreach (KeyValuePair kc in keyColors) + foreach (KeyValuePair kc in keyColors) { //This keyboard doesn't take alpha (transparency) values, so we do this: processedColor = ColorUtils.CorrectWithAlpha(kc.Value); //This if statement grabs the packet offset from the key that Aurora wants to set, using DuckyColourOffsetMap. //It also checks whether the key exists in the Dictionary, and if not, doesn't try and set the key colour. - if(!DuckyRGBMappings.DuckyColourOffsetMap.TryGetValue(kc.Key, out currentKeyOffset)){ + if(!DuckyRGBMappings.DuckyColourOffsetMap.TryGetValue((DeviceKeys)kc.Key, out currentKeyOffset)){ continue; } @@ -221,7 +221,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; diff --git a/Project-Aurora/Project-Aurora/Devices/IDevice.cs b/Project-Aurora/Project-Aurora/Devices/IDevice.cs index 7ed543f64..a6775b57e 100644 --- a/Project-Aurora/Project-Aurora/Devices/IDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/IDevice.cs @@ -1,8 +1,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Drawing; -using System.Threading; -using System.Threading.Tasks; using Aurora.Settings; namespace Aurora.Devices @@ -12,9 +10,8 @@ namespace Aurora.Devices /// public class DeviceColorComposition { - public readonly object bitmapLock = new object(); - public Dictionary keyColors; - public Bitmap keyBitmap; + public Dictionary KeyColors; + public Bitmap KeyBitmap; } /// @@ -67,14 +64,6 @@ public interface IDevice /// void Reset(); - /// - /// Updates the device with a specified color arrangement. - /// - /// A dictionary of DeviceKeys their corresponding Colors - /// A boolean value indicating whether or not to forcefully update this device - /// - bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false); - /// /// Updates the device with a specified color composition. /// diff --git a/Project-Aurora/Project-Aurora/Devices/LightFX/LightFX.cs b/Project-Aurora/Project-Aurora/Devices/LightFX/LightFX.cs index ec75d4525..61ae4b2f2 100644 --- a/Project-Aurora/Project-Aurora/Devices/LightFX/LightFX.cs +++ b/Project-Aurora/Project-Aurora/Devices/LightFX/LightFX.cs @@ -320,19 +320,14 @@ public int AlienfxWaitForReady() bool NumLock = (((ushort)LightFXSDK.GetKeyState(0x90)) & 0xffff) != 0; - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + private readonly List leftColor = new List(); + private readonly List midleftColor = new List(); + private readonly List midRightColor = new List(); + private readonly List rightColor = new List(); + private readonly List numpadColor = new List(); + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (e.Cancel) return false; - List leftColor = new List(); - - List midleftColor = new List(); - - - List midRightColor = new List(); - - List rightColor = new List(); - - List numpadColor = new List(); try { @@ -388,38 +383,38 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg LightFXSDK.LFX_Reset(); } - foreach (KeyValuePair key in keyColors) { + foreach (KeyValuePair key in keyColors) { if (e.Cancel) return false; if (isInitialized) { //left - if (Array.Exists(leftZoneKeys, s => s == key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { + if (Array.Exists(leftZoneKeys, s => s == (DeviceKeys)key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { leftColor.Add(key.Value); } //middle left - if (Array.Exists(midLeftZoneKeys, s => s == key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { + if (Array.Exists(midLeftZoneKeys, s => s == (DeviceKeys)key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { midleftColor.Add(key.Value); }//middle right - if (Array.Exists(midRightZoneKeys, s => s == key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { + if (Array.Exists(midRightZoneKeys, s => s == (DeviceKeys)key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { midRightColor.Add(key.Value); }//right */ - if (Array.Exists(rightZoneKeys, s => s == key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { + if (Array.Exists(rightZoneKeys, s => s == (DeviceKeys)key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { rightColor.Add(key.Value); } - if (Array.Exists(numpadZone, s => s == key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { + if (Array.Exists(numpadZone, s => s == (DeviceKeys)key.Key) && (key.Value.R > 0 || key.Value.G > 0 || key.Value.B > 0)) { numpadColor.Add(key.Value); } - if (key.Key == DeviceKeys.Peripheral_Logo) { + if ((DeviceKeys)key.Key == DeviceKeys.Peripheral_Logo) { setColor(1, (int)BITMASK.AlienFrontLogo, key.Value.R, key.Value.G, key.Value.B); if (!usingHID) { @@ -435,7 +430,7 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg if (NumLock) { midRightColor.AddRange(rightColor); rightColor.Clear(); - rightColor = numpadColor; + rightColor.AddRange(numpadColor); } if (leftColor.Any()) { var mostUsed = leftColor.GroupBy(item => item) @@ -544,7 +539,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; diff --git a/Project-Aurora/Project-Aurora/Devices/Logitech/LedMap.cs b/Project-Aurora/Project-Aurora/Devices/Logitech/LedMap.cs index 72345ad86..08f6cf3cb 100644 --- a/Project-Aurora/Project-Aurora/Devices/Logitech/LedMap.cs +++ b/Project-Aurora/Project-Aurora/Devices/Logitech/LedMap.cs @@ -167,6 +167,14 @@ public static class LedMaps [DeviceKeys.PERIPHERAL_DPI] = (DeviceType.Mouse, 0), [DeviceKeys.Peripheral_Logo] = (DeviceType.Mouse, 1), [DeviceKeys.Peripheral_ScrollWheel] = (DeviceType.Mouse, 2), + [DeviceKeys.MOUSEPADLIGHT1] = (DeviceType.Mousemat, 0), + + [DeviceKeys.ADDITIONALLIGHT1] = (DeviceType.Speaker, 0), //Remapped to match my Devicekeys Configuration , Needs to added Speaker Lights soon + [DeviceKeys.ADDITIONALLIGHT2] = (DeviceType.Speaker, 1), + [DeviceKeys.ADDITIONALLIGHT3] = (DeviceType.Speaker, 2), + [DeviceKeys.ADDITIONALLIGHT4] = (DeviceType.Speaker, 3), + [DeviceKeys.ADDITIONALLIGHT5] = (DeviceType.Headset, 0), //Remapped to match my Devicekeys Configuration + [DeviceKeys.ADDITIONALLIGHT6] = (DeviceType.Headset, 1), //Remapped to match my Devicekeys Configuration }; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Logitech/LogitechDevice.cs b/Project-Aurora/Project-Aurora/Devices/Logitech/LogitechDevice.cs index 1e1310141..5d1027085 100755 --- a/Project-Aurora/Project-Aurora/Devices/Logitech/LogitechDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Logitech/LogitechDevice.cs @@ -60,14 +60,14 @@ public override void Shutdown() IsInitialized = false; } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (!IsInitialized) return false; //reset keys to peripheral_logo here so if we dont find any better color for them, //at least the leds wont turn off :) - if (keyColors.TryGetValue(genericKey, out var periph)) + if (keyColors.TryGetValue((int)genericKey, out var periph)) { speakers = periph; mousepad = periph; @@ -77,37 +77,37 @@ public override bool UpdateDevice(Dictionary keyColors, DoWor headset[1] = periph; } - foreach (var key in keyColors) + foreach (var (key, clr) in keyColors) { #region keyboard - if (LedMaps.BitmapMap.TryGetValue(key.Key, out var index)) + if (LedMaps.BitmapMap.TryGetValue((DeviceKeys)key, out var index)) { - logitechBitmap[index] = key.Value.B; - logitechBitmap[index + 1] = key.Value.G; - logitechBitmap[index + 2] = key.Value.R; - logitechBitmap[index + 3] = key.Value.A; + logitechBitmap[index] = clr.B; + logitechBitmap[index + 1] = clr.G; + logitechBitmap[index + 2] = clr.R; + logitechBitmap[index + 3] = clr.A; } - if (!Global.Configuration.DevicesDisableKeyboard && LedMaps.KeyMap.TryGetValue(key.Key, out var logiKey)) - IsInitialized &= LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(logiKey, key.Value); + if (!Global.Configuration.DevicesDisableKeyboard && LedMaps.KeyMap.TryGetValue((DeviceKeys)key, out var logiKey)) + IsInitialized &= LogitechGSDK.LogiLedSetLightingForKeyWithKeyName(logiKey, clr); #endregion #region peripherals - if (LedMaps.PeripheralMap.TryGetValue(key.Key, out var peripheral)) + if (LedMaps.PeripheralMap.TryGetValue((DeviceKeys)key, out var peripheral)) { switch (peripheral.type) { case DeviceType.Mouse: - mouse[peripheral.zone] = key.Value; + mouse[peripheral.zone] = clr; break; case DeviceType.Mousemat: - mousepad = key.Value; + mousepad = clr; break; case DeviceType.Headset: - headset[peripheral.zone] = key.Value; + headset[peripheral.zone] = clr; break; case DeviceType.Speaker: - speakers = key.Value; + speakers = clr; break; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/IOmenDevice.cs b/Project-Aurora/Project-Aurora/Devices/Omen/IOmenDevice.cs index 26dac999a..412414078 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/IOmenDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/IOmenDevice.cs @@ -10,7 +10,7 @@ namespace Aurora.Devices.Omen interface IOmenDevice { public void Shutdown(); - public void SetLights(Dictionary keyColors); + public void SetLights(Dictionary keyColors); public string GetDeviceName(); }; } diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenChassis.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenChassis.cs index 169a6deca..0bf139ff7 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenChassis.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenChassis.cs @@ -72,13 +72,13 @@ public string GetDeviceName() return (hChassis != IntPtr.Zero ? "Chassis Connected" : string.Empty); } - public void SetLights(Dictionary keyColors) + public void SetLights(Dictionary keyColors) { if (hChassis != IntPtr.Zero) { - if (keyColors.ContainsKey(DeviceKeys.Peripheral_Logo)) + if (keyColors.ContainsKey((int)DeviceKeys.Peripheral_Logo)) { - SetLight(DeviceKeys.Peripheral_Logo, keyColors[DeviceKeys.Peripheral_Logo]); + SetLight(DeviceKeys.Peripheral_Logo, keyColors[(int)DeviceKeys.Peripheral_Logo]); return; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenDevices.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenDevices.cs index 02fb1f043..49be790b2 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenDevices.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenDevices.cs @@ -55,8 +55,9 @@ public string DeviceDetails public bool Initialize() { - Global.kbLayout.KeyboardLayoutUpdated -= DeviceChangedHandler; - Global.kbLayout.KeyboardLayoutUpdated += DeviceChangedHandler; + //TODO fix this + /*Global.kbLayout.KeyboardLayoutUpdated -= DeviceChangedHandler; + Global.kbLayout.KeyboardLayoutUpdated += DeviceChangedHandler;*/ lock (this) { @@ -161,7 +162,7 @@ public void Shutdown() } } - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { try { @@ -184,7 +185,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenFourZoneLighting.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenFourZoneLighting.cs index 0a4808dc3..6225a3ba9 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenFourZoneLighting.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenFourZoneLighting.cs @@ -15,7 +15,7 @@ namespace Aurora.Devices.Omen { class OmenFourZoneLighting : IOmenDevice { - public void SetLights(Dictionary keyColors) + public void SetLights(Dictionary keyColors) { Task.Run(() => { if (Monitor.TryEnter(this)) @@ -23,16 +23,16 @@ public void SetLights(Dictionary keyColors) try { if(FourZoneLighting.IsTurnOn() - && keyColors.ContainsKey(DeviceKeys.ADDITIONALLIGHT1) - && keyColors.ContainsKey(DeviceKeys.ADDITIONALLIGHT2) - && keyColors.ContainsKey(DeviceKeys.ADDITIONALLIGHT3) - && keyColors.ContainsKey(DeviceKeys.ADDITIONALLIGHT4)) + && keyColors.ContainsKey((int)DeviceKeys.ADDITIONALLIGHT1) + && keyColors.ContainsKey((int)DeviceKeys.ADDITIONALLIGHT2) + && keyColors.ContainsKey((int)DeviceKeys.ADDITIONALLIGHT3) + && keyColors.ContainsKey((int)DeviceKeys.ADDITIONALLIGHT4)) { FourZoneLighting.SetZoneColors( - new Color[] { keyColors[DeviceKeys.ADDITIONALLIGHT1], - keyColors[DeviceKeys.ADDITIONALLIGHT2], - keyColors[DeviceKeys.ADDITIONALLIGHT3], - keyColors[DeviceKeys.ADDITIONALLIGHT4] }); + new Color[] { keyColors[(int)DeviceKeys.ADDITIONALLIGHT1], + keyColors[(int)DeviceKeys.ADDITIONALLIGHT2], + keyColors[(int)DeviceKeys.ADDITIONALLIGHT3], + keyColors[(int)DeviceKeys.ADDITIONALLIGHT4] }); } } finally diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenKeyboard.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenKeyboard.cs index df4ce1774..a0a68aa34 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenKeyboard.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenKeyboard.cs @@ -43,10 +43,10 @@ public struct StaticKeyEffect public LightingColor lightingColor; public int key; - public StaticKeyEffect(KeyValuePair key) + public StaticKeyEffect(KeyValuePair key) { lightingColor = LightingColor.FromColor(key.Value); - this.key = OmenKeys.GetKey(key.Key); + this.key = OmenKeys.GetKey((DeviceKeys)key.Key); } } @@ -55,7 +55,7 @@ public string GetDeviceName() return (hKB != IntPtr.Zero ? "Keyboard Connected" : string.Empty); } - public void SetLights(Dictionary keyColors) + public void SetLights(Dictionary keyColors) { if (hKB != IntPtr.Zero && keyColors.Count > 0) { @@ -71,7 +71,7 @@ public void SetLights(Dictionary keyColors) try { List list = new List(); - foreach (KeyValuePair key in keyColors) + foreach (KeyValuePair key in keyColors) { list.Add(new StaticKeyEffect(key)); } diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenMouse.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenMouse.cs index 84767af94..782667678 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenMouse.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenMouse.cs @@ -65,18 +65,18 @@ public enum MouseLightingZone MOUSE_LIGHTING_ZONE_WHEEL = 2, /* Wheel zone */ } - public void SetLights(Dictionary keyColors) + public void SetLights(Dictionary keyColors) { if (hMouse != IntPtr.Zero) { - foreach (KeyValuePair keyColor in keyColors) + foreach (var keyColor in keyColors) { - switch (keyColor.Key) + switch ((DeviceKeys)keyColor.Key) { case DeviceKeys.Peripheral_Logo: case DeviceKeys.Peripheral_FrontLight: case DeviceKeys.Peripheral_ScrollWheel: - SetLight(keyColor.Key, keyColor.Value); + SetLight((DeviceKeys)keyColor.Key, keyColor.Value); break; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenMousePad.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenMousePad.cs index abad3c7a7..f2fbb29b5 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenMousePad.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenMousePad.cs @@ -58,15 +58,15 @@ private int GetZone(DeviceKeys key) return (key == DeviceKeys.MOUSEPADLIGHT15 ? (int)MousePadZone.MOUSE_PAD_ZONE_LOGO : (int)MousePadZone.MOUSE_PAD_ZONE_0 + ((int)key - (int)DeviceKeys.MOUSEPADLIGHT1)); } - public void SetLights(Dictionary keyColors) + public void SetLights(Dictionary keyColors) { if (hMousePad != IntPtr.Zero) { - foreach (KeyValuePair keyColor in keyColors) + foreach (var keyColor in keyColors) { - if (keyColor.Key >= DeviceKeys.MOUSEPADLIGHT1 && keyColor.Key <= DeviceKeys.MOUSEPADLIGHT15) + if (keyColor.Key >= (int)DeviceKeys.MOUSEPADLIGHT1 && keyColor.Key <= (int)DeviceKeys.MOUSEPADLIGHT15) { - SetLight(keyColor.Key, keyColor.Value); + SetLight((DeviceKeys)keyColor.Key, keyColor.Value); } } } diff --git a/Project-Aurora/Project-Aurora/Devices/Omen/OmenSpeaker.cs b/Project-Aurora/Project-Aurora/Devices/Omen/OmenSpeaker.cs index 81d814cf3..c479a6cd1 100644 --- a/Project-Aurora/Project-Aurora/Devices/Omen/OmenSpeaker.cs +++ b/Project-Aurora/Project-Aurora/Devices/Omen/OmenSpeaker.cs @@ -44,13 +44,13 @@ public void Shutdown() } } - public void SetLights(Dictionary keyColors) + public void SetLights(Dictionary keyColors) { if (hSpeaker != IntPtr.Zero) { - if (keyColors.ContainsKey(DeviceKeys.Peripheral_Logo)) + if (keyColors.ContainsKey((int)DeviceKeys.Peripheral_Logo)) { - SetLight(DeviceKeys.Peripheral_Logo, keyColors[DeviceKeys.Peripheral_Logo]); + SetLight(DeviceKeys.Peripheral_Logo, keyColors[(int)DeviceKeys.Peripheral_Logo]); return; } } diff --git a/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBDevice.cs b/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBDevice.cs index 2f7f5b258..39eabf150 100644 --- a/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBDevice.cs @@ -2,10 +2,7 @@ using OpenRGB.NET; using System; using System.Collections.Generic; -using System.ComponentModel; -using System.Drawing; using System.Linq; -using System.Threading; using DK = Aurora.Devices.DeviceKeys; using OpenRGBColor = OpenRGB.NET.Models.Color; using OpenRGBDevice = OpenRGB.NET.Models.Device; @@ -14,180 +11,164 @@ namespace Aurora.Devices.OpenRGB { - public class OpenRGBAuroraDevice : DefaultDevice + public class OpenRGBDeviceConnector : AuroraDeviceConnector { - public override string DeviceName => "OpenRGB"; - protected override string DeviceInfo => string.Join(", ", _devices.Select(d => d.OrgbDevice.Name)); + + protected override string ConnectorName => "OpenRGB"; private OpenRGBClient _openRgb; - private List _devices; - public override bool Initialize() + protected override bool InitializeImpl() { - if (IsInitialized) - return true; - try { - var ip = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_ip"); - var port = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_port"); - var usePeriphLogo = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_use_periph_logo"); - var ignoreDirectMode = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_ignore_direct"); - - _openRgb = new OpenRGBClient(name: "Aurora", ip: ip, port: port); + _openRgb = new OpenRGBClient(name: "Aurora"); _openRgb.Connect(); - var devices = _openRgb.GetAllControllerData(); - _devices = new List(); + OpenRGBDevice[] _devices = _openRgb.GetAllControllerData(); - for (int i = 0; i < devices.Length; i++) + + for (var i = 0; i < _devices.Length; i++) { - if (devices[i].Modes.Any(m => m.Name == "Direct") || ignoreDirectMode) - { - var helper = new HelperOpenRGBDevice(i, devices[i]); - helper.ProcessMappings(usePeriphLogo); - _devices.Add(helper); - } + OpenRGBAuroraDevice device = new OpenRGBAuroraDevice(_devices[i], i, _openRgb); + RegisterDevice(device); } } catch (Exception e) { - LogError("error in OpenRGB device: " + e); - IsInitialized = false; + LogError("There was an error in OpenRGB device: " + e); return false; } - IsInitialized = true; - return IsInitialized; + return true; } - public override void Shutdown() + protected override void ShutdownImpl() { - if (!IsInitialized) - return; - - foreach (var d in _devices) - { - try - { - _openRgb.UpdateLeds(d.Index, d.OrgbDevice.Colors); - } - catch - { - //we tried. - } - } - _openRgb?.Dispose(); _openRgb = null; - IsInitialized = false; } + } + public class OpenRGBAuroraDevice : AuroraDevice + { + private OpenRGBDevice Device; + private OpenRGBColor[] DeviceColors; + private List KeyMapping = new(); + private int DeviceIndex; + static object update_lock = new(); + private OpenRGBClient _openRgb; + protected override string DeviceName => Device.Name; + + protected override AuroraDeviceType AuroraDeviceType => AuroraDeviceTypeConverter(Device.Type); - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public int Id { get; set; } + + public OpenRGBAuroraDevice(OpenRGBDevice device, int deviceIndex, OpenRGBClient openRgb) { - if (!IsInitialized) - return false; + Device = device; + _openRgb = openRgb; + DeviceIndex = deviceIndex; + DeviceColors = new OpenRGBColor[Device.Leds.Length]; + for (var ledIdx = 0; ledIdx < Device.Leds.Length; ledIdx++) + DeviceColors[ledIdx] = new OpenRGBColor(); - foreach (var device in _devices) + int overIndex = 0; + + for (int j = 0; j < Device.Leds.Length; j++) { - for (int ledIndex = 0; ledIndex < device.Colors.Length; ledIndex++) + if (Device.Type == OpenRGBDeviceType.Keyboard) { - if (keyColors.TryGetValue(device.Mapping[ledIndex], out var keyColor)) + if (OpenRGBKeyNames.KeyNames.TryGetValue(Device.Leds[j].Name, out var dk)) { - device.Colors[ledIndex] = new OpenRGBColor(keyColor.R, keyColor.G, keyColor.B); + KeyMapping.Add(new DeviceKey(dk)); + } + else + { + KeyMapping.Add(new DeviceKey(500 + overIndex++, Device.Leds[j].Name)); } } - - try - { - _openRgb.UpdateLeds(device.Index, device.Colors); - } - catch (Exception exc) + else { - LogError($"Failed to update OpenRGB device {device.OrgbDevice.Name}: " + exc); - Reset(); + KeyMapping.Add(new DeviceKey(j, Device.Leds[j].Name)); } } - - var sleep = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_sleep"); - if (sleep > 0) - Thread.Sleep(sleep); - - return true; } - protected override void RegisterVariables(VariableRegistry variableRegistry) + protected override bool UpdateDeviceImpl(DeviceColorComposition composition) { - variableRegistry.Register($"{DeviceName}_sleep", 0, "Sleep for", 1000, 0); - variableRegistry.Register($"{DeviceName}_ip", "127.0.0.1", "IP Address"); - variableRegistry.Register($"{DeviceName}_port", 6742, "Port", 1024, 65535); - variableRegistry.Register($"{DeviceName}_ignore_direct", false, "Ignore Direct mode"); - variableRegistry.Register($"{DeviceName}_use_periph_logo", true, "Use peripheral logo for unknown leds"); - } - } - - public class HelperOpenRGBDevice - { - public int Index { get; } - public OpenRGBDevice OrgbDevice { get; } - public OpenRGBColor[] Colors { get; } - public DK[] Mapping { get; } - public HelperOpenRGBDevice(int idx, OpenRGBDevice dev) - { - Index = idx; - OrgbDevice = dev; - Colors = Enumerable.Range(0, dev.Leds.Length).Select(_ => new OpenRGBColor()).ToArray(); - Mapping = new DK[dev.Leds.Length]; - } + //should probably store these bools somewhere when initing + //might also add this as a property in the library + if (!Device.Modes.Any(m => m.Name == "Direct")) + return true; - internal void ProcessMappings(bool usePeriphLogo) - { - for (int ledIndex = 0; ledIndex < OrgbDevice.Leds.Length; ledIndex++) + for (int ledIdx = 0; ledIdx < Device.Leds.Length; ledIdx++) { - if (OpenRGBKeyNames.KeyNames.TryGetValue(OrgbDevice.Leds[ledIndex].Name, out var devKey)) + if (composition.KeyColors.TryGetValue(KeyMapping[ledIdx].Tag, out var keyColor)) { - Mapping[ledIndex] = devKey; + var deviceKey = DeviceColors[ledIdx]; + deviceKey.R = keyColor.R; + deviceKey.G = keyColor.G; + deviceKey.B = keyColor.B; } - else + } + + try + { + lock (update_lock) { - Mapping[ledIndex] = usePeriphLogo ? DK.Peripheral_Logo : DK.NONE; + _openRgb.UpdateLeds(DeviceIndex, DeviceColors); } } + catch (Exception exc) + { + LogError($"Failed to update OpenRGB device {DeviceName}: " + exc); + return false; + } - if (usePeriphLogo) - return; + /*var sleep = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_sleep"); + if (sleep > 0) + Thread.Sleep(sleep);*/ - //if we have the option enabled, - //we'll skip these as users may not want - //linear zones to depend on additionalllight + return true; + } - uint ledOffset = 0; - for (int zoneIndex = 0; zoneIndex < OrgbDevice.Zones.Length; zoneIndex++) + protected override void RegisterVariables(VariableRegistry variableRegistry) + { + variableRegistry.Register($"{DeviceName}_sleep", 25, "Sleep for", 1000, 0); + } + private AuroraDeviceType AuroraDeviceTypeConverter(OpenRGBDeviceType type) + { + switch (type) { - if (OrgbDevice.Zones[zoneIndex].Type == OpenRGBZoneType.Linear) - { - for (int zoneLedIndex = 0; zoneLedIndex < OrgbDevice.Zones[zoneIndex].LedCount; zoneLedIndex++) - { - if (OrgbDevice.Type == OpenRGBDeviceType.Mousemat) - { - if (zoneLedIndex < 15) - { - Mapping[(int)(ledOffset + zoneLedIndex)] = OpenRGBKeyNames.MousepadLights[zoneLedIndex]; - } - } - else - { - //TODO - scale zones with more than 32 LEDs - if (zoneLedIndex < 32) - { - Mapping[(int)(ledOffset + zoneLedIndex)] = OpenRGBKeyNames.AdditionalLights[zoneLedIndex]; - } - } - } - } - ledOffset += OrgbDevice.Zones[zoneIndex].LedCount; + case OpenRGBDeviceType.Motherboard: + break; + case OpenRGBDeviceType.Dram: + break; + case OpenRGBDeviceType.Gpu: + break; + case OpenRGBDeviceType.Cooler: + break; + case OpenRGBDeviceType.Ledstrip: + break; + case OpenRGBDeviceType.Keyboard: + return AuroraDeviceType.OpenRGBKeyboard; + case OpenRGBDeviceType.Mouse: + return AuroraDeviceType.OpenRGBMouse; + case OpenRGBDeviceType.Mousemat: + break; + case OpenRGBDeviceType.Headset: + return AuroraDeviceType.OpenRGBHeadset; + case OpenRGBDeviceType.HeadsetStand: + break; + case OpenRGBDeviceType.Unknown: + return AuroraDeviceType.OpenRGBUnkown; + default: + return AuroraDeviceType.OpenRGBUnkown; } + return AuroraDeviceType.Unkown; } + + public override List GetAllDeviceKey() => KeyMapping; } } diff --git a/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBKeyNames.cs b/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBKeyNames.cs index ebc8d989e..8a5ec0302 100644 --- a/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBKeyNames.cs +++ b/Project-Aurora/Project-Aurora/Devices/OpenRGB/OpenRGBKeyNames.cs @@ -65,6 +65,7 @@ public static class OpenRGBKeyNames { "Key: ," , DK.COMMA }, { "Key: ." , DK.PERIOD }, { "Key: /" , DK.FORWARD_SLASH }, + { "Key: / (ABNT)" , DK.FORWARD_SLASH }, { "Key: Caps Lock" , DK.CAPS_LOCK }, { "Key: F1" , DK.F1 }, { "Key: F2" , DK.F2 }, @@ -127,6 +128,8 @@ public static class OpenRGBKeyNames { "Key: Media Play" , DK.MEDIA_PLAY }, { "Key: Media Play/Pause" , DK.MEDIA_PLAY_PAUSE }, { "Key: Media Mute" , DK.VOLUME_MUTE }, + { "Key: Media Volume Down", DK.VOLUME_DOWN }, + { "Key: Media Volume Up" , DK.VOLUME_UP }, { "Logo" , DK.LOGO }, { "Key: Brightness" , DK.BRIGHTNESS_SWITCH }, { "Key: M1" , DK.G1 }, @@ -138,11 +141,74 @@ public static class OpenRGBKeyNames { "Key: G1" , DK.G1 }, { "Key: G2" , DK.G2 }, { "Key: G3" , DK.G3 }, + { "Key: G4" , DK.G4 }, + { "Key: G5" , DK.G5 }, //{ "Logo" , DK.Peripheral_Logo }, { "Mouse" , DK.Peripheral_Logo }, { "Scroll Wheel" , DK.Peripheral_ScrollWheel }, { "DPI" , DK.Peripheral_ScrollWheel }, { "Front" , DK.Peripheral_FrontLight }, + { "RGB Strip 1" , DK.ADDITIONALLIGHT1 }, + { "RGB Strip 2" , DK.ADDITIONALLIGHT2 }, + { "RGB Strip 3" , DK.ADDITIONALLIGHT3 }, + { "RGB Strip 4" , DK.ADDITIONALLIGHT4 }, + { "RGB Strip 5" , DK.ADDITIONALLIGHT5 }, + { "RGB Strip 6" , DK.ADDITIONALLIGHT6 }, + { "RGB Strip 7" , DK.ADDITIONALLIGHT7 }, + { "RGB Strip 8" , DK.ADDITIONALLIGHT8 }, + { "RGB Strip 9" , DK.ADDITIONALLIGHT9 }, + { "RGB Strip 10" , DK.ADDITIONALLIGHT10 }, + { "RGB Strip 11" , DK.ADDITIONALLIGHT11 }, + { "RGB Strip 12" , DK.ADDITIONALLIGHT12 }, + { "RGB Strip 13" , DK.ADDITIONALLIGHT13 }, + { "RGB Strip 14" , DK.ADDITIONALLIGHT14 }, + { "RGB Strip 15" , DK.ADDITIONALLIGHT15 }, + { "RGB Strip 16" , DK.ADDITIONALLIGHT16 }, + { "RGB Strip 17" , DK.ADDITIONALLIGHT17 }, + { "RGB Strip 18" , DK.ADDITIONALLIGHT18 }, + { "RGB Strip 19" , DK.ADDITIONALLIGHT19 }, + { "RGB Strip 20" , DK.ADDITIONALLIGHT20 }, + { "RGB Strip 21" , DK.ADDITIONALLIGHT21 }, + { "RGB Strip 22" , DK.ADDITIONALLIGHT22 }, + { "RGB Strip 23" , DK.ADDITIONALLIGHT23 }, + { "RGB Strip 24" , DK.ADDITIONALLIGHT24 }, + { "RGB Strip 25" , DK.ADDITIONALLIGHT25 }, + { "RGB Strip 26" , DK.ADDITIONALLIGHT26 }, + { "RGB Strip 27" , DK.ADDITIONALLIGHT27 }, + { "RGB Strip 28" , DK.ADDITIONALLIGHT28 }, + { "RGB Strip 29" , DK.ADDITIONALLIGHT29 }, + { "RGB Strip 30" , DK.ADDITIONALLIGHT30 }, + { "RGB Strip 31" , DK.ADDITIONALLIGHT31 }, + { "RGB Strip 32" , DK.ADDITIONALLIGHT32 }, + { "RGB Strip 33" , DK.ADDITIONALLIGHT33 }, + { "RGB Strip 34" , DK.ADDITIONALLIGHT34 }, + { "RGB Strip 35" , DK.ADDITIONALLIGHT35 }, + { "RGB Strip 36" , DK.ADDITIONALLIGHT36 }, + { "RGB Strip 37" , DK.ADDITIONALLIGHT37 }, + { "RGB Strip 38" , DK.ADDITIONALLIGHT38 }, + { "RGB Strip 39" , DK.ADDITIONALLIGHT39 }, + { "RGB Strip 40" , DK.ADDITIONALLIGHT40 }, + { "RGB Strip 41" , DK.ADDITIONALLIGHT41 }, + { "RGB Strip 42" , DK.ADDITIONALLIGHT42 }, + { "RGB Strip 43" , DK.ADDITIONALLIGHT43 }, + { "RGB Strip 44" , DK.ADDITIONALLIGHT44 }, + { "RGB Strip 45" , DK.ADDITIONALLIGHT45 }, + { "RGB Strip 46" , DK.ADDITIONALLIGHT46 }, + { "RGB Strip 47" , DK.ADDITIONALLIGHT47 }, + { "RGB Strip 48" , DK.ADDITIONALLIGHT48 }, + { "RGB Strip 49" , DK.ADDITIONALLIGHT49 }, + { "RGB Strip 50" , DK.ADDITIONALLIGHT50 }, + { "RGB Strip 51" , DK.ADDITIONALLIGHT51 }, + { "RGB Strip 52" , DK.ADDITIONALLIGHT52 }, + { "RGB Strip 53" , DK.ADDITIONALLIGHT53 }, + { "RGB Strip 54" , DK.ADDITIONALLIGHT54 }, + { "RGB Strip 55" , DK.ADDITIONALLIGHT55 }, + { "RGB Strip 56" , DK.ADDITIONALLIGHT56 }, + { "RGB Strip 57" , DK.ADDITIONALLIGHT57 }, + { "RGB Strip 58" , DK.ADDITIONALLIGHT58 }, + { "RGB Strip 59" , DK.ADDITIONALLIGHT59 }, + { "RGB Strip 60" , DK.ADDITIONALLIGHT60 }, + { "Key: Calculator" , DK.CALC }, }; public static readonly DK[] MousepadLights = new[] @@ -198,6 +264,34 @@ public static class OpenRGBKeyNames DK.ADDITIONALLIGHT30, DK.ADDITIONALLIGHT31, DK.ADDITIONALLIGHT32, + DK.ADDITIONALLIGHT33, + DK.ADDITIONALLIGHT34, + DK.ADDITIONALLIGHT35, + DK.ADDITIONALLIGHT36, + DK.ADDITIONALLIGHT37, + DK.ADDITIONALLIGHT38, + DK.ADDITIONALLIGHT39, + DK.ADDITIONALLIGHT40, + DK.ADDITIONALLIGHT41, + DK.ADDITIONALLIGHT42, + DK.ADDITIONALLIGHT43, + DK.ADDITIONALLIGHT44, + DK.ADDITIONALLIGHT45, + DK.ADDITIONALLIGHT46, + DK.ADDITIONALLIGHT47, + DK.ADDITIONALLIGHT48, + DK.ADDITIONALLIGHT49, + DK.ADDITIONALLIGHT50, + DK.ADDITIONALLIGHT51, + DK.ADDITIONALLIGHT52, + DK.ADDITIONALLIGHT53, + DK.ADDITIONALLIGHT54, + DK.ADDITIONALLIGHT55, + DK.ADDITIONALLIGHT56, + DK.ADDITIONALLIGHT57, + DK.ADDITIONALLIGHT58, + DK.ADDITIONALLIGHT59, + DK.ADDITIONALLIGHT60, }; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Rampage/Rampage.cs b/Project-Aurora/Project-Aurora/Devices/Rampage/Rampage.cs new file mode 100644 index 000000000..efc019853 --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/Rampage/Rampage.cs @@ -0,0 +1,74 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using Aurora.Utils; +using System.Drawing; +using System.Threading; +using Aurora.Settings; + +namespace Aurora.Devices.Rampage +{ + public class Rampage : DefaultDevice + { + public override string DeviceName => "Rampage"; + protected override string DeviceInfo => IsInitialized ? GetDeviceNames() : base.DeviceInfo; + + private RampageMouse mouse; + + public override bool Initialize() + { + mouse = RampageMouse.Initialize(); + + return IsInitialized = mouse != null; + } + + public override void Shutdown() + { + mouse?.Disconnect(); + mouse = null; + IsInitialized = false; + } + + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { + if (mouse!=null) + { + UpdateMouse(keyColors); + + var sleep = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_sleep"); + if (sleep > 0) + Thread.Sleep(sleep); + } + return true; + } + + protected override void RegisterVariables(VariableRegistry variableRegistry) + { + variableRegistry.Register($"{DeviceName}_sleep", 30, "Sleep for", 1000, 0); + } + + private void UpdateMouse(Dictionary keyColors) + { + keyColors.TryGetValue((int)DeviceKeys.Peripheral, out var peripheralColor); + mouse.SetColor(ColorUtils.CorrectWithAlpha(peripheralColor)); + foreach (var keyValuePair in RampageKeyMap.MouseLightMap) + { + if (keyColors.TryGetValue((int)keyValuePair.Value, out var color)) + { + var fromArgb = Color.FromArgb( + Math.Max(color.A - 128, 0), + Math.Max(color.R - 128, 0), + Math.Max(color.G - 128, 0), + Math.Max(color.B - 128, 0)); + mouse.SetKeyColor(keyValuePair.Key, ColorUtils.CorrectWithAlpha(fromArgb)); + } + } + + mouse.Update(); + } + + private string GetDeviceNames() + { + return (mouse != null ? " Mouse" : ""); + } + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Rampage/RampageKey.cs b/Project-Aurora/Project-Aurora/Devices/Rampage/RampageKey.cs new file mode 100644 index 000000000..b09f43acc --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/Rampage/RampageKey.cs @@ -0,0 +1,13 @@ +namespace Aurora.Devices.Rampage +{ + public enum RampageKey + { + L1 = 0, + L2 = 1, + L3 = 2, + L4 = 3, + L5 = 4, + L6 = 5, + L7 = 6, + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Rampage/RampageKeyMap.cs b/Project-Aurora/Project-Aurora/Devices/Rampage/RampageKeyMap.cs new file mode 100644 index 000000000..f75b8b1cf --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/Rampage/RampageKeyMap.cs @@ -0,0 +1,19 @@ +using System.Collections.Generic; +using System.Collections.Immutable; + +namespace Aurora.Devices.Rampage +{ + public static class RampageKeyMap + { + public static readonly IImmutableDictionary MouseLightMap = new Dictionary + { + [RampageKey.L1] = DeviceKeys.PERIPHERAL_LIGHT1, + [RampageKey.L2] = DeviceKeys.PERIPHERAL_LIGHT2, + [RampageKey.L3] = DeviceKeys.PERIPHERAL_LIGHT3, + [RampageKey.L4] = DeviceKeys.PERIPHERAL_LIGHT4, + [RampageKey.L5] = DeviceKeys.PERIPHERAL_LIGHT5, + [RampageKey.L6] = DeviceKeys.PERIPHERAL_LIGHT6, + [RampageKey.L7] = DeviceKeys.Peripheral_Logo, + }.ToImmutableDictionary(); + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Rampage/RampageMouse.cs b/Project-Aurora/Project-Aurora/Devices/Rampage/RampageMouse.cs new file mode 100644 index 000000000..cbce14fcd --- /dev/null +++ b/Project-Aurora/Project-Aurora/Devices/Rampage/RampageMouse.cs @@ -0,0 +1,127 @@ +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using HidSharp; +using HidSharp.Reports.Encodings; + +namespace Aurora.Devices.Rampage +{ + public class RampageMouse : IDisposable + { + private const int VendorId = 0x258A; + private const int ProductId = 0x1007; + private static readonly byte[] ColorPacketHeader = new byte[23] { 0x04, 0x00, 0x06, 0xb0, 0x01, 0x09, 0x13, 0x1d, 0x27, 0x37, 0x3b, 0x81, 0x81, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x80, 0x62, 0x00 }; + private static readonly byte[] ColorPacketFooter = new byte[15] { 0x01, 0x03, 0x02, 0x06, 0x05, 0x04, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; + + private readonly byte[] _keyColors = new byte[7*3]; + + private readonly HidStream _ctrlStream; + + private RampageMouse(HidStream ctrlStream) + { + _ctrlStream = ctrlStream; + } + + + public static RampageMouse Initialize() + { + var devices = DeviceList.Local.GetHidDevices(VendorId, ProductId); //Find device with given VID PID + + if (!devices.Any()) + { + return null; + } + try + { + HidDevice ctrlDevice = devices.First(d => d.GetMaxFeatureReportLength() > 50); + + HidStream ctrlStream = null; + if (ctrlDevice?.TryOpen(out ctrlStream) ?? false) + { + RampageMouse rm = new RampageMouse(ctrlStream); + return rm; + } + else + { + ctrlStream?.Close(); + } + } + catch(Exception e) + { + return null; + } + return null; + } + + #region Set Colors + /// + /// All packets sent to the mouse which invole anything to do with rgb are 64 bytes long. + /// First Packet of rgb data transfer starts with 07030601 and next bytes are empty. + /// Next Packets contain actual rgb data and start with 0703060200000000 + /// + public void SetColors(Dictionary keyColors) + { + foreach (var key in keyColors) + SetKeyColor(key.Key, key.Value); + } + + public void SetColor(Color clr) //Set Color to every key on keyboard + { + foreach (RampageKey key in (RampageKey[])Enum.GetValues(typeof(RampageKey))) + SetKeyColor(key, clr); + } + + public void SetKeyColor(RampageKey key, Color clr) //Puts data for each key into the byte array _keyColors + { + int offset = (int)key*3; + _keyColors[offset + 0] = clr.R; + _keyColors[offset + 1] = clr.G; + _keyColors[offset + 2] = clr.B; + } + public bool Update() => WriteColorBuffer(); + private bool WriteColorBuffer() + { + byte[] packet = new byte[64]; + + try + { + ColorPacketHeader.CopyTo(packet, 0); //Copies Color Header to packet + Array.Copy(_keyColors, 0, packet, ColorPacketHeader.Length, _keyColors.Length); //Copies rgb bytes to the packet + ColorPacketFooter.CopyTo(packet, ColorPacketHeader.Length + _keyColors.Length); + _ctrlStream.SetFeature(packet); //Sends packet as additional data in SetReport USBHID packet + //_ctrlStream.SetFeature(endp1); //Sends packet as additional data in SetReport USBHID packet + return true; + } + catch(Exception e) + { + Disconnect(); + return false; + } + } + #endregion + + public void Disconnect() + { + _ctrlStream?.Close(); + } + + #region IDisposable Support + /// + /// Disconnects the mouse when disposing + /// + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + /// + protected virtual void Dispose(bool b) + { + Disconnect(); + } + + #endregion + } +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Razer/RazerDevice.cs b/Project-Aurora/Project-Aurora/Devices/Razer/RazerDevice.cs index 584ae4a3c..467addb60 100755 --- a/Project-Aurora/Project-Aurora/Devices/Razer/RazerDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Razer/RazerDevice.cs @@ -1,26 +1,28 @@ -using Corale.Colore.Core; -using Corale.Colore.Razer.Keyboard; +using Aurora.Utils; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Aurora.Settings; -using KeyboardCustom = Corale.Colore.Razer.Keyboard.Effects.Custom; -using MousepadCustom = Corale.Colore.Razer.Mousepad.Effects.Custom; -using MouseCustom = Corale.Colore.Razer.Mouse.Effects.CustomGrid; -using KeypadCustom = Corale.Colore.Razer.Keypad.Effects.Custom; -using ChromaLinkCustom = Corale.Colore.Razer.ChromaLink.Effects.Custom; +using KeyboardCustom = Colore.Effects.Keyboard.CustomKeyboardEffect; +using MousepadCustom = Colore.Effects.Mousepad.CustomMousepadEffect; +using MouseCustom = Colore.Effects.Mouse.CustomMouseEffect; +using KeypadCustom = Colore.Effects.Keypad.CustomKeypadEffect; +using ChromaLinkCustom = Colore.Effects.ChromaLink.CustomChromaLinkEffect; using System.ComponentModel; using System.Linq; -using Corale.Colore.Razer.Mouse; +using Colore; +using Colore.Data; +using Colore.Api; namespace Aurora.Devices.Razer { public class RazerDevice : DefaultDevice { + IChroma Chroma; public override string DeviceName => "Razer"; - private readonly List<(string Name, Guid Guid)> DeviceGuids = typeof(Corale.Colore.Razer.Devices) + private readonly List<(string Name, Guid Guid)> DeviceGuids = typeof(Colore.Data.Devices) .GetFields() .Select(f => (f.Name, (Guid)f.GetValue(null))) .ToList(); @@ -40,15 +42,21 @@ public override bool Initialize() { try { - Chroma.Instance.Initialize(); + Chroma = ColoreProvider.CreateNativeAsync().Result; + var v = Chroma.SdkVersion; } - catch (Exception e) + catch (ColoreException e) { LogError("Error initializing:" + e.Message); return IsInitialized = false; } + catch (AggregateException e) + { + LogError("SDK not available. Install Razer synapse " + e.Message); + return IsInitialized = false; + } - if (!Chroma.Instance.Initialized) + if (!Chroma.Initialized) { LogError("Failed to Initialize Razer Chroma sdk"); return IsInitialized = false; @@ -67,8 +75,7 @@ public override void Shutdown() try { - Chroma.Instance.SetAll(Color.Black); - Chroma.Instance.Uninitialize(); + Chroma.UninitializeAsync(); IsInitialized = false; } catch (Exception e) @@ -77,44 +84,44 @@ public override void Shutdown() } } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (!IsInitialized) return false; - if (keyColors.TryGetValue(DeviceKeys.Peripheral_Logo, out var clr)) + if (keyColors.TryGetValue((int)DeviceKeys.Peripheral_Logo, out var color)) { - keyboard.Set(ToColore(clr)); - mousepad.Set(ToColore(clr)); - mouse.Set(ToColore(clr)); - headset = ToColore(clr); - chromalink.Set(ToColore(clr)); - keypad.Set(ToColore(clr)); + keyboard.Set(ToColore(color)); + mousepad.Set(ToColore(color)); + mouse.Set(ToColore(color)); + headset = ToColore(color); + chromalink.Set(ToColore(color)); + keypad.Set(ToColore(color)); } - foreach (var key in keyColors) + foreach (var (key, clr) in keyColors) { - if (RazerMappings.keyboardDictionary.TryGetValue(key.Key, out var kbIndex)) - keyboard[kbIndex] = ToColore(key.Value); + if (RazerMappings.keyboardDictionary.TryGetValue((DeviceKeys)key, out var kbIndex)) + keyboard[kbIndex] = ToColore(clr); - if (RazerMappings.mousepadDictionary.TryGetValue(key.Key, out var mousepadIndex)) - mousepad[mousepadIndex] = ToColore(key.Value); + if (RazerMappings.mousepadDictionary.TryGetValue((DeviceKeys)key, out var mousepadIndex)) + mousepad[mousepadIndex] = ToColore(clr); - if (RazerMappings.mouseDictionary.TryGetValue(key.Key, out var mouseIndex)) - mouse[mouseIndex] = ToColore(key.Value); + if (RazerMappings.mouseDictionary.TryGetValue((DeviceKeys)key, out var mouseIndex)) + mouse[mouseIndex] = ToColore(clr); } if (!Global.Configuration.DevicesDisableKeyboard) - Chroma.Instance.Keyboard.SetCustom(keyboard); + Chroma.Keyboard.SetCustomAsync(keyboard); if (!Global.Configuration.DevicesDisableMouse) - Chroma.Instance.Mousepad.SetCustom(mousepad); + Chroma.Mousepad.SetCustomAsync(mousepad); if (!Global.Configuration.DevicesDisableMouse) - Chroma.Instance.Mouse.SetGrid(mouse); + Chroma.Mouse.SetGridAsync(mouse); if (!Global.Configuration.DevicesDisableHeadset) - Chroma.Instance.Headset.SetAll(headset); + Chroma.Headset.SetAllAsync(headset); - Chroma.Instance.Keypad.SetCustom(keypad); - Chroma.Instance.ChromaLink.SetCustom(chromalink); + Chroma.Keypad.SetCustomAsync(keypad); + Chroma.ChromaLink.SetCustomAsync(chromalink); return true; } @@ -126,21 +133,21 @@ protected override void RegisterVariables(VariableRegistry variableRegistry) private Color ToColore(System.Drawing.Color value) => new Color(value.R, value.G, value.B); - private void DetectDevices() + private async void DetectDevices() { deviceNames.Clear(); - foreach (var device in DeviceGuids.Where(d => d.Name != "Razer Core Chroma"))//somehow this device is unsupported, can't query it + foreach (var device in DeviceGuids) { try { - var devInfo = Chroma.Instance.Query(device.Guid); + var devInfo = await Chroma.QueryAsync(device.Guid); if (devInfo.Connected) { deviceNames.Add(device.Name); } } - catch (Corale.Colore.Razer.NativeCallException e) + catch (ColoreException e) { LogError("Error querying device: " + e.Message); } diff --git a/Project-Aurora/Project-Aurora/Devices/Razer/RazerMappings.cs b/Project-Aurora/Project-Aurora/Devices/Razer/RazerMappings.cs index f7f9ac25e..7951ea900 100644 --- a/Project-Aurora/Project-Aurora/Devices/Razer/RazerMappings.cs +++ b/Project-Aurora/Project-Aurora/Devices/Razer/RazerMappings.cs @@ -1,5 +1,5 @@ -using Corale.Colore.Razer.Keyboard; -using Corale.Colore.Razer.Mouse; +using Colore.Effects.Keyboard; +using Colore.Effects.Mouse; using System; using System.Collections.Generic; using System.Linq; diff --git a/Project-Aurora/Project-Aurora/Devices/Roccat/RoccatDevice.cs b/Project-Aurora/Project-Aurora/Devices/Roccat/RoccatDevice.cs index e4111b543..f74d8b5d0 100755 --- a/Project-Aurora/Project-Aurora/Devices/Roccat/RoccatDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Roccat/RoccatDevice.cs @@ -286,7 +286,7 @@ public bool IsConnected() byte[] stateStruct = new byte[110]; Roccat_Talk.TalkFX.Color[] colorStruct = new Roccat_Talk.TalkFX.Color[110]; - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (RyosTalkFX == null || !RyosInitialized) return false; @@ -303,10 +303,10 @@ public bool UpdateDevice(Dictionary keyColors, else if (Global.Configuration.KeyboardLocalization == PreferredKeyboardLocalization.jpn) layout = DeviceLayout.JP; - foreach (KeyValuePair key in keyColors) + foreach (KeyValuePair key in keyColors) { if (e.Cancel) return false; - DeviceKeys dev_key = key.Key; + DeviceKeys dev_key = (DeviceKeys)key.Key; //Solution to slightly different mapping rather than giving a whole different dictionary if (layout == DeviceLayout.ANSI) { @@ -320,7 +320,7 @@ public bool UpdateDevice(Dictionary keyColors, if (Global.Configuration.VarRegistry.GetVariable($"{devicename}_enable_generic") == true) { generic_deactivated_first_time = true; - if (key.Key == DeviceKeys.Peripheral_Logo || key.Key == DeviceKeys.Peripheral) + if ((DeviceKeys)key.Key == DeviceKeys.Peripheral_Logo || (DeviceKeys)key.Key == DeviceKeys.Peripheral) { //Send to generic roccat device if color not equal or 1. time after generic got enabled if (!previous_peripheral_Color.Equals(key.Value) || generic_activated_first_time == true) @@ -374,7 +374,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg if (e.Cancel) return false; - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; diff --git a/Project-Aurora/Project-Aurora/Devices/ScriptedDevice/ScriptedDevice.cs b/Project-Aurora/Project-Aurora/Devices/ScriptedDevice/ScriptedDevice.cs index 5d322deae..fbcd562e6 100644 --- a/Project-Aurora/Project-Aurora/Devices/ScriptedDevice/ScriptedDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/ScriptedDevice/ScriptedDevice.cs @@ -136,7 +136,7 @@ public void Shutdown() } } - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (isInitialized) { @@ -165,7 +165,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; diff --git a/Project-Aurora/Project-Aurora/Devices/SteelSeries/SteelSeriesDevice.cs b/Project-Aurora/Project-Aurora/Devices/SteelSeries/SteelSeriesDevice.cs index c68ff22cf..74a9086dd 100755 --- a/Project-Aurora/Project-Aurora/Devices/SteelSeries/SteelSeriesDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/SteelSeries/SteelSeriesDevice.cs @@ -21,6 +21,7 @@ public enum SteelSeriesKeyCodes G3 = 0xEB, G4 = 0xEC, G5 = 0xED, + MSI_FN = 0xF0, }; class SteelSeriesDevice : IDevice @@ -118,7 +119,7 @@ public bool IsConnected() public bool IsInitialized => this.isInitialized; - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (e.Cancel) return false; @@ -139,7 +140,7 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg GameSensePayloadPeripheryColorEventJSON payload = new GameSensePayloadPeripheryColorEventJSON(); gameSenseSDK.setupEvent(payload); - foreach (KeyValuePair key in keyColors) + foreach (KeyValuePair key in keyColors) { @@ -153,7 +154,7 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg if (e.Cancel) return false; - switch (key.Key) + switch ((DeviceKeys)key.Key) { case DeviceKeys.Peripheral: SendColorToPeripheral(color, payload, forced); @@ -161,7 +162,7 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg case DeviceKeys.Peripheral_Logo: case DeviceKeys.Peripheral_FrontLight: case DeviceKeys.Peripheral_ScrollWheel: - SendColorToPeripheralZone(key.Key, color, payload); + SendColorToPeripheralZone((DeviceKeys)key.Key, color, payload); break; case DeviceKeys.MOUSEPADLIGHT1: case DeviceKeys.MOUSEPADLIGHT2: @@ -179,7 +180,7 @@ public bool UpdateDevice(Dictionary keyColors, DoWorkEventArg colorsMousepad.Add(Tuple.Create(color.R, color.G, color.B)); break; default: - byte hid = GetHIDCode(key.Key); + byte hid = GetHIDCode((DeviceKeys)key.Key); if (hid != (byte)USBHIDCodes.ERROR) { @@ -210,7 +211,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; @@ -341,7 +342,10 @@ public static byte GetHIDCode(DeviceKeys key) case (DeviceKeys.LOGO): return (byte)SteelSeriesKeyCodes.LOGO; case (DeviceKeys.FN_Key): - return (byte)SteelSeriesKeyCodes.SS_KEY; + if (Global.Configuration.KeyboardBrand == Settings.PreferredKeyboard.MSI_GP66_US) + return (byte)SteelSeriesKeyCodes.MSI_FN; + else + return (byte)SteelSeriesKeyCodes.SS_KEY; case (DeviceKeys.G0): return (byte)SteelSeriesKeyCodes.G0; case (DeviceKeys.G1): @@ -389,9 +393,9 @@ public static byte GetHIDCode(DeviceKeys key) case (DeviceKeys.JPN_HALFFULLWIDTH): return (byte)USBHIDCodes.TILDE; case (DeviceKeys.OEM5): - if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.jpn) + /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.jpn) return (byte)USBHIDCodes.ERROR; - else + else*/ return (byte)USBHIDCodes.TILDE; case (DeviceKeys.TILDE): return (byte)USBHIDCodes.TILDE; @@ -514,9 +518,9 @@ public static byte GetHIDCode(DeviceKeys key) case (DeviceKeys.LEFT_SHIFT): return (byte)USBHIDCodes.LEFT_SHIFT; case (DeviceKeys.BACKSLASH_UK): - if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.jpn) + /*if (Global.kbLayout.Loaded_Localization == Settings.PreferredKeyboardLocalization.jpn) return (byte)USBHIDCodes.ERROR; - else + else*/ return (byte)USBHIDCodes.BACKSLASH_UK; case (DeviceKeys.Z): return (byte)USBHIDCodes.Z; @@ -588,6 +592,8 @@ public static byte GetHIDCode(DeviceKeys key) return (byte)USBHIDCodes.NUM_ZERO; case (DeviceKeys.NUM_PERIOD): return (byte)USBHIDCodes.NUM_PERIOD; + case (DeviceKeys.POWER): + return (byte)USBHIDCodes.POWER; default: return (byte)USBHIDCodes.ERROR; diff --git a/Project-Aurora/Project-Aurora/Devices/SteelSeries/USBHIDCodes.cs b/Project-Aurora/Project-Aurora/Devices/SteelSeries/USBHIDCodes.cs index 5ba2a2717..e07454c1a 100644 --- a/Project-Aurora/Project-Aurora/Devices/SteelSeries/USBHIDCodes.cs +++ b/Project-Aurora/Project-Aurora/Devices/SteelSeries/USBHIDCodes.cs @@ -114,9 +114,9 @@ public enum USBHIDCodes BACKSLASH_UK = 0x64, // Keyboard Non-US \ and | APPLICATION_SELECT = 0x65, + POWER = 0x66, - // skip unused special keys from 0x66 to 0xA4 - //0x66 Keyboard Power + // skip unused special keys from 0x67 to 0xA4 //0x67 Keypad = //0x68 Keyboard F13 //0x69 Keyboard F14 diff --git a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/AsusPugio.cs b/Project-Aurora/Project-Aurora/Devices/UnifiedHID/AsusPugio.cs deleted file mode 100644 index 3bf082dd2..000000000 --- a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/AsusPugio.cs +++ /dev/null @@ -1,92 +0,0 @@ -using HidLibrary; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Aurora.Devices.UnifiedHID -{ - internal class AsusPugio : UnifiedBase - { - public AsusPugio() - { - PrettyName = "Asus Pugio"; - this.deviceKeyMap = new Dictionary> - { - { DeviceKeys.Peripheral_Logo, SetLogo }, - { DeviceKeys.Peripheral_ScrollWheel, SetScrollWheel }, - { DeviceKeys.Peripheral_FrontLight, SetBottomLed } - }; - } - - public override bool Connect() - { - if (!Global.Configuration.VarRegistry.GetVariable($"UnifiedHID_{this.GetType().Name}_enable")) - { - return false; - } - - return this.Connect(0x0b05, new[] { 0x1846, 0x1847 }, unchecked((short)0xFFFFFF01)); - } - - public bool SetScrollWheel(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x00; - for (int i = 0; i < 64; i++) - { - report.Data[i] = 0x00; - } - report.Data[0] = 0x51; - report.Data[1] = 0x28; - report.Data[2] = 0x01; - report.Data[4] = 0x00; - report.Data[5] = 0x04; - report.Data[6] = r; - report.Data[7] = g; - report.Data[8] = b; - return device.WriteReport(report); - } - - public bool SetLogo(byte r, byte g, byte b) - { - SetBottomLed(r, g, b); - HidReport report = device.CreateReport(); - report.ReportId = 0x00; - for (int i = 0; i < 64; i++) - { - report.Data[i] = 0x00; - } - report.Data[0] = 0x51; - report.Data[1] = 0x28; - report.Data[2] = 0x00; - report.Data[4] = 0x00; - report.Data[5] = 0x04; - report.Data[6] = r; - report.Data[7] = g; - report.Data[8] = b; - return device.WriteReport(report); - } - - public bool SetBottomLed(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x00; - for (int i = 0; i < 64; i++) - { - report.Data[i] = 0x00; - } - report.Data[0] = 0x51; - report.Data[1] = 0x28; - report.Data[2] = 0x02; - report.Data[4] = 0x00; - report.Data[5] = 0x04; - report.Data[6] = r; - report.Data[7] = g; - report.Data[8] = b; - return device.WriteReport(report); - } - } - -} diff --git a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/RivalMouses.cs b/Project-Aurora/Project-Aurora/Devices/UnifiedHID/RivalMouses.cs deleted file mode 100644 index d0284c25e..000000000 --- a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/RivalMouses.cs +++ /dev/null @@ -1,196 +0,0 @@ -using HidLibrary; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace Aurora.Devices.UnifiedHID -{ - - internal class Rival100 : UnifiedBase - { - public Rival100() - { - PrettyName = "Rival 100"; - deviceKeyMap = new Dictionary> - { - { DeviceKeys.Peripheral_Logo, SetLogo } - }; - } - - public override bool Connect() - { - if (!Global.Configuration.VarRegistry.GetVariable($"UnifiedHID_{this.GetType().Name}_enable")) - { - return false; - } - - return this.Connect(0x1038, new[] { 0x1702 }, unchecked((short)0xFFFFFFC0)); - } - - public bool SetLogo(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x02; - report.Data[0] = 0x05; - report.Data[1] = 0x00; - report.Data[2] = r; - report.Data[3] = g; - report.Data[4] = b; - return device.WriteReport(report); - } - } - - internal class Rival110 : UnifiedBase - { - public Rival110() - { - PrettyName = "Rival 110"; - deviceKeyMap = new Dictionary> - { - { DeviceKeys.Peripheral_Logo, SetLogo } - }; - } - - public override bool Connect() - { - if (!Global.Configuration.VarRegistry.GetVariable($"UnifiedHID_{this.GetType().Name}_enable")) - { - return false; - } - - return this.Connect(0x1038, new[] { 0x1729 }, unchecked((short)0xFFFFFFC0)); - } - - public bool SetLogo(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x02; - report.Data[0] = 0x05; - report.Data[1] = 0x00; - report.Data[2] = r; - report.Data[3] = g; - report.Data[4] = b; - report.Data[5] = 0x00; - report.Data[6] = 0x00; - report.Data[7] = 0x00; - report.Data[8] = 0x00; - - return device.WriteReport(report); - } - } - - internal class Rival300 : UnifiedBase - { - public Rival300() - { - PrettyName = "Rival 300"; - this.deviceKeyMap = new Dictionary> - { - { DeviceKeys.Peripheral_Logo, SetLogo }, - { DeviceKeys.Peripheral_ScrollWheel, SetScrollWheel } - }; - } - - public override bool Connect() - { - if (!Global.Configuration.VarRegistry.GetVariable($"UnifiedHID_{this.GetType().Name}_enable")) - { - return false; - } - - return this.Connect(0x1038, new[] { 0x1710, 0x171A, 0x1394, 0x1384, 0x1718, 0x1712 }, unchecked((short)0xFFFFFFC0)); - } - - public bool SetScrollWheel(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x02; - report.Data[0] = 0x08; - report.Data[1] = 0x02; - report.Data[2] = r; - report.Data[3] = g; - report.Data[4] = b; - return device.WriteReport(report); - } - - public bool SetLogo(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x02; - report.Data[0] = 0x08; - report.Data[1] = 0x01; - report.Data[2] = r; - report.Data[3] = g; - report.Data[4] = b; - return device.WriteReport(report); - } - } - - internal class Rival500 : UnifiedBase - { - public Rival500() - { - PrettyName = "Rival 500"; - this.deviceKeyMap = new Dictionary> - { - { DeviceKeys.Peripheral_Logo, SetLogo }, - { DeviceKeys.Peripheral_ScrollWheel, SetScrollWheel } - }; - } - - public override bool Connect() - { - if (!Global.Configuration.VarRegistry.GetVariable($"UnifiedHID_{this.GetType().Name}_enable")) - { - return false; - } - - return this.Connect(0x1038, new[] { 0x170e }, unchecked((short)0xFFFFFFC0)); - } - - public bool SetScrollWheel(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x03; - report.Data[0] = 0x05; - report.Data[1] = 0x00; - report.Data[2] = 0x01; - report.Data[3] = r; - report.Data[4] = g; - report.Data[5] = b; - report.Data[6] = 0xFF; - report.Data[7] = 0x32; - report.Data[8] = 0xC8; - report.Data[9] = 0xC8; - report.Data[10] = 0x00; - report.Data[11] = 0x01; - report.Data[12] = 0x01; - return device.WriteReport(report); - } - - public bool SetLogo(byte r, byte g, byte b) - { - HidReport report = device.CreateReport(); - report.ReportId = 0x03; - report.Data[0] = 0x05; - report.Data[1] = 0x00; - report.Data[2] = 0x00; - report.Data[3] = r; - report.Data[4] = g; - report.Data[5] = b; - report.Data[6] = 0xFF; - report.Data[7] = 0x32; - report.Data[8] = 0xC8; - report.Data[9] = 0xC8; - report.Data[10] = 0x00; - report.Data[11] = 0x00; - report.Data[12] = 0x01; - - return device.WriteReport(report); - } - - } - -} diff --git a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/RoccatTyon.cs b/Project-Aurora/Project-Aurora/Devices/UnifiedHID/RoccatTyon.cs deleted file mode 100644 index 1b29f7b7c..000000000 --- a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/RoccatTyon.cs +++ /dev/null @@ -1,140 +0,0 @@ -using HidLibrary; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; - -namespace Aurora.Devices.UnifiedHID -{ - - internal class RoccatTyon : UnifiedBase - { - private static HidDevice ctrl_device_leds; - private static HidDevice ctrl_device; - - public RoccatTyon() - { - PrettyName = "Roccat Tyon"; - } - - private bool InitMouseColor() - { - return ctrl_device.WriteFeatureData(initPacket); - } - - static bool WaitCtrlDevice() - { - for (int i = 1; i < 3; i++) // 3 Tries because the first one always fails. - { - if (ctrl_device.ReadFeatureData(out byte[] buffer, 0x04) && buffer.Length > 2) - { - if (buffer[1] == 0x01) - return true; - } - else - return false; - } - return false; - } - - public override bool Connect() - { - if (!Global.Configuration.VarRegistry.GetVariable($"UnifiedHID_{this.GetType().Name}_enable")) - { - return false; - } - IEnumerable devices = HidDevices.Enumerate(0x1E7D, new int[] { 0x2E4A }); - try - { - if (devices.Count() > 0) - { - ctrl_device_leds = devices.First(dev => dev.Capabilities.UsagePage == 0x0001 && dev.Capabilities.Usage == 0x0002); - ctrl_device = devices.First(dev => dev.Capabilities.FeatureReportByteLength > 50); - ctrl_device.OpenDevice(); - ctrl_device_leds.OpenDevice(); - bool success = InitMouseColor() && WaitCtrlDevice(); - if (!success) - { - Global.logger.LogLine($"Roccat Tyon Could not connect\n", Logging_Level.Error); - ctrl_device.CloseDevice(); - ctrl_device_leds.CloseDevice(); - } - Global.logger.LogLine($"Roccat Tyon Connected\n", Logging_Level.Info); - return (IsConnected = success); - } - } - catch (Exception exc) - { - Global.logger.LogLine($"Error when attempting to open UnifiedHID device:\n{exc}", Logging_Level.Error); - } - return false; - } - - // We need to override Disconnect() too cause we have two HID devices open for this mouse. - public override bool Disconnect() - { - try - { - ctrl_device.CloseDevice(); - ctrl_device_leds.CloseDevice(); - return true; - } - catch (Exception exc) - { - Global.logger.LogLine($"Error when attempting to close UnifiedHID device:\n{exc}", Logging_Level.Error); - } - return false; - } - - public override bool SetLEDColour(DeviceKeys key, byte red, byte green, byte blue) - { - try - { - if (!this.IsConnected) - return false; - - byte[] hwmap = - { - red, - green, - blue, - 0x00, - 0x00, - red, - green, - blue, - 0x00, - 0x80, - 0x80 - }; - - byte[] workbuf = new byte[30]; - Array.Copy(controlPacket, 0, workbuf, 0, controlPacket.Length); - Array.Copy(hwmap, 0, workbuf, controlPacket.Length, hwmap.Length); - - return ctrl_device.WriteFeatureData(workbuf); - } - catch (Exception exc) - { - Global.logger.LogLine($"Error when attempting to close UnifiedHID device:\n{exc}", Logging_Level.Error); - return false; - } - } - - // Packet with values set to white for mouse initialisation. - static readonly byte[] initPacket = new byte[] { - 0x06,0x1e,0x00,0x00, - 0x06,0x06,0x06,0x10,0x20,0x40,0x80,0xa4,0x02,0x03,0x33,0x00,0x01,0x01,0x03, - 0xff,0xff,0xff,0x00,0x00,0xff,0xff,0xff,0x00,0x01,0x08 - }; - - // Packet with fixed values for affixing to mouse colors. - static readonly byte[] controlPacket = new byte[] { - 0x06,0x1e,0x00,0x00, - 0x06,0x06,0x06,0x10,0x20,0x40,0x80,0xa4,0x02,0x03,0x33,0x00,0x01,0x01,0x03 - }; - } -} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/UnifiedHID.cs b/Project-Aurora/Project-Aurora/Devices/UnifiedHID/UnifiedHID.cs deleted file mode 100644 index fc7801411..000000000 --- a/Project-Aurora/Project-Aurora/Devices/UnifiedHID/UnifiedHID.cs +++ /dev/null @@ -1,310 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using Aurora.Settings; -using System.Threading; -using System.Threading.Tasks; -using HidLibrary; -using System.ComponentModel; -using System.Reflection; - -namespace Aurora.Devices.UnifiedHID -{ - class UnifiedHIDDevice : IDevice - { - private string devicename = "UnifiedHID"; - private bool isInitialized = false; - private bool peripheral_updated = false; - private readonly object action_lock = new object(); - private System.Diagnostics.Stopwatch watch = new System.Diagnostics.Stopwatch(); - private long lastUpdateTime = 0; - private VariableRegistry default_registry = null; - - List AllDevices = new List(); - - - - public UnifiedHIDDevice() - { - //Copied GetLoadableTypes from https://haacked.com/archive/2012/07/23/get-all-types-in-an-assembly.aspx/ - IEnumerable GetLoadableTypes(Assembly assembly) - { - if (assembly == null) throw new ArgumentNullException(nameof(assembly)); - try - { - return assembly.GetTypes(); - } - catch (ReflectionTypeLoadException e) - { - return e.Types.Where(t => t != null); - } - } - - try - { - AppDomain.CurrentDomain.GetAssemblies() - .SelectMany(assembly => GetLoadableTypes(assembly)) - .Where(type => type.IsSubclassOf(typeof(UnifiedBase))).ToList() - .ForEach(class_ => AllDevices.Add((ISSDevice)Activator.CreateInstance(class_))); - } - catch (Exception exc) - { - Global.logger.Error("UnifiedHID class could not be constructed: " + exc); - } - } - - List FoundDevices = new List(); - - public bool Initialize() - { - lock (action_lock) - { - if (!isInitialized) - { - this.FoundDevices.Clear(); - try - { - foreach (ISSDevice dev in AllDevices) - { - if (dev.Connect()) - FoundDevices.Add(dev); - } - } - catch (Exception e) - { - Global.logger.Error("UnifiedHID could not be initialized: " + e); - isInitialized = false; - } - if (FoundDevices.Count > 0) - isInitialized = true; - } - - return isInitialized; - } - } - - public void Shutdown() - { - lock (action_lock) - { - try - { - if (isInitialized) - { - foreach (ISSDevice dev in FoundDevices) - { - dev.Disconnect(); - } - this.FoundDevices.Clear(); - this.Reset(); - - isInitialized = false; - } - } - catch (Exception ex) - { - Global.logger.Error("There was an error shutting down UnifiedHID: " + ex); - isInitialized = false; - } - - } - } - - public string DeviceDetails => IsInitialized - ? "Initialized" - : "Not Initialized"; - - public string DeviceName => devicename; - - public void Reset() - { - if (this.IsInitialized&& (peripheral_updated)) - { - peripheral_updated = false; - } - } - - public bool Reconnect() - { - Shutdown(); - return Initialize(); - } - - public bool IsConnected() - { - return this.isInitialized; - } - - public bool IsInitialized => this.isInitialized; - - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) - { - if (e.Cancel) return false; - try - { - List> colors = new List>(); - - foreach (ISSDevice device in FoundDevices) - { - if (e.Cancel) return false; - - if (!device.IsKeyboard) - { - foreach (KeyValuePair key in keyColors) - { - Color color = (Color)key.Value; - //Apply and strip Alpha - color = Color.FromArgb(255, Utils.ColorUtils.MultiplyColorByScalar(color, color.A / 255.0D)); - - if (e.Cancel) return false; - else if (Global.Configuration.AllowPeripheralDevices && !Global.Configuration.DevicesDisableMouse) - { - if (key.Key == DeviceKeys.Peripheral_Logo || key.Key == DeviceKeys.Peripheral_ScrollWheel || key.Key == DeviceKeys.Peripheral_FrontLight) - { - device.SetLEDColour(key.Key, color.R, color.G, color.B); - } - peripheral_updated = true; - } - else - { - peripheral_updated = false; - } - } - } - else - { - if (!Global.Configuration.DevicesDisableKeyboard) - { - device.SetMultipleLEDColour(keyColors); - peripheral_updated = true; - } - else - { - peripheral_updated = false; - } - } - } - - - return true; - } - catch (Exception ex) - { - Global.logger.Error("UnifiedHID, error when updating device: " + ex); - return false; - } - } - - public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArgs e, bool forced = false) - { - watch.Restart(); - - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); - - watch.Stop(); - lastUpdateTime = watch.ElapsedMilliseconds; - - return update_result; - } - - public bool IsPeripheralConnected() - { - return isInitialized; - } - - public bool IsKeyboardConnected() - { - return isInitialized; - //return false; - } - - public string DeviceUpdatePerformance => (isInitialized ? lastUpdateTime + " ms" : ""); - - public VariableRegistry RegisteredVariables - { - get - { - if (default_registry == null) - { - default_registry = new VariableRegistry(); - foreach (ISSDevice device in AllDevices) - { - default_registry.Register($"UnifiedHID_{device.GetType().Name}_enable", false, $"Enable {(string.IsNullOrEmpty(device.PrettyName) ? device.GetType().Name : device.PrettyName)} in {devicename}"); - } - } - return default_registry; - } - } - } - - interface ISSDevice - { - bool IsConnected { get; } - bool IsKeyboard { get; } - string PrettyName { get; } - bool Connect(); - bool Disconnect(); - bool SetLEDColour(DeviceKeys key, byte red, byte green, byte blue); - bool SetMultipleLEDColour(Dictionary keyColors); - } - - abstract class UnifiedBase : ISSDevice - { - protected HidDevice device; - protected Dictionary> deviceKeyMap; - public bool IsConnected { get; protected set; } = false; - public bool IsKeyboard { get; protected set; } = false; - public string PrettyName { get; protected set; } - - protected bool Connect(int vendorID, int[] productIDs, short usagePage) - { - IEnumerable devices = HidDevices.Enumerate(vendorID, productIDs); - - if (devices.Count() > 0) - { - try - { - device = devices.First(dev => dev.Capabilities.UsagePage == usagePage); - device.OpenDevice(); - return (IsConnected = true); - } - catch (Exception exc) - { - Global.logger.LogLine($"Error when attempting to open UnifiedHID device:\n{exc}", Logging_Level.Error); - } - } - return false; - } - - public abstract bool Connect(); - - public virtual bool Disconnect() - { - try - { - device.CloseDevice(); - return true; - } - catch - { - return false; - } - } - - public virtual bool SetLEDColour(DeviceKeys key, byte red, byte green, byte blue) - { - if (this.deviceKeyMap.TryGetValue(key, out Func func)) - return func.Invoke(red, green, blue); - - return false; - } - - public virtual bool SetMultipleLEDColour(Dictionary keyColors) - { - return false; - } - - } - -} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Devices/Uniwill/UniwillDevice.cs b/Project-Aurora/Project-Aurora/Devices/Uniwill/UniwillDevice.cs index e945dcc2d..063b95d09 100644 --- a/Project-Aurora/Project-Aurora/Devices/Uniwill/UniwillDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Uniwill/UniwillDevice.cs @@ -196,7 +196,7 @@ public bool IsConnected() bool bRefreshOnce = true; // This is used to refresh effect between Row-Type and Fw-Type change or layout light level change - public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + public bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (e.Cancel) return false; @@ -214,7 +214,7 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg { watch.Restart(); - bool update_result = UpdateDevice(colorComposition.keyColors, e, forced); + bool update_result = UpdateDevice(colorComposition.KeyColors, e, forced); watch.Stop(); lastUpdateTime = watch.ElapsedMilliseconds; @@ -222,9 +222,9 @@ public bool UpdateDevice(DeviceColorComposition colorComposition, DoWorkEventArg return update_result; } - private KeyValuePair AdjustBrightness(KeyValuePair kc) + private KeyValuePair AdjustBrightness(KeyValuePair kc) { - var newEntry = new KeyValuePair(kc.Key, Color.FromArgb(255, Utils.ColorUtils.MultiplyColorByScalar(kc.Value, (kc.Value.A / 255.0D) * brightness))); + var newEntry = new KeyValuePair(kc.Key, Color.FromArgb(255, Utils.ColorUtils.MultiplyColorByScalar(kc.Value, (kc.Value.A / 255.0D) * brightness))); kc = newEntry; return kc; } diff --git a/Project-Aurora/Project-Aurora/Devices/Vulcan/Vulcan.cs b/Project-Aurora/Project-Aurora/Devices/Vulcan/Vulcan.cs index d4d34b2c6..ed622ab55 100644 --- a/Project-Aurora/Project-Aurora/Devices/Vulcan/Vulcan.cs +++ b/Project-Aurora/Project-Aurora/Devices/Vulcan/Vulcan.cs @@ -37,18 +37,18 @@ public override void Shutdown() _keyboards.Clear(); } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (!IsInitialized) return false; - foreach (var key in keyColors) + foreach (var (key, clr) in keyColors) { foreach (var keyboard in _keyboards) { - if (VulcanKeyMap.KeyMap.TryGetValue(key.Key, out var vulcanKey)) + if (VulcanKeyMap.KeyMap.TryGetValue((DeviceKeys)key, out var vulcanKey)) { - var color = ColorUtils.CorrectWithAlpha(key.Value); + var color = ColorUtils.CorrectWithAlpha(clr); keyboard.SetKeyColor(vulcanKey,color.R, color.G, color.B ); } } diff --git a/Project-Aurora/Project-Aurora/Devices/Vulcan/VulcanKeyMap.cs b/Project-Aurora/Project-Aurora/Devices/Vulcan/VulcanKeyMap.cs index 59ff6b77a..7942986b2 100644 --- a/Project-Aurora/Project-Aurora/Devices/Vulcan/VulcanKeyMap.cs +++ b/Project-Aurora/Project-Aurora/Devices/Vulcan/VulcanKeyMap.cs @@ -116,7 +116,8 @@ public static class VulcanKeyMap { DeviceKeys.NUM_PLUS, Key.NUM_PLUS }, { DeviceKeys.NUM_ENTER, Key.NUM_ENTER }, { DeviceKeys.BACKSLASH_UK, Key.ISO_BACKSLASH }, - { DeviceKeys.HASHTAG, Key.ISO_HASH } + { DeviceKeys.HASHTAG, Key.ISO_HASH }, + { DeviceKeys.VOLUME_MUTE, Key.MUTE } }; } } diff --git a/Project-Aurora/Project-Aurora/Devices/Wooting/WootingDevice.cs b/Project-Aurora/Project-Aurora/Devices/Wooting/WootingDevice.cs index 40c7d7ef1..a33b631be 100755 --- a/Project-Aurora/Project-Aurora/Devices/Wooting/WootingDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/Wooting/WootingDevice.cs @@ -58,7 +58,7 @@ public override void Shutdown() IsInitialized = false; } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { if (!IsInitialized) return false; @@ -69,14 +69,14 @@ public override bool UpdateDevice(Dictionary keyColors, DoWor try { - foreach (var key in keyColors) + foreach (var (key, clr) in keyColors) { - if (WootingKeyMap.KeyMap.TryGetValue(key.Key, out var wootKey)) + if (WootingKeyMap.KeyMap.TryGetValue((DeviceKeys)key, out var wootKey)) { - var clr = ColorUtils.CorrectWithAlpha(key.Value); - RGBControl.SetKey(wootKey, (byte)(clr.R * rScalar), - (byte)(clr.G * gScalar), - (byte)(clr.B * bScalar)); + var color = ColorUtils.CorrectWithAlpha(clr); + RGBControl.SetKey(wootKey, (byte)(color.R * rScalar), + (byte)(color.G * gScalar), + (byte)(color.B * bScalar)); } } RGBControl.UpdateKeyboard(); diff --git a/Project-Aurora/Project-Aurora/Devices/YeeLight/YeeLightDevice.cs b/Project-Aurora/Project-Aurora/Devices/YeeLight/YeeLightDevice.cs index e7c5770ff..a4333ffce 100644 --- a/Project-Aurora/Project-Aurora/Devices/YeeLight/YeeLightDevice.cs +++ b/Project-Aurora/Project-Aurora/Devices/YeeLight/YeeLightDevice.cs @@ -14,6 +14,7 @@ using YeeLightAPI.YeeLightConstants; using YeeLightAPI.YeeLightExceptions; using YeeLightAPI; +using static YeeLightAPI.YeeLightExceptions.Exceptions; namespace Aurora.Devices.YeeLight { @@ -21,63 +22,67 @@ public class YeeLightDevice : DefaultDevice { public override string DeviceName => "YeeLight"; - private const int lightListenPort = 55443; - private readonly Stopwatch updateDelayStopWatch = new Stopwatch(); - private List lights = new List(); + private const int LightListenPort = 55443; + private readonly Stopwatch _updateDelayStopWatch = new(); + private readonly List _lights = new(); + + protected override string DeviceInfo => String.Join( + ", ", + _lights.Select(light => light.GetLightIPAddressAndPort().ipAddress + ":" + light.GetLightIPAddressAndPort().port + "w:" + _whiteCounter + (light.IsMusicMode() ? "(m)" : "")) + ); public override bool Initialize() { - if (!IsInitialized) + if (IsInitialized) return IsInitialized; + try { - try - { - lights.Clear(); + _lights.Clear(); - var IPListString = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_IP"); - var lightIPList = new List(); + var ipListString = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_IP"); + var lightIpList = new List(); - //Auto discover a device if the IP is empty and auto-discovery is enabled - if (string.IsNullOrWhiteSpace(IPListString) && Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_auto_discovery")) + //Auto discover a device if the IP is empty and auto-discovery is enabled + if (string.IsNullOrWhiteSpace(ipListString) && Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_auto_discovery")) + { + var devices = DeviceLocator.DiscoverDevices(10000, 2); + if (!devices.Any()) { - var devices = DeviceLocator.DiscoverDevices(10000, 2); - if (!devices.Any()) - { - throw new Exception("Auto-discovery is enabled but no devices have been located."); - } - - lightIPList.AddRange(devices.Select(v => v.GetLightIPAddressAndPort().ipAddress)); + throw new Exception("Auto-discovery is enabled but no devices have been located."); } - else + + lightIpList.AddRange(devices.Select(v => v.GetLightIPAddressAndPort().ipAddress)); + } + else + { + lightIpList = ipListString.Split(',').Select(x => IPAddress.Parse(x.Replace(" ", ""))).ToList(); + if (lightIpList.Count == 0) { - lightIPList = IPListString.Split(new[] { ',' }).Select(x => IPAddress.Parse(x.Replace(" ", ""))).ToList(); - if (lightIPList.Count == 0) - { - throw new Exception("Device IP list is empty."); - } + throw new Exception("Device IP list is empty."); } + } - for (int i = 0; i < lightIPList.Count; i++) + for (var i = 0; i < lightIpList.Count; i++) + { + var ipaddr = lightIpList[i]; + try { - IPAddress ipaddr = lightIPList[i]; - try - { - ConnectNewDevice(ipaddr); - } - catch (Exception exc) - { - LogError($"Encountered an error while connecting to the {i}. light. Exception: {exc}"); - } + ConnectNewDevice(ipaddr); + } + catch (Exception exc) + { + LogError($"Encountered an error while connecting to the {i}. light. Exception: {exc}"); } - - IsInitialized = lights.All(x => x.IsConnected()); } - catch (Exception exc) - { - LogError($"Encountered an error while initializing. Exception: {exc}"); - IsInitialized = false; - return false; - } + _updateDelayStopWatch.Start(); + IsInitialized = _lights.All(x => x.IsConnected()); + } + catch (Exception exc) + { + LogError($"Encountered an error while initializing. Exception: {exc}"); + IsInitialized = false; + + return false; } return IsInitialized; @@ -85,43 +90,54 @@ public override bool Initialize() public override void Shutdown() { - foreach (var light in lights.Where(x => x.IsConnected())) + foreach (var light in _lights.Where(x => x.IsConnected())) { light.CloseConnection(); } - lights.Clear(); + _lights.Clear(); IsInitialized = false; - if (updateDelayStopWatch.IsRunning) + if (_updateDelayStopWatch.IsRunning) { - updateDelayStopWatch.Stop(); + _updateDelayStopWatch.Stop(); } } - public override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) + private Color _previousColor = Color.Empty; + private int _whiteCounter = 10; + protected override bool UpdateDevice(Dictionary keyColors, DoWorkEventArgs e, bool forced = false) { - // Reduce sending based on user config - if (!updateDelayStopWatch.IsRunning) + try { - updateDelayStopWatch.Start(); + return TryUpdate(keyColors); + }catch(Exception excp) + { + Reset(); + return TryUpdate(keyColors); } + } - if (updateDelayStopWatch.ElapsedMilliseconds <= Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_send_delay")) + private bool TryUpdate(IReadOnlyDictionary keyColors) + { + var sendDelay = Math.Max(5, Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_send_delay")); + if (_updateDelayStopWatch.ElapsedMilliseconds <= sendDelay) return false; var targetKey = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_devicekey"); - if (!keyColors.TryGetValue(targetKey, out var targetColor)) + if (!keyColors.TryGetValue((int)targetKey, out var targetColor)) return false; + if (_previousColor.Equals(targetColor)) + return ProceedSameColor(targetColor); + _previousColor = targetColor; - if ((targetColor.R + targetColor.G + targetColor.B) > 0) + if (IsWhiteTone(targetColor)) { - lights.ForEach(x => x.SetColor(targetColor.R, targetColor.G, targetColor.B)); - updateDelayStopWatch.Restart(); + return ProceedDifferentWhiteColor(targetColor); } - - return true; + _whiteCounter = Global.Configuration.VarRegistry.GetVariable($"{DeviceName}_white_delay"); + return ProceedColor(targetColor); } protected override void RegisterVariables(VariableRegistry variableRegistry) @@ -132,47 +148,141 @@ protected override void RegisterVariables(VariableRegistry variableRegistry) variableRegistry.Register($"{DeviceName}_send_delay", 35, "Send delay (ms)"); variableRegistry.Register($"{DeviceName}_IP", "", "YeeLight IP(s)", null, null, "Comma separated IPv4 or IPv6 addresses."); variableRegistry.Register($"{DeviceName}_auto_discovery", false, "Auto-discovery", null, null, "Enable this and empty out the IP field to auto-discover lights."); + variableRegistry.Register($"{DeviceName}_white_delay", 10, "White mode delay(ticks)", null, null, "How many ticks should happen before white mode is activated."); + } + + private bool ProceedSameColor(Color targetColor) + { + if (IsWhiteTone(targetColor)) + { + return ProceedWhiteColor(targetColor); + } + + if (ShouldSendKeepAlive()) + { + return ProceedColor(targetColor); + } + _updateDelayStopWatch.Restart(); + return true; + } + + private bool ProceedWhiteColor(Color targetColor) + { + if (_whiteCounter == 0) + { + if (ShouldSendKeepAlive()) + { + _lights.ForEach(x => + { + x.SetTemperature(6500); + x.SetBrightness(targetColor.R * 100 / 255); + }); + } + _updateDelayStopWatch.Restart(); + return true; + } + if (_whiteCounter == 1) + { + _lights.ForEach(x => + { + x.SetTemperature(6500); + x.SetBrightness(targetColor.R * 100 / 255); + }); + } + _whiteCounter--; + _updateDelayStopWatch.Restart(); + return true; + } + + private bool ProceedDifferentWhiteColor(Color targetColor) + { + if (_whiteCounter > 0) + { + _whiteCounter--; + return ProceedColor(targetColor); + } + _lights.ForEach(x => + { + x.SetTemperature(6500); + x.SetBrightness(targetColor.R * 100 / 255); + }); + _updateDelayStopWatch.Restart(); + return true; + } + + private bool ProceedColor(Color targetColor) + { + _lights.ForEach(x => + { + x.SetColor(targetColor.R, targetColor.G, targetColor.B); + x.SetBrightness(Math.Max(targetColor.R, Math.Max(targetColor.G, Math.Max(targetColor.B, (short)1))) * 100 / 255); + }); + _updateDelayStopWatch.Restart(); + return true; + } + + private const int KeepAliveCounter = 500; + private int _keepAlive = KeepAliveCounter; + private bool ShouldSendKeepAlive() + { + if (_keepAlive-- != 0) return false; + _keepAlive = KeepAliveCounter; + return true; + } + + private bool IsWhiteTone(Color color) + { + return color.R == color.G && color.G == color.B; } - private void ConnectNewDevice(IPAddress lightIP) + private void ConnectNewDevice(IPAddress lightIp) { - if (lights.Any(x => x.IsConnected() && x.GetLightIPAddressAndPort().ipAddress == lightIP)) + if (_lights.Any(x => x.IsConnected() && Equals(x.GetLightIPAddressAndPort().ipAddress, lightIp))) { return; } var light = new YeeLightAPI.YeeLightDevice(); - light.SetLightIPAddressAndPort(lightIP, YeeLightAPI.YeeLightConstants.Constants.DefaultCommandPort); + light.SetLightIPAddressAndPort(lightIp, Constants.DefaultCommandPort); LightConnectAndEnableMusicMode(light); - lights.Add(light); + _lights.Add(light); } + private int _connectionTries; private void LightConnectAndEnableMusicMode(YeeLightAPI.YeeLightDevice light) { - int localMusicModeListenPort = GetFreeTCPPort(); // This can be any free port + var localMusicModeListenPort = GetFreeTCPPort(); // This can be any free port - IPAddress localIP; - using (Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0)) - { - var lightIP = light.GetLightIPAddressAndPort().ipAddress; - socket.Connect(lightIP, lightListenPort); - localIP = ((IPEndPoint)socket.LocalEndPoint).Address; - } + using var socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, 0); + var lightIp = light.GetLightIPAddressAndPort().ipAddress; + socket.Connect(lightIp, LightListenPort); + var localIp = ((IPEndPoint)socket.LocalEndPoint).Address; light.Connect(); - light.SetMusicMode(localIP, (ushort)localMusicModeListenPort, true); + _connectionTries = 100; + do + { + Thread.Sleep(500); + } while (!light.IsConnected() && --_connectionTries > 0); + + try + { + light.SetMusicMode(localIp, (ushort)localMusicModeListenPort, true); + } + catch (Exception e) + { + // ignored + } } private int GetFreeTCPPort() { - int freePort; - - // When a TCPListener is created with 0 as port, the TCP/IP stack will asign it a free port - TcpListener listener = new TcpListener(IPAddress.Loopback, 0); // Create a TcpListener on loopback with 0 as the port + // When a TCPListener is created with 0 as port, the TCP/IP stack will assign it a free port + var listener = new TcpListener(IPAddress.Loopback, 0); // Create a TcpListener on loopback with 0 as the port listener.Start(); - freePort = ((IPEndPoint)listener.LocalEndpoint).Port; // Gets the local port the TcpListener is listening on + var freePort = ((IPEndPoint)listener.LocalEndpoint).Port; listener.Stop(); return freePort; } diff --git a/Project-Aurora/Project-Aurora/Directory.Build.props b/Project-Aurora/Project-Aurora/Directory.Build.props index b17c4a495..1fdb38d01 100644 --- a/Project-Aurora/Project-Aurora/Directory.Build.props +++ b/Project-Aurora/Project-Aurora/Directory.Build.props @@ -3,14 +3,18 @@ Aurora Unified Lighting Effects across different RGB devices - Aurora Copyright © 2017 1.0.0.0 false + true $(APPVEYOR_BUILD_VERSION) - 0.8.1 + v0 + $(OWNER) + Aurora-RGB + $(REPOSITORY) + Aurora diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationCircle.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationCircle.cs index 0808de685..0db80281f 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationCircle.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationCircle.cs @@ -7,18 +7,15 @@ namespace Aurora.EffectsEngine.Animations public class AnimationCircle : AnimationFrame { [Newtonsoft.Json.JsonProperty] - internal float _radius = 0.0f; - [Newtonsoft.Json.JsonProperty] - internal PointF _center = new PointF(); - - public float Radius { get { return _radius; } } - public PointF Center { get { return _center; } } + internal float _radius; + public float Radius => _radius; + public PointF Center => _dimension.Location; public AnimationFrame SetRadius(float radius) { _radius = radius; - _dimension = new RectangleF(_center.X - _radius, _center.Y - _radius, 2.0f * _radius, 2.0f * _radius); + _dimension = new RectangleF(_dimension.X - _radius, _dimension.Y - _radius, 2.0f * _radius, 2.0f * _radius); _invalidated = true; return this; @@ -26,8 +23,7 @@ public AnimationFrame SetRadius(float radius) public AnimationFrame SetCenter(PointF center) { - _center = center; - _dimension = new RectangleF(_center.X - _radius, _center.Y - _radius, 2.0f * _radius, 2.0f * _radius); + _dimension = new RectangleF(center.X - _radius, center.Y - _radius, 2.0f * _radius, 2.0f * _radius); _invalidated = true; return this; @@ -36,30 +32,36 @@ public AnimationFrame SetCenter(PointF center) public AnimationCircle() { _radius = 0; - _center = new PointF(0, 0); - _dimension = new RectangleF(_center.X - _radius, _center.Y - _radius, 2.0f * _radius, 2.0f * _radius); + _dimension = new RectangleF(- _radius, - _radius, 2.0f * _radius, 2.0f * _radius); _color = Utils.ColorUtils.GenerateRandomColor(); _width = 1; _duration = 0.0f; } + public AnimationCircle(AnimationFrame frame, float radius) : base(frame) + { + _radius = radius; + } + + public AnimationCircle(AnimationCircle animationCircle) : base(animationCircle) + { + _radius = animationCircle.Radius; + } + public AnimationCircle(Rectangle dimension, Color color, int width = 1, float duration = 0.0f) : base(dimension, color, width, duration) { _radius = dimension.Width / 2.0f; - _center = new PointF(dimension.X + _radius, dimension.Y + _radius); } public AnimationCircle(RectangleF dimension, Color color, int width = 1, float duration = 0.0f) : base(dimension, color, width, duration) { _radius = dimension.Width / 2.0f; - _center = new PointF(dimension.X + _radius, dimension.Y + _radius); } public AnimationCircle(PointF center, float radius, Color color, int width = 1, float duration = 0.0f) { _radius = radius; - _center = center; - _dimension = new RectangleF(_center.X - _radius, _center.Y - _radius, 2.0f * _radius, 2.0f * _radius); + _dimension = new RectangleF(center.X - _radius, center.Y - _radius, 2.0f * _radius, 2.0f * _radius); _color = color; _width = width; _duration = duration; @@ -68,35 +70,31 @@ public AnimationCircle(PointF center, float radius, Color color, int width = 1, public AnimationCircle(float x, float y, float radius, Color color, int width = 1, float duration = 0.0f) { _radius = radius; - _center = new PointF(x, y); - _dimension = new RectangleF(_center.X - _radius, _center.Y - _radius, 2.0f * _radius, 2.0f * _radius); + _dimension = new RectangleF(x - _radius, y - _radius, 2.0f * _radius, 2.0f * _radius); _color = color; _width = width; _duration = duration; } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { - if (_pen == null || _invalidated) + if (_invalidated) { _pen = new Pen(_color); _pen.Width = _width; - _pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; + _pen.Alignment = PenAlignment.Center; + _pen.ScaleTransform(Scale, Scale); + virtUpdate(); _invalidated = false; } - _pen.ScaleTransform(scale, scale); - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); - - Matrix rotationMatrix = new Matrix(); - rotationMatrix.RotateAt(-_angle, new PointF(_center.X * scale, _center.Y * scale), MatrixOrder.Append); - - Matrix originalMatrix = g.Transform; - g.Transform = rotationMatrix; - g.DrawEllipse(_pen, _scaledDimension); - g.Transform = originalMatrix; + if(_dimension.Width > 1 && _dimension.Height > 1) + { + g.ResetTransform(); + g.Transform = _transformationMatrix; + g.DrawEllipse(_pen, _dimension); + } } public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) @@ -105,30 +103,20 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount { throw new FormatException("Cannot blend with another type"); } + AnimationCircle otherCircle = (AnimationCircle)otherAnim; amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) - ); + AnimationFrame newFrame = base.BlendWith(otherCircle, amount); - int newwidth = (int)CalculateNewValue(_width, otherAnim._width, amount); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); + float newRadius = CalculateNewValue(_radius, otherCircle._radius, amount); - return new AnimationCircle(newrect, Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount), newwidth).SetAngle(newAngle); + return new AnimationCircle(newFrame, newRadius); } public override AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - return new AnimationCircle(newrect, Color.FromArgb(_color.A, _color.R, _color.G, _color.B), _width, _duration).SetAngle(_angle).SetTransitionType(_transitionType); + return new AnimationCircle(this); } public override bool Equals(object obj) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationEllipse.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationEllipse.cs index f26378d36..3649f1eda 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationEllipse.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationEllipse.cs @@ -1,167 +1,74 @@ using System; using System.Drawing; using System.Drawing.Drawing2D; +using Aurora.Utils; namespace Aurora.EffectsEngine.Animations { - public class AnimationEllipse : AnimationFrame + public class AnimationEllipse : AnimationCircle { [Newtonsoft.Json.JsonProperty] - private float _radius_x = 0.0f; + private float _radius_x; [Newtonsoft.Json.JsonProperty] - private float _radius_y = 0.0f; - [Newtonsoft.Json.JsonProperty] - private PointF _center = new PointF(); - - public float RadiusHorizontal { get { return _radius_x; } } - public float RadiusVertical { get { return _radius_y; } } - public PointF Center { get { return _center; } } - + private float _radius_y; - public AnimationFrame SetRadiusHorizontal(float radius) - { - _radius_x = radius; - _dimension = new RectangleF(_center.X - _radius_x, _center.Y - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); - _invalidated = true; - - return this; - } - - public AnimationFrame SetRadiusVertical(float radius) + public AnimationEllipse() { - _radius_y = radius; - _dimension = new RectangleF(_center.X - _radius_x, _center.Y - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); - _invalidated = true; - - return this; + _radius_x = 0; + _radius_y = 0; + _dimension = new RectangleF(- _radius_x, - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); + _color = ColorUtils.GenerateRandomColor(); + _width = 1; + _duration = 0.0f; } - public AnimationFrame SetCenter(PointF center) + public AnimationEllipse(AnimationFrame frame, float radiusX, float radiusY) : base(frame, radiusX) { - _center = center; - _dimension = new RectangleF(_center.X - _radius_x, _center.Y - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); - _invalidated = true; - - return this; + _radius_x = radiusX; + _radius_y = radiusY; } - public AnimationEllipse() + public AnimationEllipse(AnimationEllipse animationEllipse) : base(animationEllipse) { - _radius_x = 0; - _radius_y = 0; - _center = new PointF(0, 0); - _dimension = new RectangleF(_center.X - _radius_x, _center.Y - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); - _color = Utils.ColorUtils.GenerateRandomColor(); - _width = 1; - _duration = 0.0f; + _radius_x = animationEllipse._radius_x; + _radius_y = animationEllipse._radius_y; } public AnimationEllipse(Rectangle dimension, Color color, int width = 1, float duration = 0.0f) : base(dimension, color, width, duration) { _radius_x = dimension.Width / 2.0f; _radius_y = dimension.Height / 2.0f; - _center = new PointF(dimension.X + _radius_x, dimension.Y + _radius_y); } public AnimationEllipse(RectangleF dimension, Color color, int width = 1, float duration = 0.0f) : base(dimension, color, width, duration) { _radius_x = dimension.Width / 2.0f; _radius_y = dimension.Height / 2.0f; - _center = new PointF(dimension.X + _radius_x, dimension.Y + _radius_y); } - public AnimationEllipse(PointF center, float x_axis, float y_axis, Color color, int width = 1, float duration = 0.0f) + public AnimationEllipse(PointF center, float xAxis, float yAxis, Color color, int width = 1, float duration = 0.0f) { - _radius_x = x_axis; - _radius_y = y_axis; - _center = new PointF(center.X + _radius_x, center.Y + _radius_y); - _dimension = new RectangleF(_center.X - _radius_x, _center.Y - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); + _radius_x = xAxis; + _radius_y = yAxis; + _dimension = new RectangleF(center.X , center.Y, 2.0f * _radius_x, 2.0f * _radius_y); _color = color; _width = width; _duration = duration; } - public AnimationEllipse(float x, float y, float x_axis, float y_axis, Color color, int width = 1, float duration = 0.0f) + public AnimationEllipse(float x, float y, float xAxis, float yAxis, Color color, int width = 1, float duration = 0.0f) { - _radius_x = x_axis; - _radius_y = y_axis; - _center = new PointF(x + _radius_x, y + _radius_y); - _dimension = new RectangleF(_center.X - _radius_x, _center.Y - _radius_y, 2.0f * _radius_x, 2.0f * _radius_y); + _radius_x = xAxis; + _radius_y = yAxis; + _dimension = new RectangleF(x , y, 2.0f * _radius_x, 2.0f * _radius_y); _color = color; _width = width; _duration = duration; } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) - { - if (_pen == null || _invalidated) - { - _pen = new Pen(_color); - _pen.Width = _width; - _pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; - _invalidated = false; - } - - _pen.ScaleTransform(scale, scale); - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); - - Matrix rotationMatrix = new Matrix(); - rotationMatrix.RotateAt(-_angle, new PointF(_center.X * scale, _center.Y * scale), MatrixOrder.Append); - - Matrix originalMatrix = g.Transform; - g.Transform = rotationMatrix; - g.DrawEllipse(_pen, _scaledDimension); - g.Transform = originalMatrix; - } - - public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) - { - if (!(otherAnim is AnimationEllipse)) - { - throw new FormatException("Cannot blend with another type"); - } - - amount = GetTransitionValue(amount); - - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) - ); - - int newwidth = (int)CalculateNewValue(_width, otherAnim._width, amount); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); - - return new AnimationEllipse(newrect, Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount), newwidth).SetAngle(newAngle); - } - public override AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - return new AnimationEllipse(newrect, Color.FromArgb(_color.A, _color.R, _color.G, _color.B), _width, _duration).SetAngle(_angle).SetTransitionType(_transitionType); - } - - public override bool Equals(object obj) - { - if (ReferenceEquals(null, obj)) return false; - if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((AnimationEllipse)obj); - } - - public bool Equals(AnimationEllipse p) - { - return _color.Equals(p._color) && - _dimension.Equals(p._dimension) && - _width.Equals(p._width) && - _duration.Equals(p._duration) && - _angle.Equals(p._angle); + return new AnimationEllipse(this); } public override int GetHashCode() diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFill.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFill.cs index 43f13d381..90bd3860a 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFill.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFill.cs @@ -14,7 +14,7 @@ public AnimationFill(Color color, float duration = 0.0f) : base(new Rectangle(), { } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { // Offset has no effect on this. I think. if (_brush == null || _invalidated) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledCircle.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledCircle.cs index 6f8d93289..394e2e6aa 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledCircle.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledCircle.cs @@ -10,12 +10,7 @@ public class AnimationFilledCircle : AnimationCircle public AnimationFilledCircle() : base() { } - - public AnimationFilledCircle(Rectangle dimension, Color color, float duration = 0.0f) : base(dimension, color, 1, duration) - { - } - - public AnimationFilledCircle(RectangleF dimension, Color color, float duration = 0.0f) : base(dimension, color, 1, duration) + public AnimationFilledCircle(AnimationCircle circleFrame) : base(circleFrame) { } @@ -27,24 +22,22 @@ public AnimationFilledCircle(float x, float y, float radius, Color color, int wi { } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { if (_brush == null || _invalidated) { _brush = new SolidBrush(_color); + _pen = new Pen(_color); + _pen.Width = _width; + _pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; + _pen.ScaleTransform(Scale, Scale); + + virtUpdate(); _invalidated = false; } - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); - - Matrix rotationMatrix = new Matrix(); - rotationMatrix.RotateAt(-_angle, new PointF(_center.X * scale, _center.Y * scale), MatrixOrder.Append); - - Matrix originalMatrix = g.Transform; - g.Transform = rotationMatrix; - g.FillEllipse(_brush, _scaledDimension); - g.Transform = originalMatrix; + g.ResetTransform(); + g.FillEllipse(_brush, _dimension); } public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) @@ -53,29 +46,18 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount { throw new FormatException("Cannot blend with another type"); } + AnimationFilledCircle otherCircle = (AnimationFilledCircle)otherAnim; amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) - ); + AnimationCircle newCircle = (AnimationCircle) base.BlendWith(otherAnim, amount); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); - - return new AnimationFilledCircle(newrect, Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount)).SetAngle(newAngle); + return new AnimationFilledCircle(newCircle); } public override AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - return new AnimationFilledCircle(newrect, Color.FromArgb(_color.A, _color.R, _color.G, _color.B), _duration).SetAngle(_angle).SetTransitionType(_transitionType); + return new AnimationFilledCircle(this); } public override bool Equals(object obj) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledGradientRectangle.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledGradientRectangle.cs index 3823b2237..3a9f060a3 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledGradientRectangle.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledGradientRectangle.cs @@ -9,46 +9,51 @@ public class AnimationFilledGradientRectangle : AnimationFilledRectangle [Newtonsoft.Json.JsonProperty] internal EffectBrush _gradientBrush; - public EffectBrush GradientBrush { get { return _gradientBrush; } } + private readonly Brush _drawingBrush; - public AnimationFilledGradientRectangle() : base() + public EffectBrush GradientBrush => _gradientBrush; + + public AnimationFilledGradientRectangle() { } - public AnimationFilledGradientRectangle(RectangleF dimension, EffectBrush brush, float duration = 0.0f) : base(dimension, Color.Transparent, duration) + public AnimationFilledGradientRectangle(AnimationFilledGradientRectangle animationFilledGradientRectangle) : base(animationFilledGradientRectangle) { - _gradientBrush = brush; + _gradientBrush = animationFilledGradientRectangle.GradientBrush; + _drawingBrush = _gradientBrush.GetDrawingBrush(); + } + + public AnimationFilledGradientRectangle(AnimationFrame animationFrame, EffectBrush effectBrush) : base(animationFrame) + { + _gradientBrush = effectBrush; + _drawingBrush = _gradientBrush.GetDrawingBrush(); } - public AnimationFilledGradientRectangle(PointF center, float rect_width, float rect_height, EffectBrush brush, float duration = 0.0f) : base(center, rect_width, rect_height, Color.Transparent, duration) + public AnimationFilledGradientRectangle(RectangleF dimension, EffectBrush brush, float duration = 0.0f) : base(dimension, Color.Transparent, duration) { _gradientBrush = brush; + _drawingBrush = _gradientBrush.GetDrawingBrush(); } public AnimationFilledGradientRectangle(float x, float y, float rect_width, float rect_height, EffectBrush brush, float duration = 0.0f) : base(x, y, rect_width, rect_height, Color.Transparent, duration) { _gradientBrush = brush; + _drawingBrush = _gradientBrush.GetDrawingBrush(); } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); - - PointF rotatePoint = new PointF(_scaledDimension.X, _scaledDimension.Y); - - EffectBrush _newbrush = new EffectBrush(_gradientBrush); - _newbrush.start = new PointF(_newbrush.start.X * scale, _newbrush.start.Y * scale); - _newbrush.end = new PointF(_newbrush.end.X * scale, _newbrush.end.Y * scale); - - Matrix rotationMatrix = new Matrix(); - rotationMatrix.RotateAt(-_angle, rotatePoint, MatrixOrder.Append); - rotationMatrix.Translate(-_scaledDimension.Width / 2f, -_scaledDimension.Height / 2f); - - Matrix originalMatrix = g.Transform; - g.Transform = rotationMatrix; - g.FillRectangle(_newbrush.GetDrawingBrush(), _scaledDimension); - g.Transform = originalMatrix; + if (_invalidated) + { + virtUpdate(); + _invalidated = false; + } + + g.ResetTransform(); + g.Transform = _transformationMatrix; + float drawX = _dimension.X - _dimension.Width/2; + float drawY = _dimension.Y - _dimension.Height/2; + g.FillRectangle(_drawingBrush, drawX, drawY, _dimension.Width, _dimension.Height); } public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) @@ -57,29 +62,18 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount { throw new FormatException("Cannot blend with another type"); } + AnimationFilledGradientRectangle otherCircle = (AnimationFilledGradientRectangle)otherAnim; amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) - ); - - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); + AnimationFrame newFrame = base.BlendWith(otherCircle, amount); - return new AnimationFilledGradientRectangle(newrect, _gradientBrush.BlendEffectBrush((otherAnim as AnimationFilledGradientRectangle)._gradientBrush, amount)).SetAngle(newAngle); + return new AnimationFilledGradientRectangle(newFrame, _gradientBrush); } public override AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - return new AnimationFilledGradientRectangle(newrect, new EffectBrush(_gradientBrush), _duration).SetAngle(_angle).SetTransitionType(_transitionType); + return new AnimationFilledGradientRectangle(this); } public override bool Equals(object obj) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledRectangle.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledRectangle.cs index 5a02ca292..725d766c7 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledRectangle.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFilledRectangle.cs @@ -6,15 +6,15 @@ namespace Aurora.EffectsEngine.Animations { public class AnimationFilledRectangle : AnimationRectangle { - public AnimationFilledRectangle() : base() + public AnimationFilledRectangle() { } - public AnimationFilledRectangle(RectangleF dimension, Color color, float duration = 0.0f) : base(dimension, color, 1, duration) + public AnimationFilledRectangle(AnimationFrame animationFrame) : base(animationFrame) { } - public AnimationFilledRectangle(PointF center, float rect_width, float rect_height, Color color, float duration = 0.0f) : base(center, rect_width, rect_height, color, 1, duration) + public AnimationFilledRectangle(RectangleF dimension, Color color, float duration = 0.0f) : base(dimension, color, 1, duration) { } @@ -22,58 +22,41 @@ public AnimationFilledRectangle(float x, float y, float rect_width, float rect_h { } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { - if (_brush == null || _invalidated) + if (_invalidated) { _brush = new SolidBrush(_color); + + virtUpdate(); _invalidated = false; } - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); - - PointF rotatePoint = new PointF(_scaledDimension.X, _scaledDimension.Y); - - Matrix transformationMatrix = new Matrix(); - transformationMatrix.RotateAt(-_angle, rotatePoint, MatrixOrder.Append); - transformationMatrix.Translate(-_scaledDimension.Width / 2f, -_scaledDimension.Height / 2f); - - Matrix originalMatrix = g.Transform; - g.Transform = transformationMatrix; - g.FillRectangle(_brush, _scaledDimension); - g.Transform = originalMatrix; + g.ResetTransform(); + g.Transform = _transformationMatrix; + float drawX = _dimension.X - _dimension.Width/2; + float drawY = _dimension.Y - _dimension.Height/2; + g.FillRectangle(_brush, drawX, drawY, _dimension.Width, _dimension.Height); } - + public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) { if (!(otherAnim is AnimationFilledRectangle)) { throw new FormatException("Cannot blend with another type"); } + AnimationFilledRectangle otherCircle = (AnimationFilledRectangle)otherAnim; amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) - ); + AnimationFrame newFrame = base.BlendWith(otherCircle, amount); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); - - return new AnimationFilledRectangle(newrect, Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount)).SetAngle(newAngle); + return new AnimationFilledRectangle(newFrame); } public override AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - return new AnimationFilledRectangle(newrect, Color.FromArgb(_color.A, _color.R, _color.G, _color.B), _duration).SetAngle(_angle).SetTransitionType(_transitionType); + return new AnimationFilledRectangle(this); } public override bool Equals(object obj) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFrame.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFrame.cs index 0eecc2a4a..fa9523f46 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFrame.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationFrame.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel; using System.Drawing; +using System.Drawing.Drawing2D; namespace Aurora.EffectsEngine.Animations { @@ -63,19 +64,39 @@ public class AnimationFrame [Newtonsoft.Json.JsonProperty] internal float _duration; internal Pen _pen = null; - internal Brush _brush = null; + internal Brush _brush; internal bool _invalidated = true; [Newtonsoft.Json.JsonProperty] internal AnimationFrameTransitionType _transitionType = AnimationFrameTransitionType.Linear; [Newtonsoft.Json.JsonProperty] - internal float _angle = 0.0f; + internal float _angle; - public Color Color { get { return _color; } } - public RectangleF Dimension { get { return _dimension; } } - public int Width { get { return _width; } } - public float Duration { get { return _duration; } } - public AnimationFrameTransitionType TransitionType { get { return _transitionType; } } - public float Angle { get { return _angle; } } + + protected float _scale = 1.0f; + protected PointF _offset; + + internal Matrix _transformationMatrix; + + public float Scale + { + get { return _scale; } + set + { + if (_scale != value) + { + _scale = value; + _invalidated = true; + } + } + } + public PointF Offset => _offset; + + public Color Color => _color; + public RectangleF Dimension => _dimension; + public int Width => _width; + public float Duration => _duration; + public AnimationFrameTransitionType TransitionType => _transitionType; + public float Angle => _angle; public AnimationFrame() { @@ -85,6 +106,18 @@ public AnimationFrame() _duration = 0.0f; } + public AnimationFrame(AnimationFrame frame) + { + _dimension = frame.Dimension; + _color = frame.Color; + _duration = frame.Duration; + _width = frame.Width; + _scale = frame.Scale; + _offset = frame.Offset; + _angle = frame.Angle; + _transitionType = frame.TransitionType; + } + public AnimationFrame(Rectangle dimension, Color color, int width = 1, float duration = 0.0f) { _color = color; @@ -101,10 +134,36 @@ public AnimationFrame(RectangleF dimension, Color color, int width = 1, float du _duration = duration; } + protected virtual void virtUpdate() + { + updateMatrices(); + } + + void updateMatrices() + { + _transformationMatrix = new Matrix(); + + _transformationMatrix.RotateAt(-_angle, _dimension.Location, MatrixOrder.Append); + //_transformationMatrix.Scale(_scale, _scale, MatrixOrder.Append); + _transformationMatrix.Translate(-_offset.X, -_offset.Y, MatrixOrder.Append); + + _invalidated = false; + } + + public void SetOffset(PointF offset) + { + if (_offset != offset) + { + _offset = offset; + _invalidated = true; + } + } + public AnimationFrame SetColor(Color color) { _color = color; _invalidated = true; + _brush = null; return this; } @@ -151,20 +210,35 @@ public AnimationFrame SetAngle(float angle) return this; } - public virtual void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) { } + public virtual void Draw(Graphics g) { } public virtual AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) { amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) + RectangleF newrect = new RectangleF(CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), + CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), + CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), + CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) ); + PointF newOffset = new PointF( + CalculateNewValue(_offset.X, otherAnim._offset.X, amount), + CalculateNewValue(_offset.Y, otherAnim._offset.Y, amount) + ); + + float newAngle = CalculateNewValue(_angle, otherAnim._angle, amount); + float newScale = CalculateNewValue(_scale, otherAnim._scale, amount); + int newWidth = CalculateNewValue(_width, otherAnim._width, amount); + AnimationFrame newframe = new AnimationFrame(); newframe._dimension = newrect; + newframe._offset = newOffset; + + newframe._angle = newAngle; + newframe._scale = newScale; + newframe._width = newWidth; newframe._color = Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount); + return newframe; } @@ -212,27 +286,31 @@ internal double GetTransitionValue(double amount) return returnamount; } + internal float CalculateNewValue(float first, float second, double amount) + { + if (first == second) + return first; + return (float)(first * (1.0 - amount) + second * (amount)); + } + internal double CalculateNewValue(double first, double second, double amount) + { + if (first == second) + return first; + return first * (1.0 - amount) + second * (amount); + } + + internal int CalculateNewValue(int first, int second, double amount) { if (first == second) return first; else - return (double)(first * (1.0 - amount) + second * (amount)); + return (int)(first * (1.0 - amount) + second * (amount)); } public virtual AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - AnimationFrame copy = new AnimationFrame(); - copy._dimension = newrect; - copy._color = Color.FromArgb(_color.A, _color.R, _color.G, _color.B); - - return copy; + return new AnimationFrame(this); } public override bool Equals(object obj) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationGradientCircle.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationGradientCircle.cs index 0560bb3ad..d167d3fb7 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationGradientCircle.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationGradientCircle.cs @@ -10,48 +10,52 @@ public class AnimationGradientCircle : AnimationCircle [Newtonsoft.Json.JsonProperty] internal EffectBrush _gradientBrush; - public EffectBrush GradientBrush { get { return _gradientBrush; } } + public EffectBrush GradientBrush => _gradientBrush; - public AnimationGradientCircle() : base() + public AnimationGradientCircle() { } public AnimationGradientCircle(Rectangle dimension, EffectBrush brush, int width = 1, float duration = 0.0f) : base(dimension, Color.Transparent, width, duration) { - _gradientBrush = brush; + _gradientBrush = new EffectBrush(brush); + _gradientBrush.start = new PointF(0.0f, 0.0f); + _gradientBrush.end = new PointF(1.0f, 1.0f); + _gradientBrush.center = new PointF(0.5f, 0.5f); } public AnimationGradientCircle(RectangleF dimension, EffectBrush brush, int width = 1, float duration = 0.0f) : base(dimension, Color.Transparent, width, duration) { - _gradientBrush = brush; + _gradientBrush = new EffectBrush(brush); + _gradientBrush.start = new PointF(0.0f, 0.0f); + _gradientBrush.end = new PointF(1.0f, 1.0f); + _gradientBrush.center = new PointF(0.5f, 0.5f); } public AnimationGradientCircle(PointF center, float radius, EffectBrush brush, int width = 1, float duration = 0.0f) : base(center, radius, Color.Transparent, width, duration) { - _gradientBrush = brush; + _gradientBrush = new EffectBrush(brush); + _gradientBrush.start = new PointF(0.0f, 0.0f); + _gradientBrush.end = new PointF(1.0f, 1.0f); + _gradientBrush.center = new PointF(0.5f, 0.5f); } public AnimationGradientCircle(float x, float y, float radius, EffectBrush brush, int width = 1, float duration = 0.0f) : base(x, y, radius, Color.Transparent, width, duration) { - _gradientBrush = brush; + _gradientBrush = new EffectBrush(brush); + _gradientBrush.start = new PointF(0.0f, 0.0f); + _gradientBrush.end = new PointF(1.0f, 1.0f); + _gradientBrush.center = new PointF(0.5f, 0.5f); } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + protected override void virtUpdate() { - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); + base.virtUpdate(); - EffectBrush _newbrush = new EffectBrush(_gradientBrush); - _newbrush.start = new PointF(0.0f, 0.0f); - _newbrush.end = new PointF(1.0f, 1.0f); - _newbrush.center = new PointF(0.5f, 0.5f); - - SortedDictionary newColorGradients = new SortedDictionary(); - ColorSpectrum spectrum = _newbrush.GetColorSpectrum(); - var colors = _newbrush.colorGradients; + SortedDictionary newColorGradients = new SortedDictionary(); + ColorSpectrum spectrum = _gradientBrush.GetColorSpectrum(); float _cutOffPoint = _width / _radius; - if (_cutOffPoint < 1.0f) { _cutOffPoint = 1.0f - _cutOffPoint; @@ -62,7 +66,7 @@ public AnimationGradientCircle(float x, float y, float radius, EffectBrush brush newColorGradients.Add(_cutOffPoint - 0.0001f, Color.Transparent); newColorGradients.Add(0.0f, Color.Transparent); - _newbrush.colorGradients = newColorGradients; + _gradientBrush.colorGradients = newColorGradients; } else if (_cutOffPoint > 1.0f) { @@ -77,21 +81,30 @@ public AnimationGradientCircle(float x, float y, float radius, EffectBrush brush newColorGradients.Add(0.0f, spectrum.GetColorAt((1 - 1 / _cutOffPoint))); } - _newbrush.SetBrushType(EffectBrush.BrushType.Radial); - Brush brush = _newbrush.GetDrawingBrush(); + _gradientBrush.SetBrushType(EffectBrush.BrushType.Radial); + _gradientBrush.center = _dimension.Location; + _brush = _gradientBrush.GetDrawingBrush(); + (_brush as PathGradientBrush).TranslateTransform( + _dimension.X + _dimension.Width/2, + _dimension.Y + _dimension.Height/2 + ); + (_brush as PathGradientBrush).ScaleTransform(_dimension.Width, _dimension.Height); + } - if(brush is PathGradientBrush) + public override void Draw(Graphics g) + { + if (_invalidated) { - (brush as PathGradientBrush).TranslateTransform(_scaledDimension.X, _scaledDimension.Y); - (brush as PathGradientBrush).ScaleTransform(_scaledDimension.Width - (2.0f), _scaledDimension.Height - (2.0f)); + virtUpdate(); + _invalidated = false; + } - Matrix rotationMatrix = new Matrix(); - rotationMatrix.RotateAt(-_angle, new PointF(_center.X * scale, _center.Y * scale), MatrixOrder.Append); + if(_brush is PathGradientBrush) + { - Matrix originalMatrix = g.Transform; - g.Transform = rotationMatrix; - g.FillEllipse(brush, _scaledDimension); - g.Transform = originalMatrix; + g.ResetTransform(); + g.Transform = _transformationMatrix; + g.FillEllipse(_brush, _dimension); } } @@ -104,14 +117,14 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) + RectangleF newrect = new RectangleF(CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), + CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), + CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), + CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) ); - int newwidth = (int)CalculateNewValue(_width, otherAnim._width, amount); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); + int newwidth = CalculateNewValue(_width, otherAnim._width, amount); + float newAngle = CalculateNewValue(_angle, otherAnim._angle, amount); return new AnimationGradientCircle(newrect, _gradientBrush.BlendEffectBrush((otherAnim as AnimationGradientCircle)._gradientBrush, amount), newwidth).SetAngle(newAngle); } diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLine.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLine.cs index 510f3f6af..4c75d9b54 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLine.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLine.cs @@ -1,6 +1,8 @@ using System; using System.Drawing; using System.Drawing.Drawing2D; +using Aurora.Utils; +using CSScriptLibrary; namespace Aurora.EffectsEngine.Animations { @@ -17,6 +19,9 @@ public class AnimationLine : AnimationFrame public PointF EndPoint { get { return _end_point; } } public Color EndColor { get { return _end_color; } } + //PointF _scaledStartPoint; + //PointF _scaledEndPoint; + public AnimationFrame SetStartPoint(PointF startPoint) { _start_point = startPoint; @@ -44,11 +49,11 @@ public AnimationFrame SetEndColor(Color endColor) public AnimationLine() { _start_point = new PointF(0, 0); - _end_point = new PointF(0, 0); + _end_point = new PointF(30, 30); _color = Utils.ColorUtils.GenerateRandomColor(); _end_color = Utils.ColorUtils.GenerateRandomColor(); _width = 1; - _duration = 0.0f; + _duration = 1.0f; } public AnimationLine(PointF start_point, PointF end_point, Color color, int width = 1, float duration = 0.0f) @@ -111,32 +116,27 @@ public AnimationLine(float start_x, float start_y, float end_x, float end_y, Col _duration = duration; } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { if (_start_point.Equals(_end_point)) return; - PointF _scaledStartPoint = new PointF((_start_point.X * scale) + offset.X, (_start_point.Y * scale) + offset.Y); - PointF _scaledEndPoint = new PointF((_end_point.X * scale) + offset.X, (_end_point.Y * scale) + offset.Y); - - if (_pen == null || _invalidated) + if (_invalidated) { - _pen = new Pen(new LinearGradientBrush(_scaledStartPoint, _scaledEndPoint, _color, _end_color)); + _pen = new Pen(new LinearGradientBrush(_start_point, _end_point, _color, _end_color)); _pen.Width = _width; - _pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; + _pen.Alignment = PenAlignment.Center; - _invalidated = false; - } + //_pen.ScaleTransform(Scale, Scale); - _pen.ScaleTransform(scale, scale); + virtUpdate(); - Matrix rotationMatrix = new Matrix(); - rotationMatrix.RotateAt(-_angle, _scaledStartPoint, MatrixOrder.Append); + _invalidated = false; + } - Matrix originalMatrix = g.Transform; - g.Transform = rotationMatrix; - g.DrawLine(_pen, _scaledStartPoint, _scaledEndPoint); - g.Transform = originalMatrix; + g.ResetTransform(); + g.Transform = _transformationMatrix; + g.DrawLine(_pen, _start_point, _end_point); } public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) @@ -148,18 +148,18 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount amount = GetTransitionValue(amount); - PointF newstart = new PointF((float)CalculateNewValue(_start_point.X, (otherAnim as AnimationLine)._start_point.X, amount), - (float)CalculateNewValue(_start_point.Y, (otherAnim as AnimationLine)._start_point.Y, amount) + PointF newstart = new PointF(CalculateNewValue(_start_point.X, (otherAnim as AnimationLine)._start_point.X, amount), + CalculateNewValue(_start_point.Y, (otherAnim as AnimationLine)._start_point.Y, amount) ); - PointF newend = new PointF((float)CalculateNewValue(_end_point.X, (otherAnim as AnimationLine)._end_point.X, amount), - (float)CalculateNewValue(_end_point.Y, (otherAnim as AnimationLine)._end_point.Y, amount) + PointF newend = new PointF(CalculateNewValue(_end_point.X, (otherAnim as AnimationLine)._end_point.X, amount), + CalculateNewValue(_end_point.Y, (otherAnim as AnimationLine)._end_point.Y, amount) ); - int newwidth = (int)Math.Round(CalculateNewValue(_width, otherAnim._width, amount)); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); + int newwidth = CalculateNewValue(_width, otherAnim._width, amount); + float newAngle = CalculateNewValue(_angle, otherAnim._angle, amount); - return new AnimationLine(newstart, newend, Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount), Utils.ColorUtils.BlendColors(_end_color, (otherAnim as AnimationLine)._end_color, amount), newwidth).SetAngle(newAngle); + return new AnimationLine(newstart, newend, ColorUtils.BlendColors(_color, otherAnim._color, amount), ColorUtils.BlendColors(_end_color, (otherAnim as AnimationLine)._end_color, amount), newwidth).SetAngle(newAngle); } public override AnimationFrame GetCopy() diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLines.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLines.cs index 755bc8edb..cc098c0c0 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLines.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationLines.cs @@ -15,10 +15,10 @@ public AnimationLines(AnimationLine[] lines, float duration = 0.0f) _duration = duration; } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { foreach( AnimationLine line in _lines) - line.Draw(g, scale, offset); + line.Draw(g); } public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationManualColorFrame.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationManualColorFrame.cs index 11c1e13df..b3ab7fcd3 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationManualColorFrame.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationManualColorFrame.cs @@ -1,23 +1,18 @@ -using Aurora.Devices; -using System; +using System; using System.Collections.Generic; using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; +using Aurora.Settings; namespace Aurora.EffectsEngine.Animations { public class AnimationManualColorFrame : AnimationFrame { [Newtonsoft.Json.JsonProperty] - private Dictionary _BitmapColors = new Dictionary(); + private Dictionary _BitmapColors = new Dictionary(); - public Dictionary BitmapColors { - get { return new Dictionary(_BitmapColors); } - } + public Dictionary BitmapColors => _BitmapColors; - public AnimationFrame SetKeyColor(DeviceKeys Key, Color Color) + public AnimationFrame SetKeyColor(DeviceKey Key, Color Color) { if (_BitmapColors.ContainsKey(Key)) _BitmapColors[Key] = Color; @@ -27,33 +22,37 @@ public AnimationFrame SetKeyColor(DeviceKeys Key, Color Color) return this; } - public AnimationFrame SetBitmapColors(Dictionary ColorMapping) + public AnimationFrame SetBitmapColors(Dictionary ColorMapping) { if(ColorMapping != null) + { + _BitmapColors.Clear(); _BitmapColors = ColorMapping; + } return this; } public AnimationManualColorFrame() { - _BitmapColors = new Dictionary(); _duration = 0.0f; } - public AnimationManualColorFrame(Dictionary ColorMapping, float duration = 0.0f) + public AnimationManualColorFrame(Dictionary ColorMapping, float duration = 0.0f) { _BitmapColors = ColorMapping; _duration = duration; } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { // Offset has no effect on this type of animation frame if (_brush == null || _invalidated) { _brush = new SolidBrush(_color); + + virtUpdate(); _invalidated = false; } @@ -61,7 +60,7 @@ public AnimationManualColorFrame(Dictionary ColorMapping, flo { var region = Effects.GetBitmappingFromDeviceKey(kvp.Key); - g.FillRectangle(new SolidBrush(kvp.Value), region.Left * scale, region.Top * scale, region.Width * scale, region.Height * scale); + g.FillRectangle(new SolidBrush(kvp.Value), region.Left * Scale, region.Top * Scale, region.Width * Scale, region.Height * Scale); } } @@ -72,7 +71,9 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount throw new FormatException("Cannot blend with another type"); } - Dictionary _combinedBitmapColors = new Dictionary(); + + AnimationManualColorFrame newAnim = new AnimationManualColorFrame(); + Dictionary _combinedBitmapColors = newAnim._BitmapColors; amount = GetTransitionValue(amount); foreach (var kvp in _BitmapColors) @@ -95,15 +96,12 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount } } - AnimationManualColorFrame newAnim = new AnimationManualColorFrame(); - newAnim._BitmapColors = _combinedBitmapColors; - return newAnim; } public override AnimationFrame GetCopy() { - Dictionary newmapping = new Dictionary(_BitmapColors); + Dictionary newmapping = new Dictionary(_BitmapColors); return new AnimationManualColorFrame(newmapping, _duration).SetAngle(_angle).SetTransitionType(_transitionType); } diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationMix.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationMix.cs index 015805a09..32304bf36 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationMix.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationMix.cs @@ -1,31 +1,29 @@ using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Drawing; +using Aurora.Utils; +using Newtonsoft.Json; namespace Aurora.EffectsEngine.Animations { public class AnimationMix { [Newtonsoft.Json.JsonProperty] - private Dictionary _tracks; + [JsonConverter(typeof(ConcurrentDictionaryJsonConverterAdapter))] + private readonly ConcurrentDictionary _tracks = new(); /// /// When true, will remove Animation tracks that no longer have any animations. /// - [Newtonsoft.Json.JsonProperty] - private bool _automatically_remove_complete; + [Newtonsoft.Json.JsonProperty] private bool _automatically_remove_complete; public AnimationMix() { - _tracks = new Dictionary(); - _automatically_remove_complete = false; } public AnimationMix(AnimationTrack[] tracks) { - _tracks = new Dictionary(); - _automatically_remove_complete = false; - foreach (var track in tracks) AddTrack(track); } @@ -44,26 +42,15 @@ public AnimationMix AddTrack(AnimationTrack track) if (_tracks.ContainsKey(track.GetName())) _tracks[track.GetName()] = track; else - _tracks.Add(track.GetName(), track); + _tracks.TryAdd(track.GetName(), track); } return this; } - public AnimationMix AddTrack(string track_name, AnimationTrack track) - { - if (_tracks.ContainsKey(track_name)) - _tracks[track_name] = track; - else - _tracks.Add(track_name, track); - - return this; - } - public AnimationMix RemoveTrack(string track_name) { - if (_tracks.ContainsKey(track_name)) - _tracks.Remove(track_name); + _tracks.TryRemove(track_name, out _); return this; } @@ -83,11 +70,9 @@ public bool ContainsTrack(string track_name) public float GetDuration() { - Dictionary _local = new Dictionary(_tracks); - float current_duration, return_val = 0.0f; - - foreach (KeyValuePair track in _local) + + foreach (KeyValuePair track in _tracks) { current_duration = track.Value.GetShift() + track.Value.AnimationDuration; if (current_duration > return_val) @@ -97,48 +82,50 @@ public float GetDuration() return return_val; } - public Dictionary GetTracks() + public void SetScale(float scale) { - return new Dictionary(_tracks); + foreach (KeyValuePair track in _tracks) + { + track.Value.SetScale(scale); + } } - public bool AnyActiveTracksAt(float time) + public ConcurrentDictionary GetTracks() { - Dictionary _local = new Dictionary(_tracks); - - bool return_val = false; + return _tracks; + } - foreach (KeyValuePair track in _local) + public bool AnyActiveTracksAt(float time) + { + foreach (KeyValuePair track in _tracks) { if (track.Value.ContainsAnimationAt(time)) - return_val = true; + return true; } - return return_val; + return false; } - public void Draw(Graphics g, float time, float scale = 1.0f, PointF offset = default(PointF)) + public void Draw(Graphics g, float time, PointF offset = default(PointF)) { - Dictionary _local = new Dictionary(_tracks); - - foreach (KeyValuePair track in _local) + foreach (KeyValuePair track in _tracks) { if (track.Value.ContainsAnimationAt(time)) { + AnimationFrame frame = track.Value.GetFrame(time); try { - track.Value.GetFrame(time).Draw(g, scale, offset); + frame.SetOffset(offset); + frame.Draw(g); } catch (Exception exc) { - System.Console.WriteLine(); + System.Console.WriteLine("Animation mix draw error: " + exc.Message); } - } - else + else if (_automatically_remove_complete) { - if (_automatically_remove_complete) - RemoveTrack(track.Key); + RemoveTrack(track.Key); } } } @@ -155,13 +142,13 @@ public override bool Equals(object obj) if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; if (obj.GetType() != this.GetType()) return false; - return Equals((AnimationMix)obj); + return Equals((AnimationMix) obj); } public bool Equals(AnimationMix p) { return _tracks.Equals(p._tracks) && - _automatically_remove_complete == p._automatically_remove_complete; + _automatically_remove_complete == p._automatically_remove_complete; } public override int GetHashCode() @@ -179,6 +166,5 @@ public override string ToString() { return "AnimationMix: [ Count: " + _tracks.Count + " ]"; } - } -} +} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationRectangle.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationRectangle.cs index 17c066c7f..f998e8b96 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationRectangle.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationRectangle.cs @@ -1,6 +1,7 @@ using System; using System.Drawing; using System.Drawing.Drawing2D; +using Aurora.Utils; namespace Aurora.EffectsEngine.Animations { @@ -8,58 +9,49 @@ public class AnimationRectangle : AnimationFrame { public AnimationRectangle() { - _dimension = new Rectangle((int)(0), (int)(0), (int)0, (int)0); - _color = Utils.ColorUtils.GenerateRandomColor(); + _dimension = new RectangleF(25, 10, 50, 20); + _color = ColorUtils.GenerateRandomColor(); _width = 1; - _duration = 0.0f; + _duration = 2.0f; } - public AnimationRectangle(RectangleF dimension, Color color, int width = 1, float duration = 0.0f) : base(dimension, color, width, duration) + public AnimationRectangle(AnimationFrame animationFrame) : base(animationFrame) { } - public AnimationRectangle(PointF center, float rect_width, float rect_height, Color color, int width = 1, float duration = 0.0f) + public AnimationRectangle(RectangleF dimension, Color color, int width = 1, float duration = 0.0f) { - _dimension = new RectangleF(center.X - rect_width * 0.5f, center.Y - rect_height * 0.5f, rect_width, rect_height); + _dimension = dimension; _color = color; _width = width; _duration = duration; } - public AnimationRectangle(float x, float y, float rect_width, float rect_height, Color color, int width = 1, float duration = 0.0f) + public AnimationRectangle(float x, float y, float rectWidth, float rectHeight, Color color, int width = 1, float duration = 0.0f) { - _dimension = new RectangleF(x, y, rect_width, rect_height); + _dimension = new RectangleF(x, y, rectWidth, rectHeight); _color = color; _width = width; _duration = duration; } - public override void Draw(Graphics g, float scale = 1.0f, PointF offset = default(PointF)) + public override void Draw(Graphics g) { - if (_pen == null || _invalidated) + if (_invalidated) { _pen = new Pen(_color); _pen.Width = _width; - _pen.Alignment = System.Drawing.Drawing2D.PenAlignment.Center; + _pen.Alignment = PenAlignment.Inset; + virtUpdate(); _invalidated = false; } - - _pen.ScaleTransform(scale, scale); - RectangleF _scaledDimension = new RectangleF(_dimension.X * scale, _dimension.Y * scale, _dimension.Width * scale, _dimension.Height * scale); - _scaledDimension.Offset(offset); - - PointF rotatePoint = new PointF(_scaledDimension.X, _scaledDimension.Y); - - Matrix transformationMatrix = new Matrix(); - transformationMatrix.RotateAt(-_angle, rotatePoint, MatrixOrder.Append); - transformationMatrix.Translate(-_scaledDimension.Width / 2f, -_scaledDimension.Height / 2f); - - Matrix originalMatrix = g.Transform; - g.Transform = transformationMatrix; - g.DrawRectangle(_pen, _scaledDimension.X, _scaledDimension.Y, _scaledDimension.Width, _scaledDimension.Height); - g.Transform = originalMatrix; - + + g.ResetTransform(); + g.Transform = _transformationMatrix; + float drawX = _dimension.X - _dimension.Width/2; + float drawY = _dimension.Y - _dimension.Height/2; + g.DrawRectangle(_pen, drawX, drawY, _dimension.Width, _dimension.Height); } public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount) @@ -68,37 +60,25 @@ public override AnimationFrame BlendWith(AnimationFrame otherAnim, double amount { throw new FormatException("Cannot blend with another type"); } + AnimationRectangle otherRectangle = (AnimationRectangle)otherAnim; amount = GetTransitionValue(amount); - RectangleF newrect = new RectangleF((float)CalculateNewValue(_dimension.X, otherAnim._dimension.X, amount), - (float)CalculateNewValue(_dimension.Y, otherAnim._dimension.Y, amount), - (float)CalculateNewValue(_dimension.Width, otherAnim._dimension.Width, amount), - (float)CalculateNewValue(_dimension.Height, otherAnim._dimension.Height, amount) - ); - - int newwidth = (int)CalculateNewValue(_width, otherAnim._width, amount); - float newAngle = (float)CalculateNewValue(_angle, otherAnim._angle, amount); + AnimationFrame newFrame = base.BlendWith(otherRectangle, amount); - return new AnimationRectangle(newrect, Utils.ColorUtils.BlendColors(_color, otherAnim._color, amount), newwidth).SetAngle(newAngle); + return new AnimationRectangle(newFrame); } public override AnimationFrame GetCopy() { - RectangleF newrect = new RectangleF(_dimension.X, - _dimension.Y, - _dimension.Width, - _dimension.Height - ); - - return new AnimationRectangle(newrect, Color.FromArgb(_color.A, _color.R, _color.G, _color.B), _width, _duration).SetAngle(_angle).SetTransitionType(_transitionType); + return new AnimationRectangle(this); } public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; + if (obj.GetType() != GetType()) return false; return Equals((AnimationRectangle)obj); } diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationTrack.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationTrack.cs index a7226ae58..ab7702e6d 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationTrack.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Animations/AnimationTrack.cs @@ -1,23 +1,31 @@ using Aurora.Settings; using System; +using System.Collections.Concurrent; using System.Collections.Generic; using System.Linq; +using Aurora.Utils; +using Newtonsoft.Json; namespace Aurora.EffectsEngine.Animations { public class AnimationTrack { - [Newtonsoft.Json.JsonProperty] - private Dictionary _animations; - [Newtonsoft.Json.JsonProperty] + [JsonProperty] + [JsonConverter(typeof(ConcurrentDictionaryJsonConverterAdapter))] + private readonly ConcurrentDictionary _animations; + [JsonProperty] private float _animationDuration; - [Newtonsoft.Json.JsonProperty] + [JsonProperty] private string _track_name; - [Newtonsoft.Json.JsonProperty] + [JsonProperty] private float _shift; - private bool _SupportedTypeIdentified = false; + private bool _SupportedTypeIdentified; private Type _SupportedAnimationType = typeof(AnimationFrame); + + [JsonIgnore] + private readonly Dictionary _blendCache = new(); + public Type SupportedAnimationType { get @@ -35,16 +43,25 @@ public Type SupportedAnimationType } } - public float AnimationDuration { get { return _animationDuration; } } + public float AnimationDuration => _animationDuration; public AnimationTrack(string track_name, float animationDuration, float shift = 0.0f) { - _animations = new Dictionary(); + _animations = new ConcurrentDictionary(); _track_name = track_name; _animationDuration = animationDuration; _shift = shift; } + public void SetScale(float scale) + { + foreach(var frame in _animations.Values) + { + frame.Scale = scale; + } + _blendCache.Clear(); + } + public AnimationTrack SetName(string name) { _track_name = name; @@ -81,8 +98,7 @@ public bool ContainsAnimationAt(float time) if (time > _animationDuration || _animations.Count == 0) return false; - else - return true; + return true; } public AnimationTrack SetFrame(float time, AnimationFrame animframe) @@ -118,22 +134,7 @@ public AnimationTrack RemoveFrame(float time) { if (kvp.Key == time) { - _animations.Remove(kvp.Key); - break; - } - } - - UpdateDuration(); - return this; - } - - public AnimationTrack RemoveFrame(AnimationFrame frame) - { - foreach (KeyValuePair kvp in _animations) - { - if (kvp.Value.Equals(frame)) - { - _animations.Remove(kvp.Key); + _animations.TryRemove(kvp.Key, out _); break; } } @@ -145,11 +146,11 @@ public AnimationTrack RemoveFrame(AnimationFrame frame) public AnimationTrack Clear() { _animations.Clear(); + _blendCache.Clear(); UpdateDuration(); return this; } - public AnimationFrame GetFrame(float time) { if (!ContainsAnimationAt(time)) @@ -168,23 +169,29 @@ public AnimationFrame GetFrame(float time) //The time value is exact if (closeValues.Item1 == closeValues.Item2) return _animations[closeValues.Item1]; - else + if (closeValues.Item1 + _animations[closeValues.Item1]._duration > time) + return _animations[closeValues.Item1]; + if (_animations.ContainsKey(closeValues.Item1) && _animations.ContainsKey(closeValues.Item2)) { - if (closeValues.Item1 + _animations[closeValues.Item1]._duration > time) - return _animations[closeValues.Item1]; - else + int roundedTime = (int)Math.Round(time * 100); + AnimationFrame blend; + if (_blendCache.TryGetValue(roundedTime, out blend)) { - if (_animations.ContainsKey(closeValues.Item1) && _animations.ContainsKey(closeValues.Item2)) - return _animations[closeValues.Item1].BlendWith(_animations[closeValues.Item2], ((double)(time - (closeValues.Item1 + _animations[closeValues.Item1]._duration)) / (double)(closeValues.Item2 - (closeValues.Item1 + _animations[closeValues.Item1]._duration)))); - else - return (AnimationFrame)Activator.CreateInstance(SupportedAnimationType); + return blend; } + var blendAmount = (time - (closeValues.Item1 + _animations[closeValues.Item1]._duration)) / + (double)(closeValues.Item2 - (closeValues.Item1 + _animations[closeValues.Item1]._duration)); + blend = _animations[closeValues.Item1].BlendWith(_animations[closeValues.Item2], blendAmount); + _blendCache.Add(roundedTime, blend); + return blend; } + + return (AnimationFrame)Activator.CreateInstance(SupportedAnimationType); } - public Dictionary GetAnimations() + public ConcurrentDictionary GetAnimations() { - return new Dictionary(_animations); + return _animations; } private Tuple GetCloseValues(float time) @@ -209,6 +216,7 @@ private Tuple GetCloseValues(float time) private void UpdateDuration() { + _blendCache.Clear(); if (_animations.Count > 0) { float max = _animations.Keys.Max(); diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/ColorSpectrum.cs b/Project-Aurora/Project-Aurora/EffectsEngine/ColorSpectrum.cs index c922004ea..1377d986e 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/ColorSpectrum.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/ColorSpectrum.cs @@ -38,7 +38,7 @@ public class ColorSpectrum Color.FromArgb(255, 0, 0) ); - private Dictionary colors; + private readonly Dictionary colors = new Dictionary(); private float shift = 0.0f; /// @@ -46,8 +46,6 @@ public class ColorSpectrum /// public ColorSpectrum() { - colors = new Dictionary(); - colors[0.0f] = Color.FromArgb(255, 0, 0); colors[1.0f] = Color.FromArgb(255, 0, 0); } @@ -58,8 +56,6 @@ public ColorSpectrum() /// public ColorSpectrum(Color color) { - colors = new Dictionary(); - colors[0.0f] = color; colors[1.0f] = color; } @@ -71,8 +67,6 @@ public ColorSpectrum(Color color) /// The ending color (at 1.0f) public ColorSpectrum(Color startcolor, Color endcolor) { - colors = new Dictionary(); - colors[0.0f] = startcolor; colors[1.0f] = endcolor; } @@ -83,8 +77,6 @@ public ColorSpectrum(Color startcolor, Color endcolor) /// The passed array of colors public ColorSpectrum(params Color[] colorslist) { - colors = new Dictionary(); - for (int i = 0; i < colorslist.Length; i++) { float position = i / (float)(colorslist.Length - 1); @@ -99,7 +91,7 @@ public ColorSpectrum(params Color[] colorslist) /// The passed ColorSpectrum public ColorSpectrum(ColorSpectrum otherspectrum) { - colors = otherspectrum.colors; + colors = new Dictionary(otherspectrum.colors); } /// @@ -115,7 +107,9 @@ public ColorSpectrum Flip() newcolors[1.0f - kvp.Key] = kvp.Value; } - colors = newcolors; + colors.Clear(); + foreach (var e in newcolors) + colors.Add(e.Key, e.Value); return this; } @@ -290,7 +284,9 @@ public ColorSpectrum MultiplyByScalar(double scalar) foreach (KeyValuePair kvp in colors) newcolors[kvp.Key] = Utils.ColorUtils.MultiplyColorByScalar(kvp.Value, scalar); - colors = newcolors; + colors.Clear(); + foreach (var e in newcolors) + colors.Add(e.Key, e.Value); return this; } diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/EffectFrame.cs b/Project-Aurora/Project-Aurora/EffectsEngine/EffectFrame.cs index dd0bbf2c0..00d37c5cb 100644 --- a/Project-Aurora/Project-Aurora/EffectsEngine/EffectFrame.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/EffectFrame.cs @@ -8,16 +8,8 @@ namespace Aurora.EffectsEngine /// public class EffectFrame : IDisposable { - Queue over_layers = new Queue(); - Queue layers = new Queue(); - - /// - /// A default constructor for EffectFrame class - /// - public EffectFrame() - { - - } + readonly Queue over_layers = new(); + readonly Queue layers = new(); /// /// Adds layers into the frame @@ -62,19 +54,17 @@ public Queue GetOverlayLayers() protected virtual void Dispose(bool disposing) { - if (!disposedValue) + if (disposedValue) return; + if (disposing) { - if (disposing) - { - over_layers.Clear(); - layers.Clear(); - } + over_layers.Clear(); + layers.Clear(); + } - // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. - // TODO: set large fields to null. + // TODO: free unmanaged resources (unmanaged objects) and override a finalizer below. + // TODO: set large fields to null. - disposedValue = true; - } + disposedValue = true; } // TODO: override a finalizer only if Dispose(bool disposing) above has code to free unmanaged resources. diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs b/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs index f3b54fe36..fe14f20fd 100755 --- a/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/EffectLayer.cs @@ -1,11 +1,13 @@ -using Aurora.Settings; -using System; +using System; using System.Collections.Generic; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; -using System.Linq; -using System.Threading.Tasks; +using System.Windows; +using Aurora.Devices; +using Aurora.Settings; +using Aurora.Utils; +using Point = System.Drawing.Point; namespace Aurora.EffectsEngine { @@ -14,110 +16,125 @@ namespace Aurora.EffectsEngine /// public class EffectLayer : IDisposable { - private String name; - private Bitmap colormap; + private static readonly Lazy EmptyLayerFactory = new(); + public static EffectLayer EmptyLayer => EmptyLayerFactory.Value; - private object bufferLock = new object(); + private readonly string _name; + private Bitmap _colormap; + private float _opacity = 1; - private bool needsRender = false; + private TextureBrush _textureBrush; + private bool _needsRender; - Color peripheral; + internal Rectangle Dimension; - private static Devices.DeviceKeys[] possible_peripheral_keys = { - Devices.DeviceKeys.Peripheral, - Devices.DeviceKeys.Peripheral_FrontLight, - Devices.DeviceKeys.Peripheral_ScrollWheel, - Devices.DeviceKeys.Peripheral_Logo - }; + internal TextureBrush TextureBrush + { + get + { + if (!_needsRender && _textureBrush != null) return _textureBrush; + + var colorMatrix = new ColorMatrix + { + Matrix33 = _opacity + }; + var imageAttributes = new ImageAttributes(); + imageAttributes.SetColorMatrix(colorMatrix); + imageAttributes.SetWrapMode(WrapMode.Clamp, Color.Empty); + + _textureBrush?.Dispose(); + _textureBrush = new TextureBrush(_colormap, Dimension, imageAttributes); + _needsRender = false; - static private ColorSpectrum rainbow = new ColorSpectrum(ColorSpectrum.RainbowLoop); + return _textureBrush; + } + } /// /// Creates a new instance of the EffectLayer class with default parameters. /// + [Obsolete("Always name the layer")] public EffectLayer() { - name = "Effect Layer"; - colormap = new Bitmap(Effects.canvas_width, Effects.canvas_height); - peripheral = Color.FromArgb(0, 0, 0, 0); + _name = "Unknown Layer"; + WeakEventManager.AddHandler(null, "CanvasChanged", InvalidateColorMap); + _colormap = new Bitmap(Effects.CanvasWidth, Effects.CanvasHeight); + _textureBrush = new TextureBrush(_colormap); + Dimension = new Rectangle(0, 0, _colormap.Width, _colormap.Height); - Fill(Color.FromArgb(0, 0, 0, 0)); + FillOver(Color.Empty); } - /// - /// A copy constructor, Creates a new instance of the EffectLayer class from another EffectLayer instance. - /// - /// EffectLayer instance to copy data from - public EffectLayer(EffectLayer another_layer) + public EffectLayer(EffectLayer anotherLayer) { - this.name = another_layer.name; - colormap = new Bitmap(another_layer.colormap); - peripheral = another_layer.peripheral; - - needsRender = another_layer.needsRender; + _name = anotherLayer._name; + var graphicsUnit = anotherLayer.GetGraphics().PageUnit; + var rectangleF = anotherLayer._colormap.GetBounds(ref graphicsUnit); + WeakEventManager.AddHandler(null, "CanvasChanged", InvalidateColorMap); + _colormap = anotherLayer._colormap.Clone(rectangleF, anotherLayer._colormap.PixelFormat); + _textureBrush = new TextureBrush(_colormap); + Dimension = anotherLayer.Dimension; + + _needsRender = anotherLayer._needsRender; } - /// - /// Creates a new instance of the EffectLayer class with a specified layer name. - /// - /// A layer name public EffectLayer(string name) { - this.name = name; - colormap = new Bitmap(Effects.canvas_width, Effects.canvas_height); - peripheral = Color.FromArgb(0, 0, 0, 0); + _name = name; + WeakEventManager.AddHandler(null, "CanvasChanged", InvalidateColorMap); + _colormap = new Bitmap(Effects.CanvasWidth, Effects.CanvasHeight); + _textureBrush = new TextureBrush(_colormap); + Dimension = new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight); - Fill(Color.FromArgb(0, 0, 0, 0)); + FillOver(Color.FromArgb(0, 1, 1, 1)); } - /// - /// Creates a new instance of the EffectLayer class with a specified layer name. And fills the layer bitmap with a specified color. - /// - /// A layer name - /// A color to fill the bitmap with public EffectLayer(string name, Color color) { - this.name = name; - colormap = new Bitmap(Effects.canvas_width, Effects.canvas_height); - peripheral = color; + _name = name; + WeakEventManager.AddHandler(null, "CanvasChanged", InvalidateColorMap); + _colormap = new Bitmap(Effects.CanvasWidth, Effects.CanvasHeight); + _textureBrush = new TextureBrush(_colormap); + Dimension = new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight); - Fill(color); + FillOver(color); } /// /// Creates a new instance of the EffectLayer class with a specified layer name. And applies a LayerEffect onto this EffectLayer instance. /// Using the parameters from LayerEffectConfig and a specified region in RectangleF /// - /// A layer name /// An enum specifying which LayerEffect to apply - /// Configurations for the LayerEffect + /// Configurations for the LayerEffect /// A rectangle specifying what region to apply effects in - public EffectLayer(string name, LayerEffects effect, LayerEffectConfig effect_config, RectangleF rect = new RectangleF()) + public EffectLayer(string name, LayerEffects effect, LayerEffectConfig effectConfig, RectangleF rect = new()) { - this.name = name; - colormap = new Bitmap(Effects.canvas_width, Effects.canvas_height); - peripheral = new Color(); + _name = name; + WeakEventManager.AddHandler(null, "CanvasChanged", InvalidateColorMap); + _colormap = new Bitmap(Effects.CanvasWidth, Effects.CanvasHeight); + _textureBrush = new TextureBrush(_colormap); + Dimension = new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight); Brush brush; - float shift = 0.0f; + var shift = 0.0f; switch (effect) { case LayerEffects.ColorOverlay: - Fill(effect_config.primary); + FillOver(effectConfig.primary); break; case LayerEffects.ColorBreathing: - Fill(effect_config.primary); - float sine = (float)Math.Pow(Math.Sin((double)((Utils.Time.GetMillisecondsSinceEpoch() % 10000L) / 10000.0f) * 2 * Math.PI * effect_config.speed), 2); - Fill(Color.FromArgb((byte)(sine * 255), effect_config.secondary)); + FillOver(effectConfig.primary); + float sine = (float)Math.Pow(Math.Sin((double)(Time.GetMillisecondsSinceEpoch() % 10000L / 10000.0f) * 2 * Math.PI * effectConfig.speed), 2); + FillOver(Color.FromArgb((byte)(sine * 255), effectConfig.secondary)); break; case LayerEffects.RainbowShift_Horizontal: - effect_config.shift_amount += ((Utils.Time.GetMillisecondsSinceEpoch() - effect_config.last_effect_call) / 1000.0f) * 5.0f * effect_config.speed; - effect_config.shift_amount = effect_config.shift_amount % Effects.canvas_biggest; + effectConfig.shift_amount += (Time.GetMillisecondsSinceEpoch() - effectConfig.last_effect_call) / 1000.0f * 5.0f * effectConfig.speed; + effectConfig.shift_amount %= Effects.CanvasBiggest; - if (effect_config.animation_type == AnimationType.Translate_XY) - shift = effect_config.shift_amount; + if (effectConfig.animation_type == AnimationType.Translate_XY) + shift = effectConfig.shift_amount; - if (effect_config.animation_reverse) + if (effectConfig.animation_reverse) shift *= -1.0f; brush = CreateRainbowBrush(); @@ -126,16 +143,16 @@ public EffectLayer(string name, Color color) Fill(brush); - effect_config.last_effect_call = Utils.Time.GetMillisecondsSinceEpoch(); + effectConfig.last_effect_call = Time.GetMillisecondsSinceEpoch(); break; case LayerEffects.RainbowShift_Vertical: - effect_config.shift_amount += ((Utils.Time.GetMillisecondsSinceEpoch() - effect_config.last_effect_call) / 1000.0f) * 5.0f * effect_config.speed; - effect_config.shift_amount = effect_config.shift_amount % Effects.canvas_biggest; + effectConfig.shift_amount += (Time.GetMillisecondsSinceEpoch() - effectConfig.last_effect_call) / 1000.0f * 5.0f * effectConfig.speed; + effectConfig.shift_amount %= Effects.CanvasBiggest; - if (effect_config.animation_type == AnimationType.Translate_XY) - shift = effect_config.shift_amount; + if (effectConfig.animation_type == AnimationType.Translate_XY) + shift = effectConfig.shift_amount; - if (effect_config.animation_reverse) + if (effectConfig.animation_reverse) shift *= -1.0f; brush = CreateRainbowBrush(); @@ -144,16 +161,16 @@ public EffectLayer(string name, Color color) Fill(brush); - effect_config.last_effect_call = Utils.Time.GetMillisecondsSinceEpoch(); + effectConfig.last_effect_call = Time.GetMillisecondsSinceEpoch(); break; case LayerEffects.RainbowShift_Diagonal: - effect_config.shift_amount += ((Utils.Time.GetMillisecondsSinceEpoch() - effect_config.last_effect_call) / 1000.0f) * 5.0f * effect_config.speed; - effect_config.shift_amount = effect_config.shift_amount % Effects.canvas_biggest; + effectConfig.shift_amount += (Time.GetMillisecondsSinceEpoch() - effectConfig.last_effect_call) / 1000.0f * 5.0f * effectConfig.speed; + effectConfig.shift_amount %= Effects.CanvasBiggest; - if (effect_config.animation_type == AnimationType.Translate_XY) - shift = effect_config.shift_amount; + if (effectConfig.animation_type == AnimationType.Translate_XY) + shift = effectConfig.shift_amount; - if (effect_config.animation_reverse) + if (effectConfig.animation_reverse) shift *= -1.0f; brush = CreateRainbowBrush(); @@ -162,16 +179,16 @@ public EffectLayer(string name, Color color) Fill(brush); - effect_config.last_effect_call = Utils.Time.GetMillisecondsSinceEpoch(); + effectConfig.last_effect_call = Time.GetMillisecondsSinceEpoch(); break; case LayerEffects.RainbowShift_Diagonal_Other: - effect_config.shift_amount += ((Utils.Time.GetMillisecondsSinceEpoch() - effect_config.last_effect_call) / 1000.0f) * 5.0f * effect_config.speed; - effect_config.shift_amount = effect_config.shift_amount % Effects.canvas_biggest; + effectConfig.shift_amount += (Time.GetMillisecondsSinceEpoch() - effectConfig.last_effect_call) / 1000.0f * 5.0f * effectConfig.speed; + effectConfig.shift_amount %= Effects.CanvasBiggest; - if (effect_config.animation_type == AnimationType.Translate_XY) - shift = effect_config.shift_amount; + if (effectConfig.animation_type == AnimationType.Translate_XY) + shift = effectConfig.shift_amount; - if (effect_config.animation_reverse) + if (effectConfig.animation_reverse) shift *= -1.0f; brush = CreateRainbowBrush(); @@ -180,113 +197,135 @@ public EffectLayer(string name, Color color) Fill(brush); - effect_config.last_effect_call = Utils.Time.GetMillisecondsSinceEpoch(); + effectConfig.last_effect_call = Time.GetMillisecondsSinceEpoch(); break; case LayerEffects.RainbowShift_Custom_Angle: - effect_config.shift_amount += ((Utils.Time.GetMillisecondsSinceEpoch() - effect_config.last_effect_call) / 1000.0f) * 5.0f * effect_config.speed; - effect_config.shift_amount = effect_config.shift_amount % Effects.canvas_biggest; + effectConfig.shift_amount += (Time.GetMillisecondsSinceEpoch() - effectConfig.last_effect_call) / 1000.0f * 5.0f * effectConfig.speed; + effectConfig.shift_amount %= Effects.CanvasBiggest; - if (effect_config.animation_type == AnimationType.Translate_XY) - shift = effect_config.shift_amount; + if (effectConfig.animation_type == AnimationType.Translate_XY) + shift = effectConfig.shift_amount; - if (effect_config.animation_reverse) + if (effectConfig.animation_reverse) shift *= -1.0f; brush = CreateRainbowBrush(); - (brush as LinearGradientBrush).RotateTransform(effect_config.angle); + (brush as LinearGradientBrush).RotateTransform(effectConfig.angle); (brush as LinearGradientBrush).TranslateTransform(shift, shift); Fill(brush); - effect_config.last_effect_call = Utils.Time.GetMillisecondsSinceEpoch(); + effectConfig.last_effect_call = Time.GetMillisecondsSinceEpoch(); break; case LayerEffects.GradientShift_Custom_Angle: - effect_config.shift_amount += ((Utils.Time.GetMillisecondsSinceEpoch() - effect_config.last_effect_call) / 1000.0f) * 0.067f * effect_config.speed; - effect_config.shift_amount = effect_config.shift_amount % Effects.canvas_biggest; + effectConfig.shift_amount += (Time.GetMillisecondsSinceEpoch() - effectConfig.last_effect_call) / 1000.0f * 0.067f * effectConfig.speed; + effectConfig.shift_amount %= Effects.CanvasBiggest; - if (effect_config.animation_type == AnimationType.Translate_XY) - shift = effect_config.shift_amount; - else if (effect_config.animation_type == AnimationType.Zoom_in && effect_config.brush.type == EffectBrush.BrushType.Radial) - shift = ((Effects.canvas_biggest - effect_config.shift_amount) * 40.0f) % Effects.canvas_biggest; - else if (effect_config.animation_type == AnimationType.Zoom_out && effect_config.brush.type == EffectBrush.BrushType.Radial) - shift = (effect_config.shift_amount * 40.0f) % Effects.canvas_biggest; - - if (effect_config.animation_reverse) + shift = effectConfig.animation_type switch + { + AnimationType.Translate_XY => effectConfig.shift_amount, + AnimationType.Zoom_in when effectConfig.brush.type == EffectBrush.BrushType.Radial => + (Effects.CanvasBiggest - effectConfig.shift_amount) * 40.0f % Effects.CanvasBiggest, + AnimationType.Zoom_out when effectConfig.brush.type == EffectBrush.BrushType.Radial => + effectConfig.shift_amount * 40.0f % Effects.CanvasBiggest, + _ => shift + }; + + if (effectConfig.animation_reverse) shift *= -1.0f; - brush = effect_config.brush.GetDrawingBrush(); - if (effect_config.brush.type == EffectBrush.BrushType.Linear) + brush = effectConfig.brush.GetDrawingBrush(); + switch (effectConfig.brush.type) { - if (!rect.IsEmpty) + case EffectBrush.BrushType.Linear: { - (brush as LinearGradientBrush).TranslateTransform(rect.X, rect.Y); - (brush as LinearGradientBrush).ScaleTransform(rect.Width * 100 / effect_config.gradient_size, rect.Height * 100 / effect_config.gradient_size); - } - else - { - (brush as LinearGradientBrush).ScaleTransform(Effects.canvas_height * 100 / effect_config.gradient_size, Effects.canvas_height * 100 / effect_config.gradient_size); - } - - (brush as LinearGradientBrush).RotateTransform(effect_config.angle); - (brush as LinearGradientBrush).TranslateTransform(shift, shift); - } - else if (effect_config.brush.type == EffectBrush.BrushType.Radial) - { - if (effect_config.animation_type == AnimationType.Zoom_in || effect_config.animation_type == AnimationType.Zoom_out) - { - float percent = shift / Effects.canvas_biggest; - - float x_offset = (Effects.canvas_width / 2.0f) * percent; - float y_offset = (Effects.canvas_height / 2.0f) * percent; - - - (brush as PathGradientBrush).WrapMode = WrapMode.Clamp; - if (!rect.IsEmpty) { - x_offset = (rect.Width / 2.0f) * percent; - y_offset = (rect.Height / 2.0f) * percent; - - (brush as PathGradientBrush).TranslateTransform(rect.X + x_offset, rect.Y + y_offset); - (brush as PathGradientBrush).ScaleTransform((rect.Width - (2.0f * x_offset)) * 100 / effect_config.gradient_size, (rect.Height - (2.0f * y_offset)) * 100 / effect_config.gradient_size); + (brush as LinearGradientBrush).TranslateTransform(rect.X, rect.Y); + (brush as LinearGradientBrush).ScaleTransform(rect.Width * 100 / effectConfig.gradient_size, rect.Height * 100 / effectConfig.gradient_size); } else { - (brush as PathGradientBrush).ScaleTransform((Effects.canvas_height + x_offset) * 100 / effect_config.gradient_size, (Effects.canvas_height + y_offset) * 100 / effect_config.gradient_size); + (brush as LinearGradientBrush).ScaleTransform(Effects.CanvasHeight * 100 / effectConfig.gradient_size, Effects.CanvasHeight * 100 / effectConfig.gradient_size); } + + (brush as LinearGradientBrush).RotateTransform(effectConfig.angle); + (brush as LinearGradientBrush).TranslateTransform(shift, shift); + break; } - else + case EffectBrush.BrushType.Radial: { - if (!rect.IsEmpty) + if (effectConfig.animation_type == AnimationType.Zoom_in || effectConfig.animation_type == AnimationType.Zoom_out) { - (brush as PathGradientBrush).TranslateTransform(rect.X, rect.Y); - (brush as PathGradientBrush).ScaleTransform(rect.Width * 100 / effect_config.gradient_size, rect.Height * 100 / effect_config.gradient_size); + float percent = shift / Effects.CanvasBiggest; + + float x_offset = Effects.CanvasWidth / 2.0f * percent; + float y_offset = Effects.CanvasHeight / 2.0f * percent; + + + (brush as PathGradientBrush).WrapMode = WrapMode.Clamp; + + if (!rect.IsEmpty) + { + x_offset = rect.Width / 2.0f * percent; + y_offset = rect.Height / 2.0f * percent; + + (brush as PathGradientBrush).TranslateTransform(rect.X + x_offset, rect.Y + y_offset); + (brush as PathGradientBrush).ScaleTransform((rect.Width - 2.0f * x_offset) * 100 / effectConfig.gradient_size, (rect.Height - 2.0f * y_offset) * 100 / effectConfig.gradient_size); + } + else + { + (brush as PathGradientBrush).ScaleTransform((Effects.CanvasHeight + x_offset) * 100 / effectConfig.gradient_size, (Effects.CanvasHeight + y_offset) * 100 / effectConfig.gradient_size); + } } else { - (brush as PathGradientBrush).ScaleTransform(Effects.canvas_height * 100 / effect_config.gradient_size, Effects.canvas_height * 100 / effect_config.gradient_size); + if (!rect.IsEmpty) + { + (brush as PathGradientBrush).TranslateTransform(rect.X, rect.Y); + (brush as PathGradientBrush).ScaleTransform(rect.Width * 100 / effectConfig.gradient_size, rect.Height * 100 / effectConfig.gradient_size); + } + else + { + (brush as PathGradientBrush).ScaleTransform(Effects.CanvasHeight * 100 / effectConfig.gradient_size, Effects.CanvasHeight * 100 / effectConfig.gradient_size); + } } - } - (brush as PathGradientBrush).RotateTransform(effect_config.angle); + (brush as PathGradientBrush).RotateTransform(effectConfig.angle); - //(brush as PathGradientBrush).TranslateTransform(x_shift, y_shift); + //(brush as PathGradientBrush).TranslateTransform(x_shift, y_shift); + break; + } } Fill(brush); - effect_config.last_effect_call = Utils.Time.GetMillisecondsSinceEpoch(); - break; - default: + effectConfig.last_effect_call = Time.GetMillisecondsSinceEpoch(); break; } } public void Dispose() { - colormap.Dispose(); - colormap = null; + Dispose(true); + GC.SuppressFinalize(this); + } + + private void Dispose(bool disposing) + { + if (disposing) + { + _colormap?.Dispose(); + _textureBrush?.Dispose(); + _transformedDrawExcludeMap?.Dispose(); + WeakEventManager.RemoveHandler(null, "CanvasChanged", InvalidateColorMap); + } + } + + ~EffectLayer() + { + Dispose(false); } /// @@ -295,117 +334,86 @@ public void Dispose() /// Rainbow LinearGradientBrush private LinearGradientBrush CreateRainbowBrush() { - LinearGradientBrush the_brush = - new LinearGradientBrush( - new Point(0, 0), - new Point(Effects.canvas_biggest, 0), - Color.Red, Color.Red); - Color[] colors = new Color[] - { - Color.FromArgb(255, 0, 0), - Color.FromArgb(255, 127, 0), - Color.FromArgb(255, 255, 0), - Color.FromArgb(0, 255, 0), - Color.FromArgb(0, 0, 255), - Color.FromArgb(75, 0, 130), - Color.FromArgb(139, 0, 255), - Color.FromArgb(255, 0, 0) + var brush = new LinearGradientBrush( + new Point(0, 0), + new Point(Effects.CanvasBiggest, 0), + Color.Red, Color.Red); + Color[] colors = { + Color.FromArgb(255, 0, 0), + Color.FromArgb(255, 127, 0), + Color.FromArgb(255, 255, 0), + Color.FromArgb(0, 255, 0), + Color.FromArgb(0, 0, 255), + Color.FromArgb(75, 0, 130), + Color.FromArgb(139, 0, 255), + Color.FromArgb(255, 0, 0) }; - int num_colors = colors.Length; - float[] blend_positions = new float[num_colors]; - for (int i = 0; i < num_colors; i++) + var numColors = colors.Length; + var blendPositions = new float[numColors]; + for (var i = 0; i < numColors; i++) { - blend_positions[i] = i / (num_colors - 1f); + blendPositions[i] = i / (numColors - 1f); } - ColorBlend color_blend = new ColorBlend(); - color_blend.Colors = colors; - color_blend.Positions = blend_positions; - the_brush.InterpolationColors = color_blend; + var colorBlend = new ColorBlend(); + colorBlend.Colors = colors; + colorBlend.Positions = blendPositions; + brush.InterpolationColors = colorBlend; - return the_brush; + return brush; } /// /// Fills the entire bitmap of the EffectLayer with a specified brush. /// /// Brush to be used during bitmap fill - /// Itself - public EffectLayer Fill(Brush brush) + public void Fill(Brush brush) { - using (Graphics g = Graphics.FromImage(colormap)) - { - /*if(brush is PathGradientBrush) - { - GraphicsPath gp = new GraphicsPath(); - gp.AddEllipse((brush as PathGradientBrush).Rectangle); - - g.FillPath(brush, gp); - } - else - { - Rectangle rect = new Rectangle(0, 0, colormap.Width, colormap.Height); - g.FillRectangle(brush, rect); - } - */ - Rectangle rect = new Rectangle(0, 0, colormap.Width, colormap.Height); - g.FillRectangle(brush, rect); - needsRender = true; - } - - return this; + using var g = Graphics.FromImage(_colormap); + g.CompositingMode = CompositingMode.SourceCopy; + g.FillRectangle(brush, Dimension); + Invalidate(); } /// - /// Fills the entire bitmap of the EffectLayer with a specified color. + /// Paints over the entire bitmap of the EffectLayer with a specified color. /// /// Color to be used during bitmap fill /// Itself - public EffectLayer Fill(Color color) + [Obsolete("Use with Brush argument")] + public EffectLayer FillOver(Color color) { - using (Graphics g = Graphics.FromImage(colormap)) + using (var g = Graphics.FromImage(_colormap)) { - Rectangle rect = new Rectangle(0, 0, colormap.Width, colormap.Height); - g.FillRectangle(new SolidBrush(color), rect); - needsRender = true; + g.CompositingMode = CompositingMode.SourceOver; + g.SmoothingMode = SmoothingMode.None; + g.FillRectangle(new SolidBrush(color), Dimension); } + Invalidate(); return this; } /// - /// Sets a specific coordinate on the bitmap with a specified color. + /// Paints over the entire bitmap of the EffectLayer with a specified color. /// - /// X Coordinate on the bitmap - /// Y Coordinate on the bitmap - /// Color to be used + /// Color to be used during bitmap fill /// Itself - public EffectLayer Set(int x, int y, Color color) + public void FillOver(Brush brush) { - BitmapData srcData = colormap.LockBits( - new Rectangle(x, y, 1, 1), - ImageLockMode.WriteOnly, - PixelFormat.Format32bppArgb); - - int stride = srcData.Stride; - - IntPtr Scan0 = srcData.Scan0; - - unsafe - { - byte* p = (byte*)(void*)Scan0; - - p[0] = color.B; - p[1] = color.G; - p[2] = color.R; - p[3] = color.A; - } - - colormap.UnlockBits(srcData); - - needsRender = true; - - return this; + using var g = Graphics.FromImage(_colormap); + g.CompositingMode = CompositingMode.SourceOver; + g.SmoothingMode = SmoothingMode.None; + g.FillRectangle(brush, Dimension); + Invalidate(); + } + + public void Clear() + { + using var g = Graphics.FromImage(_colormap); + g.CompositingMode = CompositingMode.SourceCopy; + g.FillRectangle(ClearingBrush, Dimension); + Invalidate(); } /// @@ -414,10 +422,9 @@ public EffectLayer Set(int x, int y, Color color) /// DeviceKey to be set /// Color to be used /// Itself - public EffectLayer Set(Devices.DeviceKeys key, Color color) + public EffectLayer Set(DeviceKey key, Color color) { SetOneKey(key, color); - return this; } @@ -426,13 +433,10 @@ public EffectLayer Set(Devices.DeviceKeys key, Color color) /// /// Array of DeviceKeys to be set /// Color to be used - /// Itself - public EffectLayer Set(Devices.DeviceKeys[] keys, Color color) + public void Set(DeviceKey[] keys, Color color) { - foreach(var key in keys) + foreach (var key in keys) SetOneKey(key, color); - - return this; } /// @@ -443,6 +447,8 @@ public EffectLayer Set(Devices.DeviceKeys[] keys, Color color) /// Itself public EffectLayer Set(KeySequence sequence, Color color) => Set(sequence, new SolidBrush(color)); + private FreeFormObject _lastFreeform = new(); + private bool _ksChanged = true; /// /// Sets a specific KeySequence on the bitmap with a specified brush. /// @@ -451,6 +457,13 @@ public EffectLayer Set(Devices.DeviceKeys[] keys, Color color) /// Itself public EffectLayer Set(KeySequence sequence, Brush brush) { + if (_previousSequenceType != sequence.type) + { + Clear(); + _previousSequenceType = sequence.type; + _ksChanged = true; + } + if (sequence.type == KeySequenceType.Sequence) { foreach (var key in sequence.keys) @@ -458,31 +471,60 @@ public EffectLayer Set(KeySequence sequence, Brush brush) } else { - using (Graphics g = Graphics.FromImage(colormap)) + if (!sequence.freeform.Equals(_lastFreeform)) { - float x_pos = (float)Math.Round((sequence.freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width); - float y_pos = (float)Math.Round((sequence.freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height); - float width = (float)Math.Round((sequence.freeform.Width * Effects.editor_to_canvas_width)); - float height = (float)Math.Round((sequence.freeform.Height * Effects.editor_to_canvas_height)); + WeakEventManager.RemoveHandler(_lastFreeform, "ValuesChanged", FreeformOnValuesChanged); + _lastFreeform = sequence.freeform; + WeakEventManager.AddHandler(_lastFreeform, "ValuesChanged", FreeformOnValuesChanged); + FreeformOnValuesChanged(this, EventArgs.Empty); + } - if (width < 3) width = 3; - if (height < 3) height = 3; + if (_ksChanged) + { + Clear(); + _ksChanged = false; + } + else if (brush is SolidBrush solidBrush) + { + if (sequence.freeform.Equals(_lastFreeform) && _lastColor == solidBrush.Color) + { + return this; + } + _lastColor = solidBrush.Color; + } + + using var g = Graphics.FromImage(_colormap); + var xPos = (float)Math.Round((sequence.freeform.X + Effects.grid_baseline_x) * Effects.EditorToCanvasWidth); + var yPos = (float)Math.Round((sequence.freeform.Y + Effects.grid_baseline_y) * Effects.EditorToCanvasHeight); + var width = (float)Math.Round(sequence.freeform.Width * Effects.EditorToCanvasWidth); + var height = (float)Math.Round(sequence.freeform.Height * Effects.EditorToCanvasHeight); - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height); + if (width < 3) width = 3; + if (height < 3) height = 3; - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); + var rect = new RectangleF(xPos, yPos, width, height); //TODO dependant property? parameter? - Matrix myMatrix = new Matrix(); - myMatrix.RotateAt(sequence.freeform.Angle, rotatePoint, MatrixOrder.Append); + var rotatePoint = new PointF(xPos + width / 2.0f, yPos + height / 2.0f); + var myMatrix = new Matrix(); + myMatrix.RotateAt(sequence.freeform.Angle, rotatePoint, MatrixOrder.Append); //TODO dependant property? parameter? - g.Transform = myMatrix; - g.FillRectangle(brush, rect); - } + g.Transform = myMatrix; + g.CompositingMode = CompositingMode.SourceCopy; + g.FillRectangle(brush, rect); + Invalidate(); } return this; } + private void FreeformOnValuesChanged(object sender, EventArgs args) + { + _ksChanged = true; + Clear(); + } + + private Bitmap _transformedDrawExcludeMap; + /// /// Allows drawing some arbitrary content to the sequence bounds, including translation, scaling and rotation. /// Usage: @@ -503,31 +545,39 @@ public EffectLayer Set(KeySequence sequence, Brush brush) /// An action that further configures the transformation matrix before render is called. /// An action that receives a transformed graphics context and can render whatever it needs to. /// The source region of the rendered content. This is used when calculating the transformation matrix, so that this - /// rectangle in the render context is transformed to the keysequence bounds in the layer's context. Note that no clipping is performed. - public EffectLayer DrawTransformed(KeySequence sequence, Action configureMatrix, Action render, RectangleF sourceRegion) { + /// rectangle in the render context is transformed to the keysequence bounds in the layer's context. Note that no clipping is performed. + public void DrawTransformed(KeySequence sequence, Action configureMatrix, Action render, RectangleF sourceRegion) + { // The matrix represents the transformation that will be applied to the rendered content var matrix = new Matrix(); // The bounds represent the target position of the render part - // Note that we round the X and Y off to properly imitate the above `Set(KeySequence, Color)` method. Unsure exactly why this is done, but it _is_ done to replicate behaviour properly. + // Note that we round the X and Y off to properly imitate the above `Set(KeySequence, Color)` method. + // Unsure exactly why this is done, but it _is_ done to replicate behaviour properly. // Also unsure why the X and Y are rounded using math.Round but Width and Height are just truncated using an int cast?? var boundsRaw = sequence.GetAffectedRegion(); var bounds = new RectangleF((int)Math.Round(boundsRaw.X), (int)Math.Round(boundsRaw.Y), (int)boundsRaw.Width, (int)boundsRaw.Height); - using (var gfx = Graphics.FromImage(colormap)) { + using (var gfx = Graphics.FromImage(_colormap)) + { // First, calculate the scaling required to transform the sourceRect's size into the bounds' size float sx = bounds.Width / sourceRegion.Width, sy = bounds.Height / sourceRegion.Height; // Perform this scale first - // Note: that if the scale is zero, when setting the graphics transform to the matrix, it throws an error, so we must have NON-ZERO values - // Note 2: Also tried using float.Epsilon but this also caused the exception, so a somewhat small number will have to suffice. Not noticed any visual issues with 0.001f. + // Note: that if the scale is zero, when setting the graphics transform to the matrix, + // it throws an error, so we must have NON-ZERO values + // Note 2: Also tried using float.Epsilon but this also caused the exception, + // so a somewhat small number will have to suffice. Not noticed any visual issues with 0.001f. matrix.Scale(sx == 0 ? .001f : sx, sy == 0 ? .001f : sy, MatrixOrder.Append); - // Second, for freeform objects, apply the rotation. This needs to be done AFTER the scaling, else the scaling is applied to the rotated object, which skews it + // Second, for freeform objects, apply the rotation. This needs to be done AFTER the scaling, + // else the scaling is applied to the rotated object, which skews it // We rotate around the central point of the source region, but we need to take the scaling of the dimensions into account if (sequence.type == KeySequenceType.FreeForm) - matrix.RotateAt(sequence.freeform.Angle, new PointF((sourceRegion.Left + (sourceRegion.Width / 2f)) * sx, (sourceRegion.Top + (sourceRegion.Height / 2f)) * sy), MatrixOrder.Append); + matrix.RotateAt( + sequence.freeform.Angle, + new PointF((sourceRegion.Left + sourceRegion.Width / 2f) * sx, (sourceRegion.Top + sourceRegion.Height / 2f) * sy), MatrixOrder.Append); // Third, we can translate the matrix from the source to the target location. matrix.Translate(bounds.X - sourceRegion.Left, bounds.Y - sourceRegion.Top, MatrixOrder.Append); @@ -536,11 +586,44 @@ public EffectLayer DrawTransformed(KeySequence sequence, Action configur configureMatrix(matrix); // Apply the matrix transform to the graphics context and then render + gfx.ResetTransform(); + gfx.ResetClip(); gfx.Transform = matrix; render(gfx); + if (sequence.type == KeySequenceType.Sequence) + { + var gp = GetExclusionPath(sequence); + gfx.ResetTransform(); + gfx.ResetClip(); + gfx.SetClip(gp); + gfx.CompositingMode = CompositingMode.SourceOver; + gfx.Clear(Color.Transparent); + } } - return this; + Invalidate(); + } + + private static GraphicsPath GetExclusionPath(KeySequence sequence) + { + if (sequence.type == KeySequenceType.Sequence) + { + var gp = new GraphicsPath(); + gp.AddRectangle(new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight)); + sequence.keys.ForEach(k => + { + var keyBounds = Effects.GetBitmappingFromDeviceKey(k); + gp.AddRectangle(keyBounds.Rectangle); //Overlapping additons remove that shape + }); + return gp; + } + else + { + var gp = new GraphicsPath(); + gp.AddRectangle(new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight)); + gp.AddRectangle(sequence.GetAffectedRegion()); + return gp; + } } /// @@ -550,9 +633,11 @@ public EffectLayer DrawTransformed(KeySequence sequence, Action configur /// The target sequence whose bounds will be used as the target location on the drawing canvas. /// An action that receives a transformed graphics context and can render whatever it needs to. /// The source region of the rendered content. This is used when calculating the transformation matrix, so that this - /// rectangle in the render context is transformed to the keysequence bounds in the layer's context. Note that no clipping is performed. - public EffectLayer DrawTransformed(KeySequence sequence, Action render, RectangleF sourceRegion) - => DrawTransformed(sequence, _ => { }, render, sourceRegion); + /// rectangle in the render context is transformed to the keysequence bounds in the layer's context. Note that no clipping is performed. + public void DrawTransformed(KeySequence sequence, Action render, RectangleF sourceRegion) + { + DrawTransformed(sequence, _ => { }, render, sourceRegion); + } /// /// Allows drawing some arbitrary content to the sequence bounds, including translation, scaling and rotation. @@ -561,148 +646,84 @@ public EffectLayer DrawTransformed(KeySequence sequence, Action render /// /// The target sequence whose bounds will be used as the target location on the drawing canvas. /// An action that receives a transformed graphics context and can render whatever it needs to. - public EffectLayer DrawTransformed(KeySequence sequence, Action render) => - DrawTransformed(sequence, render, new RectangleF(0, 0, Effects.canvas_width, Effects.canvas_height)); + public void DrawTransformed(KeySequence sequence, Action render) + { + DrawTransformed(sequence, render, new RectangleF(0, 0, Effects.CanvasWidth, Effects.CanvasHeight)); + } /// /// Sets one DeviceKeys key with a specific color on the bitmap /// /// DeviceKey to be set /// Color to be used - /// Itself - private EffectLayer SetOneKey(Devices.DeviceKeys key, Color color) => SetOneKey(key, new SolidBrush(color)); + private void SetOneKey(DeviceKey key, Color color) => SetOneKey(key, new SolidBrush(color)); + + private readonly Dictionary _keyColors = new(); + private static readonly SolidBrush ClearingBrush = new(Color.Transparent); + private Color _lastColor = Color.Empty; /// /// Sets one DeviceKeys key with a specific brush on the bitmap /// /// DeviceKey to be set /// Brush to be used - /// Itself - private EffectLayer SetOneKey(Devices.DeviceKeys key, Brush brush) + private void SetOneKey(DeviceKey key, Brush brush) { - BitmapRectangle keymaping = Effects.GetBitmappingFromDeviceKey(key); - - if (key == Devices.DeviceKeys.Peripheral) + if (brush is SolidBrush solidBrush) { - if (brush is SolidBrush solidBrush) - peripheral = solidBrush.Color; - // TODO Add support for this ^ to other brush types - - using (Graphics g = Graphics.FromImage(colormap)) + if (_keyColors.TryGetValue(key, out var currentColor) && currentColor == solidBrush.Color) { - foreach (Devices.DeviceKeys peri_key in possible_peripheral_keys) - { - BitmapRectangle peri_keymaping = Effects.GetBitmappingFromDeviceKey(peri_key); - - if (peri_keymaping.IsValid) - g.FillRectangle(brush, peri_keymaping.Rectangle); - } - - needsRender = true; + return; } + _keyColors[key] = solidBrush.Color; } - else + BitmapRectangle keymaping = Effects.GetBitmappingFromDeviceKey(key); + _needsRender = true; + + if (keymaping.Top < 0 || keymaping.Bottom > Effects.CanvasHeight || + keymaping.Left < 0 || keymaping.Right > Effects.CanvasWidth) { - if (keymaping.Top < 0 || keymaping.Bottom > Effects.canvas_height || - keymaping.Left < 0 || keymaping.Right > Effects.canvas_width) - { - Global.logger.Warn("Coudln't set key color " + key.ToString()); - return this; - } - else - { - using (Graphics g = Graphics.FromImage(colormap)) - { - g.FillRectangle(brush, keymaping.Rectangle); - needsRender = true; - } - } + Global.logger.Warn("Coudln't set key color " + key); + return; } - return this; + using Graphics g = Graphics.FromImage(_colormap); + g.CompositingMode = CompositingMode.SourceCopy; + g.FillRectangle(brush, keymaping.Rectangle); + _needsRender = true; } /// - /// Retrieves a color of the specified X and Y coordinate on the bitmap + /// Retrieves a color of the specified DeviceKeys key from the bitmap /// - /// X Coordiante on the bitmap - /// Y Coordinate on the bitmap - /// Color at (X,Y) - public Color Get(int x, int y) + public Color Get(DeviceKey key) { - BitmapData srcData = colormap.LockBits( - new Rectangle(x, y, 1, 1), - ImageLockMode.ReadOnly, - PixelFormat.Format32bppArgb); - - int stride = srcData.Stride; - - IntPtr Scan0 = srcData.Scan0; - - byte red, green, blue, alpha; - - unsafe + if (_keyColors.TryGetValue(key, out var color)) { - byte* p = (byte*)(void*)Scan0; - - blue = p[0]; - green = p[1]; - red = p[2]; - alpha = p[3]; + return color; } + var keyMapping = Effects.GetBitmappingFromDeviceKey(key); - colormap.UnlockBits(srcData); + var keyColor = keyMapping.IsEmpty ? Color.Black : BitmapUtils.GetRegionColor(_colormap, keyMapping.Rectangle); - return Color.FromArgb(alpha, red, green, blue); + _keyColors[key] = keyColor; + return keyColor; } - /// - /// Retrieves a color of the specified DeviceKeys key from the bitmap - /// - /// Key - /// Color of the Key - public Color Get(Devices.DeviceKeys key) + public Graphics GetGraphics() //TODO deprecate { - try - { - BitmapRectangle keymaping = Effects.GetBitmappingFromDeviceKey(key); - - if (keymaping.IsEmpty && key == Devices.DeviceKeys.Peripheral) - { - return peripheral; - } - else - { - if (keymaping.IsEmpty) - return Color.FromArgb(0, 0, 0); - - return Utils.BitmapUtils.GetRegionColor(colormap, keymaping.Rectangle); - } - } - catch (Exception exc) - { - Global.logger.Error("EffectLayer.Get() Exception: " + exc); - - return Color.FromArgb(0, 0, 0); - } + Invalidate(); + return Graphics.FromImage(_colormap); } - /// - /// Get an instance of Drawing.Graphics, to allow drawing on the bitmap. - /// - /// Graphics instance - public Graphics GetGraphics() + public Bitmap GetBitmap() { - return Graphics.FromImage(colormap); + return _colormap; } - /// - /// Get the current layer bitmap. - /// - /// Layer Bitmap - public Bitmap GetBitmap() + public void Add(EffectLayer other) { - return colormap; + var _ = this + other; } /// @@ -710,21 +731,20 @@ public Bitmap GetBitmap() /// /// Left Hand Side EffectLayer /// Right Hand Side EffectLayer - /// A new instance of EffectLayer, which is a combination of two passed EffectLayers + /// Left hand side EffectLayer, which is a combination of two passed EffectLayers public static EffectLayer operator +(EffectLayer lhs, EffectLayer rhs) { - EffectLayer added = new EffectLayer(lhs); - added.name += " + " + rhs.name; - - using (Graphics g = added.GetGraphics()) + using (var g = lhs.GetGraphics()) { - lock (rhs.bufferLock) - g.DrawImage(rhs.colormap, 0, 0); + g.CompositingMode = CompositingMode.SourceOver; + g.CompositingQuality = CompositingQuality.HighSpeed; + g.SmoothingMode = SmoothingMode.None; + g.InterpolationMode = InterpolationMode.Low; + g.FillRectangle(rhs.TextureBrush, rhs.Dimension); } + lhs.Invalidate(); - added.peripheral = Utils.ColorUtils.AddColors(lhs.peripheral, rhs.peripheral); - - return added; + return lhs; } /// @@ -735,282 +755,280 @@ public Bitmap GetBitmap() /// The passed instance of EffectLayer with adjustments public static EffectLayer operator *(EffectLayer layer, double value) { - BitmapData srcData = layer.colormap.LockBits( - new Rectangle(0, 0, layer.colormap.Width, layer.colormap.Height), - ImageLockMode.ReadWrite, - PixelFormat.Format32bppArgb); - - int stride = srcData.Stride; - - IntPtr Scan0 = srcData.Scan0; - - int width = layer.colormap.Width; - int height = layer.colormap.Height; - - unsafe + if (!ColorUtils.NearlyEqual(layer._opacity,(float)value, 0.0001f)) { - byte* p = (byte*)(void*)Scan0; - - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - //p[(y * stride) + x * 4] = Utils.ColorUtils.ColorByteMultiplication(p[(y * stride) + x * 4], value); - //p[(y * stride) + x * 4 + 1] = Utils.ColorUtils.ColorByteMultiplication(p[(y * stride) + x * 4 + 1], value); - //p[(y * stride) + x * 4 + 2] = Utils.ColorUtils.ColorByteMultiplication(p[(y * stride) + x * 4 + 2], value); - p[(y * stride) + x * 4 + 3] = Utils.ColorUtils.ColorByteMultiplication(p[(y * stride) + x * 4 + 3], value); - } - } + layer._opacity = (float) value; + layer.Invalidate(); } - - layer.colormap.UnlockBits(srcData); - - layer.peripheral = Utils.ColorUtils.MultiplyColorByScalar(layer.peripheral, value); - return layer; } + private KeySequenceType _previousSequenceType; + /// /// Draws a percent effect on the layer bitmap using a KeySequence with solid colors. /// /// The foreground color, used as a "Progress bar color" - /// The background color - /// The sequence of keys that the percent effect will be drawn on /// The current progress value /// The maxiumum progress value - /// The percent effect type - /// Itself - public EffectLayer PercentEffect(Color foregroundColor, Color backgroundColor, Settings.KeySequence sequence, double value, double total = 1.0D, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false, bool blink_background = false) + public void PercentEffect(Color foregroundColor, Color backgroundColor, KeySequence sequence, double value, + double total = 1.0D, PercentEffectType percentEffectType = PercentEffectType.Progressive, + double flashPast = 0.0, bool flashReversed = false, bool blinkBackground = false) { + if (_previousSequenceType != sequence.type) + { + Clear(); + _previousSequenceType = sequence.type; + } if (sequence.type == KeySequenceType.Sequence) - PercentEffect(foregroundColor, backgroundColor, sequence.keys.ToArray(), value, total, percentEffectType, flash_past, flash_reversed, blink_background); + PercentEffect(foregroundColor, backgroundColor, sequence.keys, value, total, percentEffectType, flashPast, flashReversed, blinkBackground); else - PercentEffect(foregroundColor, backgroundColor, sequence.freeform, value, total, percentEffectType, flash_past, flash_reversed, blink_background); - - return this; + PercentEffect(foregroundColor, backgroundColor, sequence.freeform, value, total, percentEffectType, flashPast, flashReversed, blinkBackground); } /// /// Draws a percent effect on the layer bitmap using a KeySequence and a ColorSpectrum. /// /// The ColorSpectrum to be used as a "Progress bar" - /// The sequence of keys that the percent effect will be drawn on /// The current progress value /// The maxiumum progress value - /// The percent effect type - /// Itself - public EffectLayer PercentEffect(ColorSpectrum spectrum, Settings.KeySequence sequence, double value, double total = 1.0D, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false, bool blink_background = false) + public void PercentEffect(ColorSpectrum spectrum, KeySequence sequence, double value, double total = 1.0D, + PercentEffectType percentEffectType = PercentEffectType.Progressive, double flashPast = 0.0, + bool flashReversed = false) { + if (_previousSequenceType != sequence.type) + { + Clear(); + _previousSequenceType = sequence.type; + } if (sequence.type == KeySequenceType.Sequence) - PercentEffect(spectrum, sequence.keys.ToArray(), value, total, percentEffectType, flash_past, flash_reversed); + PercentEffect(spectrum, sequence.keys.ToArray(), value, total, percentEffectType, flashPast, flashReversed); else - PercentEffect(spectrum, sequence.freeform, value, total, percentEffectType, flash_past, flash_reversed); - - return this; + PercentEffect(spectrum, sequence.freeform, value, total, percentEffectType, flashPast, flashReversed); } /// /// Draws a percent effect on the layer bitmap using an array of DeviceKeys keys and solid colors. /// /// The foreground color, used as a "Progress bar color" - /// The background color - /// The array of keys that the percent effect will be drawn on /// The current progress value /// The maxiumum progress value - /// The percent effect type - /// Itself - public EffectLayer PercentEffect(Color foregroundColor, Color backgroundColor, Devices.DeviceKeys[] keys, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false, bool blink_background = false) + private void PercentEffect(Color foregroundColor, Color backgroundColor, IReadOnlyList keys, double value, + double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flashPast = 0.0, + bool flashReversed = false, bool blinkBackground = false) { - double progress_total = value / total; - if (progress_total < 0.0) - progress_total = 0.0; - else if (progress_total > 1.0) - progress_total = 1.0; + var progressTotal = value / total; + if (progressTotal < 0.0) + progressTotal = 0.0; + else if (progressTotal > 1.0) + progressTotal = 1.0; - double progress = progress_total * keys.Count(); + var progress = progressTotal * keys.Count; - if (flash_past > 0.0) + if (flashPast > 0.0) { - if ((flash_reversed && progress_total >= flash_past) || (!flash_reversed && progress_total <= flash_past)) + if ((flashReversed && progressTotal >= flashPast) || (!flashReversed && progressTotal <= flashPast)) { - if (blink_background) - backgroundColor = Utils.ColorUtils.BlendColors(backgroundColor, Color.FromArgb(0, 0, 0, 0), Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI)); + var percent = Math.Sin(Time.GetMillisecondsSinceEpoch() % 1000.0D / 1000.0D * Math.PI); + if (blinkBackground) + backgroundColor = ColorUtils.BlendColors(backgroundColor, Color.Empty, percent); else - foregroundColor = Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI)); + foregroundColor = ColorUtils.BlendColors(backgroundColor, foregroundColor, percent); } } - if ((percentEffectType == PercentEffectType.Highest_Key || percentEffectType == PercentEffectType.Highest_Key_Blend) && keys.Length > 0) { - var activeKey = (int)Math.Ceiling(value / (total / keys.Length)) - 1; - var col = percentEffectType == PercentEffectType.Highest_Key ? foregroundColor : Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, progress_total); - SetOneKey(keys[Math.Min(Math.Max(activeKey, 0), keys.Length - 1)], col); + if (percentEffectType is PercentEffectType.Highest_Key or PercentEffectType.Highest_Key_Blend && keys.Count > 0) + { + var activeKey = (int)Math.Ceiling(value / (total / keys.Count)) - 1; + var col = percentEffectType == PercentEffectType.Highest_Key ? + foregroundColor : ColorUtils.BlendColors(backgroundColor, foregroundColor, progressTotal); + SetOneKey(keys[Math.Min(Math.Max(activeKey, 0), keys.Count - 1)], col); - } else { - for (int i = 0; i < keys.Count(); i++) + } + else + { + for (var i = 0; i < keys.Count; i++) { - Devices.DeviceKeys current_key = keys[i]; + var currentKey = keys[i]; switch (percentEffectType) { - case (PercentEffectType.AllAtOnce): - SetOneKey(current_key, Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, progress_total)); + case PercentEffectType.AllAtOnce: + SetOneKey(currentKey, ColorUtils.BlendColors(backgroundColor, foregroundColor, progressTotal)); break; - case (PercentEffectType.Progressive_Gradual): + case PercentEffectType.Progressive_Gradual: if (i == (int)progress) { - double percent = (double)progress - i; - SetOneKey(current_key, Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, percent)); + var percent = progress - i; + SetOneKey(currentKey, ColorUtils.BlendColors(backgroundColor, foregroundColor, percent)); } else if (i < (int)progress) - SetOneKey(current_key, foregroundColor); + SetOneKey(currentKey, foregroundColor); else - SetOneKey(current_key, backgroundColor); + SetOneKey(currentKey, backgroundColor); break; default: - if (i < (int)progress) - SetOneKey(current_key, foregroundColor); - else - SetOneKey(current_key, backgroundColor); + SetOneKey(currentKey, i < (int) progress ? foregroundColor : backgroundColor); break; } } } - - return this; } /// /// Draws a percent effect on the layer bitmap using DeviceKeys keys and a ColorSpectrum. /// /// The ColorSpectrum to be used as a "Progress bar" - /// The array of keys that the percent effect will be drawn on /// The current progress value /// The maxiumum progress value - /// The percent effect type - /// Itself - public EffectLayer PercentEffect(ColorSpectrum spectrum, Devices.DeviceKeys[] keys, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false) + private void PercentEffect(ColorSpectrum spectrum, DeviceKey[] keys, double value, double total, + PercentEffectType percentEffectType = PercentEffectType.Progressive, double flashPast = 0.0, + bool flashReversed = false) { - double progress_total = value / total; - if (progress_total < 0.0) - progress_total = 0.0; - else if (progress_total > 1.0) - progress_total = 1.0; + var progressTotal = value / total; + if (progressTotal < 0.0) + progressTotal = 0.0; + else if (progressTotal > 1.0) + progressTotal = 1.0; - double progress = progress_total * keys.Count(); + var progress = progressTotal * keys.Length; - double flash_amount = 1.0; + var flashAmount = 1.0; - if (flash_past > 0.0) + if (flashPast > 0.0) { - if ((flash_reversed && progress_total >= flash_past) || (!flash_reversed && progress_total <= flash_past)) + if ((flashReversed && progressTotal >= flashPast) || (!flashReversed && progressTotal <= flashPast)) { - flash_amount = Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI); + flashAmount = Math.Sin(Time.GetMillisecondsSinceEpoch() % 1000.0D / 1000.0D * Math.PI); } } - for (int i = 0; i < keys.Count(); i++) + switch (percentEffectType) { - Devices.DeviceKeys current_key = keys[i]; - - switch (percentEffectType) - { - case (PercentEffectType.AllAtOnce): - SetOneKey(current_key, spectrum.GetColorAt((float)progress_total, 1.0f, flash_amount)); - break; - case (PercentEffectType.Progressive_Gradual): + case PercentEffectType.AllAtOnce: + foreach (var currentKey in keys) + { + SetOneKey(currentKey, spectrum.GetColorAt((float)progressTotal, 1.0f, flashAmount)); + } + break; + case PercentEffectType.Progressive_Gradual: + Clear(); + for (var i = 0; i < keys.Length; i++) + { + var currentKey = keys[i]; if (i == (int)progress) { - double percent = (double)progress - i; - SetOneKey(current_key, - Utils.ColorUtils.MultiplyColorByScalar(spectrum.GetColorAt((float)i / (float)(keys.Count() - 1), 1.0f, flash_amount), percent) - ); + var percent = progress - i; + SetOneKey( + currentKey, + ColorUtils.MultiplyColorByScalar(spectrum.GetColorAt((float)i / (keys.Length - 1), 1.0f, flashAmount), percent) + ); } else if (i < (int)progress) - SetOneKey(current_key, spectrum.GetColorAt((float)i / (float)(keys.Count() - 1), 1.0f, flash_amount)); - break; - default: + SetOneKey(currentKey, spectrum.GetColorAt((float)i / (keys.Length - 1), 1.0f, flashAmount)); + } + break; + default: + for (var i = 0; i < keys.Length; i++) + { + var currentKey = keys[i]; if (i < (int)progress) - SetOneKey(current_key, spectrum.GetColorAt((float)i / (float)(keys.Count() - 1), 1.0f, flash_amount)); - break; - } + SetOneKey(currentKey, spectrum.GetColorAt((float)i / (keys.Length - 1), 1.0f, flashAmount)); + } + break; } - - return this; } /// /// Draws a percent effect on the layer bitmap using a FreeFormObject and solid colors. /// /// The foreground color, used as a "Progress bar color" - /// The background color /// The FreeFormObject that the progress effect will be drawn on /// The current progress value /// The maxiumum progress value - /// The percent effect type - /// Itself - public EffectLayer PercentEffect(Color foregroundColor, Color backgroundColor, Settings.FreeFormObject freeform, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false, bool blink_background = false) + private void PercentEffect(Color foregroundColor, Color backgroundColor, FreeFormObject freeform, double value, + double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flashPast = 0.0, + bool flashReversed = false, bool blinkBackground = false) { - double progress_total = value / total; - if (progress_total < 0.0 || Double.IsNaN(progress_total)) - progress_total = 0.0; - else if (progress_total > 1.0) - progress_total = 1.0; - - if (flash_past > 0.0) + var progressTotal = value / total; + switch (progressTotal) { - if ((flash_reversed && progress_total >= flash_past) || (!flash_reversed && progress_total <= flash_past)) - { - if(!blink_background) - foregroundColor = Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI)); - if(blink_background) - backgroundColor = Utils.ColorUtils.BlendColors(backgroundColor, Color.FromArgb(0, 0, 0, 0), Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI)); - } + case < 0.0: + case double.NaN: + progressTotal = 0.0; + break; + case > 1.0: + progressTotal = 1.0; + break; } - using (Graphics g = Graphics.FromImage(colormap)) + if (flashPast > 0.0 && ((flashReversed && progressTotal >= flashPast) || (!flashReversed && progressTotal <= flashPast))) { - float x_pos = (float)Math.Round((freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width); - float y_pos = (float)Math.Round((freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height); - float width = (float)(freeform.Width * Effects.editor_to_canvas_width); - float height = (float)(freeform.Height * Effects.editor_to_canvas_height); - - if (width < 3) width = 3; - if (height < 3) height = 3; - - - if (percentEffectType == PercentEffectType.AllAtOnce) + var percent = Math.Sin(Time.GetMillisecondsSinceEpoch() % 1000.0D / 1000.0D * Math.PI); + switch (blinkBackground) { - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height); - - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); + case false: + foregroundColor = ColorUtils.BlendColors(backgroundColor, foregroundColor, percent); + break; + case true: + backgroundColor = ColorUtils.BlendColors(backgroundColor, Color.Empty, percent); + break; + } + } - Matrix myMatrix = new Matrix(); - myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); + var xPos = (float)Math.Round((freeform.X + Effects.grid_baseline_x) * Effects.EditorToCanvasWidth); + var yPos = (float)Math.Round((freeform.Y + Effects.grid_baseline_y) * Effects.EditorToCanvasHeight); + var width = freeform.Width * Effects.EditorToCanvasWidth; + var height = freeform.Height * Effects.EditorToCanvasHeight; - g.Transform = myMatrix; - g.FillRectangle(new SolidBrush(Utils.ColorUtils.BlendColors(backgroundColor, foregroundColor, progress_total)), rect); - } - else - { - double progress = progress_total * width; + if (width < 3) width = 3; + if (height < 3) height = 3; + + using var g = Graphics.FromImage(_colormap); + if (percentEffectType == PercentEffectType.AllAtOnce) + { + var rect = new RectangleF(xPos, yPos, width, height); - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)progress, (int)height); + var rotatePoint = new PointF(xPos + width / 2.0f, yPos + height / 2.0f); - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); + var myMatrix = new Matrix(); + myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); - Matrix myMatrix = new Matrix(); - myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); + g.Transform = myMatrix; + g.FillRectangle(new SolidBrush(ColorUtils.BlendColors(backgroundColor, foregroundColor, progressTotal)), rect); + Invalidate(); + } + else + { + var progress = progressTotal * width; + var rect = new RectangleF(xPos, yPos, (float)progress, height); + var rotatePoint = new PointF(xPos + width / 2.0f, yPos + height / 2.0f); - g.Transform = myMatrix; + var myMatrix = new Matrix(); + myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); - Rectangle rect_rest = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height); - g.FillRectangle(new SolidBrush(backgroundColor), rect_rest); + g.Transform = myMatrix; - g.FillRectangle(new SolidBrush(foregroundColor), rect); - } + var rectRest = new RectangleF(xPos, yPos, width, height); + g.FillRectangle(new SolidBrush(backgroundColor), rectRest); + g.FillRectangle(new SolidBrush(foregroundColor), rect); + Invalidate(); } + } - return this; + public void Invalidate() + { + _needsRender = true; + _keyColors.Clear(); + } + private void InvalidateColorMap(object sender, EventArgs args) + { + _colormap?.Dispose(); + _colormap = new Bitmap(Effects.CanvasWidth, Effects.CanvasHeight); + _ksChanged = true; + Dimension.Height = Effects.CanvasHeight; + Dimension.Width = Effects.CanvasWidth; + Invalidate(); } /// @@ -1020,281 +1038,93 @@ public EffectLayer PercentEffect(Color foregroundColor, Color backgroundColor, S /// The FreeFormObject that the progress effect will be drawn on /// The current progress value /// The maxiumum progress value - /// The percent effect type - /// Itself - public EffectLayer PercentEffect(ColorSpectrum spectrum, Settings.FreeFormObject freeform, double value, double total, PercentEffectType percentEffectType = PercentEffectType.Progressive, double flash_past = 0.0, bool flash_reversed = false) + private void PercentEffect(ColorSpectrum spectrum, FreeFormObject freeform, double value, double total, + PercentEffectType percentEffectType = PercentEffectType.Progressive, double flashPast = 0.0, + bool flashReversed = false) { - double progress_total = value / total; - if (progress_total < 0.0) - progress_total = 0.0; - else if (progress_total > 1.0) - progress_total = 1.0; + var progressTotal = MathUtils.Clamp(value / total, 0, 1); - double flash_amount = 1.0; + var flashAmount = 1.0; - if (flash_past > 0.0) + if (flashPast > 0.0) { - if ((flash_reversed && progress_total >= flash_past) || (!flash_reversed && progress_total <= flash_past)) + if ((flashReversed && progressTotal >= flashPast) || (!flashReversed && progressTotal <= flashPast)) { - flash_amount = Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() % 1000.0D) / 1000.0D * Math.PI); + flashAmount = Math.Sin(Time.GetMillisecondsSinceEpoch() % 1000.0D / 1000.0D * Math.PI); } } - using (Graphics g = Graphics.FromImage(colormap)) - { - float x_pos = (float)Math.Round((freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width); - float y_pos = (float)Math.Round((freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height); - float width = (float)(freeform.Width * Effects.editor_to_canvas_width); - float height = (float)(freeform.Height * Effects.editor_to_canvas_height); - - if (width < 3) width = 3; - if (height < 3) height = 3; - - if (percentEffectType == PercentEffectType.AllAtOnce) - { - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height); - - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); - - Matrix myMatrix = new Matrix(); - myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); - - g.Transform = myMatrix; - g.FillRectangle(new SolidBrush(spectrum.GetColorAt((float)progress_total, 1.0f, flash_amount)), rect); - } - else - { - double progress = progress_total * width; - - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)progress, (int)height); - - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); - - Matrix myMatrix = new Matrix(); - myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); + var xPos = (float)Math.Round((freeform.X + Effects.grid_baseline_x) * Effects.EditorToCanvasWidth); + var yPos = (float)Math.Round((freeform.Y + Effects.grid_baseline_y) * Effects.EditorToCanvasHeight); + var width = freeform.Width * Effects.EditorToCanvasWidth; + var height = freeform.Height * Effects.EditorToCanvasHeight; - g.Transform = myMatrix; - LinearGradientBrush brush = spectrum.ToLinearGradient(width, 0, x_pos, 0, flash_amount); - brush.WrapMode = WrapMode.Tile; - g.FillRectangle(brush, rect); - } - - return this; - } - } + if (width < 3) width = 3; + if (height < 3) height = 3; - /// - /// Draws a FreeFormObject on the layer bitmap using a specified color. - /// - /// The FreeFormObject that will be filled with a color - /// The color to be used - /// Itself - public EffectLayer DrawFreeForm(Settings.FreeFormObject freeform, Color color) - { - using (Graphics g = Graphics.FromImage(colormap)) + using var g = Graphics.FromImage(_colormap); + if (percentEffectType == PercentEffectType.AllAtOnce) { - float x_pos = (float)Math.Round((freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width); - float y_pos = (float)Math.Round((freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height); - float width = (float)Math.Round(freeform.Width * Effects.editor_to_canvas_width); - float height = (float)Math.Round(freeform.Height * Effects.editor_to_canvas_height); - - if (width < 3) width = 3; - if (height < 3) height = 3; + var rect = new RectangleF(xPos, yPos, width, height); - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height); + var rotatePoint = new PointF(xPos + width / 2.0f, yPos + height / 2.0f); - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); - - Matrix myMatrix = new Matrix(); + var myMatrix = new Matrix(); myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); g.Transform = myMatrix; - g.FillRectangle(new SolidBrush(color), rect); + g.FillRectangle(new SolidBrush(spectrum.GetColorAt((float)progressTotal, 1.0f, flashAmount)), rect); } - - return this; - } - - /// - /// Draws ColorZones on the layer bitmap. - /// - /// An array of ColorZones - /// Itself - public EffectLayer DrawColorZones(ColorZone[] colorzones) - { - foreach (ColorZone cz in colorzones.Reverse()) + else { - if (cz.keysequence.type == KeySequenceType.Sequence) - { - foreach (var key in cz.keysequence.keys) - Set(key, cz.color); + var progress = progressTotal * width; - if (cz.effect != LayerEffects.None) - { - EffectLayer temp_layer = new EffectLayer("Color Zone Effect", cz.effect, cz.effect_config); - - foreach (var key in cz.keysequence.keys) - Set(key, Utils.ColorUtils.AddColors(Get(key), temp_layer.Get(key))); - - temp_layer.Dispose(); - } - } - else - { - if (cz.effect == LayerEffects.None) - { - DrawFreeForm(cz.keysequence.freeform, cz.color); - } - else - { - float x_pos = (float)Math.Round((cz.keysequence.freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width); - float y_pos = (float)Math.Round((cz.keysequence.freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height); - float width = (float)Math.Round((double)(cz.keysequence.freeform.Width * Effects.editor_to_canvas_width)); - float height = (float)Math.Round((double)(cz.keysequence.freeform.Height * Effects.editor_to_canvas_height)); - - if (width < 3) width = 3; - if (height < 3) height = 3; + var rect = new RectangleF(xPos, yPos, (float)progress, height); - Rectangle rect = new Rectangle((int)x_pos, (int)y_pos, (int)width, (int)height); + var rotatePoint = new PointF(xPos + width / 2.0f, yPos + height / 2.0f); - EffectLayer temp_layer = new EffectLayer("Color Zone Effect", cz.effect, cz.effect_config, rect); - - using (Graphics g = Graphics.FromImage(colormap)) - { - PointF rotatePoint = new PointF(x_pos + (width / 2.0f), y_pos + (height / 2.0f)); - - Matrix myMatrix = new Matrix(); - myMatrix.RotateAt(cz.keysequence.freeform.Angle, rotatePoint, MatrixOrder.Append); - - g.Transform = myMatrix; - g.DrawImage(temp_layer.GetBitmap(), rect, rect, GraphicsUnit.Pixel); - } + var myMatrix = new Matrix(); + myMatrix.RotateAt(freeform.Angle, rotatePoint, MatrixOrder.Append); - temp_layer.Dispose(); - } - } + g.Transform = myMatrix; + var brush = spectrum.ToLinearGradient(width, 0, xPos, 0, flashAmount); + brush.WrapMode = WrapMode.Tile; + g.FillRectangle(brush, rect); } - - return this; + Invalidate(); } /// /// Excludes provided sequence from the layer (Applies a mask) /// /// The mask to be applied - /// Itself - public EffectLayer Exclude(KeySequence sequence) + public void Exclude(KeySequence sequence) { - //Create draw alpha mask - EffectLayer _alpha_mask = new EffectLayer(this.name + " - Alpha Mask", Color.Transparent); - _alpha_mask.Set(sequence, Color.Black); - - //Apply alpha mask - BitmapData srcData_alpha = _alpha_mask.colormap.LockBits( - new Rectangle(0, 0, _alpha_mask.colormap.Width, _alpha_mask.colormap.Height), - ImageLockMode.ReadWrite, - PixelFormat.Format32bppArgb); - - int alpha_mask_stride = srcData_alpha.Stride; - IntPtr alpha_mask_Scan0 = srcData_alpha.Scan0; - - - BitmapData srcData = colormap.LockBits( - new Rectangle(0, 0, colormap.Width, colormap.Height), - ImageLockMode.ReadWrite, - PixelFormat.Format32bppArgb); - - int stride = srcData.Stride; - - IntPtr Scan0 = srcData.Scan0; - - int width = colormap.Width; - int height = colormap.Height; - - unsafe + var gp = new GraphicsPath(); + sequence.keys.ForEach(k => { - byte* p_alpha = (byte*)(void*)alpha_mask_Scan0; - byte* p = (byte*)(void*)Scan0; - - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - byte mask_alpha = p_alpha[(y * alpha_mask_stride) + x * 4 + 3]; - if (mask_alpha != 0) - p[(y * stride) + x * 4 + 3] = (byte)(255 - mask_alpha); - } - } - } - - _alpha_mask.colormap.UnlockBits(srcData_alpha); - colormap.UnlockBits(srcData); - - return this; + var keyBounds = Effects.GetBitmappingFromDeviceKey(k); + gp.AddRectangle(keyBounds.Rectangle); //Overlapping additons remove that shape + }); + + using var g = Graphics.FromImage(_colormap); + g.SetClip(gp); + g.Clear(Color.Transparent); + Invalidate(); } /// /// Inlcudes provided sequence from the layer (Applies a mask) /// - /// The mask to be applied - /// Itself - public EffectLayer OnlyInclude(KeySequence sequence) + public void OnlyInclude(KeySequence sequence) { - //Create draw alpha mask - EffectLayer _alpha_mask = new EffectLayer(this.name + " - Alpha Mask", Color.Transparent); - _alpha_mask.Set(sequence, Color.Black); - - //Apply alpha mask - BitmapData srcData_alpha = _alpha_mask.colormap.LockBits( - new Rectangle(0, 0, _alpha_mask.colormap.Width, _alpha_mask.colormap.Height), - ImageLockMode.ReadWrite, - PixelFormat.Format32bppArgb); - - int alpha_mask_stride = srcData_alpha.Stride; - IntPtr alpha_mask_Scan0 = srcData_alpha.Scan0; - - - BitmapData srcData = colormap.LockBits( - new Rectangle(0, 0, colormap.Width, colormap.Height), - ImageLockMode.ReadWrite, - PixelFormat.Format32bppArgb); - - int stride = srcData.Stride; - - IntPtr Scan0 = srcData.Scan0; - - int width = colormap.Width; - int height = colormap.Height; - - unsafe - { - byte* p_alpha = (byte*)(void*)alpha_mask_Scan0; - byte* p = (byte*)(void*)Scan0; - - for (int y = 0; y < height; y++) - { - for (int x = 0; x < width; x++) - { - byte mask_alpha = p_alpha[(y * alpha_mask_stride) + x * 4 + 3]; - - p[(y * stride) + x * 4 + 3] = (byte)(mask_alpha * (p[(y * stride) + x * 4 + 3] / 255.0f)); - } - } - } - - _alpha_mask.colormap.UnlockBits(srcData_alpha); - colormap.UnlockBits(srcData); - - return this; + var exclusionPath = GetExclusionPath(sequence); + using var g = Graphics.FromImage(_colormap); + g.SetClip(exclusionPath); + g.Clear(Color.Transparent); + Invalidate(); } - /// - /// Returns the layer name - /// - /// Layer name - public override string ToString() - { - return name; - } + public override string ToString() => _name; } } diff --git a/Project-Aurora/Project-Aurora/EffectsEngine/Effects.cs b/Project-Aurora/Project-Aurora/EffectsEngine/Effects.cs index d396ebe5c..bcd616d05 100755 --- a/Project-Aurora/Project-Aurora/EffectsEngine/Effects.cs +++ b/Project-Aurora/Project-Aurora/EffectsEngine/Effects.cs @@ -1,77 +1,37 @@ -using Aurora.EffectsEngine; -using System; +using System; +using Aurora.EffectsEngine; using System.Collections.Generic; using System.Linq; using Aurora.Devices; using System.Drawing; using System.Timers; +using Aurora.Settings; namespace Aurora { public class BitmapRectangle { - private bool _isvalid = false; - public bool IsValid { get { return _isvalid; } } + public static readonly BitmapRectangle EmptyRectangle = new(); - private Rectangle _rectangle; - public Rectangle Rectangle { get { return _rectangle; } } + private readonly bool _isvalid; + public bool IsValid => _isvalid; - public bool IsEmpty - { - get - { - if (_rectangle.IsEmpty || _rectangle.Height == 0 || _rectangle.Width == 0 || !_isvalid) - return true; + private readonly Rectangle _rectangle; + public Rectangle Rectangle => _rectangle; - return false; - } - } + public bool IsEmpty => _rectangle.IsEmpty || !_isvalid; - public int Bottom { get { return _rectangle.Bottom; } } - public int Top { get { return _rectangle.Top; } } - public int Left { get { return _rectangle.Left; } } - public int Right { get { return _rectangle.Right; } } - public int Height { get { return _rectangle.Height; } } - public int Width { get { return _rectangle.Width; } } - public int Area { get { return _rectangle.Width * _rectangle.Height; } } + public int Bottom => _rectangle.Bottom; + public int Top => _rectangle.Top; + public int Left => _rectangle.Left; + public int Right => _rectangle.Right; + public int Height => _rectangle.Height; + public int Width => _rectangle.Width; - public PointF TopLeft - { - get - { - return new PointF(Top, Left); - } - } - public PointF TopRight - { - get - { - return new PointF(Top, Right); - } - } - public PointF BottomLeft - { - get - { - return new PointF(Bottom, Left); - } - } - public PointF BottomRight - { - get - { - return new PointF(Bottom, Right); - } - } - public PointF Center - { - get - { - return new PointF(_rectangle.Left + _rectangle.Width / 2.0f, _rectangle.Top + _rectangle.Height / 2.0f); - } - } + private PointF _center; + public PointF Center => _center; - public BitmapRectangle() + private BitmapRectangle() { } @@ -79,12 +39,14 @@ public BitmapRectangle() public BitmapRectangle(int X, int Y, int Width, int Height) { _rectangle = new Rectangle(X, Y, Width, Height); + _center = new PointF(_rectangle.Left + _rectangle.Width / 2.0f, _rectangle.Top + _rectangle.Height / 2.0f); _isvalid = true; } public BitmapRectangle(Rectangle region) { _rectangle = new Rectangle(region.Location, region.Size); + _center = new PointF(_rectangle.Left + _rectangle.Width / 2.0f, _rectangle.Top + _rectangle.Height / 2.0f); _isvalid = true; } @@ -99,8 +61,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((BitmapRectangle)obj); + return obj.GetType() == GetType() && Equals((BitmapRectangle)obj); } public bool Equals(BitmapRectangle p) @@ -119,290 +80,197 @@ public override int GetHashCode() public delegate void NewLayerRendered(Bitmap bitmap); - public class Effects + public class CanvasChangedArgs: EventArgs { - int filenamecount = 0; - public bool isrecording = false; - Bitmap previousframe = null; - long nextsecond = 0L; - long currentsecond = 0L; - int renderedframes = 0; - long render_time = 0L; - Timer recordTimer = new Timer(1000D / 15D); // 30fps - int pushedframes = 0; - Timer fpsDebugTimer = new Timer(1000D); - - public static Devices.DeviceKeys[] possible_peripheral_keys = { - Devices.DeviceKeys.Peripheral, - Devices.DeviceKeys.Peripheral_FrontLight, - Devices.DeviceKeys.Peripheral_ScrollWheel, - Devices.DeviceKeys.Peripheral_Logo - }; - - Bitmap _forcedFrame = null; - - - private static object bitmap_lock = new object(); - - public event NewLayerRendered NewLayerRender = delegate { }; - - public static int canvas_width = 1; - public static int canvas_height = 1; + public EffectLayer EffectLayer { get; } - public static float grid_baseline_x = 0.0f; - public static float grid_baseline_y = 0.0f; - public static float grid_width = 1.0f; - public static float grid_height = 1.0f; - - public static float canvas_width_center + public CanvasChangedArgs(EffectLayer effectLayer) { - get - { - return canvas_width / 2.0f; - } + EffectLayer = effectLayer; } + } - public static float canvas_height_center - { - get - { - return canvas_height / 2.0f; - } - } + class EnumHashGetter: IEqualityComparer + { + public static EnumHashGetter Instance = new(); - public static float editor_to_canvas_width + private EnumHashGetter() { - get - { - return canvas_width / grid_width; - } } - public static float editor_to_canvas_height + public bool Equals(Enum x, Enum y) { - get - { - return canvas_height / grid_height; - } + return object.Equals(x, y); } - public static int canvas_biggest + public int GetHashCode(Enum obj) { - get - { - return Effects.canvas_width > Effects.canvas_height ? Effects.canvas_width : Effects.canvas_height; - } + return Convert.ToInt32(obj); } + } - /// - /// Creates a new FreeFormObject that perfectly occupies the entire canvas. - /// - public static Aurora.Settings.FreeFormObject WholeCanvasFreeForm => new Settings.FreeFormObject(-grid_baseline_x, -grid_baseline_y, grid_width, grid_height); + public class Effects + { + private const int MaxDeviceId = (int)DeviceKeys.ADDITIONALLIGHT60; //Optimization: used to block dictionary resizing - private static Dictionary bitmap_map = new Dictionary(); + private int filenamecount; + private bool isrecording = false; + private Bitmap previousframe; + private long nextsecond; + private long currentsecond; + private long render_time = 0L; - private static Dictionary keyColors = new Dictionary(); + Bitmap _forcedFrame; - public Effects() - { - Devices.DeviceKeys[] allKeys = bitmap_map.Keys.ToArray(); + public event NewLayerRendered NewLayerRender = delegate { }; - foreach (Devices.DeviceKeys key in allKeys) + // ReSharper disable once EventNeverSubscribedTo.Global + public static event EventHandler CanvasChanged; + public static object CanvasChangedLock = new(); + + private static int _canvasWidth = 1; + public static int CanvasWidth + { + get => _canvasWidth; + private set { - keyColors.Add(key, Color.FromArgb(0, 0, 0)); + lock (CanvasChangedLock) + { + _canvasWidth = value; + CanvasChanged?.Invoke(null, null); + } } - - recordTimer.Elapsed += RecordTimer_Elapsed; - - fpsDebugTimer.Elapsed += FpsDebugTimer_Elapsed; } - - private void FpsDebugTimer_Elapsed(object sender, ElapsedEventArgs e) + private static int _canvasHeight = 1; + public static int CanvasHeight { - System.Diagnostics.Debug.WriteLine("fps = " + pushedframes); - pushedframes = 0; + get => _canvasHeight; + private set + { + lock (CanvasChangedLock) + { + _canvasHeight = value; + CanvasChanged?.Invoke(null, null); + } + } } - private void RecordTimer_Elapsed(object sender, ElapsedEventArgs e) - { - if (nextsecond == 0L) - nextsecond = currentsecond + 1000L; - - currentsecond += (long)recordTimer.Interval; + public static float grid_baseline_x = 0.0f; + public static float grid_baseline_y = 0.0f; + public static float grid_width = 1.0f; + public static float grid_height = 1.0f; - if (previousframe != null) - { - Bitmap tempbmp = new Bitmap(previousframe); + public static float CanvasWidthCenter => CanvasWidth / 2.0f; + public static float CanvasHeightCenter => CanvasHeight / 2.0f; + public static float EditorToCanvasWidth => CanvasWidth / grid_width; + public static float EditorToCanvasHeight => CanvasHeight / grid_height; + public static int CanvasBiggest => CanvasWidth > CanvasHeight ? CanvasWidth : CanvasHeight; - renderedframes++; - tempbmp.Save("renders\\" + (filenamecount++) + ".bmp", System.Drawing.Imaging.ImageFormat.Bmp); - } + /// + /// Creates a new FreeFormObject that perfectly occupies the entire canvas. + /// + public static Settings.FreeFormObject WholeCanvasFreeForm => new(-grid_baseline_x, -grid_baseline_y, grid_width, grid_height); - if (currentsecond >= nextsecond) - { - System.Diagnostics.Debug.WriteLine("fps = " + (double)renderedframes / ((double)(currentsecond - (nextsecond - 1000L)) / 1000D)); + private static Dictionary _bitmapMap = new(MaxDeviceId, EnumHashGetter.Instance as IEqualityComparer); - nextsecond = currentsecond + 1000L; - renderedframes = 0; - } + private readonly Dictionary _keyColors = new(MaxDeviceId, EnumHashGetter.Instance as IEqualityComparer); - } + private EffectLayer _background = new("Global Background", Color.Black); - public void ToggleRecord() + public Effects() { - isrecording = !isrecording; + var allKeys = _bitmapMap.Keys.ToArray(); - if (isrecording) - recordTimer.Start(); - else - recordTimer.Stop(); + foreach (var key in allKeys) + { + _keyColors.Add(key, Color.Black); + } } public void ForceImageRender(Bitmap forcedframe) { - _forcedFrame = forcedframe; + _forcedFrame?.Dispose(); + _forcedFrame = (Bitmap) forcedframe?.Clone(); } public void SetCanvasSize(int width, int height) { - canvas_width = width == 0 ? 1 : width; - canvas_height = height == 0 ? 1 : height; + CanvasWidth = width == 0 ? 1 : width; + CanvasHeight = height == 0 ? 1 : height; } - public static BitmapRectangle GetBitmappingFromDeviceKey(DeviceKeys key) + public static BitmapRectangle GetBitmappingFromDeviceKey(DeviceKey key) { - if (bitmap_map.ContainsKey(key)) - return bitmap_map[key]; - else - return new BitmapRectangle(); + return _bitmapMap.ContainsKey(key) ? _bitmapMap[_bitmapMap.Keys.First(k => k == key)] : BitmapRectangle.EmptyRectangle; } - public void SetBitmapping(Dictionary bitmap_map) + public void SetBitmapping(Dictionary bitmap_map) { - Effects.bitmap_map = bitmap_map; + _bitmapMap = bitmap_map; } - + + private readonly SolidBrush _keyboardDarknessBrush = new(Color.Empty); + private readonly SolidBrush _blackBrush = new(Color.Black); public void PushFrame(EffectFrame frame) { - var watch = System.Diagnostics.Stopwatch.StartNew(); - - lock (bitmap_lock) - { - EffectLayer background = new EffectLayer("Global Background", Color.FromArgb(0, 0, 0)); - - EffectLayer[] over_layers_array = frame.GetOverlayLayers().ToArray(); - EffectLayer[] layers_array = frame.GetLayers().ToArray(); - - foreach (EffectLayer layer in layers_array) - background += layer; - - foreach (EffectLayer layer in over_layers_array) - background += layer; - - //Apply Brightness - Dictionary peripehralColors = new Dictionary(); - - foreach (Devices.DeviceKeys key in possible_peripheral_keys) - { - if(!peripehralColors.ContainsKey(key)) - peripehralColors.Add(key, background.Get(key)); - } - - background.Fill(Color.FromArgb((int)(255.0f * (1.0f - Global.Configuration.KeyboardBrightness)), Color.Black)); - - foreach (Devices.DeviceKeys key in possible_peripheral_keys) - background.Set(key, Utils.ColorUtils.BlendColors(peripehralColors[key], Color.Black, (1.0f - Global.Configuration.PeripheralBrightness))); - - - //if (Global.Configuration.UseVolumeAsBrightness) - background *= Global.Configuration.GlobalBrightness; - - if (_forcedFrame != null) - { - using (Graphics g = background.GetGraphics()) - { - g.Clear(Color.Black); - - g.DrawImage(_forcedFrame, 0, 0, canvas_width, canvas_height); - } - } - - Dictionary keyColors = new Dictionary(); - Devices.DeviceKeys[] allKeys = bitmap_map.Keys.ToArray(); + _background.Fill(_blackBrush); - foreach (Devices.DeviceKeys key in allKeys) - keyColors[key] = background.Get(key); + var overLayersArray = frame.GetOverlayLayers(); + var layersArray = frame.GetLayers(); - Effects.keyColors = new Dictionary(keyColors); + foreach (var layer in layersArray) + _background.Add(layer); + foreach (var layer in overLayersArray) + _background.Add(layer); - pushedframes++; + //Apply Brightness + var keyboardDarkness = 1.0f - Global.Configuration.KeyboardBrightness * Global.Configuration.GlobalBrightness; + _keyboardDarknessBrush.Color = Color.FromArgb((int) (255.0f * keyboardDarkness), Color.Black); + _background.FillOver(_keyboardDarknessBrush); - DeviceColorComposition dcc = new DeviceColorComposition() - { - keyColors = new Dictionary(keyColors), - keyBitmap = background.GetBitmap() - }; + if (_forcedFrame != null) + { + using var g = _background.GetGraphics(); + g.Clear(Color.Black); + g.DrawImage(_forcedFrame, 0, 0, CanvasWidth, CanvasHeight); + } - Global.dev_manager.UpdateDevices(dcc); + var allKeys = _bitmapMap.Keys.ToArray(); - var hander = NewLayerRender; - if (hander != null) - hander.Invoke(background.GetBitmap()); + foreach (var key in allKeys) + _keyColors[key] = _background.Get(key); - if (isrecording) + //var dcc = new DeviceColorComposition + //{ + // keyColors = keyColors.ToDictionary(pair => pair.Key.Tag, pair => pair.Value), + // keyBitmap = _background.GetBitmap() + //}; + + Dictionary dccMap = new Dictionary(); + foreach (var item in _keyColors.Keys) + { + if (item.DeviceId == null) + continue; + if(!dccMap.ContainsKey(item.DeviceId.Value)) { - - EffectLayer pizelated_render = new EffectLayer(); - foreach (Devices.DeviceKeys key in allKeys) - { - pizelated_render.Set(key, background.Get(key)); - } - - using (Bitmap map = pizelated_render.GetBitmap()) + dccMap[item.DeviceId.Value] = new DeviceColorComposition { - previousframe = new Bitmap(map); - } + KeyColors = new Dictionary(), + KeyBitmap = _background.GetBitmap() + }; } - - - frame.Dispose(); + dccMap[item.DeviceId.Value].KeyColors[item.Tag] = _keyColors[item]; } + Global.dev_manager.UpdateDevices(dccMap); - watch.Stop(); - var elapsedMs = watch.ElapsedMilliseconds; - } + NewLayerRender?.Invoke(_background.GetBitmap()); - public Dictionary GetKeyboardLights() - { - return Effects.keyColors; + frame.Dispose(); } - [System.Runtime.InteropServices.DllImport("msvcrt.dll")] - private static extern int memcmp(IntPtr b1, IntPtr b2, long count); - - public static bool CompareMemCmp(Bitmap b1, Bitmap b2) + public Dictionary GetDevicesColor() { - if ((b1 == null) != (b2 == null)) return false; - if (b1.Size != b2.Size) return false; - - var bd1 = b1.LockBits(new Rectangle(new Point(0, 0), b1.Size), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - var bd2 = b2.LockBits(new Rectangle(new Point(0, 0), b2.Size), System.Drawing.Imaging.ImageLockMode.ReadOnly, System.Drawing.Imaging.PixelFormat.Format32bppArgb); - - try - { - IntPtr bd1scan0 = bd1.Scan0; - IntPtr bd2scan0 = bd2.Scan0; - - int stride = bd1.Stride; - int len = stride * b1.Height; - - return memcmp(bd1scan0, bd2scan0, len) == 0; - } - finally - { - b1.UnlockBits(bd1); - b2.UnlockBits(bd2); - } + return _keyColors; } } } diff --git a/Project-Aurora/Project-Aurora/LibreHardwareMonitorLib.dll b/Project-Aurora/Project-Aurora/LibreHardwareMonitorLib.dll new file mode 100644 index 000000000..590aabb7d Binary files /dev/null and b/Project-Aurora/Project-Aurora/LibreHardwareMonitorLib.dll differ diff --git a/Project-Aurora/Project-Aurora/NLog.config b/Project-Aurora/Project-Aurora/NLog.config index 7ae4301d8..d61088fec 100644 --- a/Project-Aurora/Project-Aurora/NLog.config +++ b/Project-Aurora/Project-Aurora/NLog.config @@ -13,7 +13,7 @@ (); AllowLayer(); AllowLayer(); - AllowLayer(); AllowLayer(); AllowLayer(); AllowLayer(); diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs index 2c8d9189e..ab716332d 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/CSGOProfile.cs @@ -29,7 +29,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.FromArgb(0, 255, 0), - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.TILDE, Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS, Devices.DeviceKeys.BACKSPACE, + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.TILDE, Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS, Devices.DeviceKeys.BACKSPACE, Devices.DeviceKeys.TAB, Devices.DeviceKeys.Q, Devices.DeviceKeys.W, Devices.DeviceKeys.E, Devices.DeviceKeys.R, Devices.DeviceKeys.T, Devices.DeviceKeys.Y, Devices.DeviceKeys.U, Devices.DeviceKeys.I, Devices.DeviceKeys.O, Devices.DeviceKeys.P, Devices.DeviceKeys.CLOSE_BRACKET, Devices.DeviceKeys.OPEN_BRACKET, Devices.DeviceKeys.BACKSLASH, Devices.DeviceKeys.CAPS_LOCK, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.F, Devices.DeviceKeys.G, Devices.DeviceKeys.H, Devices.DeviceKeys.J, Devices.DeviceKeys.K, Devices.DeviceKeys.L, Devices.DeviceKeys.SEMICOLON, Devices.DeviceKeys.APOSTROPHE, Devices.DeviceKeys.HASHTAG, Devices.DeviceKeys.ENTER, Devices.DeviceKeys.LEFT_SHIFT, Devices.DeviceKeys.BACKSLASH_UK, Devices.DeviceKeys.Z, Devices.DeviceKeys.X, Devices.DeviceKeys.C, Devices.DeviceKeys.V, Devices.DeviceKeys.B, Devices.DeviceKeys.N, Devices.DeviceKeys.M, Devices.DeviceKeys.COMMA, Devices.DeviceKeys.PERIOD, Devices.DeviceKeys.FORWARD_SLASH, Devices.DeviceKeys.RIGHT_SHIFT, @@ -66,7 +66,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 255, 0), _SecondaryColor = Color.FromArgb(255, 0, 0), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -87,7 +87,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 0, 255), _SecondaryColor = Color.FromArgb(255, 0, 0), _PercentType = PercentEffectType.Progressive, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs index e76dd2002..4397565f5 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBackgroundLayerHandler.cs @@ -20,32 +20,32 @@ public class CSGOBackgroundLayerHandlerProperties : LayerHandlerProperties2Color public Color? _DefaultColor { get; set; } [JsonIgnore] - public Color DefaultColor { get { return Logic._DefaultColor ?? _DefaultColor ?? Color.Empty; } } + public Color DefaultColor => Logic._DefaultColor ?? _DefaultColor ?? Color.Empty; public Color? _CTColor { get; set; } [JsonIgnore] - public Color CTColor { get { return Logic._CTColor ?? _CTColor ?? Color.Empty; } } + public Color CTColor => Logic._CTColor ?? _CTColor ?? Color.Empty; public Color? _TColor { get; set; } [JsonIgnore] - public Color TColor { get { return Logic._TColor ?? _TColor ?? Color.Empty; } } + public Color TColor => Logic._TColor ?? _TColor ?? Color.Empty; public bool? _DimEnabled { get; set; } [JsonIgnore] - public bool DimEnabled { get { return Logic._DimEnabled ?? _DimEnabled ?? false; } } + public bool DimEnabled => Logic._DimEnabled ?? _DimEnabled ?? false; public double? _DimDelay { get; set; } [JsonIgnore] - public double DimDelay { get { return Logic._DimDelay ?? _DimDelay ?? 0.0; } } + public double DimDelay => Logic._DimDelay ?? _DimDelay ?? 0.0; public int? _DimAmount { get; set; } [JsonIgnore] - public int DimAmount { get { return Logic._DimAmount ?? _DimAmount ?? 100; } } + public int DimAmount => Logic._DimAmount ?? _DimAmount ?? 100; public CSGOBackgroundLayerHandlerProperties() : base() { } @@ -55,21 +55,23 @@ public override void Default() { base.Default(); - this._DefaultColor = Color.FromArgb(158, 205, 255); - this._CTColor = Color.FromArgb(33, 155, 221); - this._TColor = Color.FromArgb(221, 99, 33); - this._DimEnabled = true; - this._DimDelay = 15; - this._DimAmount = 20; + _DefaultColor = Color.FromArgb(158, 205, 255); + _CTColor = Color.FromArgb(33, 155, 221); + _TColor = Color.FromArgb(221, 99, 33); + _DimEnabled = true; + _DimDelay = 15; + _DimAmount = 20; } } public class CSGOBackgroundLayerHandler : LayerHandler { - private bool isDimming = false; - private double dim_value = 100.0; - private long dim_bg_at = 15; + private bool _isDimming; + private double _dimValue = 100.0; + private long _dimBgAt = 15; + private readonly EffectLayer _bgLayer = new("CSGO - Background"); + private SolidBrush _solidBrush = new(Color.Empty); protected override UserControl CreateControl() { @@ -78,68 +80,57 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState state) { - EffectLayer bg_layer = new EffectLayer("CSGO - Background"); + if (state is not GameState_CSGO csgostate) return _bgLayer; - if (state is GameState_CSGO) + var inGame = csgostate.Previously.Player.State.Health is > -1 and < 100 + || (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined); + if (csgostate.Player.State.Health == 100 && inGame && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) { - GameState_CSGO csgostate = state as GameState_CSGO; - - if (csgostate.Player.State.Health == 100 && ((csgostate.Previously.Player.State.Health > -1 && csgostate.Previously.Player.State.Health < 100) || (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined)) && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) - { - isDimming = false; - dim_bg_at = Utils.Time.GetMillisecondsSinceEpoch() + (long)(this.Properties.DimDelay * 1000D); - dim_value = 100.0; - } + _isDimming = false; + _dimBgAt = Utils.Time.GetMillisecondsSinceEpoch() + (long)Properties.DimDelay * 1000; + _dimValue = 100.0; + } - Color bg_color = this.Properties.DefaultColor; + var bgColor = csgostate.Player.Team switch + { + PlayerTeam.T => Properties.TColor, + PlayerTeam.CT => Properties.CTColor, + _ => Properties.DefaultColor + }; - switch (csgostate.Player.Team) + if (csgostate.Player.Team is PlayerTeam.CT or PlayerTeam.T) + { + if (_dimBgAt <= Utils.Time.GetMillisecondsSinceEpoch() || csgostate.Player.State.Health == 0) { - case PlayerTeam.T: - bg_color = this.Properties.TColor; - break; - case PlayerTeam.CT: - bg_color = this.Properties.CTColor; - break; - default: - break; + _isDimming = true; + bgColor = Utils.ColorUtils.MultiplyColorByScalar(bgColor, GetDimmingValue() / 100); } - - if (csgostate.Player.Team == PlayerTeam.CT || csgostate.Player.Team == PlayerTeam.T) + else { - if (dim_bg_at <= Utils.Time.GetMillisecondsSinceEpoch() || csgostate.Player.State.Health == 0) - { - isDimming = true; - bg_color = Utils.ColorUtils.MultiplyColorByScalar(bg_color, (getDimmingValue() / 100)); - } - else - { - isDimming = false; - dim_value = 100.0; - } + _isDimming = false; + _dimValue = 100.0; } - - bg_layer.Fill(bg_color); } - return bg_layer; + if (_solidBrush.Color == bgColor) return _bgLayer; + _solidBrush.Color = bgColor; + _bgLayer.Fill(_solidBrush); + + return _bgLayer; } public override void SetApplication(Application profile) { - (Control as Control_CSGOBackgroundLayer).SetProfile(profile); + (Control as Control_CSGOBackgroundLayer)?.SetProfile(profile); base.SetApplication(profile); } - private double getDimmingValue() + private double GetDimmingValue() { - if (isDimming && Properties.DimEnabled) - { - dim_value -= 2.0; - return dim_value = (dim_value < Math.Abs(Properties.DimAmount - 100) ? Math.Abs(Properties.DimAmount - 100) : dim_value); - } - else - return dim_value = 100.0; + if (!_isDimming || !Properties.DimEnabled) return _dimValue = 100.0; + _dimValue -= 2.0; + return _dimValue = _dimValue < Math.Abs(Properties.DimAmount - 100) ? Math.Abs(Properties.DimAmount - 100) : _dimValue; + } } } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs index 31a68790c..47f30e4eb 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBombLayerHandler.cs @@ -1,17 +1,15 @@ -using Aurora.EffectsEngine; +using System; +using System.Diagnostics; +using System.Drawing; +using System.Windows.Controls; +using Aurora.Devices; +using Aurora.EffectsEngine; using Aurora.Profiles.CSGO.GSI; using Aurora.Profiles.CSGO.GSI.Nodes; using Aurora.Settings; using Aurora.Settings.Layers; +using Aurora.Utils; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; namespace Aurora.Profiles.CSGO.Layers { @@ -20,18 +18,15 @@ public class CSGOBombLayerHandlerProperties : LayerHandlerProperties2Color Logic._FlashColor ?? _FlashColor ?? Color.Empty; public Color? _PrimedColor { get; set; } [JsonIgnore] - public Color PrimedColor { get { return Logic._PrimedColor ?? _PrimedColor ?? Color.Empty; } } + public Color PrimedColor => Logic._PrimedColor ?? _PrimedColor ?? Color.Empty; public bool? _DisplayWinningTeamColor { get; set; } - [JsonIgnore] - public bool DisplayWinningTeamColor { get { return Logic._DisplayWinningTeamColor ?? _DisplayWinningTeamColor ?? false; } } - public bool? _GradualEffect { get; set; } [JsonIgnore] @@ -42,7 +37,8 @@ public class CSGOBombLayerHandlerProperties : LayerHandlerProperties2Color { - private static Stopwatch bombtimer = new Stopwatch(); - private static bool bombflash = false; - private static int bombflashcount = 0; - private static long bombflashtime = 0; - private static long bombflashedat = 0; + private static Stopwatch bombtimer = new(); + private static bool bombflash; + private static int bombflashcount; + private static long bombflashtime; + private static long bombflashedat; + private readonly EffectLayer _bombEffectLayer = new("CSGO - Bomb Effect"); protected override UserControl CreateControl() { return new Control_CSGOBombLayer(this); } + private bool _empty = true; public override EffectLayer Render(IGameState state) { - EffectLayer bomb_effect_layer = new EffectLayer("CSGO - Bomb Effect"); + if (state is not GameState_CSGO csgostate) return _bombEffectLayer; - if (state is GameState_CSGO) + if (csgostate.Round.Bomb != BombState.Planted) { - GameState_CSGO csgostate = state as GameState_CSGO; - - if (csgostate.Round.Bomb == BombState.Planted) + if (!_empty) { - if (!bombtimer.IsRunning) - { - bombtimer.Restart(); - bombflashcount = 0; - bombflashtime = 0; - bombflashedat = 0; - } - - double bombflashamount = 1.0; - bool isCritical = false; - - if (bombtimer.ElapsedMilliseconds < 38000) - { - - if (bombtimer.ElapsedMilliseconds >= bombflashtime) - { - bombflash = true; - bombflashedat = bombtimer.ElapsedMilliseconds; - bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ * 13)); - } - - if (bombtimer.ElapsedMilliseconds < bombflashedat || bombtimer.ElapsedMilliseconds > bombflashedat + 220) - bombflashamount = 0.0; - else - bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0); - } - else if (bombtimer.ElapsedMilliseconds >= 38000) - { - isCritical = true; - bombflashamount = (double)bombtimer.ElapsedMilliseconds / 40000.0; - } - else if (bombtimer.ElapsedMilliseconds >= 45000) - { - bombtimer.Stop(); - csgostate.Round.Bomb = BombState.Undefined; - } - - if (!isCritical) - { - if (bombflashamount <= 0.05 && bombflash) - bombflash = false; - - if (!bombflash) - bombflashamount = 0.0; - } - - if (!Properties.GradualEffect) - bombflashamount = Math.Round(bombflashamount); - - Color bombcolor = Properties.FlashColor; - - if (isCritical) - bombcolor = Utils.ColorUtils.MultiplyColorByScalar(Properties.PrimedColor, Math.Min(bombflashamount, 1.0)); - else - bombcolor = Utils.ColorUtils.MultiplyColorByScalar(Properties.FlashColor, Math.Min(bombflashamount, 1.0)); - - bomb_effect_layer.Set(Properties.Sequence, bombcolor); - - if (Properties.PeripheralUse) - bomb_effect_layer.Set(Devices.DeviceKeys.Peripheral, bombcolor); + bombtimer.Stop(); + _bombEffectLayer.Clear(); + _empty = true; } - else + return _bombEffectLayer; + } + _empty = false; + + if (!bombtimer.IsRunning) + { + bombtimer.Restart(); + bombflashcount = 0; + bombflashtime = 0; + bombflashedat = 0; + } + + double bombflashamount = 1.0; + bool isCritical = false; + + if (bombtimer.ElapsedMilliseconds < 38000) + { + if (bombtimer.ElapsedMilliseconds >= bombflashtime) { - bombtimer.Stop(); + bombflash = true; + bombflashedat = bombtimer.ElapsedMilliseconds; + bombflashtime = bombtimer.ElapsedMilliseconds + (1000 - (bombflashcount++ * 13)); } + + if (bombtimer.ElapsedMilliseconds < bombflashedat || bombtimer.ElapsedMilliseconds > bombflashedat + 220) + bombflashamount = 0.0; + else + bombflashamount = Math.Pow(Math.Sin((bombtimer.ElapsedMilliseconds - bombflashedat) / 80.0 + 0.25), 2.0); + } + else if (bombtimer.ElapsedMilliseconds >= 38000) + { + isCritical = true; + bombflashamount = bombtimer.ElapsedMilliseconds / 40000.0; + } + else if (bombtimer.ElapsedMilliseconds >= 45000) + { + bombtimer.Stop(); + csgostate.Round.Bomb = BombState.Undefined; + } + + if (!isCritical) + { + if (bombflashamount <= 0.05 && bombflash) + bombflash = false; + + if (!bombflash) + bombflashamount = 0.0; } - return bomb_effect_layer; + if (!Properties.GradualEffect) + bombflashamount = Math.Round(bombflashamount); + + Color bombcolor; + if (bombflashamount > 0) + { + if (isCritical) + bombcolor = ColorUtils.MultiplyColorByScalar(Properties.PrimedColor, Math.Min(bombflashamount, 1.0)); + else + bombcolor = ColorUtils.MultiplyColorByScalar(Properties.FlashColor, Math.Min(bombflashamount, 1.0)); + } + else + { + bombcolor = Color.Empty; + } + + _bombEffectLayer.Set(Properties.Sequence, bombcolor); + + if (Properties.PeripheralUse) + _bombEffectLayer.Set(DeviceKeys.Peripheral, bombcolor); + + return _bombEffectLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBurningLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBurningLayerHandler.cs index 8341aaf3c..91da3a239 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBurningLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOBurningLayerHandler.cs @@ -1,17 +1,11 @@ -using Aurora.EffectsEngine; +using System; +using System.Drawing; +using System.Windows.Controls; +using Aurora.EffectsEngine; using Aurora.Profiles.CSGO.GSI; -using Aurora.Profiles.CSGO.GSI.Nodes; -using Aurora.Settings; using Aurora.Settings.Layers; +using Aurora.Utils; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; namespace Aurora.Profiles.CSGO.Layers { @@ -20,14 +14,15 @@ public class CSGOBurningLayerHandlerProperties : LayerHandlerProperties2Color Logic._BurningColor ?? _BurningColor ?? Color.Empty; public bool? _Animated { get; set; } [JsonIgnore] - public bool Animated { get { return Logic._Animated ?? _Animated ?? false; } } + public bool Animated => Logic._Animated ?? _Animated ?? false; - public CSGOBurningLayerHandlerProperties() : base() { } + public CSGOBurningLayerHandlerProperties() + { } public CSGOBurningLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } @@ -35,15 +30,16 @@ public override void Default() { base.Default(); - this._BurningColor = Color.FromArgb(255, 70, 0); - this._Animated = true; + _BurningColor = Color.FromArgb(255, 70, 0); + _Animated = true; } - } public class CSGOBurningLayerHandler : LayerHandler { - private Random randomizer = new Random(); + private Random randomizer = new(); + private readonly EffectLayer _burningLayer = new("CSGO - Burning"); + private SolidBrush _solidBrush = new(Color.Empty); protected override UserControl CreateControl() { @@ -52,59 +48,49 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState state) { - EffectLayer burning_layer = new EffectLayer("CSGO - Burning"); + if (state is not GameState_CSGO csgostate) return _burningLayer; + + //Update Burning + + if (csgostate.Player.State.Burning <= 0) return _burningLayer; + var burncolor = Properties.BurningColor; - if (state is GameState_CSGO) + if (Properties.Animated) { - GameState_CSGO csgostate = state as GameState_CSGO; + var redAdjusted = (int)(burncolor.R + (Math.Cos((Time.GetMillisecondsSinceEpoch() + randomizer.Next(75)) / 75.0) * 0.15 * 255)); - //Update Burning + byte red = redAdjusted switch + { + > 255 => 255, + < 0 => 0, + _ => (byte) redAdjusted + }; + + var greenAdjusted = (int)(burncolor.G + (Math.Sin((Time.GetMillisecondsSinceEpoch() + randomizer.Next(150)) / 75.0) * 0.15 * 255)); + + byte green = greenAdjusted switch + { + > 255 => 255, + < 0 => 0, + _ => (byte) greenAdjusted + }; + + var blueAdjusted = (int)(burncolor.B + (Math.Cos((Time.GetMillisecondsSinceEpoch() + randomizer.Next(225)) / 75.0) * 0.15 * 255)); - if (csgostate.Player.State.Burning > 0) + byte blue = blueAdjusted switch { - double burning_percent = (double)csgostate.Player.State.Burning / 255.0; - Color burncolor = Properties.BurningColor; - - if (Properties.Animated) - { - int red_adjusted = (int)(burncolor.R + (Math.Cos((Utils.Time.GetMillisecondsSinceEpoch() + randomizer.Next(75)) / 75.0) * 0.15 * 255)); - byte red = 0; - - if (red_adjusted > 255) - red = 255; - else if (red_adjusted < 0) - red = 0; - else - red = (byte)red_adjusted; - - int green_adjusted = (int)(burncolor.G + (Math.Sin((Utils.Time.GetMillisecondsSinceEpoch() + randomizer.Next(150)) / 75.0) * 0.15 * 255)); - byte green = 0; - - if (green_adjusted > 255) - green = 255; - else if (green_adjusted < 0) - green = 0; - else - green = (byte)green_adjusted; - - int blue_adjusted = (int)(burncolor.B + (Math.Cos((Utils.Time.GetMillisecondsSinceEpoch() + randomizer.Next(225)) / 75.0) * 0.15 * 255)); - byte blue = 0; - - if (blue_adjusted > 255) - blue = 255; - else if (blue_adjusted < 0) - blue = 0; - else - blue = (byte)blue_adjusted; - - burncolor = Color.FromArgb(csgostate.Player.State.Burning, red, green, blue); - } - - burning_layer.Fill(burncolor); - } + > 255 => 255, + < 0 => 0, + _ => (byte) blueAdjusted + }; + + burncolor = Color.FromArgb(csgostate.Player.State.Burning, red, green, blue); } - return burning_layer; + if (_solidBrush.Color == burncolor) return _burningLayer; + _solidBrush.Color = burncolor; + _burningLayer.Fill(_solidBrush); + return _burningLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGODeathLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGODeathLayerHandler.cs index ad7413688..5777f8277 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGODeathLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGODeathLayerHandler.cs @@ -43,10 +43,12 @@ public override void Default() public class CSGODeathLayerHandler : LayerHandler { - private bool isDead = false; - private long fadeStartAt = 15; - private int fadeAlpha = 255; - + private readonly EffectLayer _effectLayer = new("CSGO - Death Effect"); + private bool _isDead; + private int _fadeAlpha = 255; + private long _lastTimeMillis; + private SolidBrush _solidBrush = new(Color.Empty); + protected override UserControl CreateControl() { return new Control_CSGODeathLayer(this); @@ -54,54 +56,38 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState state) { - EffectLayer effectLayer = new EffectLayer("CSGO - Death Effect"); + if (state is not GameState_CSGO gameState) return _effectLayer; + var deathColor = Properties.DeathColor; + + // Confirm if CS:GO Player is correct + if (!gameState.Provider.SteamID.Equals(gameState.Player.SteamID)) return _effectLayer; + + // Are they dead? + if (!_isDead && gameState.Player.State.Health <= 0 && gameState.Previously.Player.State.Health > 0) + { + _isDead = true; + _lastTimeMillis = Utils.Time.GetMillisecondsSinceEpoch(); + _fadeAlpha = 255; + } + + if (!_isDead) + { + return _effectLayer; + } + + // If so... + var fadeAlpha = GetFadeAlpha(); + _solidBrush.Color = Color.FromArgb(fadeAlpha, deathColor.R, deathColor.G, deathColor.B); - if (state is GameState_CSGO) + if (fadeAlpha == 0) { - GameState_CSGO gameState = state as GameState_CSGO; - Color deathColor = this.Properties.DeathColor; - - // Confirm if CS:GO Player is correct - if (gameState.Provider.SteamID.Equals(gameState.Player.SteamID)) - { - - // Are they dead? - if (!isDead && gameState.Player.State.Health <= 0 && gameState.Previously.Player.State.Health > 0) - { - isDead = true; - - fadeAlpha = 255; - fadeStartAt = Utils.Time.GetMillisecondsSinceEpoch() + (long)(this.Properties.FadeOutAfter * 1000D); - } else if (gameState.Player.State.Health > 0) - { - isDead = false; - return effectLayer; - } - - // If so... - if (isDead) - { - - Global.logger.Info("IsDead"); - if (fadeStartAt <= Utils.Time.GetMillisecondsSinceEpoch()) - { - int fadeAlpha = getFadeAlpha(); - Global.logger.Info(fadeAlpha); - - deathColor = Color.FromArgb(fadeAlpha, deathColor.R, deathColor.G, deathColor.B); - - if (fadeAlpha == 0) - { - isDead = false; - } - } - - effectLayer.Fill(deathColor); - } - } + _isDead = false; + _effectLayer.Clear(); + return _effectLayer; } - return effectLayer; + _effectLayer.Fill(_solidBrush); + return _effectLayer; } public override void SetApplication(Application profile) @@ -110,10 +96,12 @@ public override void SetApplication(Application profile) base.SetApplication(profile); } - private int getFadeAlpha() + private int GetFadeAlpha() { - fadeAlpha -= 15; - return fadeAlpha = (fadeAlpha < 0 ? 0 : fadeAlpha); + var t = Utils.Time.GetMillisecondsSinceEpoch() - _lastTimeMillis; + _lastTimeMillis = Utils.Time.GetMillisecondsSinceEpoch(); + _fadeAlpha -= (int)(t / 10); + return _fadeAlpha = _fadeAlpha < 0 ? 0 : _fadeAlpha; } } } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOFlashbangLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOFlashbangLayerHandler.cs deleted file mode 100644 index 485c1f59d..000000000 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOFlashbangLayerHandler.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Aurora.EffectsEngine; -using Aurora.Profiles.CSGO.GSI; -using Aurora.Profiles.CSGO.GSI.Nodes; -using Aurora.Settings; -using Aurora.Settings.Layers; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; - -namespace Aurora.Profiles.CSGO.Layers -{ - public class CSGOFlashbangLayerHandlerProperties : LayerHandlerProperties2Color - { - public Color? _FlashbangColor { get; set; } - - [JsonIgnore] - public Color FlashbangColor { get { return Logic._FlashbangColor ?? _FlashbangColor ?? Color.Empty; } } - - public CSGOFlashbangLayerHandlerProperties() : base() { } - - public CSGOFlashbangLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } - - public override void Default() - { - base.Default(); - - this._FlashbangColor = Color.FromArgb(255, 255, 255); - } - - } - - [Obsolete("This layer is obselete and has been replaced by the Overrides system.")] - public class CSGOFlashbangLayerHandler : LayerHandler - { - protected override UserControl CreateControl() - { - return new Control_CSGOFlashbangLayer(this); - } - - public override EffectLayer Render(IGameState state) - { - EffectLayer flashed_layer = new EffectLayer("CSGO - Flashed"); - - if (state is GameState_CSGO) - { - GameState_CSGO csgostate = state as GameState_CSGO; - - //Update Flashed - if (csgostate.Player.State.Flashed > 0) - { - Color flash_color = Color.FromArgb(csgostate.Player.State.Flashed, Properties.FlashbangColor); - - flashed_layer.Fill(flash_color); - } - } - - return flashed_layer; - } - - public override void SetApplication(Application profile) - { - (Control as Control_CSGOFlashbangLayer).SetProfile(profile); - base.SetApplication(profile); - } - } -} \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs index 3601cc863..b168d2c1c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOKillsIndicatorLayerHandler.cs @@ -1,17 +1,15 @@ -using Aurora.EffectsEngine; +using System; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Controls; +using Aurora.Devices; +using Aurora.EffectsEngine; using Aurora.Profiles.CSGO.GSI; using Aurora.Profiles.CSGO.GSI.Nodes; using Aurora.Settings; using Aurora.Settings.Layers; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; namespace Aurora.Profiles.CSGO.Layers { @@ -20,14 +18,15 @@ public class CSGOKillIndicatorLayerHandlerProperties : LayerHandlerProperties2Co public Color? _RegularKillColor { get; set; } [JsonIgnore] - public Color RegularKillColor { get { return Logic._RegularKillColor ?? _RegularKillColor ?? Color.Empty; } } + public Color RegularKillColor => Logic._RegularKillColor ?? _RegularKillColor ?? Color.Empty; public Color? _HeadshotKillColor { get; set; } [JsonIgnore] - public Color HeadshotKillColor { get { return Logic._HeadshotKillColor ?? _HeadshotKillColor ?? Color.Empty; } } + public Color HeadshotKillColor => Logic._HeadshotKillColor ?? _HeadshotKillColor ?? Color.Empty; - public CSGOKillIndicatorLayerHandlerProperties() : base() { } + public CSGOKillIndicatorLayerHandlerProperties() + { } public CSGOKillIndicatorLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } @@ -35,24 +34,25 @@ public override void Default() { base.Default(); - this._Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.G1, Devices.DeviceKeys.G2, Devices.DeviceKeys.G3, Devices.DeviceKeys.G4, Devices.DeviceKeys.G5 }); - this._RegularKillColor = Color.FromArgb(255, 204, 0); - this._HeadshotKillColor = Color.FromArgb(255, 0, 0); + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.G1, DeviceKeys.G2, DeviceKeys.G3, DeviceKeys.G4, DeviceKeys.G5 }); + _RegularKillColor = Color.FromArgb(255, 204, 0); + _HeadshotKillColor = Color.FromArgb(255, 0, 0); } } public class CSGOKillIndicatorLayerHandler : LayerHandler { - enum RoundKillType + private enum RoundKillType { None, Regular, Headshot - }; + } - private List roundKills = new List(); - private int lastCountedKill = 0; + private List roundKills = new(); + private int _lastCountedKill; + private readonly EffectLayer _killsIndicatorLayer = new("CSGO - Kills Indicator"); protected override UserControl CreateControl() { @@ -61,51 +61,47 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState state) { - EffectLayer kills_indicator_layer = new EffectLayer("CSGO - Kills Indicator"); + if (state is not GameState_CSGO csgostate) return _killsIndicatorLayer; - if (state is GameState_CSGO) + if (_lastCountedKill != csgostate.Player.State.RoundKills) { - GameState_CSGO csgostate = state as GameState_CSGO; - - if (lastCountedKill != csgostate.Player.State.RoundKills) + if (csgostate.Player.State.RoundKills == 0 || + (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined) || + (csgostate.Player.State.Health == 100 && ((csgostate.Previously.Player.State.Health > -1 && csgostate.Previously.Player.State.Health < 100) || (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined)) && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) + ) + roundKills.Clear(); + if (csgostate.Previously.Player.State.RoundKills != -1 && csgostate.Player.State.RoundKills != -1 && csgostate.Previously.Player.State.RoundKills < csgostate.Player.State.RoundKills && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) { - if (csgostate.Player.State.RoundKills == 0 || - (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined) || - (csgostate.Player.State.Health == 100 && ((csgostate.Previously.Player.State.Health > -1 && csgostate.Previously.Player.State.Health < 100) || (csgostate.Round.WinTeam == RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam != RoundWinTeam.Undefined)) && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) - ) - roundKills.Clear(); - if (csgostate.Previously.Player.State.RoundKills != -1 && csgostate.Player.State.RoundKills != -1 && csgostate.Previously.Player.State.RoundKills < csgostate.Player.State.RoundKills && csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) - { - if (csgostate.Previously.Player.State.RoundKillHS != -1 && csgostate.Player.State.RoundKillHS != -1 && csgostate.Previously.Player.State.RoundKillHS < csgostate.Player.State.RoundKillHS) - roundKills.Add(RoundKillType.Headshot); - else - roundKills.Add(RoundKillType.Regular); - } - - lastCountedKill = csgostate.Player.State.RoundKills; + if (csgostate.Previously.Player.State.RoundKillHS != -1 && csgostate.Player.State.RoundKillHS != -1 && csgostate.Previously.Player.State.RoundKillHS < csgostate.Player.State.RoundKillHS) + roundKills.Add(RoundKillType.Headshot); + else + roundKills.Add(RoundKillType.Regular); } - if (csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) + _lastCountedKill = csgostate.Player.State.RoundKills; + } + + if (!csgostate.Provider.SteamID.Equals(csgostate.Player.SteamID)) return _killsIndicatorLayer; + for (var pos = 0; pos < Properties.Sequence.keys.Count; pos++) + { + if (pos < roundKills.Count) { - for (int pos = 0; pos < Properties.Sequence.keys.Count(); pos++) + switch (roundKills[pos]) { - if (pos < roundKills.Count) - { - switch (roundKills[pos]) - { - case (RoundKillType.Regular): - kills_indicator_layer.Set(Properties.Sequence.keys[pos], Properties.RegularKillColor); - break; - case (RoundKillType.Headshot): - kills_indicator_layer.Set(Properties.Sequence.keys[pos], Properties.HeadshotKillColor); - break; - } - } + case RoundKillType.Regular: + _killsIndicatorLayer.Set(Properties.Sequence.keys[pos], Properties.RegularKillColor); + break; + case RoundKillType.Headshot: + _killsIndicatorLayer.Set(Properties.Sequence.keys[pos], Properties.HeadshotKillColor); + break; + case RoundKillType.None: + _killsIndicatorLayer.Set(Properties.Sequence.keys[pos], Color.Empty); + break; } } } - return kills_indicator_layer; + return _killsIndicatorLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOTypingIndicatorLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOTypingIndicatorLayerHandler.cs index 1dfbb5117..97fec1a66 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOTypingIndicatorLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOTypingIndicatorLayerHandler.cs @@ -1,17 +1,13 @@ -using Aurora.EffectsEngine; +using System; +using System.Drawing; +using System.Windows.Controls; +using Aurora.Devices; +using Aurora.EffectsEngine; using Aurora.Profiles.CSGO.GSI; using Aurora.Profiles.CSGO.GSI.Nodes; using Aurora.Settings; using Aurora.Settings.Layers; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; namespace Aurora.Profiles.CSGO.Layers { @@ -20,9 +16,10 @@ public class CSGOTypingIndicatorLayerHandlerProperties : LayerHandlerProperties2 public Color? _TypingKeysColor { get; set; } [JsonIgnore] - public Color TypingKeysColor { get { return Logic._TypingKeysColor ?? _TypingKeysColor ?? Color.Empty; } } + public Color TypingKeysColor => Logic._TypingKeysColor ?? _TypingKeysColor ?? Color.Empty; - public CSGOTypingIndicatorLayerHandlerProperties() : base() { } + public CSGOTypingIndicatorLayerHandlerProperties() + { } public CSGOTypingIndicatorLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } @@ -30,20 +27,22 @@ public override void Default() { base.Default(); - this._Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.TILDE, Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS, Devices.DeviceKeys.BACKSPACE, - Devices.DeviceKeys.TAB, Devices.DeviceKeys.Q, Devices.DeviceKeys.W, Devices.DeviceKeys.E, Devices.DeviceKeys.R, Devices.DeviceKeys.T, Devices.DeviceKeys.Y, Devices.DeviceKeys.U, Devices.DeviceKeys.I, Devices.DeviceKeys.O, Devices.DeviceKeys.P, Devices.DeviceKeys.CLOSE_BRACKET, Devices.DeviceKeys.OPEN_BRACKET, Devices.DeviceKeys.BACKSLASH, - Devices.DeviceKeys.CAPS_LOCK, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.F, Devices.DeviceKeys.G, Devices.DeviceKeys.H, Devices.DeviceKeys.J, Devices.DeviceKeys.K, Devices.DeviceKeys.L, Devices.DeviceKeys.SEMICOLON, Devices.DeviceKeys.APOSTROPHE, Devices.DeviceKeys.HASHTAG, Devices.DeviceKeys.ENTER, - Devices.DeviceKeys.LEFT_SHIFT, Devices.DeviceKeys.BACKSLASH_UK, Devices.DeviceKeys.Z, Devices.DeviceKeys.X, Devices.DeviceKeys.C, Devices.DeviceKeys.V, Devices.DeviceKeys.B, Devices.DeviceKeys.N, Devices.DeviceKeys.M, Devices.DeviceKeys.COMMA, Devices.DeviceKeys.PERIOD, Devices.DeviceKeys.FORWARD_SLASH, Devices.DeviceKeys.RIGHT_SHIFT, - Devices.DeviceKeys.LEFT_CONTROL, Devices.DeviceKeys.LEFT_WINDOWS, Devices.DeviceKeys.LEFT_ALT, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.RIGHT_ALT, Devices.DeviceKeys.RIGHT_WINDOWS, Devices.DeviceKeys.APPLICATION_SELECT, Devices.DeviceKeys.RIGHT_CONTROL, - Devices.DeviceKeys.ARROW_UP, Devices.DeviceKeys.ARROW_LEFT, Devices.DeviceKeys.ARROW_DOWN, Devices.DeviceKeys.ARROW_RIGHT, Devices.DeviceKeys.ESC + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.TILDE, DeviceKeys.ONE, DeviceKeys.TWO, DeviceKeys.THREE, DeviceKeys.FOUR, DeviceKeys.FIVE, DeviceKeys.SIX, DeviceKeys.SEVEN, DeviceKeys.EIGHT, DeviceKeys.NINE, DeviceKeys.ZERO, DeviceKeys.MINUS, DeviceKeys.EQUALS, DeviceKeys.BACKSPACE, + DeviceKeys.TAB, DeviceKeys.Q, DeviceKeys.W, DeviceKeys.E, DeviceKeys.R, DeviceKeys.T, DeviceKeys.Y, DeviceKeys.U, DeviceKeys.I, DeviceKeys.O, DeviceKeys.P, DeviceKeys.CLOSE_BRACKET, DeviceKeys.OPEN_BRACKET, DeviceKeys.BACKSLASH, + DeviceKeys.CAPS_LOCK, DeviceKeys.A, DeviceKeys.S, DeviceKeys.D, DeviceKeys.F, DeviceKeys.G, DeviceKeys.H, DeviceKeys.J, DeviceKeys.K, DeviceKeys.L, DeviceKeys.SEMICOLON, DeviceKeys.APOSTROPHE, DeviceKeys.HASHTAG, DeviceKeys.ENTER, + DeviceKeys.LEFT_SHIFT, DeviceKeys.BACKSLASH_UK, DeviceKeys.Z, DeviceKeys.X, DeviceKeys.C, DeviceKeys.V, DeviceKeys.B, DeviceKeys.N, DeviceKeys.M, DeviceKeys.COMMA, DeviceKeys.PERIOD, DeviceKeys.FORWARD_SLASH, DeviceKeys.RIGHT_SHIFT, + DeviceKeys.LEFT_CONTROL, DeviceKeys.LEFT_WINDOWS, DeviceKeys.LEFT_ALT, DeviceKeys.SPACE, DeviceKeys.RIGHT_ALT, DeviceKeys.RIGHT_WINDOWS, DeviceKeys.APPLICATION_SELECT, DeviceKeys.RIGHT_CONTROL, + DeviceKeys.ARROW_UP, DeviceKeys.ARROW_LEFT, DeviceKeys.ARROW_DOWN, DeviceKeys.ARROW_RIGHT, DeviceKeys.ESC }); - this._TypingKeysColor = Color.FromArgb(0, 255, 0); + _TypingKeysColor = Color.FromArgb(0, 255, 0); } } [Obsolete("This layer is obselete and has been replaced by the Overrides system.")] public class CSGOTypingIndicatorLayerHandler : LayerHandler { + private readonly EffectLayer _typingKeysLayer = new("CSGO - Typing Keys"); + protected override UserControl CreateControl() { return new Control_CSGOTypingIndicatorLayer(this); @@ -51,18 +50,17 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState state) { - EffectLayer typing_keys_layer = new EffectLayer("CSGO - Typing Keys"); + if (state is not GameState_CSGO csgostate) return _typingKeysLayer; - if (state is GameState_CSGO) + //Update Typing Keys + if (csgostate.Player.Activity == PlayerActivity.TextInput) + _typingKeysLayer.Set(Properties.Sequence, Properties.TypingKeysColor); + else { - GameState_CSGO csgostate = state as GameState_CSGO; - - //Update Typing Keys - if (csgostate.Player.Activity == PlayerActivity.TextInput) - typing_keys_layer.Set(Properties.Sequence, Properties.TypingKeysColor); + _typingKeysLayer.Set(Properties.Sequence, Color.Empty); } - return typing_keys_layer; + return _typingKeysLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs index 0d7a579c1..c0f69f49c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/CSGOWinningTeamLayerHandler.cs @@ -21,12 +21,12 @@ public class CSGOWinningTeamLayerHandlerProperties : LayerHandlerProperties2Colo public Color? _CTColor { get; set; } [JsonIgnore] - public Color CTColor { get { return Logic._CTColor ?? _CTColor ?? Color.Empty; } } + public Color CTColor => Logic._CTColor ?? _CTColor ?? Color.Empty; public Color? _TColor { get; set; } [JsonIgnore] - public Color TColor { get { return Logic._TColor ?? _TColor ?? Color.Empty; } } + public Color TColor => Logic._TColor ?? _TColor ?? Color.Empty; public CSGOWinningTeamLayerHandlerProperties() : base() { } @@ -36,132 +36,140 @@ public override void Default() { base.Default(); - this._CTColor = Color.FromArgb(33, 155, 221); - this._TColor = Color.FromArgb(221, 99, 33); + _CTColor = Color.FromArgb(33, 155, 221); + _TColor = Color.FromArgb(221, 99, 33); } } public class CSGOWinningTeamLayerHandler : LayerHandler { - private readonly AnimationTrack[] tracks = + private readonly EffectLayer _effectLayer = new("CSGO - Winning Team Effect"); + + private readonly AnimationTrack[] _tracks = { - new AnimationTrack("Winning Team Track 0", 1.0f, 0.0f), - new AnimationTrack("Winning Team Track 1", 1.0f, 1.0f), - new AnimationTrack("Winning Team Track 2", 1.0f, 2.0f), - new AnimationTrack("Winning Team Track 3", 1.0f, 3.0f), - new AnimationTrack("Winning Team Track 4", 1.0f, 4.0f) + new("Winning Team Track 0", 1.0f), + new("Winning Team Track 1", 1.0f, 1.0f), + new("Winning Team Track 2", 1.0f, 2.0f), + new("Winning Team Track 3", 1.0f, 3.0f), + new("Winning Team Track 4", 1.0f, 4.0f) }; + private readonly AnimationMix _animationMix; - private long previoustime = 0; - private long currenttime = 0; + private long _previoustime; + private long _currenttime ; - private static float winningTeamEffect_Keyframe = 0.0f; - private const float winningTeamEffect_AnimationTime = 5.0f; + private static float _winningTeamEffectKeyframe; + private const float WinningTeamEffectAnimationTime = 5.0f; - private bool showAnimation = false; + private bool _showAnimation; + + private SolidBrush _solidBrush = new(Color.Empty); + + public CSGOWinningTeamLayerHandler() + { + _animationMix = new AnimationMix(_tracks); + SetTracks(); + } protected override UserControl CreateControl() { return new Control_CSGOWinningTeamLayer(this); } + private bool _empty = true; public override EffectLayer Render(IGameState state) { - previoustime = currenttime; - currenttime = Utils.Time.GetMillisecondsSinceEpoch(); + _previoustime = _currenttime; + _currenttime = Utils.Time.GetMillisecondsSinceEpoch(); - EffectLayer effectLayer = new EffectLayer("CSGO - Winning Team Effect"); - AnimationMix animationMix = new AnimationMix(); + if (state is not GameState_CSGO csgostate) return _effectLayer; - if (state is GameState_CSGO) + // Block animations after end of round + if (csgostate.Map.Phase == MapPhase.Undefined || csgostate.Round.Phase != RoundPhase.Over) { - GameState_CSGO csgostate = state as GameState_CSGO; - - // Block animations after end of round - if (csgostate.Map.Phase == MapPhase.Undefined || csgostate.Round.Phase != RoundPhase.Over) - { - return effectLayer; - } + if (_empty) return _effectLayer; + _effectLayer.Clear(); + _empty = true; + return _effectLayer; + } - Color color = Color.White; + _solidBrush.Color = Color.White; - // Triggers directly after a team wins a round - if (csgostate.Round.WinTeam != RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam == RoundWinTeam.Undefined) + // Triggers directly after a team wins a round + if (csgostate.Round.WinTeam != RoundWinTeam.Undefined && csgostate.Previously.Round.WinTeam == RoundWinTeam.Undefined) + { + // Determine round or game winner + if (csgostate.Map.Phase == MapPhase.GameOver) { - // Determine round or game winner - if (csgostate.Map.Phase == MapPhase.GameOver) + // End of match + var tScore = csgostate.Map.TeamT.Score; + var ctScore = csgostate.Map.TeamCT.Score; + + if (tScore > ctScore) { - // End of match - int tScore = csgostate.Map.TeamT.Score; - int ctScore = csgostate.Map.TeamCT.Score; - - if (tScore > ctScore) - { - color = Properties.TColor; - } - else if (ctScore > tScore) - { - color = Properties.CTColor; - } + _solidBrush.Color = Properties.TColor; } - else + else if (ctScore > tScore) { - // End of round - if (csgostate.Round.WinTeam == RoundWinTeam.T) color = Properties.TColor; - if (csgostate.Round.WinTeam == RoundWinTeam.CT) color = Properties.CTColor; + _solidBrush.Color = Properties.CTColor; } - - this.SetTracks(color); - animationMix.Clear(); - showAnimation = true; } - - if (showAnimation) + else { - animationMix = new AnimationMix(tracks); - - effectLayer.Fill(color); - animationMix.Draw(effectLayer.GetGraphics(), winningTeamEffect_Keyframe); - winningTeamEffect_Keyframe += (currenttime - previoustime) / 1000.0f; - - if (winningTeamEffect_Keyframe >= winningTeamEffect_AnimationTime) + _solidBrush.Color = csgostate.Round.WinTeam switch { - showAnimation = false; - winningTeamEffect_Keyframe = 0; - } + // End of round + RoundWinTeam.T => Properties.TColor, + RoundWinTeam.CT => Properties.CTColor, + _ => _solidBrush.Color + }; } + + _animationMix.Clear(); + _showAnimation = true; } - return effectLayer; + if (!_showAnimation) return _effectLayer; + + _empty = false; + _effectLayer.Fill(_solidBrush); + _animationMix.Draw(_effectLayer.GetGraphics(), _winningTeamEffectKeyframe); + _winningTeamEffectKeyframe += (_currenttime - _previoustime) / 1000.0f; + + if (!(_winningTeamEffectKeyframe >= WinningTeamEffectAnimationTime)) return _effectLayer; + _showAnimation = false; + _winningTeamEffectKeyframe = 0; + + return _effectLayer; } public override void SetApplication(Application profile) { - (Control as Control_CSGOWinningTeamLayer).SetProfile(profile); + (Control as Control_CSGOWinningTeamLayer)?.SetProfile(profile); base.SetApplication(profile); } - private void SetTracks(Color playerColor) + private void SetTracks() { - for (int i = 0; i < tracks.Length; i++) + foreach (var track in _tracks) { - tracks[i].SetFrame( + track.SetFrame( 0.0f, new AnimationCircle( - (int)(Effects.canvas_width_center * 0.9), - Effects.canvas_height_center, + (int)(Effects.CanvasWidthCenter * 0.9), + Effects.CanvasHeightCenter, 0, Color.Black, 4) ); - tracks[i].SetFrame( + track.SetFrame( 1.0f, new AnimationCircle( - (int)(Effects.canvas_width_center * 0.9), - Effects.canvas_height_center, - Effects.canvas_biggest / 2.0f, + (int)(Effects.CanvasWidthCenter * 0.9), + Effects.CanvasHeightCenter, + Effects.CanvasBiggest / 2.0f, Color.Black, 4) ); diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOFlashbangLayer.xaml b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOFlashbangLayer.xaml deleted file mode 100644 index 85d14f1ec..000000000 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOFlashbangLayer.xaml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOFlashbangLayer.xaml.cs b/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOFlashbangLayer.xaml.cs deleted file mode 100644 index 3106fd29f..000000000 --- a/Project-Aurora/Project-Aurora/Profiles/CSGO/Layers/Control_CSGOFlashbangLayer.xaml.cs +++ /dev/null @@ -1,65 +0,0 @@ -using Aurora.Settings; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Aurora.Profiles.CSGO.Layers -{ - /// - /// Interaction logic for Control_CSGOFlashbangLayer.xaml - /// - public partial class Control_CSGOFlashbangLayer : UserControl - { - private bool settingsset = false; - - public Control_CSGOFlashbangLayer() - { - InitializeComponent(); - } - - public Control_CSGOFlashbangLayer(CSGOFlashbangLayerHandler datacontext) - { - InitializeComponent(); - - this.DataContext = datacontext; - } - - public void SetSettings() - { - if (this.DataContext is CSGOFlashbangLayerHandler && !settingsset) - { - this.ColorPicker_Flashbang.SelectedColor = Utils.ColorUtils.DrawingColorToMediaColor((this.DataContext as CSGOFlashbangLayerHandler).Properties._FlashbangColor ?? System.Drawing.Color.Empty); - - settingsset = true; - } - } - - internal void SetProfile(Application profile) - { - } - - private void UserControl_Loaded(object sender, RoutedEventArgs e) - { - SetSettings(); - - this.Loaded -= UserControl_Loaded; - } - - private void ColorPicker_Flashbang_SelectedColorChanged(object sender, RoutedPropertyChangedEventArgs e) - { - if (IsLoaded && settingsset && this.DataContext is CSGOFlashbangLayerHandler && sender is Xceed.Wpf.Toolkit.ColorPicker && (sender as Xceed.Wpf.Toolkit.ColorPicker).SelectedColor.HasValue) - (this.DataContext as CSGOFlashbangLayerHandler).Properties._FlashbangColor = Utils.ColorUtils.MediaColorToDrawingColor((sender as Xceed.Wpf.Toolkit.ColorPicker).SelectedColor.Value); - } - } -} diff --git a/Project-Aurora/Project-Aurora/Profiles/CloneHero/CloneHeroProfile.cs b/Project-Aurora/Project-Aurora/Profiles/CloneHero/CloneHeroProfile.cs index 962274d5c..5234da093 100644 --- a/Project-Aurora/Project-Aurora/Profiles/CloneHero/CloneHeroProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/CloneHero/CloneHeroProfile.cs @@ -112,7 +112,7 @@ public override void Reset() Properties = new LayerHandlerProperties { _PrimaryColor = Color.FromArgb(255, 134, 0), - _Sequence = new KeySequence(new[] { DK.O, DK.P, DK.L, DK.SEMICOLON, DK.PERIOD, DK.FORWARD_SLASH }) + _Sequence = new KeySequence(new DeviceKey[] { DK.O, DK.P, DK.L, DK.SEMICOLON, DK.PERIOD, DK.FORWARD_SLASH }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/IsOrangePressed")) @@ -122,7 +122,7 @@ public override void Reset() Properties = new LayerHandlerProperties { _PrimaryColor = Color.Blue, - _Sequence = new KeySequence(new[] { DK.U, DK.I, DK.J, DK.K, DK.M, DK.COMMA }) + _Sequence = new KeySequence(new DeviceKey[] { DK.U, DK.I, DK.J, DK.K, DK.M, DK.COMMA }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/IsBluePressed")) @@ -132,7 +132,7 @@ public override void Reset() Properties = new LayerHandlerProperties { _PrimaryColor = Color.Yellow, - _Sequence = new KeySequence(new[] { DK.T, DK.Y, DK.G, DK.H, DK.B, DK.N }) + _Sequence = new KeySequence(new DeviceKey[] { DK.T, DK.Y, DK.G, DK.H, DK.B, DK.N }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/IsYellowPressed")) @@ -142,7 +142,7 @@ public override void Reset() Properties = new LayerHandlerProperties { _PrimaryColor = Color.Red, - _Sequence = new KeySequence(new[] { DK.E, DK.R, DK.D, DK.F, DK.C, DK.V }) + _Sequence = new KeySequence(new DeviceKey[] { DK.E, DK.R, DK.D, DK.F, DK.C, DK.V }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/IsRedPressed")) @@ -152,7 +152,7 @@ public override void Reset() Properties = new LayerHandlerProperties { _PrimaryColor = Color.FromArgb(0, 255, 69), - _Sequence = new KeySequence(new[] { DK.Q, DK.W, DK.A, DK.S, DK.Z, DK.X }) + _Sequence = new KeySequence(new DeviceKey[] { DK.Q, DK.W, DK.A, DK.S, DK.Z, DK.X }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Player/IsGreenPressed")) @@ -162,7 +162,7 @@ public override void Reset() Properties = new LayerHandlerProperties { _PrimaryColor = Color.FromArgb(208, 181, 0), - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.OPEN_BRACKET, DK.CLOSE_BRACKET, DK.APOSTROPHE }), } @@ -210,7 +210,7 @@ public override void Reset() _TriggerPath = "Player/Score", _StackMode = AnimationStackMode.Stack, _forceKeySequence = true, - _Sequence = new KeySequence(new[] { DK.PRINT_SCREEN, DK.SCROLL_LOCK, DK.PAUSE_BREAK, DK.INSERT, DK.HOME, DK.HOME, DK.PAGE_UP, + _Sequence = new KeySequence(new DeviceKey[] { DK.PRINT_SCREEN, DK.SCROLL_LOCK, DK.PAUSE_BREAK, DK.INSERT, DK.HOME, DK.HOME, DK.PAGE_UP, DK.DELETE, DK.END, DK.PAGE_DOWN, DK.ARROW_UP, DK.ARROW_LEFT, DK.ARROW_DOWN, DK.ARROW_RIGHT}) } }, new OverrideLogicBuilder() @@ -230,7 +230,7 @@ public override void Reset() _TriggerPath = "Player/Score", _StackMode = AnimationStackMode.Stack, _forceKeySequence = true, - _Sequence = new KeySequence(new[] { DK.PRINT_SCREEN, DK.SCROLL_LOCK, DK.PAUSE_BREAK, DK.INSERT, DK.HOME, DK.HOME, DK.PAGE_UP, + _Sequence = new KeySequence(new DeviceKey[] { DK.PRINT_SCREEN, DK.SCROLL_LOCK, DK.PAUSE_BREAK, DK.INSERT, DK.HOME, DK.HOME, DK.PAGE_UP, DK.DELETE, DK.END, DK.PAGE_DOWN, DK.ARROW_UP, DK.ARROW_LEFT, DK.ARROW_DOWN, DK.ARROW_RIGHT}) } }, new OverrideLogicBuilder() diff --git a/Project-Aurora/Project-Aurora/Profiles/Desktop/DesktopProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Desktop/DesktopProfile.cs index 1fa7e10c5..66959aee1 100755 --- a/Project-Aurora/Project-Aurora/Profiles/Desktop/DesktopProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Desktop/DesktopProfile.cs @@ -40,7 +40,7 @@ private void setVolumeOverlay() { Properties = new PercentGradientLayerHandlerProperties() { - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -154,7 +154,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 205, 255), _SecondaryColor = Color.FromArgb(0, 65, 80), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -173,7 +173,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(255, 80, 0), _SecondaryColor = Color.FromArgb(90, 30, 0), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS diff --git a/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Desktop.cs b/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Desktop.cs index b25e8e686..36e3a74e5 100755 --- a/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Desktop.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Desktop.cs @@ -14,43 +14,41 @@ namespace Aurora.Profiles.Desktop { public class Event_Desktop : LightEvent { - private long internalcounter; + private long _internalCounter; - public Event_Desktop() : base() + public Event_Desktop() { - internalcounter = 0; + _internalCounter = 0; } public override void UpdateLights(EffectFrame frame) { - var layers = new Queue(Application.Profile.Layers.Where(l => l.Enabled).Reverse().Select(l => l.Render(_game_state))); - + var layers = new Queue( + Application.Profile.Layers.Where(l => l.Enabled).Reverse().Select(l => l.Render(_game_state)) + ); + //Scripts before interactive and shortcut assistant layers //ProfilesManager.DesktopProfile.UpdateEffectScripts(layers); if (Global.Configuration.TimeBasedDimmingEnabled) { - if (Utils.Time.IsCurrentTimeBetween(Global.Configuration.TimeBasedDimmingStartHour, Global.Configuration.TimeBasedDimmingEndHour)) { + if (Utils.Time.IsCurrentTimeBetween(Global.Configuration.TimeBasedDimmingStartHour, Global.Configuration.TimeBasedDimmingEndHour)) + { layers.Clear(); - EffectLayer time_based_dim_layer = new EffectLayer("Time Based Dim"); - time_based_dim_layer.Fill(Color.Black); + var timeBasedDimLayer = new EffectLayer("Time Based Dim"); + timeBasedDimLayer.FillOver(Color.Black); - layers.Enqueue(time_based_dim_layer); + layers.Enqueue(timeBasedDimLayer); } } frame.AddLayers(layers.ToArray()); } - public override void SetGameState(IGameState new_game_state) + public override void SetGameState(IGameState newGameState) { - - } - public new bool IsEnabled - { - get { return true; } } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Idle.cs b/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Idle.cs index d2be60ea8..e4db9430a 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Idle.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Desktop/Event_Idle.cs @@ -51,7 +51,7 @@ public override void UpdateLights(EffectFrame frame) case IdleEffects.Dim: layer = new EffectLayer("Idle - Dim"); - layer.Fill(Color.FromArgb(125, 0, 0, 0)); + layer.FillOver(Color.FromArgb(125, 0, 0, 0)); layers.Enqueue(layer); break; @@ -59,11 +59,11 @@ public override void UpdateLights(EffectFrame frame) layer = new EffectLayer("Idle - Color Breathing"); Color breathe_bg_color = Global.Configuration.IdleEffectSecondaryColor; - layer.Fill(breathe_bg_color); + layer.FillOver(breathe_bg_color); float sine = (float)Math.Pow(Math.Sin((double)((currenttime % 10000L) / 10000.0f) * 2 * Math.PI * Global.Configuration.IdleSpeed), 2); - layer.Fill(Color.FromArgb((byte)(sine * 255), Global.Configuration.IdleEffectPrimaryColor)); + layer.FillOver(Color.FromArgb((byte)(sine * 255), Global.Configuration.IdleEffectPrimaryColor)); layers.Enqueue(layer); break; @@ -94,7 +94,7 @@ public override void UpdateLights(EffectFrame frame) nextstarset = currenttime + (long)(1000L * Global.Configuration.IdleFrequency); } - layer.Fill(Global.Configuration.IdleEffectSecondaryColor); + layer.FillOver(Global.Configuration.IdleEffectSecondaryColor); Devices.DeviceKeys[] stars_keys = stars.Keys.ToArray(); @@ -123,7 +123,7 @@ public override void UpdateLights(EffectFrame frame) nextstarset = currenttime + (long)(1000L * Global.Configuration.IdleFrequency); } - layer.Fill(Global.Configuration.IdleEffectSecondaryColor); + layer.FillOver(Global.Configuration.IdleEffectSecondaryColor); Devices.DeviceKeys[] raindrops_keys = raindrops.Keys.ToArray(); @@ -134,13 +134,14 @@ public override void UpdateLights(EffectFrame frame) PointF pt = Effects.GetBitmappingFromDeviceKey(raindrop).Center; float transition_value = 1.0f - raindrops[raindrop]; - float radius = transition_value * Effects.canvas_biggest; + float radius = transition_value * Effects.CanvasBiggest; - layer.GetGraphics().DrawEllipse(new Pen(drop_spec.GetColorAt(transition_value), 2), - pt.X - radius, - pt.Y - radius, - 2 * radius, - 2 * radius); + using(Graphics g = layer.GetGraphics()) + g.DrawEllipse(new Pen(drop_spec.GetColorAt(transition_value), 2), + pt.X - radius, + pt.Y - radius, + 2 * radius, + 2 * radius); raindrops[raindrop] -= getDeltaTime() * 0.05f * Global.Configuration.IdleSpeed; } @@ -150,7 +151,7 @@ public override void UpdateLights(EffectFrame frame) case IdleEffects.Blackout: layer = new EffectLayer("Idle - Blackout"); - layer.Fill(Color.Black); + layer.FillOver(Color.Black); layers.Enqueue(layer); break; @@ -163,7 +164,7 @@ public override void UpdateLights(EffectFrame frame) for (int x = 0; x < Global.Configuration.IdleAmount; x++) { - int width_start = randomizer.Next(Effects.canvas_width); + int width_start = randomizer.Next(Effects.CanvasWidth); float delay = randomizer.Next(550) / 100.0f; int random_id = randomizer.Next(125536789); @@ -171,15 +172,15 @@ public override void UpdateLights(EffectFrame frame) AnimationTrack matrix_line = new AnimationTrack("Matrix Line (Head) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, -3, width_start, 0, Global.Configuration.IdleEffectPrimaryColor, 3)).SetFrame( - 0.5f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height + 3, Global.Configuration.IdleEffectPrimaryColor, 3)).SetShift( + 0.5f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, Effects.CanvasHeight, width_start, Effects.CanvasHeight + 3, Global.Configuration.IdleEffectPrimaryColor, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); AnimationTrack matrix_line_trail = new AnimationTrack("Matrix Line (Trail) " + random_id, 0.0f).SetFrame( 0.0f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, -12, width_start, -3, darker_primary, 3)).SetFrame( - 0.5f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, Effects.canvas_height - 12, width_start, Effects.canvas_height, darker_primary, 3)).SetFrame( - 0.75f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, Effects.canvas_height, width_start, Effects.canvas_height, darker_primary, 3)).SetShift( + 0.5f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, Effects.CanvasHeight - 12, width_start, Effects.CanvasHeight, darker_primary, 3)).SetFrame( + 0.75f * 1.0f / (0.05f * Global.Configuration.IdleSpeed), new AnimationLine(width_start, Effects.CanvasHeight, width_start, Effects.CanvasHeight, darker_primary, 3)).SetShift( (currenttime % 1000000L) / 1000.0f + delay ); @@ -190,7 +191,7 @@ public override void UpdateLights(EffectFrame frame) nextstarset = currenttime + (long)(1000L * Global.Configuration.IdleFrequency); } - layer.Fill(Global.Configuration.IdleEffectSecondaryColor); + layer.FillOver(Global.Configuration.IdleEffectSecondaryColor); using (Graphics g = layer.GetGraphics()) { @@ -215,7 +216,7 @@ public override void UpdateLights(EffectFrame frame) nextstarset = currenttime + (long)(1000L * Global.Configuration.IdleFrequency); } - layer.Fill(Global.Configuration.IdleEffectSecondaryColor); + layer.FillOver(Global.Configuration.IdleEffectSecondaryColor); ColorSpectrum drop_spec2 = new ColorSpectrum( Global.Configuration.IdleEffectPrimaryColor, @@ -225,7 +226,7 @@ public override void UpdateLights(EffectFrame frame) { PointF pt = Effects.GetBitmappingFromDeviceKey(d).Center; float transitionValue = 1.0f - raindrops[d]; - float radius = transitionValue * Effects.canvas_biggest; + float radius = transitionValue * Effects.CanvasBiggest; raindrops[d] -= getDeltaTime() * 0.05f * Global.Configuration.IdleSpeed; return new Tuple(d, pt, transitionValue, radius); diff --git a/Project-Aurora/Project-Aurora/Profiles/DiscoDodgeball/DiscoDodgeballProfile.cs b/Project-Aurora/Project-Aurora/Profiles/DiscoDodgeball/DiscoDodgeballProfile.cs index db405eb93..7b1a52fc3 100644 --- a/Project-Aurora/Project-Aurora/Profiles/DiscoDodgeball/DiscoDodgeballProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/DiscoDodgeball/DiscoDodgeballProfile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.White, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Profiles/Discord/DiscordProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Discord/DiscordProfile.cs index e0761d1f3..80081627c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Discord/DiscordProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Discord/DiscordProfile.cs @@ -25,7 +25,7 @@ public override void Reset() { Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Red, - _Sequence = new KeySequence(new DeviceKeys[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4 }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4 }) } }, new OverrideLogicBuilder().SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("User/SelfMute"))), @@ -34,7 +34,7 @@ public override void Reset() { Properties = new LayerHandlerProperties() { _PrimaryColor = Color.LimeGreen, - _Sequence = new KeySequence(new DeviceKeys[] { DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8 }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8 }) } }, new OverrideLogicBuilder().SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("User/SelfDeafen"))), @@ -43,7 +43,7 @@ public override void Reset() { Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Yellow, - _Sequence = new KeySequence(new DeviceKeys[] { DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }) } }, new OverrideLogicBuilder().SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("User/Mentions"))), @@ -52,7 +52,7 @@ public override void Reset() { Properties = new LayerHandlerProperties() { _PrimaryColor = Color.LightBlue, - _Sequence = new KeySequence(new DeviceKeys[] { DeviceKeys.PRINT_SCREEN, DeviceKeys.SCROLL_LOCK, DeviceKeys.PAUSE_BREAK }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.PRINT_SCREEN, DeviceKeys.SCROLL_LOCK, DeviceKeys.PAUSE_BREAK }) } }, new OverrideLogicBuilder().SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("User/UnreadMessages"))), }; diff --git a/Project-Aurora/Project-Aurora/Profiles/Discord/GSI/AuroraGSI.plugin.js b/Project-Aurora/Project-Aurora/Profiles/Discord/GSI/AuroraGSI.plugin.js index c01c00c59..1928a035a 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Discord/GSI/AuroraGSI.plugin.js +++ b/Project-Aurora/Project-Aurora/Profiles/Discord/GSI/AuroraGSI.plugin.js @@ -2,381 +2,383 @@ /*@cc_on @if (@_jscript) - - // Offer to self-install for clueless users that try to run this directly. - var shell = WScript.CreateObject("WScript.Shell"); - var fs = new ActiveXObject("Scripting.FileSystemObject"); - var pathPlugins = shell.ExpandEnvironmentStrings("%APPDATA%\BetterDiscord\plugins"); - var pathSelf = WScript.ScriptFullName; - // Put the user at ease by addressing them in the first person - shell.Popup("It looks like you've mistakenly tried to run me directly. \n(Don't do that!)", 0, "I'm a plugin for BetterDiscord", 0x30); - if (fs.GetParentFolderName(pathSelf) === fs.GetAbsolutePathName(pathPlugins)) { - shell.Popup("I'm in the correct folder already.", 0, "I'm already installed", 0x40); - } else if (!fs.FolderExists(pathPlugins)) { - shell.Popup("I can't find the BetterDiscord plugins folder.\nAre you sure it's even installed?", 0, "Can't install myself", 0x10); - } else if (shell.Popup("Should I copy myself to BetterDiscord's plugins folder for you?", 0, "Do you need some help?", 0x34) === 6) { - fs.CopyFile(pathSelf, fs.BuildPath(pathPlugins, fs.GetFileName(pathSelf)), true); - // Show the user where to put plugins in the future - shell.Exec("explorer " + pathPlugins); - shell.Popup("I'm installed!", 0, "Successfully installed", 0x40); - } - WScript.Quit(); - + + // Offer to self-install for clueless users that try to run this directly. + var shell = WScript.CreateObject("WScript.Shell"); + var fs = new ActiveXObject("Scripting.FileSystemObject"); + var pathPlugins = shell.ExpandEnvironmentStrings("%APPDATA%BetterDiscordplugins"); + var pathSelf = WScript.ScriptFullName; + // Put the user at ease by addressing them in the first person + shell.Popup("It looks like you've mistakenly tried to run me directly. +'t do that!)", 0, "I'm a plugin for BetterDiscord", 0x30); + if (fs.GetParentFolderName(pathSelf) === fs.GetAbsolutePathName(pathPlugins)) { + shell.Popup("I'm in the correct folder already.", 0, "I'm already installed", 0x40); + } else if (!fs.FolderExists(pathPlugins)) { + shell.Popup("I can't find the BetterDiscord plugins folder. +you sure it's even installed?", 0, "Can't install myself", 0x10); + } else if (shell.Popup("Should I copy myself to BetterDiscord's plugins folder for you?", 0, "Do you need some help?", 0x34) === 6) { + fs.CopyFile(pathSelf, fs.BuildPath(pathPlugins, fs.GetFileName(pathSelf)), true); + // Show the user where to put plugins in the future + shell.Exec("explorer " + pathPlugins); + shell.Popup("I'm installed!", 0, "Successfully installed", 0x40); + } + WScript.Quit(); @else@*/ -class AuroraGSI { - - getName() { return "AuroraGSI"; } - getDescription() { return "Sends information to Aurora about users connecting to/disconnecting from, mute/deafen status"; } - getVersion() { return "2.1.1"; } - getAuthor() { return "Popato & DrMeteor"; } - getChanges() { - return { - "1.0.0" : - ` - Initial version. - `, - "1.0.1" : - ` - Added conditions for only reacting to local user. - `, - "1.0.2" : - ` - Removed isBeingCalled. - Removed redundant loop. - `, - "1.0.3" : - ` - Updated the CDN for the library. - `, - "1.1" : - ` - Made the state only be sent if it changed. - `, - "2.0" : - ` - Version bump to stop the update prompt derping. - `, - "2.1.0": - ` - Allow to track mute/deafen statuses outside voice channels. - Fix unread status for Enhanced Discord users. - Actually fix self-updating loop - `, - "2.1.1": - ` - Fix "being_called" boolean so it's now usable (triggers when user calls and getting called in DMs) - ` - }; - } - - constructor(){ - this.json = { - "provider": { - "name": "discord", - "appid": -1 - }, - "user":{ - "id": -1, - "status": "undefined", - "self_mute": false, - "self_deafen" : false, - "mentions": false, - "unread_messages": false, - "being_called": false - }, - "guild": { - "id": -1, - "name": "", - }, - "text": { - "id": -1, - "type": -1, - "name": "", - }, - "voice": { - "id": -1, - "type": -1, - "name": "", - } - } - this.lastJson; +function getModule (props) { +return BdApi.findModuleByProps.apply(null, props); +} + + +module.exports = class AuroraGSI { + getName () { + return 'AuroraGSI'; } - load() {}//legacy + getDescription () { + return 'Sends information to Aurora about users connecting to/disconnecting from, mute/deafen status'; + } - start() { - let libLoadedEvent = () => { - try{ this.onLibLoaded(); } - catch(err) { console.error(this.getName(), "fatal error, plugin could not be started!", err); } - }; + getVersion () { + return '2.4.1'; + } - let lib = document.getElementById("NeatoBurritoLibrary"); - if(lib == undefined) { - lib = document.createElement("script"); - lib.setAttribute("id", "NeatoBurritoLibrary"); - lib.setAttribute("type", "text/javascript"); - lib.setAttribute("src", "https://raw.githack.com/Popat0/Discord-GSI/master/NeatoBurritoLibrary.js"); - document.head.appendChild(lib); - } - if(typeof window.Metalloriff !== "undefined") libLoadedEvent(); - else lib.addEventListener("load", libLoadedEvent); + getAuthor () { + return 'Popato & DrMeteor'; } - - stop() { - clearInterval(this.updatetimer); - //this.unpatch(); - this.ready = false; + + getChanges () { + return { + '1.0.0' : + ` + Initial version. + `, + '1.0.1' : + ` + Added conditions for only reacting to local user. + `, + '1.0.2' : + ` + Removed isBeingCalled. + Removed redundant loop. + `, + '1.0.3' : + ` + Updated the CDN for the library. + `, + '1.1' : + ` + Made the state only be sent if it changed. + `, + '2.0' : + ` + Version bump to stop the update prompt derping. + `, + '2.1.0': + ` + Allow to track mute/deafen statuses outside voice channels. + Fix unread status for Enhanced Discord users. + Actually fix self-updating loop + `, + '2.1.1': + ` + Fix "being_called" boolean so it's now usable (triggers when user calls and getting called in DMs) + `, + '2.2.0': + ` + Rewrite a bunch of stuff + `, + '2.3.0': + ` + Rewrite some more stuff + `, + '2.4.0': + ` + Rewrite some more stuff + `, + '2.4.1': + ` + Fix stuff for Canary + ` + }; } - - onLibLoaded() { - - this.settings = NeatoLib.Settings.load(this, this.defaultSettings); - NeatoLib.Updates.check(this, "https://raw.githubusercontent.com/Popat0/Discord-GSI/master/AuroraGSI.plugin.js"); - if(this.settings.displayUpdateNotes) NeatoLib.Changelog.compareVersions(this.getName(), this.getChanges()); + constructor () { + this.sendJsonToAurora = global._.debounce(this.sendJsonToAurora, 100); + } - let getVoiceStates = NeatoLib.Modules.get(["getVoiceState"]).getVoiceStates, - getUser = NeatoLib.Modules.get(["getUser"]).getUser, - getChannel = NeatoLib.Modules.get(["getChannel"]).getChannel, - getCalls = NeatoLib.Modules.get(["getCalls"]).getCalls, - getLanguage = document.documentElement.lang; - - // this.jsonTimer = setInterval( this.sendJsonToAurora, 50, this.json ); + getSelectedGuild () { + return this.getGuild(getModule(['getLastSelectedGuildId'], false).getGuildId()); + } - switch (getLanguage) { - case "en-US": - var mute = '[aria-label="Mute"]'; - var deafen = '[aria-label="Deafen"]'; - break; - case "en-GB": - var mute = '[aria-label="Mute"]'; - var deafen = '[aria-label="Deafen"]'; - break; - case "pl": - var mute = '[aria-label="Wycisz"]'; - var deafen = '[aria-label="Wyłącz dźwięk"]'; - break; - case "da": - var mute = '[aria-label="Gør stum"]'; - var deafen = '[aria-label="Gør døv"]'; - break; - case "de": - var mute = '[aria-label="Stummschalten"]'; - var deafen = '[aria-label="Ein- und Ausgabe deaktivieren"]'; - break; - case "es-ES": - var mute = '[aria-label="Silenciar"]'; - var deafen = '[aria-label="Ensordecer"]'; - break; - case "fr": - var mute = '[aria-label="Rendre muet"]'; - var deafen = '[aria-label="Mettre en sourdine"]'; - break; - case "hr": - var mute = '[aria-label="Isključi mikrofon"]'; - var deafen = '[aria-label="Isključi zvuk"]'; - break; - case "it": - var mute = '[aria-label="Silenzia"]'; - var deafen = '[aria-label="Silenzia l\'audio"]'; - break; - case "lt": - var mute = '[aria-label="Nutildyti"]'; - var deafen = '[aria-label="Išjungti garsą"]'; - break; - case "hu": - var mute = '[aria-label="Némítás"]'; - var deafen = '[aria-label="Süketítés"]'; - break; - case "hl": - var mute = '[aria-label="Dempen"]'; - var deafen = '[aria-label="Hoorbaar maken"]'; - break; - case "no": - var mute = '[aria-label="Demp"]'; - var deafen = '[aria-label="Slå av lyd"]'; - break; - case "pt-BR": - var mute = '[aria-label="Desativar microfone"]'; - var deafen = '[aria-label="Desativar áudio"]'; - break; - case "ro": - var mute = '[aria-label="Dezactivează microfonul"]'; - var deafen = '[aria-label="Dezactivează sunetul"]'; - break; - case "fi": - var mute = '[aria-label="Mykistä"]'; - var deafen = '[aria-label="Hiljennä"]'; - break; - case "sv-SE": - var mute = '[aria-label="Mikrofon av"]'; - var deafen = '[aria-label="Ljud av"]'; - break; - case "vi": - var mute = '[aria-label="Tắt âm"]'; - var deafen = '[aria-label="Tắt tiếng"]'; - break; - case "tr": - var mute = '[aria-label="Sustur"]'; - var deafen = '[aria-label="Sağırlaştır"]'; - break; - case "cs": - var mute = '[aria-label="Ztlumit mikrofon"]'; - var deafen = '[aria-label="Ztlumit zvuk"]'; - break; - case "el": - var mute = '[aria-label="Σίγαση"]'; - var deafen = '[aria-label="Κώφωση"]'; - break; - case "bg": - var mute = '[aria-label="Изкл. на микрофона"]'; - var deafen = '[aria-label="Заглушаване"]'; - break; - case "ru": - var mute = '[aria-label="Откл. микрофон"]'; - var deafen = '[aria-label="Откл. звук"]'; - break; - case "uk": - var mute = '[aria-label="Вимкнути мікрофон"]'; - var deafen = '[aria-label="Вимкнути звук"]'; - break; - case "th": - var mute = '[aria-label="ปิดเสียง"]'; - var deafen = '[aria-label="ปิดการได้ยิน"]'; - break; - case "zh-CN": - var mute = '[aria-label="麦克风静音"]'; - var deafen = '[aria-label="耳机静音"]'; - break; - case "ja": - var mute = '[aria-label="ミュート"]'; - var deafen = '[aria-label="スピーカーミュート"]'; - break; - case "zh-TW": - var mute = '[aria-label="靜音"]'; - var deafen = '[aria-label="拒聽"]'; - break; - case "ko": - var mute = '[aria-label="마이크 음소거 "]'; - var deafen = '[aria-label="헤드셋 음소거 "]'; - break; - default: - console.log("Something is fucked up... can't find language"); - } + getSelectedTextChannel () { + return this.getChannel(getModule(['getLastSelectedChannelId'], false).getChannelId()); + } - this.updatetimer = setInterval(() => { - var self = this; - - var guild = NeatoLib.getSelectedGuild(); - var localUser = NeatoLib.getLocalUser(); - var localStatus = NeatoLib.getLocalStatus(); - var textChannel = NeatoLib.getSelectedTextChannel(); - var voiceChannel = NeatoLib.getSelectedVoiceChannel(); - if (voiceChannel) - var voiceStates = getVoiceStates(voiceChannel.guild_id); + getSelectedVoiceChannel () { + return this.getChannel(getModule(['getLastSelectedChannelId'], false).getVoiceChannelId()); + } - if(localUser && localStatus){ - self.json.user.id = localUser.id; - self.json.user.status = localStatus; - } - else { - self.json.user.id = -1; - self.json.user.status = ""; - } + getLocalStatus () { + return getModule([ 'guildPositions' ]).status; + } - if(guild) { - self.json.guild.id = guild.id; - self.json.guild.name = guild.name; - } - else { - self.json.guild.id = -1; - self.json.guild.name = ""; - } + load () {}// legacy - if(textChannel){ - self.json.text.id = textChannel.id; - if(textChannel.type === 0){//text channel - self.json.text.type = 0; - self.json.text.name = textChannel.name; - } - else if (textChannel.type === 1){//pm - self.json.text.type = 1; - self.json.text.name = getUser(textChannel.recipients[0]).username; - } - else if (textChannel.type === 3){//group pm - self.json.text.type = 3; - if(textChannel.name) - self.json.text.name = textChannel.name; - else{ - let newname = ""; - for(let i = 0; i< textChannel.recipients.length; i++){ - let user = textChannel.recipients[i]; - newname += getUser(user).username + " "; - } - self.json.text.name = newname; - } - } - } - else - { - self.json.text.id = -1; - self.json.text.type = -1; - self.json.text.name = ""; - } + start () { + this.json = { + provider: { + name: 'discord', + appid: -1 + }, + user:{ + id: -1, + status: 'undefined', + self_mute: false, + self_deafen : false, + mentions: false, + mention_count: 0, + unread_guilds_count: 0, + unread_messages: false, + being_called: false + }, + guild: { + id: -1, + name: '' + }, + text: { + id: -1, + type: -1, + name: '' + }, + voice: { + id: -1, + type: -1, + name: '' + } + }; + // eslint-disable-next-line no-unused-expressions + this.lastJson; + this.getCurrentUser = getModule([ 'getUser', 'getUsers' ], false).getCurrentUser; + this.getStatus = getModule([ 'getApplicationActivity' ], false).getStatus; + this.getChannel = getModule([ 'getChannel', 'getDMFromUserId' ], false).getChannel; + this.getGuild = getModule([ 'getGuild' ], false).getGuild; + this.channels = getModule([ 'getChannelId' ], false); + this.FluxDispatcher = getModule([ 'subscribe', 'dispatch' ], false); + const { getUser } = getModule([ 'getUser' ], false), + voice = getModule([ 'isMute', 'isDeaf', 'isSelfMute', 'isSelfDeaf' ], false), + { getCalls } = getModule([ 'getCalls' ], false), + { getMutableGuildStates: getUnreadGuilds } = getModule([ 'getMutableGuildStates' ], false), + { getTotalMentionCount } = getModule([ 'getTotalMentionCount' ], false), + isMute = voice.isMute.bind(voice), + isDeaf = voice.isDeaf.bind(voice), + isSelfMute = voice.isSelfMute.bind(voice), + isSelfDeaf = voice.isSelfDeaf.bind(voice); + /* + * { getChannel } = getModule([ 'getChannel' ], false), // we dont use this yet + * const { getVoiceStates } = getModule([ 'getVoiceState' ], false), + */ + this.handler = (props) => { + // eslint-disable-next-line consistent-this + const localUser = this.getCurrentUser(); + const localStatus = this.getLocalStatus(); + /* + * if (voiceChannel) { + * var voiceStates = getVoiceStates(voiceChannel.guild_id); + * } not implemented + */ + switch (props.type) { + case 'PRESENCE_UPDATE': + if (localUser && localStatus) { + this.json.user.id = localUser?.id; + this.json.user.status = localStatus; + } else { + this.json.user.id = -1; + this.json.user.status = ''; + } + break; - if(voiceChannel){ - if(voiceChannel.type === 1){//call - self.json.voice.type = 1; - self.json.voice.id = voiceChannel.id; - self.json.voice.name = getUser(voiceChannel.recipients[0]).username; - } - else if(voiceChannel.type === 2) {//voice channel - self.json.voice.type = 2; - self.json.voice.id = voiceChannel.id; - self.json.voice.name = voiceChannel.name; + case 'CHANNEL_SELECT': + const guild = this.getGuild(props.guildId); + const textChannel = this.getChannel(props.channelId); + if (guild) { + this.json.guild.id = guild.id; + this.json.guild.name = guild.name; + } else { + this.json.guild.id = -1; + this.json.guild.name = ''; + } + if (textChannel) { + this.json.text.id = textChannel.id; + if (textChannel.type === 0) { // text channel + this.json.text.type = 0; + this.json.text.name = textChannel.name; + } else if (textChannel.type === 5) { // announcement channel + this.json.text.type = 5; + this.json.text.name = textChannel.name; + } else if (textChannel.type === 1) { // pm + this.json.text.type = 1; + this.json.text.name = getUser(textChannel.recipients[0]).username; + } else if (textChannel.type === 3) { // group pm + this.json.text.type = 3; + if (textChannel.name) { + this.json.text.name = textChannel.name; + } else { + let newname = ''; + for (let i = 0; i < textChannel.recipients.length; i++) { + const user = textChannel.recipients[i]; + newname += `${getUser(user).username} `; } + this.json.text.name = newname; + } } - else{ - self.json.voice.id = -1; - self.json.voice.type = -1; - self.json.voice.name = ""; + } else { + this.json.text.id = -1; + this.json.text.type = -1; + this.json.text.name = ''; + } + break; + + case 'VOICE_CHANNEL_SELECT': + const voiceChannel = this.getChannel(props.channelId); + if (voiceChannel) { + if (voiceChannel.type === 1) { // call + this.json.voice.type = 1; + this.json.voice.id = voiceChannel.id; + this.json.voice.name = getUser(voiceChannel.recipients[0]).username; + } else if (voiceChannel.type === 2) { // voice channel + this.json.voice.type = 2; + this.json.voice.id = voiceChannel.id; + this.json.voice.name = voiceChannel.name; } + } else { + this.json.voice.id = -1; + this.json.voice.type = -1; + this.json.voice.name = ''; + } + break; - self.json.user.self_mute = document.querySelector(mute).getAttribute("aria-checked"); - self.json.user.self_deafen = document.querySelector(deafen).getAttribute("aria-checked"); - - self.json.user.unread_messages = false; - self.json.user.mentions = false; - - if (document.querySelector('[class^="numberBadge-"]')) - self.json.user.mentions = true; - if (Object.values(NeatoLib.Modules.get("getUnreadGuilds").getUnreadGuilds()).length > 0) - self.json.user.unread_messages = true; - if (getCalls().filter(function(x){return x.ringing.length > 0;}).length > 0) - self.json.user.being_called = true; + case 'USER_VOICE_UPDATE': + this.json.user.self_mute = props.self_mute; + this.json.user.self_deafen = props.self_deafen; + this.json.user.mute = props.mute; + this.json.user.deafen = props.deafen; + break; - if(JSON.stringify(this.json) !== this.lastJson){ - console.log("false"); - this.lastJson = JSON.stringify(this.json); - this.sendJsonToAurora (this.json); - } - }, 100); - - NeatoLib.Events.onPluginLoaded(this); - } + case 'UNREADS_UPDATE': + this.json.user.unread_messages = props.unreads > 0; + this.json.user.unread_guilds_count = props.unreads; + break; + case 'MENTIONS_UPDATE': + this.json.user.mentions = props.mentions > 0; + this.json.user.mention_count = props.mentions; + break; + case 'CALL_RING_UPDATE': + this.json.user.being_called = props.being_called; + break; + case 'SETUP': + this.json.user.id = this.getCurrentUser()?.id; + this.json.user.status = this.getLocalStatus; + this.json.user.self_mute = isSelfMute(); + this.json.user.self_deafen = isSelfDeaf(); + this.json.user.mentions = getTotalMentionCount().length > 0; + this.json.user.mention_count = getTotalMentionCount().length; + this.json.user.unread_guilds_count = Object.values(getUnreadGuilds()).filter(obj => Object.values(obj).includes(true)).length; + this.json.user.unread_messages = Object.values(getUnreadGuilds()).filter(obj => Object.values(obj).includes(true)).length > 0; + break; + default: + break; + } - async sendJsonToAurora(json) { - fetch('http://localhost:9088/', { - method: 'POST', - body: JSON.stringify(json), - mode:'no-cors', - headers:{ - 'Content-Type': 'application/json' - } - }) - .catch (error => { - return undefined; - }); - } -} + if (JSON.stringify(this.json) !== this.lastJson) { + this.lastJson = JSON.stringify(this.json); + this.sendJsonToAurora(this.json); + } + }; + + const timeoutEventHandlers = () => { + const voice = {}; + voice.self_mute = isSelfMute(); + voice.self_deafen = isSelfDeaf(); + voice.mute = isMute(); + voice.deafen = isDeaf(); + if (this.voice.mute !== voice.mute || this.voice.deafen !== voice.deafen) { + this.handler({ type: 'USER_VOICE_UPDATE', + ...voice }); + Object.assign(this.voice, voice); + } + }; + + this.detectMention = (props) => { + const uid = this.getCurrentUser()?.id; + const mentions = getTotalMentionCount(); + if (props.message && !props.message.sendMessageOptions && props.message.author.id !== uid && this.mentions !== mentions) { + this.handler({ type: 'MENTIONS_UPDATE', + mentions }); + this.mentions = mentions; + } + const unreads = Object.values(getUnreadGuilds()).filter(obj => Object.values(obj).includes(true)).length; + if (unreads !== this.unreads) { + this.handler({ type: 'UNREADS_UPDATE', + unreads }); + this.unreads = unreads; + } + }; + + this.detectPresence = (props) => { + if (props.user.id === this.getCurrentUser()?.id) { + this.handler(props); + } + }; + + this.detectCall = () => { + setTimeout(() => { + const being_called = (getCalls().filter((x) => x.ringing.length > 0).length > 0); + if (being_called !== this.voice.being_called) { + this.handler({ type: 'CALL_RING_UPDATE', + being_called }); + this.voice.being_called = being_called; + } + }, 100); + }; + this.FluxDispatcher.subscribe('MESSAGE_CREATE', this.detectMention); + this.FluxDispatcher.subscribe('CHANNEL_SELECT', this.handler); + this.FluxDispatcher.subscribe('VOICE_CHANNEL_SELECT', this.handler); + this.FluxDispatcher.subscribe('PRESENCE_UPDATE', this.detectPresence); + this.FluxDispatcher.subscribe('CALL_CREATE', this.detectCall); + this.voice = {}; + this.unreads = 0; + this.mentions = 0; + this.interval = setInterval(timeoutEventHandlers, 100); + const setupInterval = setInterval(() => { + const u = this.getCurrentUser(); + if (u?.id) { + clearInterval(setupInterval); + this.handler({ type: 'SETUP' }); + } + }, 100); + } + + + stop () { + this.ready = false; + clearInterval(this.interval); + this.FluxDispatcher.unsubscribe('MESSAGE_CREATE', this.detectMention); + this.FluxDispatcher.unsubscribe('CHANNEL_SELECT', this.handler); + this.FluxDispatcher.unsubscribe('VOICE_CHANNEL_SELECT', this.handler); + this.FluxDispatcher.unsubscribe('PRESENCE_UPDATE', this.detectPresence); + this.FluxDispatcher.unsubscribe('CALL_CREATE', this.detectCall); + } + + async sendJsonToAurora (json) { + fetch('http://localhost:9088/', { + method: 'POST', + body: JSON.stringify(json), + mode:'no-cors', + headers:{ + 'Content-Type': 'application/json' + } + }) + .catch(error => console.warn(`Aurora GSI error: ${error}`)); + } +}; diff --git a/Project-Aurora/Project-Aurora/Profiles/Dishonored/DishonoredProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Dishonored/DishonoredProfile.cs index fa6e37058..9795c930d 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dishonored/DishonoredProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dishonored/DishonoredProfile.cs @@ -26,7 +26,7 @@ public override void Reset() _PrimaryColor = Color.Red, _SecondaryColor = Color.FromArgb(255,70,0,0), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS @@ -44,7 +44,7 @@ public override void Reset() _PrimaryColor = Color.Blue, _SecondaryColor = Color.FromArgb(255,0,0,70), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -62,7 +62,7 @@ public override void Reset() _PrimaryColor = Color.Blue, _SecondaryColor = Color.FromArgb(255,0,0,70), _PercentType = PercentEffectType.Progressive, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.DELETE, Devices.DeviceKeys.END, Devices.DeviceKeys.PAGE_DOWN, Devices.DeviceKeys.INSERT, Devices.DeviceKeys.HOME, Devices.DeviceKeys.PAGE_UP, Devices.DeviceKeys.PRINT_SCREEN, Devices.DeviceKeys.SCROLL_LOCK, Devices.DeviceKeys.PAUSE_BREAK @@ -80,7 +80,7 @@ public override void Reset() _PrimaryColor = Color.Red, _SecondaryColor = Color.FromArgb(255,70,0,0), _PercentType = PercentEffectType.Progressive, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.NUM_ONE, Devices.DeviceKeys.NUM_TWO, Devices.DeviceKeys.NUM_THREE, Devices.DeviceKeys.NUM_FOUR, Devices.DeviceKeys.NUM_FIVE, Devices.DeviceKeys.NUM_SIX, Devices.DeviceKeys.NUM_SEVEN, Devices.DeviceKeys.NUM_EIGHT, Devices.DeviceKeys.NUM_NINE diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Dota2Profile.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Dota2Profile.cs index 51fe91445..cd35fcf84 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Dota2Profile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Dota2Profile.cs @@ -30,7 +30,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 255, 0), _SecondaryColor = Color.FromArgb(0, 60, 0), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -48,7 +48,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 125, 255), _SecondaryColor = Color.FromArgb(0, 0, 60), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Abilities.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Abilities.cs index 542f5ee1e..26784ded3 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Abilities.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Abilities.cs @@ -10,7 +10,7 @@ namespace Aurora.Profiles.Dota_2.GSI.Nodes /// public class Abilities_Dota2 : Node, IEnumerable { - private List abilities = new List(); + private List abilities = new(); /// /// The attributes a hero has to spend on abilities @@ -22,11 +22,11 @@ public class Abilities_Dota2 : Node, IEnumerable /// /// The number of abilities /// - public int Count { get { return abilities.Count; } } + public int Count => abilities.Count; - internal Abilities_Dota2(string json_data) : base(json_data) + internal Abilities_Dota2(string jsonData) : base(jsonData) { - json = json_data; + json = jsonData; List abilities = _ParsedData.Properties().Select(p => p.Name).ToList(); foreach (string ability_slot in abilities) diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Hero.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Hero.cs index 464fa7eab..370dda68d 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Hero.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Hero.cs @@ -105,11 +105,35 @@ public class Hero_Dota2 : Node /// public bool IsBreak; + /// + /// A boolean representing whether the hero has Aghanim's Scepter + /// + public bool HasScepter; + + /// + /// A boolean representing whether the hero has Aghanim's Shard + /// + public bool HasShard; + + /// + /// A boolean representing whether the hero is under smoke effect + /// + public bool IsSmoked; + /// /// A boolean representing whether the hero is debuffed /// public bool HasDebuff; + public bool HasTalent1; + public bool HasTalent2; + public bool HasTalent3; + public bool HasTalent4; + public bool HasTalent5; + public bool HasTalent6; + public bool HasTalent7; + public bool HasTalent8; + internal Hero_Dota2(string json_data) : base(json_data) { ID = GetInt("id"); @@ -132,7 +156,18 @@ internal Hero_Dota2(string json_data) : base(json_data) IsHexed = GetBool("hexed"); IsMuted = GetBool("muted"); IsBreak = GetBool("break"); + HasScepter = GetBool("aghanims_scepter"); + HasShard = GetBool("aghanims_shard"); + IsSmoked = GetBool("smoked"); HasDebuff = GetBool("has_debuff"); + HasTalent1 = GetBool("talen1_1"); + HasTalent2 = GetBool("talen1_2"); + HasTalent3 = GetBool("talen1_3"); + HasTalent4 = GetBool("talen1_4"); + HasTalent5 = GetBool("talen1_5"); + HasTalent6 = GetBool("talen1_6"); + HasTalent7 = GetBool("talen1_7"); + HasTalent8 = GetBool("talen1_8"); } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Items.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Items.cs index 28cb4786f..6b65d471f 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Items.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/GSI/Nodes/Items.cs @@ -19,7 +19,7 @@ public class Items_Dota2 : Node /// /// Gets the array of the inventory items /// - [Range(0, 5)] + [Range(0, 8)] public Item[] InventoryItems { get { return inventory.ToArray(); } @@ -42,12 +42,13 @@ public Item[] StashItems internal Items_Dota2(string json_data) : base(json_data) { List slots = _ParsedData.Properties().Select(p => p.Name).ToList(); - foreach (string item_slot in slots) + + foreach (string ItemSlot in slots) { - if (item_slot.StartsWith("slot")) - this.inventory.Add(new Item(_ParsedData[item_slot].ToString())); - else - this.stash.Add(new Item(_ParsedData[item_slot].ToString())); + if (ItemSlot.StartsWith("slot")) + this.inventory.Add(new Item(_ParsedData[ItemSlot].ToString())); + else if(ItemSlot.StartsWith("stash")) + this.stash.Add(new Item(_ParsedData[ItemSlot].ToString())); } } @@ -80,13 +81,13 @@ public Item GetStashAt(int index) /// /// Checks if item exists in the inventory /// - /// The item name + /// The item name /// A boolean if item is in the inventory - public bool InventoryContains(string itemname) + public bool InventoryContains(string ItemName) { - foreach(Item inventory_item in this.inventory) + foreach(Item InventoryItem in this.inventory) { - if (inventory_item.Name.Equals(itemname)) + if (InventoryItem.Name.Equals(ItemName)) return true; } @@ -98,11 +99,11 @@ public bool InventoryContains(string itemname) /// /// The item name /// A boolean if item is in the stash - public bool StashContains(string itemname) + public bool StashContains(string ItemName) { - foreach (Item stash_item in this.stash) + foreach (Item StashItem in this.stash) { - if (stash_item.Name.Equals(itemname)) + if (StashItem.Name.Equals(ItemName)) return true; } @@ -112,13 +113,13 @@ public bool StashContains(string itemname) /// /// Gets index of the first occurence of the item in the inventory /// - /// The item name + /// The item name /// The first index at which item is found, -1 if not found. - public int InventoryIndexOf(string itemname) + public int InventoryIndexOf(string ItemName) { for (int x = 0; x < this.inventory.Count; x++) { - if (this.inventory[x].Name.Equals(itemname)) + if (this.inventory[x].Name.Equals(ItemName)) return x; } @@ -130,11 +131,11 @@ public int InventoryIndexOf(string itemname) /// /// The item name /// The first index at which item is found, -1 if not found. - public int StashIndexOf(string itemname) + public int StashIndexOf(string ItemName) { for (int x = 0; x < this.stash.Count; x++) { - if (this.stash[x].Name == itemname) + if (this.stash[x].Name == ItemName) return x; } diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2AbilityLayer.xaml.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2AbilityLayer.xaml.cs index 49b415a75..596ccf1fc 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2AbilityLayer.xaml.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2AbilityLayer.xaml.cs @@ -82,7 +82,7 @@ private void ability_key1_textblock_MouseDown(object sender, MouseButtonEventArg RecordSingleKey("Dota 2 - Ability 1 Key", sender as TextBlock, ability1_keys_callback); } - private void ability1_keys_callback(DeviceKeys[] resulting_keys) + private void ability1_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= ability1_keys_callback; @@ -107,7 +107,7 @@ private void ability_key2_textblock_MouseDown(object sender, MouseButtonEventArg RecordSingleKey("Dota 2 - Ability 2 Key", sender as TextBlock, ability2_keys_callback); } - private void ability2_keys_callback(DeviceKeys[] resulting_keys) + private void ability2_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= ability2_keys_callback; @@ -132,7 +132,7 @@ private void ability_key3_textblock_MouseDown(object sender, MouseButtonEventArg RecordSingleKey("Dota 2 - Ability 3 Key", sender as TextBlock, ability3_keys_callback); } - private void ability3_keys_callback(DeviceKeys[] resulting_keys) + private void ability3_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= ability3_keys_callback; @@ -157,7 +157,7 @@ private void ability_key4_textblock_MouseDown(object sender, MouseButtonEventArg RecordSingleKey("Dota 2 - Ability 4 Key", sender as TextBlock, ability4_keys_callback); } - private void ability4_keys_callback(DeviceKeys[] resulting_keys) + private void ability4_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= ability4_keys_callback; @@ -182,7 +182,7 @@ private void ability_key5_textblock_MouseDown(object sender, MouseButtonEventArg RecordSingleKey("Dota 2 - Ability 5 Key", sender as TextBlock, ability5_keys_callback); } - private void ability5_keys_callback(DeviceKeys[] resulting_keys) + private void ability5_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= ability5_keys_callback; @@ -207,7 +207,7 @@ private void ability_key6_textblock_MouseDown(object sender, MouseButtonEventArg RecordSingleKey("Dota 2 - Ultimate Ability Key", sender as TextBlock, ability6_keys_callback); } - private void ability6_keys_callback(DeviceKeys[] resulting_keys) + private void ability6_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= ability6_keys_callback; diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2HeroAbilityEffectsLayer.xaml.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2HeroAbilityEffectsLayer.xaml.cs index ab5f6ddf8..cc2b3e5b3 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2HeroAbilityEffectsLayer.xaml.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2HeroAbilityEffectsLayer.xaml.cs @@ -64,169 +64,169 @@ private void Button_Click(object sender, RoutedEventArgs e) AnimationMix sandking_epicenter_mix = new AnimationMix(); AnimationTrack sandking_epicenter_wave0 = new AnimationTrack("Sandsking Epicenter Wave0", 0.5f); sandking_epicenter_wave0.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(115, 255, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(115, 255, 0), 4) ); sandking_epicenter_wave0.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(115, 255, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(115, 255, 0), 4) ); AnimationTrack sandking_epicenter_wave1 = new AnimationTrack("Sandsking Epicenter Wave1", 0.5f, 2.0f); sandking_epicenter_wave1.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave1.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave2 = new AnimationTrack("Sandsking Epicenter Wave2", 0.5f, 2.16f); sandking_epicenter_wave2.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave2.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave3 = new AnimationTrack("Sandsking Epicenter Wave3", 0.5f, 2.32f); sandking_epicenter_wave3.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave3.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave4 = new AnimationTrack("Sandsking Epicenter Wave4", 0.5f, 2.48f); sandking_epicenter_wave4.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave4.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave5 = new AnimationTrack("Sandsking Epicenter Wave5", 0.5f, 2.64f); sandking_epicenter_wave5.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave5.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave6 = new AnimationTrack("Sandsking Epicenter Wave6", 0.5f, 2.8f); sandking_epicenter_wave6.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave6.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave7 = new AnimationTrack("Sandsking Epicenter Wave7", 0.5f, 2.96f); sandking_epicenter_wave7.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave7.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave8 = new AnimationTrack("Sandsking Epicenter Wave8", 0.5f, 3.12f); sandking_epicenter_wave8.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave8.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave9 = new AnimationTrack("Sandsking Epicenter Wave9", 0.5f, 3.28f); sandking_epicenter_wave9.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave9.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave10 = new AnimationTrack("Sandsking Epicenter Wave10", 0.5f, 3.44f); sandking_epicenter_wave10.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave10.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave11 = new AnimationTrack("Sandsking Epicenter Wave11", 0.5f, 3.6f); sandking_epicenter_wave11.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave11.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave12 = new AnimationTrack("Sandsking Epicenter Wave12", 0.5f, 3.76f); sandking_epicenter_wave12.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave12.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave13 = new AnimationTrack("Sandsking Epicenter Wave13", 0.5f, 3.92f); sandking_epicenter_wave13.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave13.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave14 = new AnimationTrack("Sandsking Epicenter Wave14", 0.5f, 4.08f); sandking_epicenter_wave14.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave14.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave15 = new AnimationTrack("Sandsking Epicenter Wave15", 0.5f, 4.24f); sandking_epicenter_wave15.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave15.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave16 = new AnimationTrack("Sandsking Epicenter Wave16", 0.5f, 4.4f); sandking_epicenter_wave16.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave16.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave17 = new AnimationTrack("Sandsking Epicenter Wave17", 0.5f, 4.56f); sandking_epicenter_wave17.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave17.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave18 = new AnimationTrack("Sandsking Epicenter Wave18", 0.5f, 4.72f); sandking_epicenter_wave18.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave18.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave19 = new AnimationTrack("Sandsking Epicenter Wave19", 0.5f, 4.88f); sandking_epicenter_wave19.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave19.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); AnimationTrack sandking_epicenter_wave20 = new AnimationTrack("Sandsking Epicenter Wave20", 0.5f, 5f); sandking_epicenter_wave20.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_wave20.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, System.Drawing.Color.FromArgb(255, 160, 0), 4) ); sandking_epicenter_mix.AddTrack(sandking_epicenter_wave0); diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml index 1af3cc8f4..8899d7501 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml @@ -5,13 +5,21 @@ xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:Aurora.Profiles.Dota_2.Layers" xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit" x:Class="Aurora.Profiles.Dota_2.Layers.Control_Dota2ItemLayer" - mc:Ignorable="d" Loaded="UserControl_Loaded"> + mc:Ignorable="d" Loaded="UserControl_Loaded" Height="173.701"> diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml.cs index 47780150d..496521f11 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Control_Dota2ItemLayer.xaml.cs @@ -54,12 +54,15 @@ public void SetSettings() UIUtils.SetSingleKey(this.item_slot4_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 3); UIUtils.SetSingleKey(this.item_slot5_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 4); UIUtils.SetSingleKey(this.item_slot6_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 5); - UIUtils.SetSingleKey(this.stash_slot1_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 6); - UIUtils.SetSingleKey(this.stash_slot2_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 7); - UIUtils.SetSingleKey(this.stash_slot3_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 8); - UIUtils.SetSingleKey(this.stash_slot4_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 9); - UIUtils.SetSingleKey(this.stash_slot5_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 10); - UIUtils.SetSingleKey(this.stash_slot6_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 11); + UIUtils.SetSingleKey(this.item_slot7_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 6); + UIUtils.SetSingleKey(this.item_slot8_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 7); + UIUtils.SetSingleKey(this.item_slot9_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 8); + UIUtils.SetSingleKey(this.stash_slot1_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 9); + UIUtils.SetSingleKey(this.stash_slot2_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 10); + UIUtils.SetSingleKey(this.stash_slot3_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 11); + UIUtils.SetSingleKey(this.stash_slot4_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 12); + UIUtils.SetSingleKey(this.stash_slot5_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 13); + UIUtils.SetSingleKey(this.stash_slot6_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 14); settingsset = true; } @@ -81,7 +84,7 @@ private void item_slot1_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Item Slot 1 Key", sender as TextBlock, item1_keys_callback); } - private void item1_keys_callback(DeviceKeys[] resulting_keys) + private void item1_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= item1_keys_callback; @@ -106,7 +109,7 @@ private void item_slot2_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Item Slot 2 Key", sender as TextBlock, item2_keys_callback); } - private void item2_keys_callback(DeviceKeys[] resulting_keys) + private void item2_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= item2_keys_callback; @@ -131,7 +134,7 @@ private void item_slot3_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Item Slot 3 Key", sender as TextBlock, item3_keys_callback); } - private void item3_keys_callback(DeviceKeys[] resulting_keys) + private void item3_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= item3_keys_callback; @@ -156,7 +159,7 @@ private void item_slot4_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Item Slot 4 Key", sender as TextBlock, item4_keys_callback); } - private void item4_keys_callback(DeviceKeys[] resulting_keys) + private void item4_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= item4_keys_callback; @@ -181,7 +184,7 @@ private void item_slot5_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Item Slot 5 Key", sender as TextBlock, item5_keys_callback); } - private void item5_keys_callback(DeviceKeys[] resulting_keys) + private void item5_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= item5_keys_callback; @@ -206,7 +209,7 @@ private void item_slot6_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Item Slot 6 Key", sender as TextBlock, item6_keys_callback); } - private void item6_keys_callback(DeviceKeys[] resulting_keys) + private void item6_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= item6_keys_callback; @@ -226,12 +229,88 @@ private void item6_keys_callback(DeviceKeys[] resulting_keys) Global.key_recorder.Reset(); } + + private void item_slot7_textblock_MouseDown(object sender, MouseButtonEventArgs e) + { + RecordSingleKey("Dota 2 - Item Slot 7 Key", sender as TextBlock, item7_keys_callback); + } + + private void item7_keys_callback(DeviceKey[] resulting_keys) + { + Global.key_recorder.FinishedRecording -= item7_keys_callback; + + Dispatcher.Invoke(() => + { + item_slot7_textblock.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); + + if (resulting_keys.Length > 0) + { + if (IsLoaded) + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[6] = resulting_keys[0]; + + UIUtils.SetSingleKey(this.item_slot7_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 6); + } + }); + + Global.key_recorder.Reset(); + } + + private void item_slot8_textblock_MouseDown(object sender, MouseButtonEventArgs e) + { + RecordSingleKey("Dota 2 - Item Slot 8 Key", sender as TextBlock, item8_keys_callback); + } + + private void item8_keys_callback(DeviceKey[] resulting_keys) + { + Global.key_recorder.FinishedRecording -= item8_keys_callback; + + Dispatcher.Invoke(() => + { + item_slot8_textblock.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); + + if (resulting_keys.Length > 0) + { + if (IsLoaded) + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[7] = resulting_keys[0]; + + UIUtils.SetSingleKey(this.item_slot8_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 7); + } + }); + + Global.key_recorder.Reset(); + } + + private void item_slot9_textblock_MouseDown(object sender, MouseButtonEventArgs e) + { + RecordSingleKey("Dota 2 - Item Slot 9 Key", sender as TextBlock, item9_keys_callback); + } + + private void item9_keys_callback(DeviceKey[] resulting_keys) + { + Global.key_recorder.FinishedRecording -= item9_keys_callback; + + Dispatcher.Invoke(() => + { + item_slot9_textblock.Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)); + + if (resulting_keys.Length > 0) + { + if (IsLoaded) + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[8] = resulting_keys[0]; + + UIUtils.SetSingleKey(this.item_slot9_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 8); + } + }); + + Global.key_recorder.Reset(); + } + private void stash_slot1_textblock_MouseDown(object sender, MouseButtonEventArgs e) { RecordSingleKey("Dota 2 - Stash Slot 1 Key", sender as TextBlock, stash1_keys_callback); } - private void stash1_keys_callback(DeviceKeys[] resulting_keys) + private void stash1_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= stash1_keys_callback; @@ -242,9 +321,9 @@ private void stash1_keys_callback(DeviceKeys[] resulting_keys) if (resulting_keys.Length > 0) { if (IsLoaded) - (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[6] = resulting_keys[0]; + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[9] = resulting_keys[0]; - UIUtils.SetSingleKey(this.stash_slot1_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 6); + UIUtils.SetSingleKey(this.stash_slot1_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 9); } }); @@ -256,7 +335,7 @@ private void stash_slot2_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Stash Slot 2 Key", sender as TextBlock, stash2_keys_callback); } - private void stash2_keys_callback(DeviceKeys[] resulting_keys) + private void stash2_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= stash2_keys_callback; @@ -267,9 +346,9 @@ private void stash2_keys_callback(DeviceKeys[] resulting_keys) if (resulting_keys.Length > 0) { if (IsLoaded) - (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[7] = resulting_keys[0]; + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[10] = resulting_keys[0]; - UIUtils.SetSingleKey(this.stash_slot2_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 7); + UIUtils.SetSingleKey(this.stash_slot2_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 10); } }); @@ -281,7 +360,7 @@ private void stash_slot3_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Stash Slot 3 Key", sender as TextBlock, stash3_keys_callback); } - private void stash3_keys_callback(DeviceKeys[] resulting_keys) + private void stash3_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= stash3_keys_callback; @@ -292,9 +371,9 @@ private void stash3_keys_callback(DeviceKeys[] resulting_keys) if (resulting_keys.Length > 0) { if (IsLoaded) - (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[8] = resulting_keys[0]; + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[11] = resulting_keys[0]; - UIUtils.SetSingleKey(this.stash_slot3_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 8); + UIUtils.SetSingleKey(this.stash_slot3_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 11); } }); @@ -306,7 +385,7 @@ private void stash_slot4_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Stash Slot 4 Key", sender as TextBlock, stash4_keys_callback); } - private void stash4_keys_callback(DeviceKeys[] resulting_keys) + private void stash4_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= stash4_keys_callback; @@ -317,9 +396,9 @@ private void stash4_keys_callback(DeviceKeys[] resulting_keys) if (resulting_keys.Length > 0) { if (IsLoaded) - (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[9] = resulting_keys[0]; + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[12] = resulting_keys[0]; - UIUtils.SetSingleKey(this.stash_slot4_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 9); + UIUtils.SetSingleKey(this.stash_slot4_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 12); } }); @@ -331,7 +410,7 @@ private void stash_slot5_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Stash Slot 5 Key", sender as TextBlock, stash5_keys_callback); } - private void stash5_keys_callback(DeviceKeys[] resulting_keys) + private void stash5_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= stash5_keys_callback; @@ -342,9 +421,9 @@ private void stash5_keys_callback(DeviceKeys[] resulting_keys) if (resulting_keys.Length > 0) { if (IsLoaded) - (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[10] = resulting_keys[0]; + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[13] = resulting_keys[0]; - UIUtils.SetSingleKey(this.stash_slot5_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 10); + UIUtils.SetSingleKey(this.stash_slot5_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 13); } }); @@ -356,7 +435,7 @@ private void stash_slot6_textblock_MouseDown(object sender, MouseButtonEventArgs RecordSingleKey("Dota 2 - Stash Slot 6 Key", sender as TextBlock, stash6_keys_callback); } - private void stash6_keys_callback(DeviceKeys[] resulting_keys) + private void stash6_keys_callback(DeviceKey[] resulting_keys) { Global.key_recorder.FinishedRecording -= stash6_keys_callback; @@ -367,9 +446,9 @@ private void stash6_keys_callback(DeviceKeys[] resulting_keys) if (resulting_keys.Length > 0) { if (IsLoaded) - (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[11] = resulting_keys[0]; + (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys[14] = resulting_keys[0]; - UIUtils.SetSingleKey(this.stash_slot6_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 11); + UIUtils.SetSingleKey(this.stash_slot6_textblock, (this.DataContext as Dota2ItemLayerHandler).Properties._ItemKeys, 14); } }); diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2AbilityLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2AbilityLayerHandler.cs index 7ff071bf9..d26f02125 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2AbilityLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2AbilityLayerHandler.cs @@ -1,16 +1,15 @@ -using Aurora.EffectsEngine; +using System.Collections.Generic; +using System.Drawing; +using System.Linq; +using System.Windows.Controls; +using Aurora.Devices; +using Aurora.EffectsEngine; using Aurora.Profiles.Dota_2.GSI; using Aurora.Profiles.Dota_2.GSI.Nodes; using Aurora.Settings; using Aurora.Settings.Layers; +using Aurora.Utils; using Newtonsoft.Json; -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Controls; namespace Aurora.Profiles.Dota_2.Layers { @@ -19,19 +18,20 @@ public class Dota2AbilityLayerHandlerProperties : LayerHandlerProperties2Color Logic._CanCastAbilityColor ?? _CanCastAbilityColor ?? Color.Empty; public Color? _CanNotCastAbilityColor { get; set; } [JsonIgnore] - public Color CanNotCastAbilityColor { get { return Logic._CanNotCastAbilityColor ?? _CanNotCastAbilityColor ?? Color.Empty; } } + public Color CanNotCastAbilityColor => Logic._CanNotCastAbilityColor ?? _CanNotCastAbilityColor ?? Color.Empty; - public List _AbilityKeys { get; set; } + public List _AbilityKeys { get; set; } [JsonIgnore] - public List AbilityKeys { get { return Logic._AbilityKeys ?? _AbilityKeys ?? new List(); } } + public List AbilityKeys => Logic._AbilityKeys ?? _AbilityKeys ?? new List(); - public Dota2AbilityLayerHandlerProperties() : base() { } + public Dota2AbilityLayerHandlerProperties() + { } public Dota2AbilityLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } @@ -39,11 +39,10 @@ public override void Default() { base.Default(); - this._CanCastAbilityColor = Color.FromArgb(0, 255, 0); - this._CanNotCastAbilityColor = Color.FromArgb(255, 0, 0); - this._AbilityKeys = new List() { Devices.DeviceKeys.Q, Devices.DeviceKeys.W, Devices.DeviceKeys.E, Devices.DeviceKeys.D, Devices.DeviceKeys.F, Devices.DeviceKeys.R }; + _CanCastAbilityColor = Color.FromArgb(0, 255, 0); + _CanNotCastAbilityColor = Color.FromArgb(255, 0, 0); + _AbilityKeys = new List { Devices.DeviceKeys.Q, Devices.DeviceKeys.W, Devices.DeviceKeys.E, Devices.DeviceKeys.D, Devices.DeviceKeys.F, Devices.DeviceKeys.R }; } - } public class Dota2AbilityLayerHandler : LayerHandler @@ -53,38 +52,45 @@ protected override UserControl CreateControl() return new Control_Dota2AbilityLayer(this); } + private readonly List _ignoredAbilities = new() { "seasonal", "high_five" }; + private readonly EffectLayer _abilitiesLayer = new("Dota 2 - Abilities"); + + private bool _empty = true; public override EffectLayer Render(IGameState state) { - EffectLayer abilities_layer = new EffectLayer("Dota 2 - Abilities"); - - if (state is GameState_Dota2) + if (state is not GameState_Dota2 dota2State) return _abilitiesLayer; + if (dota2State.Map.GameState == DOTA_GameState.DOTA_GAMERULES_STATE_PRE_GAME || + dota2State.Map.GameState == DOTA_GameState.DOTA_GAMERULES_STATE_GAME_IN_PROGRESS) { - GameState_Dota2 dota2state = state as GameState_Dota2; + for (var index = 0; index < dota2State.Abilities.Count; index++) + { + var ability = dota2State.Abilities[index]; + if (_ignoredAbilities.Any(ignoredAbilityName => ability.Name.Contains(ignoredAbilityName))) + continue; + + _empty = false; + + if (index >= Properties.AbilityKeys.Count) continue; + var key = Properties.AbilityKeys[index]; - if (Properties.AbilityKeys.Count >= 6) + if (ability.CanCast && ability.Cooldown == 0 && ability.Level > 0) + _abilitiesLayer.Set(key, Properties.CanCastAbilityColor); + else if (ability.Cooldown <= 5 && ability.Level > 0) + _abilitiesLayer.Set(key, ColorUtils.BlendColors(Properties.CanCastAbilityColor, Properties.CanNotCastAbilityColor, ability.Cooldown / 5.0)); + else + _abilitiesLayer.Set(key, Properties.CanNotCastAbilityColor); + } + } + else + { + if (!_empty) { - for (int index = 0; index < dota2state.Abilities.Count; index++) - { - Ability ability = dota2state.Abilities[index]; - if (ability.Name.Contains("seasonal") || ability.Name.Contains("high_five")) - continue; - - Devices.DeviceKeys key = Properties.AbilityKeys[index]; - - if (ability.IsUltimate) - key = Properties.AbilityKeys[5]; - - if (ability.CanCast && ability.Cooldown == 0 && ability.Level > 0) - abilities_layer.Set(key, Properties.CanCastAbilityColor); - else if (ability.Cooldown <= 5 && ability.Level > 0) - abilities_layer.Set(key, Utils.ColorUtils.BlendColors(Properties.CanCastAbilityColor, Properties.CanNotCastAbilityColor, (double)ability.Cooldown / 5.0)); - else - abilities_layer.Set(key, Properties.CanNotCastAbilityColor); - } + _abilitiesLayer.Clear(); + _empty = true; } } - return abilities_layer; + return _abilitiesLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2BackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2BackgroundLayerHandler.cs index 66d0ebc63..cbb966150 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2BackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2BackgroundLayerHandler.cs @@ -19,27 +19,27 @@ public class Dota2BackgroundLayerHandlerProperties : LayerHandlerProperties2Colo public Color? _DefaultColor { get; set; } [JsonIgnore] - public Color DefaultColor { get { return Logic._DefaultColor ?? _DefaultColor ?? Color.Empty; } } + public Color DefaultColor => Logic._DefaultColor ?? _DefaultColor ?? Color.Empty; public Color? _RadiantColor { get; set; } [JsonIgnore] - public Color RadiantColor { get { return Logic._RadiantColor ?? _RadiantColor ?? Color.Empty; } } + public Color RadiantColor => Logic._RadiantColor ?? _RadiantColor ?? Color.Empty; public Color? _DireColor { get; set; } [JsonIgnore] - public Color DireColor { get { return Logic._DireColor ?? _DireColor ?? Color.Empty; } } + public Color DireColor => Logic._DireColor ?? _DireColor ?? Color.Empty; public bool? _DimEnabled { get; set; } [JsonIgnore] - public bool DimEnabled { get { return Logic._DimEnabled ?? _DimEnabled ?? false; } } + public bool DimEnabled => Logic._DimEnabled ?? _DimEnabled ?? false; public double? _DimDelay { get; set; } [JsonIgnore] - public double DimDelay { get { return Logic._DimDelay ?? _DimDelay ?? 0.0; } } + public double DimDelay => Logic._DimDelay ?? _DimDelay ?? 0.0; public Dota2BackgroundLayerHandlerProperties() : base() { } @@ -49,30 +49,30 @@ public override void Default() { base.Default(); - this._DefaultColor = Color.FromArgb(140, 190, 230); - this._RadiantColor = Color.FromArgb(0, 140, 30); - this._DireColor = Color.FromArgb(200, 0, 0); - this._DimEnabled = true; - this._DimDelay = 15; + _DefaultColor = Color.FromArgb(140, 190, 230); + _RadiantColor = Color.FromArgb(0, 140, 30); + _DireColor = Color.FromArgb(200, 0, 0); + _DimEnabled = true; + _DimDelay = 15; } } public class Dota2BackgroundLayerHandler : LayerHandler { - private bool isDimming = false; + private bool isDimming; private double dim_value = 1.0; private int dim_bg_at = 15; + private readonly EffectLayer _bgLayer = new("Dota 2 - Background"); protected override UserControl CreateControl() { return new Control_Dota2BackgroundLayer(this); } + private SolidBrush _currentColor = new(Color.Empty); public override EffectLayer Render(IGameState state) { - EffectLayer bg_layer = new EffectLayer("Dota 2 - Background"); - if (state is GameState_Dota2) { GameState_Dota2 dota2state = state as GameState_Dota2; @@ -80,20 +80,20 @@ public override EffectLayer Render(IGameState state) if (dota2state.Previously.Hero.HealthPercent == 0 && dota2state.Hero.HealthPercent == 100 && !dota2state.Previously.Hero.IsAlive && dota2state.Hero.IsAlive) { isDimming = false; - dim_bg_at = dota2state.Map.GameTime + (int)this.Properties.DimDelay; + dim_bg_at = dota2state.Map.GameTime + (int)Properties.DimDelay; dim_value = 1.0; } - Color bg_color = this.Properties.DefaultColor; + Color bg_color = Properties.DefaultColor; switch (dota2state.Player.Team) { case PlayerTeam.Dire: - bg_color = this.Properties.DireColor; + bg_color = Properties.DireColor; break; case PlayerTeam.Radiant: - bg_color = this.Properties.RadiantColor; + bg_color = Properties.RadiantColor; break; default: break; @@ -113,10 +113,15 @@ public override EffectLayer Render(IGameState state) } } - bg_layer.Fill(bg_color); + if (_currentColor.Color != bg_color) + { + _currentColor = new SolidBrush(bg_color); + _bgLayer.Clear(); + _bgLayer.Fill(_currentColor); + } } - return bg_layer; + return _bgLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2HeroAbiltiyEffectsLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2HeroAbiltiyEffectsLayerHandler.cs index 859130880..913123f58 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2HeroAbiltiyEffectsLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2HeroAbiltiyEffectsLayerHandler.cs @@ -20,110 +20,111 @@ public class Dota2HeroAbilityEffectsLayerHandlerProperties : LayerHandlerPropert public Dota2HeroAbilityEffectsLayerHandlerProperties() : base() { } public Dota2HeroAbilityEffectsLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } - - public override void Default() - { - base.Default(); - } } public class Dota2HeroAbilityEffectsLayerHandler : LayerHandler { - enum Dota2AbilityEffects + private enum Dota2AbilityEffects { None, - abaddon_death_coil, - abaddon_borrowed_time, - alchemist_acid_spray, - ancient_apparition_ice_vortex, - ancient_apparition_ice_blast, - antimage_blink, - antimage_mana_void, - axe_berserkers_call, - beastmaster_primal_roar, - brewmaster_thunder_clap, - centaur_hoof_stomp, - chaos_knight_chaos_bolt, - crystal_maiden_crystal_nova, - doom_bringer_scorched_earth, - dragon_knight_breathe_fire, - earthshaker_fissure, - earthshaker_echo_slam, - elder_titan_earth_splitter, - - kunkka_torrent, - kunkka_ghostship, - legion_commander_overwhelming_odds, - life_stealer_rage, - magnataur_shockwave, - omniknight_purification, - omniknight_repel, - sandking_epicenter, - slardar_slithereen_crush, - - lina_dragon_slave, - lina_light_strike_array, - lina_laguna_blade, - nevermore_shadowraze, - nevermore_requiem, - rattletrap_rocket_flare, - razor_plasma_field, - riki_smoke_screen, - zuus_arc_lightning, - zuus_lightning_bolt, - zuus_thundergods_wrath + AbaddonDeathCoil, + AbaddonBorrowedTime, + AlchemistAcidSpray, + AncientApparitionIceVortex, + AncientApparitionIceBlast, + AntimageBlink, + AntimageManaVoid, + AxeBerserkersCall, + BeastmasterPrimalRoar, + BrewmasterThunderClap, + CentaurHoofStomp, + ChaosKnightChaosBolt, + CrystalMaidenCrystalNova, + DoomBringerScorchedEarth, + DragonKnightBreatheFire, + EarthshakerFissure, + EarthshakerEchoSlam, + ElderTitanEarthSplitter, + + KunkkaTorrent, + KunkkaGhostship, + LegionCommanderOverwhelmingOdds, + LifeStealerRage, + MagnataurShockwave, + OmniknightPurification, + OmniknightRepel, + SandkingEpicenter, + SlardarSlithereenCrush, + + LinaDragonSlave, + LinaLightStrikeArray, + LinaLagunaBlade, + NevermoreShadowraze, + NevermoreRequiem, + RattletrapRocketFlare, + RazorPlasmaField, + RikiSmokeScreen, + ZuusArcLightning, + ZuusLightningBolt, + ZuusThundergodsWrath } - private AnimationTrack razor_plasma_field_track; - private AnimationTrack crystal_maiden_crystal_nova_track; - private AnimationTrack riki_smoke_screen_track; - private AnimationTrack lina_dragon_slave_track; - private AnimationTrack lina_light_strike_array_track; - private AnimationTrack lina_laguna_blade_track; - private AnimationTrack abaddon_death_coil_track; - private AnimationTrack nevermore_shadowraze_track; - private AnimationTrack nevermore_requiem_track; - private AnimationTrack zuus_arc_lightning_track; - private AnimationTrack zuus_lightning_bolt_track; - private AnimationTrack zuus_lightning_bolt_shade_track; - private AnimationTrack antimage_blink_track; - private AnimationTrack antimage_mana_void_track; - private AnimationTrack antimage_mana_void_core_track; - private AnimationTrack ancient_apparition_ice_blast_track; - private AnimationTrack axe_berserkers_call_track; - private AnimationTrack beastmaster_primal_roar_track; - private AnimationTrack brewmaster_thunder_clap_track; - private AnimationTrack centaur_hoof_stomp_track; - private AnimationMix chaos_knight_chaos_bolt_mix; - private AnimationTrack rattletrap_rocket_flare_track; - private AnimationTrack dragon_knight_breathe_fire_track; - private AnimationTrack elder_titan_earth_splitter_track; - private AnimationMix kunkka_torrent_mix; - private AnimationTrack kunkka_ghostship_track; - private AnimationTrack legion_commander_overwhelming_odds_track; - private AnimationTrack life_stealer_rage_track; - private AnimationTrack magnataur_shockwave_track; - private AnimationTrack omniknight_purification_track; - private AnimationTrack omniknight_repel_track; - private AnimationMix sandking_epicenter_mix; - private AnimationTrack slardar_slithereen_crush_track; - - private long previoustime = 0; - private long currenttime = 0; - - private float getDeltaTime() + private AnimationTrack _razorPlasmaFieldTrack; + private AnimationTrack _crystalMaidenCrystalNovaTrack; + private AnimationTrack _rikiSmokeScreenTrack; + private AnimationTrack _linaDragonSlaveTrack; + private AnimationTrack _linaLightStrikeArrayTrack; + private AnimationTrack _linaLagunaBladeTrack; + private AnimationTrack _abaddonDeathCoilTrack; + private AnimationTrack _nevermoreShadowrazeTrack; + private AnimationTrack _nevermoreRequiemTrack; + private AnimationTrack _zuusArcLightningTrack; + private AnimationTrack _zuusLightningBoltTrack; + private AnimationTrack _zuusLightningBoltShadeTrack; + private AnimationTrack _antimageBlinkTrack; + private AnimationTrack _antimageManaVoidTrack; + private AnimationTrack _antimageManaVoidCoreTrack; + private AnimationTrack _ancientApparitionIceBlastTrack; + private AnimationTrack _axeBerserkersCallTrack; + private AnimationTrack _beastmasterPrimalRoarTrack; + private AnimationTrack _brewmasterThunderClapTrack; + private AnimationTrack _centaurHoofStompTrack; + private AnimationMix _chaosKnightChaosBoltMix; + private AnimationTrack _rattletrapRocketFlareTrack; + private AnimationTrack _dragonKnightBreatheFireTrack; + private AnimationTrack _elderTitanEarthSplitterTrack; + private AnimationMix _kunkkaTorrentMix; + private AnimationTrack _kunkkaGhostshipTrack; + private AnimationTrack _legionCommanderOverwhelmingOddsTrack; + private AnimationTrack _lifeStealerRageTrack; + private AnimationTrack _magnataurShockwaveTrack; + private AnimationTrack _omniknightPurificationTrack; + private AnimationTrack _omniknightRepelTrack; + private AnimationMix _sandkingEpicenterMix; + private AnimationTrack _slardarSlithereenCrushTrack; + + private long _previousTime; + private long _currentTime; + + private float GetDeltaTime() { - return (currenttime - previoustime) / 1000.0f; + return (_currentTime - _previousTime) / 1000.0f; } - private static float abiltiyeffect_keyframe = 0.0f; - private static Dota2AbilityEffects currentabilityeffect = Dota2AbilityEffects.None; - private static float abilityeffect_time = 0.0f; + private float _abilityEffectKeyframe; + private Dota2AbilityEffects _currentAbilityEffect = Dota2AbilityEffects.None; + private float _abilityEffectTime; - private Random randomizer = new Random(); + private readonly Random _randomizer = new(); - private static Abilities_Dota2 abilities; + private static Abilities_Dota2 _abilities; + private readonly EffectLayer _abilityEffectsLayer = new("Dota 2 - Ability Effects"); + + public Dota2HeroAbilityEffectsLayerHandler() + { + UpdateAnimations(); + } protected override UserControl CreateControl() { @@ -132,1367 +133,1243 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState state) { - previoustime = currenttime; - currenttime = Utils.Time.GetMillisecondsSinceEpoch(); - - if (currenttime - previoustime > 300000 || (currenttime == 0 && previoustime == 0)) - UpdateAnimations(); + _previousTime = _currentTime; + _currentTime = Utils.Time.GetMillisecondsSinceEpoch(); - EffectLayer ability_effects_layer = new EffectLayer("Dota 2 - Ability Effects"); + if (state is not GameState_Dota2 dota2State) return _abilityEffectsLayer; - if (state is GameState_Dota2) + //Preparations + if (_abilities != null && dota2State.Abilities.Count == _abilities.Count) { - GameState_Dota2 dota2state = state as GameState_Dota2; - - //Preparations - if (abilities != null && dota2state.Abilities.Count == abilities.Count) + for (var abilityId = 0; abilityId < dota2State.Abilities.Count; abilityId++) { - for (int ability_id = 0; ability_id < dota2state.Abilities.Count; ability_id++) - { - Ability ability = dota2state.Abilities[ability_id]; + var ability = dota2State.Abilities[abilityId]; - if (!ability.CanCast && abilities[ability_id].CanCast) + if (ability.CanCast || !_abilities[abilityId].CanCast) continue; + switch (ability.Name) + { + //Casted ability + case "razor_plasma_field": + _currentAbilityEffect = Dota2AbilityEffects.RazorPlasmaField; + _abilityEffectTime = 2.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "crystal_maiden_crystal_nova": + _currentAbilityEffect = Dota2AbilityEffects.CrystalMaidenCrystalNova; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "riki_smoke_screen": + _currentAbilityEffect = Dota2AbilityEffects.RikiSmokeScreen; + _abilityEffectTime = 6.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "lina_dragon_slave": + _currentAbilityEffect = Dota2AbilityEffects.LinaDragonSlave; + _abilityEffectTime = 1.25f; + _abilityEffectKeyframe = 0.0f; + break; + case "lina_light_strike_array": + _currentAbilityEffect = Dota2AbilityEffects.LinaLightStrikeArray; + _abilityEffectTime = 2.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "lina_laguna_blade": { - //Casted ability - if (ability.Name.Equals("razor_plasma_field")) - { - currentabilityeffect = Dota2AbilityEffects.razor_plasma_field; - abilityeffect_time = 2.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("crystal_maiden_crystal_nova")) - { - currentabilityeffect = Dota2AbilityEffects.crystal_maiden_crystal_nova; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("riki_smoke_screen")) - { - currentabilityeffect = Dota2AbilityEffects.riki_smoke_screen; - abilityeffect_time = 6.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("lina_dragon_slave")) - { - currentabilityeffect = Dota2AbilityEffects.lina_dragon_slave; - abilityeffect_time = 1.25f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("lina_light_strike_array")) - { - currentabilityeffect = Dota2AbilityEffects.lina_light_strike_array; - abilityeffect_time = 2.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("lina_laguna_blade")) - { - lina_laguna_blade_track = new AnimationTrack("Lina Laguna Blade", 0.5f); - - PointF laguna_point1 = new PointF(0, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF laguna_point2 = new PointF(Effects.canvas_width_center + 3.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF laguna_point3 = new PointF(Effects.canvas_width_center + 6.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF laguna_point4 = new PointF(Effects.canvas_width_center + 9.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - - lina_laguna_blade_track.SetFrame(0.0f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), laguna_point1, Color.FromArgb(255, 255, 255), 2), - new AnimationLine(laguna_point1, laguna_point2, Color.FromArgb(255, 255, 255), Color.FromArgb(170, 170, 255), 3), - new AnimationLine(laguna_point2, laguna_point3, Color.FromArgb(170, 170, 255), Color.FromArgb(85, 85, 255), 3), - new AnimationLine(laguna_point3, laguna_point4, Color.FromArgb(85, 85, 255), Color.FromArgb(0, 0, 255), 5), - } - ) - ); - - lina_laguna_blade_track.SetFrame(0.45f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), laguna_point1, Color.FromArgb(255, 255, 255), 2), - new AnimationLine(laguna_point1, laguna_point2, Color.FromArgb(255, 255, 255), Color.FromArgb(170, 170, 255), 3), - new AnimationLine(laguna_point2, laguna_point3, Color.FromArgb(170, 170, 255), Color.FromArgb(85, 85, 255), 3), - new AnimationLine(laguna_point3, laguna_point4, Color.FromArgb(85, 85, 255), Color.FromArgb(0, 0, 255), 5), - } - ) - ); - - lina_laguna_blade_track.SetFrame(0.5f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), laguna_point1, Color.FromArgb(0, 255, 255, 255), 2), - new AnimationLine(laguna_point1, laguna_point2, Color.FromArgb(0, 255, 255, 255), Color.FromArgb(0, 170, 170, 255), 3), - new AnimationLine(laguna_point2, laguna_point3, Color.FromArgb(0, 170, 170, 255), Color.FromArgb(0, 85, 85, 255), 3), - new AnimationLine(laguna_point3, laguna_point4, Color.FromArgb(0, 85, 85, 255), Color.FromArgb(0, 0, 0, 255), 5), - } - ) - ); - - currentabilityeffect = Dota2AbilityEffects.lina_laguna_blade; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("abaddon_death_coil")) - { - abaddon_death_coil_track = new AnimationTrack("Abaddon Dealth Coil", 0.5f); - - PointF death_coil_point1 = new PointF(Effects.canvas_width_center - 3.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF death_coil_point2 = new PointF(Effects.canvas_width_center, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF death_coil_point3 = new PointF(Effects.canvas_width_center + 3.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF death_coil_point4 = new PointF(Effects.canvas_width_center + 9.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - - abaddon_death_coil_track.SetFrame(0.0f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), death_coil_point1, Color.FromArgb(0, 160, 210), 2), - new AnimationLine(death_coil_point1, death_coil_point2, Color.FromArgb(0, 160, 210), 3), - new AnimationLine(death_coil_point2, death_coil_point3, Color.FromArgb(0, 160, 210), 3), - new AnimationLine(death_coil_point3, death_coil_point4, Color.FromArgb(0, 160, 210), 5), - } - ) - ); - - abaddon_death_coil_track.SetFrame(0.45f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), death_coil_point1, Color.FromArgb(0, 160, 210), 2), - new AnimationLine(death_coil_point1, death_coil_point2, Color.FromArgb(0, 160, 210), 3), - new AnimationLine(death_coil_point2, death_coil_point3, Color.FromArgb(0, 160, 210), 3), - new AnimationLine(death_coil_point3, death_coil_point4, Color.FromArgb(0, 160, 210), 5), - } - ) - ); - - abaddon_death_coil_track.SetFrame(0.5f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), death_coil_point1, Color.FromArgb(0, 0, 160, 210), 2), - new AnimationLine(death_coil_point1, death_coil_point2, Color.FromArgb(0, 0, 160, 210), 3), - new AnimationLine(death_coil_point2, death_coil_point3, Color.FromArgb(0, 0, 160, 210), 3), - new AnimationLine(death_coil_point3, death_coil_point4, Color.FromArgb(0, 0, 160, 210), 5), - } - ) - ); - - currentabilityeffect = Dota2AbilityEffects.abaddon_death_coil; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("abaddon_borrowed_time")) - { - currentabilityeffect = Dota2AbilityEffects.abaddon_borrowed_time; - - if (ability.Level == 1) - abilityeffect_time = 4.0f; - else if (ability.Level == 2) - abilityeffect_time = 5.0f; - else if (ability.Level == 3) - abilityeffect_time = 6.0f; - else - abilityeffect_time = 6.0f; - - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("nevermore_shadowraze1") || ability.Name.Equals("nevermore_shadowraze2") || ability.Name.Equals("nevermore_shadowraze3")) - { - currentabilityeffect = Dota2AbilityEffects.nevermore_shadowraze; - abilityeffect_time = 0.7f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("nevermore_requiem")) - { - currentabilityeffect = Dota2AbilityEffects.nevermore_requiem; - abilityeffect_time = 2.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("zuus_arc_lightning")) - { - zuus_arc_lightning_track = new AnimationTrack("Zeus Arc Lightning", 0.5f); - - PointF zuus_lightning_point1 = new PointF(Effects.canvas_width_center - 3.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF zuus_lightning_point2 = new PointF(Effects.canvas_width_center, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF zuus_lightning_point3 = new PointF(Effects.canvas_width_center + 3.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - PointF zuus_lightning_point4 = new PointF(Effects.canvas_width_center + 9.0f, Effects.canvas_height_center + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - - zuus_arc_lightning_track.SetFrame(0.0f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), zuus_lightning_point1, Color.FromArgb(0, 205, 255), 2), - new AnimationLine(zuus_lightning_point1, zuus_lightning_point2, Color.FromArgb(0, 205, 255), 3), - new AnimationLine(zuus_lightning_point2, zuus_lightning_point3, Color.FromArgb(0, 205, 255) , 3), - new AnimationLine(zuus_lightning_point3, zuus_lightning_point4, Color.FromArgb(0, 205, 255), 5), - } - ) - ); - - zuus_arc_lightning_track.SetFrame(0.45f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), zuus_lightning_point1, Color.FromArgb(0, 205, 255), 2), - new AnimationLine(zuus_lightning_point1, zuus_lightning_point2, Color.FromArgb(0, 205, 255), 3), - new AnimationLine(zuus_lightning_point2, zuus_lightning_point3, Color.FromArgb(0, 205, 255) , 3), - new AnimationLine(zuus_lightning_point3, zuus_lightning_point4, Color.FromArgb(0, 205, 255), 5), - } - ) - ); - - zuus_arc_lightning_track.SetFrame(0.5f, - new AnimationLines( - new AnimationLine[] { - new AnimationLine(new PointF(0, Effects.canvas_height_center), zuus_lightning_point1, Color.FromArgb(0, 0, 205, 255), 2), - new AnimationLine(zuus_lightning_point1, zuus_lightning_point2, Color.FromArgb(0, 0, 205, 255), 3), - new AnimationLine(zuus_lightning_point2, zuus_lightning_point3, Color.FromArgb(0, 0, 205, 255), 3), - new AnimationLine(zuus_lightning_point3, zuus_lightning_point4, Color.FromArgb(0, 0, 205, 255), 5), - } - ) - ); - - currentabilityeffect = Dota2AbilityEffects.zuus_arc_lightning; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("zuus_lightning_bolt")) - { - currentabilityeffect = Dota2AbilityEffects.zuus_lightning_bolt; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("zuus_thundergods_wrath")) - { - currentabilityeffect = Dota2AbilityEffects.zuus_thundergods_wrath; - abilityeffect_time = 0.25f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("antimage_blink")) - { - currentabilityeffect = Dota2AbilityEffects.antimage_blink; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("antimage_mana_void")) - { - currentabilityeffect = Dota2AbilityEffects.antimage_mana_void; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("ancient_apparition_ice_vortex")) - { - currentabilityeffect = Dota2AbilityEffects.ancient_apparition_ice_vortex; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("ancient_apparition_ice_blast")) - { - currentabilityeffect = Dota2AbilityEffects.ancient_apparition_ice_blast; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("alchemist_acid_spray")) - { - currentabilityeffect = Dota2AbilityEffects.alchemist_acid_spray; - abilityeffect_time = 16.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("axe_berserkers_call")) - { - currentabilityeffect = Dota2AbilityEffects.axe_berserkers_call; - abilityeffect_time = 0.7f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("beastmaster_primal_roar")) - { - currentabilityeffect = Dota2AbilityEffects.beastmaster_primal_roar; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("brewmaster_thunder_clap")) - { - currentabilityeffect = Dota2AbilityEffects.brewmaster_thunder_clap; - abilityeffect_time = 1.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("centaur_hoof_stomp")) - { - currentabilityeffect = Dota2AbilityEffects.centaur_hoof_stomp; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("chaos_knight_chaos_bolt")) - { - currentabilityeffect = Dota2AbilityEffects.chaos_knight_chaos_bolt; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("rattletrap_rocket_flare")) - { - currentabilityeffect = Dota2AbilityEffects.rattletrap_rocket_flare; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("doom_bringer_scorched_earth")) - { - currentabilityeffect = Dota2AbilityEffects.doom_bringer_scorched_earth; - - if (ability.Level == 2) - abilityeffect_time = 12.0f; - else if (ability.Level == 3) - abilityeffect_time = 14.0f; - else if (ability.Level == 4) - abilityeffect_time = 16.0f; - else - abilityeffect_time = 10.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("dragon_knight_breathe_fire")) - { - currentabilityeffect = Dota2AbilityEffects.dragon_knight_breathe_fire; - abilityeffect_time = 1.25f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("earthshaker_fissure")) - { - currentabilityeffect = Dota2AbilityEffects.earthshaker_fissure; - abilityeffect_time = 0.25f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("earthshaker_echo_slam")) - { - currentabilityeffect = Dota2AbilityEffects.earthshaker_echo_slam; - abilityeffect_time = 0.25f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("elder_titan_earth_splitter")) - { - currentabilityeffect = Dota2AbilityEffects.elder_titan_earth_splitter; - abilityeffect_time = 4.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("kunkka_torrent")) - { - currentabilityeffect = Dota2AbilityEffects.kunkka_torrent; - abilityeffect_time = 4.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("kunkka_ghostship")) - { - currentabilityeffect = Dota2AbilityEffects.kunkka_ghostship; - abilityeffect_time = 2.7f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("legion_commander_overwhelming_odds")) - { - currentabilityeffect = Dota2AbilityEffects.legion_commander_overwhelming_odds; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("life_stealer_rage")) - { - currentabilityeffect = Dota2AbilityEffects.life_stealer_rage; - - if (ability.Level == 1) - abilityeffect_time = 3.0f; - else if (ability.Level == 2) - abilityeffect_time = 4.0f; - else if (ability.Level == 3) - abilityeffect_time = 5.0f; - if (ability.Level == 4) - abilityeffect_time = 6.0f; - - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("magnataur_shockwave")) - { - currentabilityeffect = Dota2AbilityEffects.magnataur_shockwave; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("omniknight_purification")) - { - currentabilityeffect = Dota2AbilityEffects.omniknight_purification; - abilityeffect_time = 1.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("omniknight_repel")) + _linaLagunaBladeTrack = new AnimationTrack("Lina Laguna Blade", 0.5f); + + var lagunaPoint1 = new PointF(0, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var lagunaPoint2 = new PointF(Effects.CanvasWidthCenter + 3.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var lagunaPoint3 = new PointF(Effects.CanvasWidthCenter + 6.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var lagunaPoint4 = new PointF(Effects.CanvasWidthCenter + 9.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + + _linaLagunaBladeTrack.SetFrame(0.0f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), lagunaPoint1, Color.FromArgb(255, 255, 255), 2), + new(lagunaPoint1, lagunaPoint2, Color.FromArgb(255, 255, 255), Color.FromArgb(170, 170, 255), 3), + new(lagunaPoint2, lagunaPoint3, Color.FromArgb(170, 170, 255), Color.FromArgb(85, 85, 255), 3), + new(lagunaPoint3, lagunaPoint4, Color.FromArgb(85, 85, 255), Color.FromArgb(0, 0, 255), 5), + } + ) + ); + + _linaLagunaBladeTrack.SetFrame(0.45f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), lagunaPoint1, Color.FromArgb(255, 255, 255), 2), + new(lagunaPoint1, lagunaPoint2, Color.FromArgb(255, 255, 255), Color.FromArgb(170, 170, 255), 3), + new(lagunaPoint2, lagunaPoint3, Color.FromArgb(170, 170, 255), Color.FromArgb(85, 85, 255), 3), + new(lagunaPoint3, lagunaPoint4, Color.FromArgb(85, 85, 255), Color.FromArgb(0, 0, 255), 5), + } + ) + ); + + _linaLagunaBladeTrack.SetFrame(0.5f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), lagunaPoint1, Color.FromArgb(0, 255, 255, 255), 2), + new(lagunaPoint1, lagunaPoint2, Color.FromArgb(0, 255, 255, 255), Color.FromArgb(0, 170, 170, 255), 3), + new(lagunaPoint2, lagunaPoint3, Color.FromArgb(0, 170, 170, 255), Color.FromArgb(0, 85, 85, 255), 3), + new(lagunaPoint3, lagunaPoint4, Color.FromArgb(0, 85, 85, 255), Color.FromArgb(0, 0, 0, 255), 5), + } + ) + ); + + _currentAbilityEffect = Dota2AbilityEffects.LinaLagunaBlade; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + } + case "abaddon_death_coil": + { + _abaddonDeathCoilTrack = new AnimationTrack("Abaddon Dealth Coil", 0.5f); + + var deathCoilPoint1 = new PointF(Effects.CanvasWidthCenter - 3.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var deathCoilPoint2 = new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var deathCoilPoint3 = new PointF(Effects.CanvasWidthCenter + 3.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var deathCoilPoint4 = new PointF(Effects.CanvasWidthCenter + 9.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + + _abaddonDeathCoilTrack.SetFrame(0.0f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), deathCoilPoint1, Color.FromArgb(0, 160, 210), 2), + new(deathCoilPoint1, deathCoilPoint2, Color.FromArgb(0, 160, 210), 3), + new(deathCoilPoint2, deathCoilPoint3, Color.FromArgb(0, 160, 210), 3), + new(deathCoilPoint3, deathCoilPoint4, Color.FromArgb(0, 160, 210), 5), + } + ) + ); + + _abaddonDeathCoilTrack.SetFrame(0.45f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), deathCoilPoint1, Color.FromArgb(0, 160, 210), 2), + new(deathCoilPoint1, deathCoilPoint2, Color.FromArgb(0, 160, 210), 3), + new(deathCoilPoint2, deathCoilPoint3, Color.FromArgb(0, 160, 210), 3), + new(deathCoilPoint3, deathCoilPoint4, Color.FromArgb(0, 160, 210), 5), + } + ) + ); + + _abaddonDeathCoilTrack.SetFrame(0.5f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), deathCoilPoint1, Color.FromArgb(0, 0, 160, 210), 2), + new(deathCoilPoint1, deathCoilPoint2, Color.FromArgb(0, 0, 160, 210), 3), + new(deathCoilPoint2, deathCoilPoint3, Color.FromArgb(0, 0, 160, 210), 3), + new(deathCoilPoint3, deathCoilPoint4, Color.FromArgb(0, 0, 160, 210), 5), + } + ) + ); + + _currentAbilityEffect = Dota2AbilityEffects.AbaddonDeathCoil; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + } + case "abaddon_borrowed_time": + { + _currentAbilityEffect = Dota2AbilityEffects.AbaddonBorrowedTime; + + _abilityEffectTime = ability.Level switch { - currentabilityeffect = Dota2AbilityEffects.omniknight_repel; - - if (ability.Level == 1) - abilityeffect_time = 6.0f; - else if (ability.Level == 2) - abilityeffect_time = 8.0f; - else if (ability.Level == 3) - abilityeffect_time = 10.0f; - if (ability.Level == 4) - abilityeffect_time = 12.0f; - - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("sandking_epicenter")) + 1 => 4.0f, + 2 => 5.0f, + 3 => 6.0f, + _ => 6.0f + }; + + _abilityEffectKeyframe = 0.0f; + break; + } + case "nevermore_shadowraze1": + case "nevermore_shadowraze2": + case "nevermore_shadowraze3": + _currentAbilityEffect = Dota2AbilityEffects.NevermoreShadowraze; + _abilityEffectTime = 0.7f; + _abilityEffectKeyframe = 0.0f; + break; + case "nevermore_requiem": + _currentAbilityEffect = Dota2AbilityEffects.NevermoreRequiem; + _abilityEffectTime = 2.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "zuus_arc_lightning": + { + _zuusArcLightningTrack = new AnimationTrack("Zeus Arc Lightning", 0.5f); + + var zuusLightningPoint1 = new PointF(Effects.CanvasWidthCenter - 3.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var zuusLightningPoint2 = new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var zuusLightningPoint3 = new PointF(Effects.CanvasWidthCenter + 3.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + var zuusLightningPoint4 = new PointF(Effects.CanvasWidthCenter + 9.0f, Effects.CanvasHeightCenter + ((_randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)_randomizer.NextDouble())); + + _zuusArcLightningTrack.SetFrame(0.0f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), zuusLightningPoint1, Color.FromArgb(0, 205, 255), 2), + new(zuusLightningPoint1, zuusLightningPoint2, Color.FromArgb(0, 205, 255), 3), + new(zuusLightningPoint2, zuusLightningPoint3, Color.FromArgb(0, 205, 255) , 3), + new(zuusLightningPoint3, zuusLightningPoint4, Color.FromArgb(0, 205, 255), 5), + } + ) + ); + + _zuusArcLightningTrack.SetFrame(0.45f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), zuusLightningPoint1, Color.FromArgb(0, 205, 255), 2), + new(zuusLightningPoint1, zuusLightningPoint2, Color.FromArgb(0, 205, 255), 3), + new(zuusLightningPoint2, zuusLightningPoint3, Color.FromArgb(0, 205, 255) , 3), + new(zuusLightningPoint3, zuusLightningPoint4, Color.FromArgb(0, 205, 255), 5), + } + ) + ); + + _zuusArcLightningTrack.SetFrame(0.5f, + new AnimationLines( + new AnimationLine[] { + new(new PointF(0, Effects.CanvasHeightCenter), zuusLightningPoint1, Color.FromArgb(0, 0, 205, 255), 2), + new(zuusLightningPoint1, zuusLightningPoint2, Color.FromArgb(0, 0, 205, 255), 3), + new(zuusLightningPoint2, zuusLightningPoint3, Color.FromArgb(0, 0, 205, 255), 3), + new(zuusLightningPoint3, zuusLightningPoint4, Color.FromArgb(0, 0, 205, 255), 5), + } + ) + ); + + _currentAbilityEffect = Dota2AbilityEffects.ZuusArcLightning; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + } + case "zuus_lightning_bolt": + _currentAbilityEffect = Dota2AbilityEffects.ZuusLightningBolt; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "zuus_thundergods_wrath": + _currentAbilityEffect = Dota2AbilityEffects.ZuusThundergodsWrath; + _abilityEffectTime = 0.25f; + _abilityEffectKeyframe = 0.0f; + break; + case "antimage_blink": + _currentAbilityEffect = Dota2AbilityEffects.AntimageBlink; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "antimage_mana_void": + _currentAbilityEffect = Dota2AbilityEffects.AntimageManaVoid; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "ancient_apparition_ice_vortex": + _currentAbilityEffect = Dota2AbilityEffects.AncientApparitionIceVortex; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "ancient_apparition_ice_blast": + _currentAbilityEffect = Dota2AbilityEffects.AncientApparitionIceBlast; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "alchemist_acid_spray": + _currentAbilityEffect = Dota2AbilityEffects.AlchemistAcidSpray; + _abilityEffectTime = 16.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "axe_berserkers_call": + _currentAbilityEffect = Dota2AbilityEffects.AxeBerserkersCall; + _abilityEffectTime = 0.7f; + _abilityEffectKeyframe = 0.0f; + break; + case "beastmaster_primal_roar": + _currentAbilityEffect = Dota2AbilityEffects.BeastmasterPrimalRoar; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "brewmaster_thunder_clap": + _currentAbilityEffect = Dota2AbilityEffects.BrewmasterThunderClap; + _abilityEffectTime = 1.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "centaur_hoof_stomp": + _currentAbilityEffect = Dota2AbilityEffects.CentaurHoofStomp; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "chaos_knight_chaos_bolt": + _currentAbilityEffect = Dota2AbilityEffects.ChaosKnightChaosBolt; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "rattletrap_rocket_flare": + _currentAbilityEffect = Dota2AbilityEffects.RattletrapRocketFlare; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + case "doom_bringer_scorched_earth": + { + _currentAbilityEffect = Dota2AbilityEffects.DoomBringerScorchedEarth; + + _abilityEffectTime = ability.Level switch { - currentabilityeffect = Dota2AbilityEffects.sandking_epicenter; - abilityeffect_time = 5.0f; - abiltiyeffect_keyframe = 0.0f; - } - else if (ability.Name.Equals("slardar_slithereen_crush")) + 2 => 12.0f, + 3 => 14.0f, + 4 => 16.0f, + _ => 10.0f + }; + _abilityEffectKeyframe = 0.0f; + break; + } + case "dragon_knight_breathe_fire": + _currentAbilityEffect = Dota2AbilityEffects.DragonKnightBreatheFire; + _abilityEffectTime = 1.25f; + _abilityEffectKeyframe = 0.0f; + break; + case "earthshaker_fissure": + _currentAbilityEffect = Dota2AbilityEffects.EarthshakerFissure; + _abilityEffectTime = 0.25f; + _abilityEffectKeyframe = 0.0f; + break; + case "earthshaker_echo_slam": + _currentAbilityEffect = Dota2AbilityEffects.EarthshakerEchoSlam; + _abilityEffectTime = 0.25f; + _abilityEffectKeyframe = 0.0f; + break; + case "elder_titan_earth_splitter": + _currentAbilityEffect = Dota2AbilityEffects.ElderTitanEarthSplitter; + _abilityEffectTime = 4.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "kunkka_torrent": + _currentAbilityEffect = Dota2AbilityEffects.KunkkaTorrent; + _abilityEffectTime = 4.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "kunkka_ghostship": + _currentAbilityEffect = Dota2AbilityEffects.KunkkaGhostship; + _abilityEffectTime = 2.7f; + _abilityEffectKeyframe = 0.0f; + break; + case "legion_commander_overwhelming_odds": + _currentAbilityEffect = Dota2AbilityEffects.LegionCommanderOverwhelmingOdds; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "life_stealer_rage": + { + _currentAbilityEffect = Dota2AbilityEffects.LifeStealerRage; + + _abilityEffectTime = ability.Level switch { - currentabilityeffect = Dota2AbilityEffects.slardar_slithereen_crush; - abilityeffect_time = 0.5f; - abiltiyeffect_keyframe = 0.0f; - } - else + 1 => 3.0f, + 2 => 4.0f, + 3 => 5.0f, + 4 => 6.0f, + _ => _abilityEffectTime + }; + + _abilityEffectKeyframe = 0.0f; + break; + } + case "magnataur_shockwave": + _currentAbilityEffect = Dota2AbilityEffects.MagnataurShockwave; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "omniknight_purification": + _currentAbilityEffect = Dota2AbilityEffects.OmniknightPurification; + _abilityEffectTime = 1.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "omniknight_repel": + _currentAbilityEffect = Dota2AbilityEffects.OmniknightRepel; + + _abilityEffectTime = ability.Level switch { - if (Global.isDebug) - System.Diagnostics.Debug.WriteLine("Unknown Ability: " + ability.Name); - } - + 1 => 6.0f, + 2 => 8.0f, + 3 => 10.0f, + 4 => 12.0f, + _ => _abilityEffectTime + }; + + _abilityEffectKeyframe = 0.0f; + break; + case "sandking_epicenter": + _currentAbilityEffect = Dota2AbilityEffects.SandkingEpicenter; + _abilityEffectTime = 5.0f; + _abilityEffectKeyframe = 0.0f; + break; + case "slardar_slithereen_crush": + _currentAbilityEffect = Dota2AbilityEffects.SlardarSlithereenCrush; + _abilityEffectTime = 0.5f; + _abilityEffectKeyframe = 0.0f; + break; + default: + { + if (Global.isDebug) + System.Diagnostics.Debug.WriteLine("Unknown Ability: " + ability.Name); + break; } } } + } - abilities = dota2state.Abilities; - - - //Begin rendering - - if (abiltiyeffect_keyframe >= abilityeffect_time) - { - currentabilityeffect = Dota2AbilityEffects.None; - abiltiyeffect_keyframe = 0.0f; - } - - float mid_x = Effects.canvas_width / 2.0f; - float mid_y = Effects.canvas_height / 2.0f; + _abilities = dota2State.Abilities; + //Begin rendering - if (currentabilityeffect == Dota2AbilityEffects.razor_plasma_field) - { - razor_plasma_field_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.crystal_maiden_crystal_nova) - { - crystal_maiden_crystal_nova_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.riki_smoke_screen) - { - riki_smoke_screen_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.lina_dragon_slave) - { - lina_dragon_slave_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.lina_light_strike_array) - { - lina_light_strike_array_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.lina_laguna_blade) - { - lina_laguna_blade_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - - //Kept to remember the times without AnimationTracks. The pain was real. - /* - if (abiltiyeffect_keyframe == 0.0f) - { - laguna_point1 = new EffectPoint(mid_x, mid_y + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - laguna_point2 = new EffectPoint(mid_x + 3.0f, mid_y + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - laguna_point3 = new EffectPoint(mid_x + 6.0f, mid_y + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - laguna_point4 = new EffectPoint(mid_x + 9.0f, mid_y + ((randomizer.Next() % 2 == 0 ? 1.0f : -1.0f) * 6.0f * (float)randomizer.NextDouble())); - } + if (_currentAbilityEffect != null && _abilityEffectKeyframe >= _abilityEffectTime) + { + _currentAbilityEffect = Dota2AbilityEffects.None; + _abilityEffectKeyframe = 0.0f; + _abilityEffectsLayer.Clear(); + } - float progress = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; - - float alpha_percent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); - - ColorSpectrum lina_blade_spectrum_step1 = new ColorSpectrum( - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(255, 255, 255), alpha_percent) - ); - ColorSpectrum lina_blade_spectrum_step2 = new ColorSpectrum( - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(255, 255, 255), alpha_percent), - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(170, 170, 255), alpha_percent) - ); - ColorSpectrum lina_blade_spectrum_step3 = new ColorSpectrum( - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(170, 170, 255), alpha_percent), - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(85, 85, 255), alpha_percent) - ); - ColorSpectrum lina_blade_spectrum_step4 = new ColorSpectrum( - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(85, 85, 255), alpha_percent), - Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(0, 0, 255), alpha_percent) - ); - - - EffectFunction linefunc1 = new EffectLine(new EffectPoint(0, mid_y), laguna_point1, true); - EffectColorFunction line1 = new EffectColorFunction(linefunc1, lina_blade_spectrum_step1, 2); - ability_effects_layer.AddPostFunction(line1); - - EffectFunction linefunc2 = new EffectLine(laguna_point1, laguna_point2, true); - EffectColorFunction line2 = new EffectColorFunction(linefunc2, lina_blade_spectrum_step2, 3); - ability_effects_layer.AddPostFunction(line2); - - EffectFunction linefunc3 = new EffectLine(laguna_point2, laguna_point3, true); - EffectColorFunction line3 = new EffectColorFunction(linefunc3, lina_blade_spectrum_step3, 3); - ability_effects_layer.AddPostFunction(line3); - - EffectFunction linefunc4 = new EffectLine(laguna_point3, laguna_point4, true); - EffectColorFunction line4 = new EffectColorFunction(linefunc4, lina_blade_spectrum_step4, 5); - ability_effects_layer.AddPostFunction(line4); - */ - } - else if (currentabilityeffect == Dota2AbilityEffects.abaddon_death_coil) - { - abaddon_death_coil_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.abaddon_borrowed_time) + _abilityEffectsLayer.Clear(); + switch (_currentAbilityEffect) + { + case Dota2AbilityEffects.RazorPlasmaField: + _razorPlasmaFieldTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.CrystalMaidenCrystalNova: + _crystalMaidenCrystalNovaTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.RikiSmokeScreen: + _rikiSmokeScreenTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.LinaDragonSlave: + _linaDragonSlaveTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.LinaLightStrikeArray: + _linaLightStrikeArrayTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.LinaLagunaBlade: + _linaLagunaBladeTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.AbaddonDeathCoil: + _abaddonDeathCoilTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.AbaddonBorrowedTime: { - float progress = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; - - float alpha_percent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); - - float fluctuatiuons = (float)Math.Sin(((double)progress) * Math.PI * 1.0f) + 0.75f; + var progress = (_abilityEffectKeyframe += GetDeltaTime()) / _abilityEffectTime; + var alphaPercent = progress >= 0.90f ? 1.0f + (1.0f - 1.11f * progress) : 1.0f; + var fluctuations = (float)Math.Sin(progress * Math.PI * 1.0f) + 0.75f; - Color color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(0, 205, 255), fluctuatiuons * alpha_percent); + var color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(0, 205, 255), fluctuations * alphaPercent); - ability_effects_layer.Fill(color); - } - else if (currentabilityeffect == Dota2AbilityEffects.nevermore_shadowraze) - { - nevermore_shadowraze_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.nevermore_requiem) - { - nevermore_requiem_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); + _abilityEffectsLayer.FillOver(color); + break; } - else if (currentabilityeffect == Dota2AbilityEffects.zuus_arc_lightning) + case Dota2AbilityEffects.NevermoreShadowraze: + _nevermoreShadowrazeTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.NevermoreRequiem: + _nevermoreRequiemTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.ZuusArcLightning: + _zuusArcLightningTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.ZuusLightningBolt: + _zuusLightningBoltShadeTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _zuusLightningBoltTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.ZuusThundergodsWrath: { - zuus_arc_lightning_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.zuus_lightning_bolt) - { - zuus_lightning_bolt_shade_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - zuus_lightning_bolt_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.zuus_thundergods_wrath) - { - float x_offset = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; - - float alpha_percent = (x_offset >= 0.85f ? 1.0f + (1.0f - (1.17f) * x_offset) : 1.0f); + var xOffset = (_abilityEffectKeyframe += GetDeltaTime()) / _abilityEffectTime; + var alphaPercent = (xOffset >= 0.85f ? 1.0f + (1.0f - (1.17f) * xOffset) : 1.0f); - ability_effects_layer.Fill(Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(0, 205, 255), alpha_percent)); - } - else if (currentabilityeffect == Dota2AbilityEffects.antimage_blink) - { - antimage_blink_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.antimage_mana_void) - { - antimage_mana_void_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - antimage_mana_void_core_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); + _abilityEffectsLayer.FillOver(Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(0, 205, 255), alphaPercent)); + break; } - else if (currentabilityeffect == Dota2AbilityEffects.ancient_apparition_ice_vortex) + case Dota2AbilityEffects.AntimageBlink: + _antimageBlinkTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.AntimageManaVoid: + _antimageManaVoidTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _antimageManaVoidCoreTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.AncientApparitionIceVortex: { - float x_offset = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; + var xOffset = (_abilityEffectKeyframe += GetDeltaTime()) / _abilityEffectTime; + var alphaPercent = (xOffset >= 0.85f ? 1.0f + (1.0f - (1.17f) * xOffset) : 1.0f); - float alpha_percent = (x_offset >= 0.85f ? 1.0f + (1.0f - (1.17f) * x_offset) : 1.0f); - - ability_effects_layer.Fill(Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 200, 255), alpha_percent)); - } - else if (currentabilityeffect == Dota2AbilityEffects.ancient_apparition_ice_blast) - { - ancient_apparition_ice_blast_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); + _abilityEffectsLayer.FillOver(Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 200, 255), alphaPercent)); + break; } - else if (currentabilityeffect == Dota2AbilityEffects.alchemist_acid_spray) + case Dota2AbilityEffects.AncientApparitionIceBlast: + _ancientApparitionIceBlastTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.AlchemistAcidSpray: { - float alpha_percent = (float)Math.Pow(Math.Sin(((double)abiltiyeffect_keyframe / (abilityeffect_time / 16)) * Math.PI), 2.0); + var alphaPercent = (float)Math.Pow(Math.Sin(((double)_abilityEffectKeyframe / (_abilityEffectTime / 16)) * Math.PI), 2.0); - ability_effects_layer.Fill(Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(140, 160, 0), (alpha_percent < 0.2f ? 0.2f : alpha_percent))); + _abilityEffectsLayer.FillOver(Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(140, 160, 0), (alphaPercent < 0.2f ? 0.2f : alphaPercent))); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.axe_berserkers_call) - { - axe_berserkers_call_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.beastmaster_primal_roar) - { - beastmaster_primal_roar_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.brewmaster_thunder_clap) - { - brewmaster_thunder_clap_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); + _abilityEffectKeyframe += GetDeltaTime(); + break; } - else if (currentabilityeffect == Dota2AbilityEffects.centaur_hoof_stomp) + case Dota2AbilityEffects.AxeBerserkersCall: + _axeBerserkersCallTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.BeastmasterPrimalRoar: + _beastmasterPrimalRoarTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.BrewmasterThunderClap: + _brewmasterThunderClapTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.CentaurHoofStomp: + _centaurHoofStompTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.ChaosKnightChaosBolt: + _chaosKnightChaosBoltMix.Draw(_abilityEffectsLayer.GetGraphics(), _abilityEffectKeyframe); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.RattletrapRocketFlare: + _rattletrapRocketFlareTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.DoomBringerScorchedEarth: { - centaur_hoof_stomp_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.chaos_knight_chaos_bolt) - { - chaos_knight_chaos_bolt_mix.Draw(ability_effects_layer.GetGraphics(), abiltiyeffect_keyframe); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.rattletrap_rocket_flare) - { - rattletrap_rocket_flare_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.doom_bringer_scorched_earth) - { - float progress = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; - - float alpha_percent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); - - float fluctuatiuons = (float)Math.Sin(((double)progress) * Math.PI * 1.0f) + 0.75f; + var progress = (_abilityEffectKeyframe += GetDeltaTime()) / _abilityEffectTime; + var alphaPercent = progress >= 0.90f ? 1.0f + (1.0f - 1.11f * progress) : 1.0f; + var fluctuations = (float)Math.Sin(progress * Math.PI * 1.0f) + 0.75f; - Color color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 60, 0), fluctuatiuons * alpha_percent); + Color color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 60, 0), fluctuations * alphaPercent); - ability_effects_layer.Fill(color); - } - else if (currentabilityeffect == Dota2AbilityEffects.dragon_knight_breathe_fire) - { - dragon_knight_breathe_fire_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); + _abilityEffectsLayer.FillOver(color); + break; } - else if (currentabilityeffect == Dota2AbilityEffects.earthshaker_fissure) + case Dota2AbilityEffects.DragonKnightBreatheFire: + _dragonKnightBreatheFireTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.EarthshakerFissure: { - float progress = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; + var progress = (_abilityEffectKeyframe += GetDeltaTime()) / _abilityEffectTime; + var alphaPercent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); + var fluctuations = (float)Math.Sin(progress * Math.PI * 1.0f) + 0.75f; - float alpha_percent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); + var color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 60, 0), fluctuations * alphaPercent); - float fluctuatiuons = (float)Math.Sin(((double)progress) * Math.PI * 1.0f) + 0.75f; - - Color color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 60, 0), fluctuatiuons * alpha_percent); - - ability_effects_layer.Fill(color); + _abilityEffectsLayer.FillOver(color); + break; } - else if (currentabilityeffect == Dota2AbilityEffects.earthshaker_echo_slam) + case Dota2AbilityEffects.EarthshakerEchoSlam: { - float progress = (abiltiyeffect_keyframe += getDeltaTime()) / abilityeffect_time; - - float alpha_percent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); + var progress = (_abilityEffectKeyframe += GetDeltaTime()) / _abilityEffectTime; + var alphaPercent = (progress >= 0.90f ? 1.0f + (1.0f - (1.11f) * progress) : 1.0f); + var fluctuations = (float)Math.Sin(progress * Math.PI * 1.0f) + 0.75f; - float fluctuatiuons = (float)Math.Sin(((double)progress) * Math.PI * 1.0f) + 0.75f; + var color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 60, 0), fluctuations * alphaPercent); - Color color = Utils.ColorUtils.MultiplyColorByScalar(Color.FromArgb(200, 60, 0), fluctuatiuons * alpha_percent); - - ability_effects_layer.Fill(color); - } - else if (currentabilityeffect == Dota2AbilityEffects.elder_titan_earth_splitter) - { - elder_titan_earth_splitter_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.kunkka_torrent) - { - kunkka_torrent_mix.Draw(ability_effects_layer.GetGraphics(), abiltiyeffect_keyframe); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.kunkka_ghostship) - { - kunkka_ghostship_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.legion_commander_overwhelming_odds) - { - legion_commander_overwhelming_odds_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.life_stealer_rage) - { - life_stealer_rage_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.magnataur_shockwave) - { - magnataur_shockwave_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.omniknight_purification) - { - omniknight_purification_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.omniknight_repel) - { - omniknight_repel_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.sandking_epicenter) - { - sandking_epicenter_mix.Draw(ability_effects_layer.GetGraphics(), abiltiyeffect_keyframe); - abiltiyeffect_keyframe += getDeltaTime(); - } - else if (currentabilityeffect == Dota2AbilityEffects.slardar_slithereen_crush) - { - slardar_slithereen_crush_track.GetFrame(abiltiyeffect_keyframe).Draw(ability_effects_layer.GetGraphics()); - abiltiyeffect_keyframe += getDeltaTime(); + _abilityEffectsLayer.FillOver(color); + break; } + case Dota2AbilityEffects.ElderTitanEarthSplitter: + _elderTitanEarthSplitterTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.KunkkaTorrent: + _kunkkaTorrentMix.Draw(_abilityEffectsLayer.GetGraphics(), _abilityEffectKeyframe); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.KunkkaGhostship: + _kunkkaGhostshipTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.LegionCommanderOverwhelmingOdds: + _legionCommanderOverwhelmingOddsTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.LifeStealerRage: + _lifeStealerRageTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.MagnataurShockwave: + _magnataurShockwaveTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.OmniknightPurification: + _omniknightPurificationTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.OmniknightRepel: + _omniknightRepelTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.SandkingEpicenter: + _sandkingEpicenterMix.Draw(_abilityEffectsLayer.GetGraphics(), _abilityEffectKeyframe); + _abilityEffectKeyframe += GetDeltaTime(); + break; + case Dota2AbilityEffects.SlardarSlithereenCrush: + _slardarSlithereenCrushTrack.GetFrame(_abilityEffectKeyframe).Draw(_abilityEffectsLayer.GetGraphics()); + _abilityEffectKeyframe += GetDeltaTime(); + break; } - return ability_effects_layer; + return _abilityEffectsLayer; } public override void SetApplication(Application profile) { - (Control as Control_Dota2HeroAbilityEffectsLayer).SetProfile(profile); + (Control as Control_Dota2HeroAbilityEffectsLayer)?.SetProfile(profile); base.SetApplication(profile); } - public void UpdateAnimations() + private void UpdateAnimations() { - razor_plasma_field_track = new AnimationTrack("Razor Plasma Field", 2.0f); - razor_plasma_field_track.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(0, 200, 255), 3) + _razorPlasmaFieldTrack = new AnimationTrack("Razor Plasma Field", 2.0f); + _razorPlasmaFieldTrack.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(0, 200, 255), 3) ); - razor_plasma_field_track.SetFrame(1.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 200, 255), 3) + _razorPlasmaFieldTrack.SetFrame(1.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 200, 255), 3) ); - razor_plasma_field_track.SetFrame(2.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(0, 200, 255), 3) + _razorPlasmaFieldTrack.SetFrame(2.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(0, 200, 255), 3) ); - crystal_maiden_crystal_nova_track = new AnimationTrack("CM Crystal Nova", 1.0f); - crystal_maiden_crystal_nova_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_height / 2.0f, Color.FromArgb(0, 200, 255)) + _crystalMaidenCrystalNovaTrack = new AnimationTrack("CM Crystal Nova", 1.0f); + _crystalMaidenCrystalNovaTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasHeight / 2.0f, Color.FromArgb(0, 200, 255)) ); - crystal_maiden_crystal_nova_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.75f / 2.0f, Color.FromArgb(0, 200, 255)) + _crystalMaidenCrystalNovaTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.75f / 2.0f, Color.FromArgb(0, 200, 255)) ); - crystal_maiden_crystal_nova_track.SetFrame(1.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 0, 200, 255)) + _crystalMaidenCrystalNovaTrack.SetFrame(1.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 0, 200, 255)) ); - riki_smoke_screen_track = new AnimationTrack("Riki Smoke Screen", 6.5f); - riki_smoke_screen_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_height / 2.0f, Color.FromArgb(163, 70, 255)) + _rikiSmokeScreenTrack = new AnimationTrack("Riki Smoke Screen", 6.5f); + _rikiSmokeScreenTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasHeight / 2.0f, Color.FromArgb(163, 70, 255)) ); - riki_smoke_screen_track.SetFrame(5.525f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.75f / 2.0f, Color.FromArgb(163, 70, 255)) + _rikiSmokeScreenTrack.SetFrame(5.525f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.75f / 2.0f, Color.FromArgb(163, 70, 255)) ); - riki_smoke_screen_track.SetFrame(6.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 163, 70, 255)) + _rikiSmokeScreenTrack.SetFrame(6.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 163, 70, 255)) ); - lina_dragon_slave_track = new AnimationTrack("Lina Dragon Slave", 1.25f); - lina_dragon_slave_track.SetFrame(0.0f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest * 0.10f, Color.FromArgb(255, 80, 0)) + _linaDragonSlaveTrack = new AnimationTrack("Lina Dragon Slave", 1.25f); + _linaDragonSlaveTrack.SetFrame(0.0f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.10f, Color.FromArgb(255, 80, 0)) ); - lina_dragon_slave_track.SetFrame(0.9375f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest * 0.75f, Color.FromArgb(255, 80, 0)) + _linaDragonSlaveTrack.SetFrame(0.9375f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.75f, Color.FromArgb(255, 80, 0)) ); - lina_dragon_slave_track.SetFrame(1.25f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 255, 80, 0)) + _linaDragonSlaveTrack.SetFrame(1.25f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 255, 80, 0)) ); - lina_light_strike_array_track = new AnimationTrack("Lina Light Strike", 2.0f); - lina_light_strike_array_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(0, 255, 80, 0)) + _linaLightStrikeArrayTrack = new AnimationTrack("Lina Light Strike", 2.0f); + _linaLightStrikeArrayTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(0, 255, 80, 0)) ); - lina_light_strike_array_track.SetFrame(0.49f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(0, 255, 80, 0)) + _linaLightStrikeArrayTrack.SetFrame(0.49f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(0, 255, 80, 0)) ); - lina_light_strike_array_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.1f / 2.0f, Color.FromArgb(255, 80, 0)) + _linaLightStrikeArrayTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.1f / 2.0f, Color.FromArgb(255, 80, 0)) ); - lina_light_strike_array_track.SetFrame(1.25f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f / 2.0f, Color.FromArgb(255, 80, 0)) + _linaLightStrikeArrayTrack.SetFrame(1.25f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f / 2.0f, Color.FromArgb(255, 80, 0)) ); - lina_light_strike_array_track.SetFrame(2.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 255, 80, 0)) + _linaLightStrikeArrayTrack.SetFrame(2.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 255, 80, 0)) ); - nevermore_shadowraze_track = new AnimationTrack("Shadow Fiend Raze", 0.7f); - nevermore_shadowraze_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f / 2.0f, Color.FromArgb(255, 0, 0)) + _nevermoreShadowrazeTrack = new AnimationTrack("Shadow Fiend Raze", 0.7f); + _nevermoreShadowrazeTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f / 2.0f, Color.FromArgb(255, 0, 0)) ); - nevermore_shadowraze_track.SetFrame(0.595f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.075f / 2.0f, Color.FromArgb(255, 0, 0)) + _nevermoreShadowrazeTrack.SetFrame(0.595f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.075f / 2.0f, Color.FromArgb(255, 0, 0)) ); - nevermore_shadowraze_track.SetFrame(0.7f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(0, 255, 0, 0)) + _nevermoreShadowrazeTrack.SetFrame(0.7f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(0, 255, 0, 0)) ); - nevermore_requiem_track = new AnimationTrack("Shadow Field Requiem", 2.0f); - nevermore_requiem_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 0, 0)) + _nevermoreRequiemTrack = new AnimationTrack("Shadow Field Requiem", 2.0f); + _nevermoreRequiemTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 0, 0)) ); - nevermore_requiem_track.SetFrame(1.7f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.85f / 2.0f, Color.FromArgb(255, 0, 0)) + _nevermoreRequiemTrack.SetFrame(1.7f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.85f / 2.0f, Color.FromArgb(255, 0, 0)) ); - nevermore_requiem_track.SetFrame(2.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 255, 0, 0)) + _nevermoreRequiemTrack.SetFrame(2.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 255, 0, 0)) ); - zuus_lightning_bolt_track = new AnimationTrack("Zeus Lighting Bolt", 0.5f); - zuus_lightning_bolt_track.SetFrame(0.0f, - new AnimationLine(new PointF(Effects.canvas_width_center, 0), new PointF(Effects.canvas_width_center, Effects.canvas_height), Color.FromArgb(0, 205, 255), 15) + _zuusLightningBoltTrack = new AnimationTrack("Zeus Lighting Bolt", 0.5f); + _zuusLightningBoltTrack.SetFrame(0.0f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, 0), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeight), Color.FromArgb(0, 205, 255), 15) ); - zuus_lightning_bolt_track.SetFrame(0.425f, - new AnimationLine(new PointF(Effects.canvas_width_center, 0), new PointF(Effects.canvas_width_center, Effects.canvas_height), Color.FromArgb(0, 205, 255), 15) + _zuusLightningBoltTrack.SetFrame(0.425f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, 0), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeight), Color.FromArgb(0, 205, 255), 15) ); - zuus_lightning_bolt_track.SetFrame(0.5f, - new AnimationLine(new PointF(Effects.canvas_width_center, 0), new PointF(Effects.canvas_width_center, Effects.canvas_height), Color.FromArgb(0, 0, 205, 255), 15) + _zuusLightningBoltTrack.SetFrame(0.5f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, 0), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeight), Color.FromArgb(0, 0, 205, 255), 15) ); - zuus_lightning_bolt_shade_track = new AnimationTrack("Zeus Lighting Bolt Shade", 0.5f); - zuus_lightning_bolt_shade_track.SetFrame(0.0f, - new AnimationLine(new PointF(Effects.canvas_width_center, 0), new PointF(Effects.canvas_width_center, Effects.canvas_height), Color.FromArgb(180, 0, 205, 255), 20) + _zuusLightningBoltShadeTrack = new AnimationTrack("Zeus Lighting Bolt Shade", 0.5f); + _zuusLightningBoltShadeTrack.SetFrame(0.0f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, 0), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeight), Color.FromArgb(180, 0, 205, 255), 20) ); - zuus_lightning_bolt_shade_track.SetFrame(0.425f, - new AnimationLine(new PointF(Effects.canvas_width_center, 0), new PointF(Effects.canvas_width_center, Effects.canvas_height), Color.FromArgb(180, 0, 205, 255), 20) + _zuusLightningBoltShadeTrack.SetFrame(0.425f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, 0), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeight), Color.FromArgb(180, 0, 205, 255), 20) ); - zuus_lightning_bolt_shade_track.SetFrame(0.5f, - new AnimationLine(new PointF(Effects.canvas_width_center, 0), new PointF(Effects.canvas_width_center, Effects.canvas_height), Color.FromArgb(0, 0, 205, 255), 20) + _zuusLightningBoltShadeTrack.SetFrame(0.5f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, 0), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeight), Color.FromArgb(0, 0, 205, 255), 20) ); - antimage_blink_track = new AnimationTrack("Anti-mage Blink", 0.5f); - antimage_blink_track.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(128, 0, 255), 3) + _antimageBlinkTrack = new AnimationTrack("Anti-mage Blink", 0.5f); + _antimageBlinkTrack.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(128, 0, 255), 3) ); - antimage_blink_track.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(128, 0, 255), 3) + _antimageBlinkTrack.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(128, 0, 255), 3) ); - antimage_mana_void_track = new AnimationTrack("Anti-mage Void", 0.5f); - antimage_mana_void_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.10f, Color.FromArgb(0, 0, 255)) + _antimageManaVoidTrack = new AnimationTrack("Anti-mage Void", 0.5f); + _antimageManaVoidTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.10f, Color.FromArgb(0, 0, 255)) ); - antimage_mana_void_track.SetFrame(0.425f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.85f, Color.FromArgb(0, 0, 255)) + _antimageManaVoidTrack.SetFrame(0.425f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.85f, Color.FromArgb(0, 0, 255)) ); - antimage_mana_void_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 0, 0, 255)) + _antimageManaVoidTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 0, 0, 255)) ); - antimage_mana_void_core_track = new AnimationTrack("Anti-mage Void Core", 0.5f); - antimage_mana_void_core_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 255, 255)) + _antimageManaVoidCoreTrack = new AnimationTrack("Anti-mage Void Core", 0.5f); + _antimageManaVoidCoreTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 255, 255)) ); - antimage_mana_void_core_track.SetFrame(0.425f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.25f, Color.FromArgb(255, 255, 255)) + _antimageManaVoidCoreTrack.SetFrame(0.425f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.25f, Color.FromArgb(255, 255, 255)) ); - antimage_mana_void_core_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f, Color.FromArgb(0, 255, 255, 255)) + _antimageManaVoidCoreTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f, Color.FromArgb(0, 255, 255, 255)) ); - ancient_apparition_ice_blast_track = new AnimationTrack("AA Ice Blast", 1.0f); - ancient_apparition_ice_blast_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(200, 200, 255)) + _ancientApparitionIceBlastTrack = new AnimationTrack("AA Ice Blast", 1.0f); + _ancientApparitionIceBlastTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(200, 200, 255)) ); - ancient_apparition_ice_blast_track.SetFrame(0.85f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.85f, Color.FromArgb(200, 200, 255)) + _ancientApparitionIceBlastTrack.SetFrame(0.85f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.85f, Color.FromArgb(200, 200, 255)) ); - ancient_apparition_ice_blast_track.SetFrame(1.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 200, 200, 255)) + _ancientApparitionIceBlastTrack.SetFrame(1.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 200, 200, 255)) ); - axe_berserkers_call_track = new AnimationTrack("Axe Berserker", 0.7f); - axe_berserkers_call_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 50, 0)) + _axeBerserkersCallTrack = new AnimationTrack("Axe Berserker", 0.7f); + _axeBerserkersCallTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 50, 0)) ); - axe_berserkers_call_track.SetFrame(0.595f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.85f, Color.FromArgb(255, 50, 0)) + _axeBerserkersCallTrack.SetFrame(0.595f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.85f, Color.FromArgb(255, 50, 0)) ); - axe_berserkers_call_track.SetFrame(0.7f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 255, 50, 0)) + _axeBerserkersCallTrack.SetFrame(0.7f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 255, 50, 0)) ); - beastmaster_primal_roar_track = new AnimationTrack("BM Primal Roar", 1.0f); - beastmaster_primal_roar_track.SetFrame(0.0f, - new AnimationFilledCircle(0, Effects.canvas_height_center, 0, Color.FromArgb(255, 200, 100)) + _beastmasterPrimalRoarTrack = new AnimationTrack("BM Primal Roar", 1.0f); + _beastmasterPrimalRoarTrack.SetFrame(0.0f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 200, 100)) ); - beastmaster_primal_roar_track.SetFrame(0.75f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest * 0.75f, Color.FromArgb(255, 200, 100)) + _beastmasterPrimalRoarTrack.SetFrame(0.75f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.75f, Color.FromArgb(255, 200, 100)) ); - beastmaster_primal_roar_track.SetFrame(1.0f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 255, 200, 100)) + _beastmasterPrimalRoarTrack.SetFrame(1.0f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 255, 200, 100)) ); - brewmaster_thunder_clap_track = new AnimationTrack("Brewmaster Thunder Clap", 1.5f); - brewmaster_thunder_clap_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(170, 90, 0)) + _brewmasterThunderClapTrack = new AnimationTrack("Brewmaster Thunder Clap", 1.5f); + _brewmasterThunderClapTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(170, 90, 0)) ); - brewmaster_thunder_clap_track.SetFrame(0.75f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f, Color.FromArgb(170, 90, 0)) + _brewmasterThunderClapTrack.SetFrame(0.75f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f, Color.FromArgb(170, 90, 0)) ); - brewmaster_thunder_clap_track.SetFrame(1.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 170, 90, 0)) + _brewmasterThunderClapTrack.SetFrame(1.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 170, 90, 0)) ); - centaur_hoof_stomp_track = new AnimationTrack("Centaur Stomp", 1.0f); - centaur_hoof_stomp_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 50, 0)) + _centaurHoofStompTrack = new AnimationTrack("Centaur Stomp", 1.0f); + _centaurHoofStompTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 50, 0)) ); - centaur_hoof_stomp_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f, Color.FromArgb(255, 50, 0)) + _centaurHoofStompTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f, Color.FromArgb(255, 50, 0)) ); - centaur_hoof_stomp_track.SetFrame(1.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 255, 50, 0)) + _centaurHoofStompTrack.SetFrame(1.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 255, 50, 0)) ); - chaos_knight_chaos_bolt_mix = new AnimationMix(); + _chaosKnightChaosBoltMix = new AnimationMix(); - AnimationTrack chaos_knight_chaos_bolt_projectile_path = new AnimationTrack("Chaos Knight Bolt - Projectile Path", 0.5f); - chaos_knight_chaos_bolt_projectile_path.SetFrame(0.0f, - new AnimationLine(new PointF(0, Effects.canvas_height_center), new PointF(0, Effects.canvas_height_center), Color.FromArgb(255, 70, 0), 3) + var chaosKnightChaosBoltProjectilePath = new AnimationTrack("Chaos Knight Bolt - Projectile Path", 0.5f); + chaosKnightChaosBoltProjectilePath.SetFrame(0.0f, + new AnimationLine(new PointF(0, Effects.CanvasHeightCenter), new PointF(0, Effects.CanvasHeightCenter), Color.FromArgb(255, 70, 0), 3) ); - chaos_knight_chaos_bolt_projectile_path.SetFrame(0.25f, - new AnimationLine(new PointF(0, Effects.canvas_height_center), new PointF(Effects.canvas_width_center, Effects.canvas_height_center), Color.FromArgb(255, 70, 0), 3) + chaosKnightChaosBoltProjectilePath.SetFrame(0.25f, + new AnimationLine(new PointF(0, Effects.CanvasHeightCenter), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter), Color.FromArgb(255, 70, 0), 3) ); - chaos_knight_chaos_bolt_projectile_path.SetFrame(0.5f, - new AnimationLine(new PointF(Effects.canvas_width_center, Effects.canvas_height_center), new PointF(Effects.canvas_width_center, Effects.canvas_height_center), Color.FromArgb(0, 255, 70, 0), 3) + chaosKnightChaosBoltProjectilePath.SetFrame(0.5f, + new AnimationLine(new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter), new PointF(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter), Color.FromArgb(0, 255, 70, 0), 3) ); - chaos_knight_chaos_bolt_mix.AddTrack(chaos_knight_chaos_bolt_projectile_path); + _chaosKnightChaosBoltMix.AddTrack(chaosKnightChaosBoltProjectilePath); - AnimationTrack chaos_knight_chaos_bolt_projectile = new AnimationTrack("Chaos Knight Bolt - Projectile", 0.25f, 0.25f); - chaos_knight_chaos_bolt_projectile.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(175, 0, 0)) + var chaosKnightChaosBoltProjectile = new AnimationTrack("Chaos Knight Bolt - Projectile", 0.25f, 0.25f); + chaosKnightChaosBoltProjectile.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(175, 0, 0)) ); - chaos_knight_chaos_bolt_projectile.SetFrame(0.25f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f, Color.FromArgb(0, 175, 0, 0)) + chaosKnightChaosBoltProjectile.SetFrame(0.25f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f, Color.FromArgb(0, 175, 0, 0)) ); - chaos_knight_chaos_bolt_mix.AddTrack(chaos_knight_chaos_bolt_projectile); + _chaosKnightChaosBoltMix.AddTrack(chaosKnightChaosBoltProjectile); - rattletrap_rocket_flare_track = new AnimationTrack("Clockwork Rocket Flare", 0.5f); - rattletrap_rocket_flare_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 80, 0)) + _rattletrapRocketFlareTrack = new AnimationTrack("Clockwork Rocket Flare", 0.5f); + _rattletrapRocketFlareTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 80, 0)) ); - rattletrap_rocket_flare_track.SetFrame(0.25f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.25f, Color.FromArgb(255, 80, 0)) + _rattletrapRocketFlareTrack.SetFrame(0.25f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.25f, Color.FromArgb(255, 80, 0)) ); - rattletrap_rocket_flare_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.5f, Color.FromArgb(0, 255, 80, 0)) + _rattletrapRocketFlareTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.5f, Color.FromArgb(0, 255, 80, 0)) ); - dragon_knight_breathe_fire_track = new AnimationTrack("Dragon Knight Breathe", 1.25f); - dragon_knight_breathe_fire_track.SetFrame(0.0f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest * 0.10f, Color.FromArgb(255, 80, 0)) + _dragonKnightBreatheFireTrack = new AnimationTrack("Dragon Knight Breathe", 1.25f); + _dragonKnightBreatheFireTrack.SetFrame(0.0f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.10f, Color.FromArgb(255, 80, 0)) ); - dragon_knight_breathe_fire_track.SetFrame(0.9375f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest * 0.75f, Color.FromArgb(255, 80, 0)) + _dragonKnightBreatheFireTrack.SetFrame(0.9375f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.75f, Color.FromArgb(255, 80, 0)) ); - dragon_knight_breathe_fire_track.SetFrame(1.25f, - new AnimationFilledCircle(0, Effects.canvas_height_center, Effects.canvas_biggest, Color.FromArgb(0, 255, 80, 0)) + _dragonKnightBreatheFireTrack.SetFrame(1.25f, + new AnimationFilledCircle(0, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.FromArgb(0, 255, 80, 0)) ); - elder_titan_earth_splitter_track = new AnimationTrack("Elder Titan Earth Splitter", 1.0f, 3.0f); - elder_titan_earth_splitter_track.SetFrame(0.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 255, 220)) + _elderTitanEarthSplitterTrack = new AnimationTrack("Elder Titan Earth Splitter", 1.0f, 3.0f); + _elderTitanEarthSplitterTrack.SetFrame(0.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 255, 220)) ); - elder_titan_earth_splitter_track.SetFrame(1.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 0, 255, 220)) + _elderTitanEarthSplitterTrack.SetFrame(1.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 0, 255, 220)) ); - kunkka_torrent_mix = new AnimationMix(); - AnimationTrack kunkka_torrent_bg_track = new AnimationTrack("Kunka Torrent BG", 4.0f); - kunkka_torrent_bg_track.SetFrame(0.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 0, 0)) + _kunkkaTorrentMix = new AnimationMix(); + var kunkkaTorrentBgTrack = new AnimationTrack("Kunka Torrent BG", 4.0f); + kunkkaTorrentBgTrack.SetFrame(0.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 0, 0)) ); - kunkka_torrent_bg_track.SetFrame(0.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 60, 80)) + kunkkaTorrentBgTrack.SetFrame(0.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 60, 80)) ); - kunkka_torrent_bg_track.SetFrame(3.6f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 60, 80)) + kunkkaTorrentBgTrack.SetFrame(3.6f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 60, 80)) ); - kunkka_torrent_bg_track.SetFrame(4.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 0, 60, 80)) + kunkkaTorrentBgTrack.SetFrame(4.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 0, 60, 80)) ); - AnimationTrack kunkka_torrent_spash_track = new AnimationTrack("Kunka Torrent Splash", 2.4f, 1.6f); + var kunkkaTorrentSpashTrack = new AnimationTrack("Kunka Torrent Splash", 2.4f, 1.6f); - kunkka_torrent_spash_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.1f / 2.0f, Color.FromArgb(0, 220, 245)) + kunkkaTorrentSpashTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.1f / 2.0f, Color.FromArgb(0, 220, 245)) ); - kunkka_torrent_spash_track.SetFrame(2.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest * 0.83f / 2.0f, Color.FromArgb(0, 220, 245)) + kunkkaTorrentSpashTrack.SetFrame(2.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest * 0.83f / 2.0f, Color.FromArgb(0, 220, 245)) ); - kunkka_torrent_spash_track.SetFrame(2.4f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 0, 220, 245)) + kunkkaTorrentSpashTrack.SetFrame(2.4f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 0, 220, 245)) ); - kunkka_torrent_mix.AddTrack(kunkka_torrent_bg_track); - kunkka_torrent_mix.AddTrack(kunkka_torrent_spash_track); + _kunkkaTorrentMix.AddTrack(kunkkaTorrentBgTrack); + _kunkkaTorrentMix.AddTrack(kunkkaTorrentSpashTrack); - kunkka_ghostship_track = new AnimationTrack("Kunka Ghostship", 2.7f); + _kunkkaGhostshipTrack = new AnimationTrack("Kunka Ghostship", 2.7f); - kunkka_ghostship_track.SetFrame(0.0f, - new AnimationFilledCircle(-(Effects.canvas_biggest / 2.0f), Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 220, 245)) + _kunkkaGhostshipTrack.SetFrame(0.0f, + new AnimationFilledCircle(-(Effects.CanvasBiggest / 2.0f), Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 220, 245)) ); - kunkka_ghostship_track.SetFrame(2.3f, - new AnimationFilledCircle(Effects.canvas_width + (Effects.canvas_biggest / 2.0f) * 0.85f, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 220, 245)) + _kunkkaGhostshipTrack.SetFrame(2.3f, + new AnimationFilledCircle(Effects.CanvasWidth + (Effects.CanvasBiggest / 2.0f) * 0.85f, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 220, 245)) ); - kunkka_ghostship_track.SetFrame(2.7f, - new AnimationFilledCircle(Effects.canvas_width + (Effects.canvas_biggest / 2.0f), Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 0, 220, 245)) + _kunkkaGhostshipTrack.SetFrame(2.7f, + new AnimationFilledCircle(Effects.CanvasWidth + (Effects.CanvasBiggest / 2.0f), Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 0, 220, 245)) ); - legion_commander_overwhelming_odds_track = new AnimationTrack("Legion Commander Overwhelming Odds", 1.0f); - legion_commander_overwhelming_odds_track.SetFrame(0.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 255, 145, 0)) + _legionCommanderOverwhelmingOddsTrack = new AnimationTrack("Legion Commander Overwhelming Odds", 1.0f); + _legionCommanderOverwhelmingOddsTrack.SetFrame(0.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 255, 145, 0)) ); - legion_commander_overwhelming_odds_track.SetFrame(0.3f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 145, 0)) + _legionCommanderOverwhelmingOddsTrack.SetFrame(0.3f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 145, 0)) ); - legion_commander_overwhelming_odds_track.SetFrame(0.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 145, 0)) + _legionCommanderOverwhelmingOddsTrack.SetFrame(0.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 145, 0)) ); - legion_commander_overwhelming_odds_track.SetFrame(1.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(0, 255, 145, 0)) + _legionCommanderOverwhelmingOddsTrack.SetFrame(1.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(0, 255, 145, 0)) ); - life_stealer_rage_track = new AnimationTrack("Life Stealer Rage", 6.0f); - life_stealer_rage_track.SetFrame(0.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack = new AnimationTrack("Life Stealer Rage", 6.0f); + _lifeStealerRageTrack.SetFrame(0.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - life_stealer_rage_track.SetFrame(0.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(130, 0, 0)) + _lifeStealerRageTrack.SetFrame(0.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(130, 0, 0)) ); - life_stealer_rage_track.SetFrame(1.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack.SetFrame(1.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - life_stealer_rage_track.SetFrame(1.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(130, 0, 0)) + _lifeStealerRageTrack.SetFrame(1.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(130, 0, 0)) ); - life_stealer_rage_track.SetFrame(2.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack.SetFrame(2.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - life_stealer_rage_track.SetFrame(2.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(130, 0, 0)) + _lifeStealerRageTrack.SetFrame(2.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(130, 0, 0)) ); - life_stealer_rage_track.SetFrame(3.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack.SetFrame(3.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - life_stealer_rage_track.SetFrame(3.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(130, 0, 0)) + _lifeStealerRageTrack.SetFrame(3.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(130, 0, 0)) ); - life_stealer_rage_track.SetFrame(4.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack.SetFrame(4.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - life_stealer_rage_track.SetFrame(4.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(130, 0, 0)) + _lifeStealerRageTrack.SetFrame(4.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(130, 0, 0)) ); - life_stealer_rage_track.SetFrame(5.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack.SetFrame(5.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - life_stealer_rage_track.SetFrame(5.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(130, 0, 0)) + _lifeStealerRageTrack.SetFrame(5.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(130, 0, 0)) ); - life_stealer_rage_track.SetFrame(6.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(175, 0, 0)) + _lifeStealerRageTrack.SetFrame(6.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(175, 0, 0)) ); - magnataur_shockwave_track = new AnimationTrack("Magnataur Shockwave", 1.0f); - magnataur_shockwave_track.SetFrame(0.0f, - new AnimationFilledCircle(-(Effects.canvas_biggest / 2.0f), Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 205, 255)) + _magnataurShockwaveTrack = new AnimationTrack("Magnataur Shockwave", 1.0f); + _magnataurShockwaveTrack.SetFrame(0.0f, + new AnimationFilledCircle(-(Effects.CanvasBiggest / 2.0f), Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 205, 255)) ); - magnataur_shockwave_track.SetFrame(0.9f, - new AnimationFilledCircle(Effects.canvas_width + (Effects.canvas_biggest / 2.0f) * 0.9f, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 205, 255)) + _magnataurShockwaveTrack.SetFrame(0.9f, + new AnimationFilledCircle(Effects.CanvasWidth + (Effects.CanvasBiggest / 2.0f) * 0.9f, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 205, 255)) ); - magnataur_shockwave_track.SetFrame(1.0f, - new AnimationFilledCircle(Effects.canvas_width + (Effects.canvas_biggest / 2.0f), Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 0, 205, 255)) + _magnataurShockwaveTrack.SetFrame(1.0f, + new AnimationFilledCircle(Effects.CanvasWidth + (Effects.CanvasBiggest / 2.0f), Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 0, 205, 255)) ); - omniknight_purification_track = new AnimationTrack("Omniknight Purification", 1.0f); - omniknight_purification_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0)) + _omniknightPurificationTrack = new AnimationTrack("Omniknight Purification", 1.0f); + _omniknightPurificationTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0)) ); - omniknight_purification_track.SetFrame(0.8f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0)) + _omniknightPurificationTrack.SetFrame(0.8f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0)) ); - omniknight_purification_track.SetFrame(1.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 255, 160, 0)) + _omniknightPurificationTrack.SetFrame(1.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 255, 160, 0)) ); - omniknight_repel_track = new AnimationTrack("Omniknight Repel", 12.0f); - omniknight_repel_track.SetFrame(0.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) - ); - omniknight_repel_track.SetFrame(0.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack = new AnimationTrack("Omniknight Repel", 12.0f); + _omniknightRepelTrack.SetFrame(0.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(1.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(0.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(1.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(1.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(2.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(1.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(2.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(2.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(3.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(2.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(3.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(3.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(4.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(3.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(4.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(4.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(5.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(4.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(5.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(5.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(6.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(5.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(6.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(6.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(7.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(6.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(7.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(7.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(8.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(7.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(8.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(8.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(9.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(8.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(9.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(9.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(10.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(9.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(10.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(10.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(11.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) + _omniknightRepelTrack.SetFrame(10.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - omniknight_repel_track.SetFrame(11.5f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(150, 150, 255)) + _omniknightRepelTrack.SetFrame(11.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - omniknight_repel_track.SetFrame(12.0f, - new AnimationFilledRectangle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_width, Effects.canvas_height, Color.FromArgb(255, 255, 255)) - ); - - sandking_epicenter_mix = new AnimationMix(); - AnimationTrack sandking_epicenter_wave0 = new AnimationTrack("Sandsking Epicenter Wave0", 0.5f); - sandking_epicenter_wave0.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(115, 255, 0), 4) + _omniknightRepelTrack.SetFrame(11.5f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(150, 150, 255)) ); - sandking_epicenter_wave0.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(115, 255, 0), 4) + _omniknightRepelTrack.SetFrame(12.0f, + new AnimationFilledRectangle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasWidth, Effects.CanvasHeight, Color.FromArgb(255, 255, 255)) ); - AnimationTrack sandking_epicenter_wave1 = new AnimationTrack("Sandsking Epicenter Wave1", 0.5f, 2.0f); - sandking_epicenter_wave1.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + _sandkingEpicenterMix = new AnimationMix(); + var sandkingEpicenterWave1 = new AnimationTrack("Sandsking Epicenter Wave1", 0.5f, 0.0f); + sandkingEpicenterWave1.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave1.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave1.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave2 = new AnimationTrack("Sandsking Epicenter Wave2", 0.5f, 2.16f); - sandking_epicenter_wave2.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave2 = new AnimationTrack("Sandsking Epicenter Wave2", 0.5f, 0.16f); + sandkingEpicenterWave2.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave2.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave2.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave3 = new AnimationTrack("Sandsking Epicenter Wave3", 0.5f, 2.32f); - sandking_epicenter_wave3.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave3 = new AnimationTrack("Sandsking Epicenter Wave3", 0.5f, 0.32f); + sandkingEpicenterWave3.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave3.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave3.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave4 = new AnimationTrack("Sandsking Epicenter Wave4", 0.5f, 2.48f); - sandking_epicenter_wave4.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave4 = new AnimationTrack("Sandsking Epicenter Wave4", 0.5f, 0.48f); + sandkingEpicenterWave4.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave4.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave4.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave5 = new AnimationTrack("Sandsking Epicenter Wave5", 0.5f, 2.64f); - sandking_epicenter_wave5.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave5 = new AnimationTrack("Sandsking Epicenter Wave5", 0.5f, 0.64f); + sandkingEpicenterWave5.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave5.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave5.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave6 = new AnimationTrack("Sandsking Epicenter Wave6", 0.5f, 2.8f); - sandking_epicenter_wave6.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave6 = new AnimationTrack("Sandsking Epicenter Wave6", 0.5f, 0.8f); + sandkingEpicenterWave6.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave6.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave6.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave7 = new AnimationTrack("Sandsking Epicenter Wave7", 0.5f, 2.96f); - sandking_epicenter_wave7.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave7 = new AnimationTrack("Sandsking Epicenter Wave7", 0.5f, 0.96f); + sandkingEpicenterWave7.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave7.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave7.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave8 = new AnimationTrack("Sandsking Epicenter Wave8", 0.5f, 3.12f); - sandking_epicenter_wave8.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave8 = new AnimationTrack("Sandsking Epicenter Wave8", 0.5f, 1.12f); + sandkingEpicenterWave8.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave8.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave8.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave9 = new AnimationTrack("Sandsking Epicenter Wave9", 0.5f, 3.28f); - sandking_epicenter_wave9.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave9 = new AnimationTrack("Sandsking Epicenter Wave9", 0.5f, 1.28f); + sandkingEpicenterWave9.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave9.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave9.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave10 = new AnimationTrack("Sandsking Epicenter Wave10", 0.5f, 3.44f); - sandking_epicenter_wave10.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave10 = new AnimationTrack("Sandsking Epicenter Wave10", 0.5f, 1.44f); + sandkingEpicenterWave10.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave10.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave10.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave11 = new AnimationTrack("Sandsking Epicenter Wave11", 0.5f, 3.6f); - sandking_epicenter_wave11.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave11 = new AnimationTrack("Sandsking Epicenter Wave11", 0.5f, 1.6f); + sandkingEpicenterWave11.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave11.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave11.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave12 = new AnimationTrack("Sandsking Epicenter Wave12", 0.5f, 3.76f); - sandking_epicenter_wave12.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave12 = new AnimationTrack("Sandsking Epicenter Wave12", 0.5f, 1.76f); + sandkingEpicenterWave12.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave12.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave12.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave13 = new AnimationTrack("Sandsking Epicenter Wave13", 0.5f, 3.92f); - sandking_epicenter_wave13.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave13 = new AnimationTrack("Sandsking Epicenter Wave13", 0.5f, 1.92f); + sandkingEpicenterWave13.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave13.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave13.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave14 = new AnimationTrack("Sandsking Epicenter Wave14", 0.5f, 4.08f); - sandking_epicenter_wave14.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave14 = new AnimationTrack("Sandsking Epicenter Wave14", 0.5f, 2.08f); + sandkingEpicenterWave14.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave14.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave14.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave15 = new AnimationTrack("Sandsking Epicenter Wave15", 0.5f, 4.24f); - sandking_epicenter_wave15.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave15 = new AnimationTrack("Sandsking Epicenter Wave15", 0.5f, 2.24f); + sandkingEpicenterWave15.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave15.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave15.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave16 = new AnimationTrack("Sandsking Epicenter Wave16", 0.5f, 4.4f); - sandking_epicenter_wave16.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave16 = new AnimationTrack("Sandsking Epicenter Wave16", 0.5f, 2.4f); + sandkingEpicenterWave16.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave16.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave16.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave17 = new AnimationTrack("Sandsking Epicenter Wave17", 0.5f, 4.56f); - sandking_epicenter_wave17.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave17 = new AnimationTrack("Sandsking Epicenter Wave17", 0.5f, 2.56f); + sandkingEpicenterWave17.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave17.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave17.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave18 = new AnimationTrack("Sandsking Epicenter Wave18", 0.5f, 4.72f); - sandking_epicenter_wave18.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave18 = new AnimationTrack("Sandsking Epicenter Wave18", 0.5f, 2.72f); + sandkingEpicenterWave18.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave18.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave18.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave19 = new AnimationTrack("Sandsking Epicenter Wave19", 0.5f, 4.88f); - sandking_epicenter_wave19.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave19 = new AnimationTrack("Sandsking Epicenter Wave19", 0.5f, 2.88f); + sandkingEpicenterWave19.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave19.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave19.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - AnimationTrack sandking_epicenter_wave20 = new AnimationTrack("Sandsking Epicenter Wave20", 0.5f, 5f); - sandking_epicenter_wave20.SetFrame(0.0f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(255, 160, 0), 4) + var sandkingEpicenterWave20 = new AnimationTrack("Sandsking Epicenter Wave20", 0.5f, 3f); + sandkingEpicenterWave20.SetFrame(0.0f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_wave20.SetFrame(0.5f, - new AnimationCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(255, 160, 0), 4) + sandkingEpicenterWave20.SetFrame(0.5f, + new AnimationCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(255, 160, 0), 4) ); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave0); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave1); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave2); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave3); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave4); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave5); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave6); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave7); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave8); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave9); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave10); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave11); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave12); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave13); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave14); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave15); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave16); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave17); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave18); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave19); - sandking_epicenter_mix.AddTrack(sandking_epicenter_wave20); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave1); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave2); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave3); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave4); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave5); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave6); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave7); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave8); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave9); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave10); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave11); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave12); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave13); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave14); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave15); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave16); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave17); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave18); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave19); + _sandkingEpicenterMix.AddTrack(sandkingEpicenterWave20); - slardar_slithereen_crush_track = new AnimationTrack("Slardar SMASH!", 0.5f); - slardar_slithereen_crush_track.SetFrame(0.0f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, 0, Color.FromArgb(0, 150, 255)) + _slardarSlithereenCrushTrack = new AnimationTrack("Slardar SMASH!", 0.5f); + _slardarSlithereenCrushTrack.SetFrame(0.0f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, 0, Color.FromArgb(0, 150, 255)) ); - slardar_slithereen_crush_track.SetFrame(0.45f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, (Effects.canvas_biggest / 2.0f) * 0.9f, Color.FromArgb(0, 150, 255)) + _slardarSlithereenCrushTrack.SetFrame(0.45f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, (Effects.CanvasBiggest / 2.0f) * 0.9f, Color.FromArgb(0, 150, 255)) ); - slardar_slithereen_crush_track.SetFrame(0.5f, - new AnimationFilledCircle(Effects.canvas_width_center, Effects.canvas_height_center, Effects.canvas_biggest / 2.0f, Color.FromArgb(0, 0, 150, 255)) + _slardarSlithereenCrushTrack.SetFrame(0.5f, + new AnimationFilledCircle(Effects.CanvasWidthCenter, Effects.CanvasHeightCenter, Effects.CanvasBiggest / 2.0f, Color.FromArgb(0, 0, 150, 255)) ); } diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2ItemLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2ItemLayerHandler.cs index 9f3b70a04..46c79f28e 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2ItemLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2ItemLayerHandler.cs @@ -41,10 +41,11 @@ public class Dota2ItemLayerHandlerProperties : LayerHandlerProperties2Color _ItemKeys { get; set; } + [JsonProperty("item_keys2")] //changed property name to reset because some update broke this setting + public List _ItemKeys { get; set; } [JsonIgnore] - public List ItemKeys { get { return Logic._ItemKeys ?? _ItemKeys ?? new List(); } } + public List ItemKeys { get { return Logic._ItemKeys ?? _ItemKeys ?? new List(); } } public Dota2ItemLayerHandlerProperties() : base() { } @@ -59,7 +60,7 @@ public override void Default() this._ItemCooldownColor = Color.FromArgb(0, 0, 0); this._ItemNoChargersColor = Color.FromArgb(150, 150, 150); this._UseItemColors = true; - this._ItemKeys = new List() { Devices.DeviceKeys.Z, Devices.DeviceKeys.X, Devices.DeviceKeys.C, Devices.DeviceKeys.V, Devices.DeviceKeys.B, Devices.DeviceKeys.N, Devices.DeviceKeys.INSERT, Devices.DeviceKeys.HOME, Devices.DeviceKeys.PAGE_UP, Devices.DeviceKeys.DELETE, Devices.DeviceKeys.END, Devices.DeviceKeys.PAGE_DOWN }; + this._ItemKeys = new List() { Devices.DeviceKeys.Z, Devices.DeviceKeys.X, Devices.DeviceKeys.C, Devices.DeviceKeys.V, Devices.DeviceKeys.B, Devices.DeviceKeys.N, Devices.DeviceKeys.INSERT, Devices.DeviceKeys.HOME, Devices.DeviceKeys.PAGE_UP, Devices.DeviceKeys.NUM_ONE, Devices.DeviceKeys.NUM_TWO, Devices.DeviceKeys.NUM_THREE, Devices.DeviceKeys.NUM_FOUR, Devices.DeviceKeys.NUM_FIVE , Devices.DeviceKeys.NUM_SIX }; } } @@ -337,88 +338,99 @@ public class Dota2ItemLayerHandler : LayerHandler= 12) + if (dota2state.Map.GameState == DOTA_GameState.DOTA_GAMERULES_STATE_PRE_GAME || + dota2state.Map.GameState == DOTA_GameState.DOTA_GAMERULES_STATE_GAME_IN_PROGRESS) { - for (int index = 0; index < 6; index++) + _empty = false; + for (int index = 0; index < dota2state.Items.InventoryCount; index++) { Item item = dota2state.Items.GetInventoryAt(index); - Devices.DeviceKeys key = Properties.ItemKeys[index]; + DeviceKey key = Properties.ItemKeys[index]; if (item.Name.Equals("empty")) - items_layer.Set(key, Properties.EmptyItemColor); + _itemsLayer.Set(key, Properties.EmptyItemColor); else { if (Properties.UseItemColors && item_colors.ContainsKey(item.Name)) { if (!String.IsNullOrWhiteSpace(item.ContainsRune)) - items_layer.Set(key, Utils.ColorUtils.BlendColors(item_colors[item.Name], bottle_rune_colors[item.ContainsRune], 0.8)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(item_colors[item.Name], bottle_rune_colors[item.ContainsRune], 0.8)); else - items_layer.Set(key, item_colors[item.Name]); + _itemsLayer.Set(key, item_colors[item.Name]); } else - items_layer.Set(key, Properties.ItemsColor); + _itemsLayer.Set(key, Properties.ItemsColor); //Cooldown if (item.Cooldown > 5) - items_layer.Set(key, Utils.ColorUtils.BlendColors(items_layer.Get(key), Properties.ItemCooldownColor, 1.0)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(_itemsLayer.Get(key), Properties.ItemCooldownColor, 1.0)); else if (item.Cooldown > 0 && item.Cooldown <= 5) - items_layer.Set(key, Utils.ColorUtils.BlendColors(items_layer.Get(key), Properties.ItemCooldownColor, item.Cooldown / 5.0)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(_itemsLayer.Get(key), Properties.ItemCooldownColor, item.Cooldown / 5.0)); //Charges if (item.Charges == 0) - items_layer.Set(key, Utils.ColorUtils.BlendColors(items_layer.Get(key), Properties.ItemNoChargersColor, 0.7)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(_itemsLayer.Get(key), Properties.ItemNoChargersColor, 0.7)); } } - for (int index = 0; index < 6; index++) + for (int index = 0; index < dota2state.Items.StashCount; index++) { Item item = dota2state.Items.GetStashAt(index); - Devices.DeviceKeys key = Properties.ItemKeys[6 + index]; + DeviceKey key = Properties.ItemKeys[9 + index]; if (item.Name.Equals("empty")) { - items_layer.Set(key, Properties.EmptyItemColor); + _itemsLayer.Set(key, Properties.EmptyItemColor); } else { if (Properties.UseItemColors && item_colors.ContainsKey(item.Name)) { if (!String.IsNullOrWhiteSpace(item.ContainsRune)) - items_layer.Set(key, Utils.ColorUtils.BlendColors(item_colors[item.Name], bottle_rune_colors[item.ContainsRune], 0.8)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(item_colors[item.Name], bottle_rune_colors[item.ContainsRune], 0.8)); else - items_layer.Set(key, item_colors[item.Name]); + _itemsLayer.Set(key, item_colors[item.Name]); } else - items_layer.Set(key, Properties.ItemsColor); + _itemsLayer.Set(key, Properties.ItemsColor); //Cooldown if (item.Cooldown > 5) - items_layer.Set(key, Utils.ColorUtils.BlendColors(items_layer.Get(key), Properties.ItemCooldownColor, 1.0)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(_itemsLayer.Get(key), Properties.ItemCooldownColor, 1.0)); else if (item.Cooldown > 0 && item.Cooldown <= 5) - items_layer.Set(key, Utils.ColorUtils.BlendColors(items_layer.Get(key), Properties.ItemCooldownColor, item.Cooldown / 5.0)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(_itemsLayer.Get(key), Properties.ItemCooldownColor, item.Cooldown / 5.0)); //Charges if (item.Charges == 0) - items_layer.Set(key, Utils.ColorUtils.BlendColors(items_layer.Get(key), Properties.ItemNoChargersColor, 0.7)); + _itemsLayer.Set(key, Utils.ColorUtils.BlendColors(_itemsLayer.Get(key), Properties.ItemNoChargersColor, 0.7)); } } } + else + { + if (!_empty) + { + _itemsLayer.Clear(); + _empty = true; + } + } } - return items_layer; + return _itemsLayer; } public override void SetApplication(Application profile) diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2KillstreakLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2KillstreakLayerHandler.cs index e291696cd..2b7077e56 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2KillstreakLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2KillstreakLayerHandler.cs @@ -19,57 +19,57 @@ public class Dota2KillstreakLayerHandlerProperties : LayerHandlerProperties2Colo public Color? _NoKillstreakColor { get; set; } [JsonIgnore] - public Color NoKillstreakColor { get { return Logic._NoKillstreakColor ?? _NoKillstreakColor ?? Color.Empty; } } + public Color NoKillstreakColor => Logic._NoKillstreakColor ?? _NoKillstreakColor ?? Color.Empty; public Color? _FirstKillstreakColor { get; set; } [JsonIgnore] - public Color FirstKillstreakColor { get { return Logic._FirstKillstreakColor ?? _FirstKillstreakColor ?? Color.Empty; } } + public Color FirstKillstreakColor => Logic._FirstKillstreakColor ?? _FirstKillstreakColor ?? Color.Empty; public Color? _DoubleKillstreakColor { get; set; } [JsonIgnore] - public Color DoubleKillstreakColor { get { return Logic._DoubleKillstreakColor ?? _DoubleKillstreakColor ?? Color.Empty; } } + public Color DoubleKillstreakColor => Logic._DoubleKillstreakColor ?? _DoubleKillstreakColor ?? Color.Empty; public Color? _TripleKillstreakColor { get; set; } [JsonIgnore] - public Color TripleKillstreakColor { get { return Logic._TripleKillstreakColor ?? _TripleKillstreakColor ?? Color.Empty; } } + public Color TripleKillstreakColor => Logic._TripleKillstreakColor ?? _TripleKillstreakColor ?? Color.Empty; public Color? _QuadKillstreakColor { get; set; } [JsonIgnore] - public Color QuadKillstreakColor { get { return Logic._QuadKillstreakColor ?? _QuadKillstreakColor ?? Color.Empty; } } + public Color QuadKillstreakColor => Logic._QuadKillstreakColor ?? _QuadKillstreakColor ?? Color.Empty; public Color? _PentaKillstreakColor { get; set; } [JsonIgnore] - public Color PentaKillstreakColor { get { return Logic._PentaKillstreakColor ?? _PentaKillstreakColor ?? Color.Empty; } } + public Color PentaKillstreakColor => Logic._PentaKillstreakColor ?? _PentaKillstreakColor ?? Color.Empty; public Color? _HexaKillstreakColor { get; set; } [JsonIgnore] - public Color HexaKillstreakColor { get { return Logic._HexaKillstreakColor ?? _HexaKillstreakColor ?? Color.Empty; } } + public Color HexaKillstreakColor => Logic._HexaKillstreakColor ?? _HexaKillstreakColor ?? Color.Empty; public Color? _SeptaKillstreakColor { get; set; } [JsonIgnore] - public Color SeptaKillstreakColor { get { return Logic._SeptaKillstreakColor ?? _SeptaKillstreakColor ?? Color.Empty; } } + public Color SeptaKillstreakColor => Logic._SeptaKillstreakColor ?? _SeptaKillstreakColor ?? Color.Empty; public Color? _OctaKillstreakColor { get; set; } [JsonIgnore] - public Color OctaKillstreakColor { get { return Logic._OctaKillstreakColor ?? _OctaKillstreakColor ?? Color.Empty; } } + public Color OctaKillstreakColor => Logic._OctaKillstreakColor ?? _OctaKillstreakColor ?? Color.Empty; public Color? _NonaKillstreakColor { get; set; } [JsonIgnore] - public Color NonaKillstreakColor { get { return Logic._NonaKillstreakColor ?? _NonaKillstreakColor ?? Color.Empty; } } + public Color NonaKillstreakColor => Logic._NonaKillstreakColor ?? _NonaKillstreakColor ?? Color.Empty; public Color? _DecaKillstreakColor { get; set; } [JsonIgnore] - public Color DecaKillstreakColor { get { return Logic._DecaKillstreakColor ?? _DecaKillstreakColor ?? Color.Empty; } } + public Color DecaKillstreakColor => Logic._DecaKillstreakColor ?? _DecaKillstreakColor ?? Color.Empty; public Dota2KillstreakLayerHandlerProperties() : base() { } @@ -79,110 +79,109 @@ public override void Default() { base.Default(); - this._NoKillstreakColor = Color.FromArgb(0, 0, 0, 0); //No Streak - this._FirstKillstreakColor = Color.FromArgb(0, 0, 0, 0); //First kill - this._DoubleKillstreakColor = Color.FromArgb(255, 255, 255); //Double Kill - this._TripleKillstreakColor = Color.FromArgb(0, 255, 0); //Killing Spree - this._QuadKillstreakColor = Color.FromArgb(128, 0, 255); //Dominating - this._PentaKillstreakColor = Color.FromArgb(255, 100, 100); //Mega Kill - this._HexaKillstreakColor = Color.FromArgb(255, 80, 0); //Unstoppable - this._SeptaKillstreakColor = Color.FromArgb(130, 180, 130); //Wicked Sick - this._OctaKillstreakColor = Color.FromArgb(255, 0, 255); //Monster Kill - this._NonaKillstreakColor = Color.FromArgb(255, 0, 0); //Godlike - this._DecaKillstreakColor = Color.FromArgb(255, 80, 0); //Godlike+ + _NoKillstreakColor = Color.FromArgb(0, 0, 0, 0); //No Streak + _FirstKillstreakColor = Color.FromArgb(0, 0, 0, 0); //First kill + _DoubleKillstreakColor = Color.FromArgb(255, 255, 255); //Double Kill + _TripleKillstreakColor = Color.FromArgb(0, 255, 0); //Killing Spree + _QuadKillstreakColor = Color.FromArgb(128, 0, 255); //Dominating + _PentaKillstreakColor = Color.FromArgb(255, 100, 100); //Mega Kill + _HexaKillstreakColor = Color.FromArgb(255, 80, 0); //Unstoppable + _SeptaKillstreakColor = Color.FromArgb(130, 180, 130); //Wicked Sick + _OctaKillstreakColor = Color.FromArgb(255, 0, 255); //Monster Kill + _NonaKillstreakColor = Color.FromArgb(255, 0, 0); //Godlike + _DecaKillstreakColor = Color.FromArgb(255, 80, 0); //Godlike+ } } public class Dota2KillstreakLayerHandler : LayerHandler { - private static bool isPlayingKillStreakAnimation = false; - private double ks_blendamount = 0.0; - private static long ks_duration = 4000; - private static long ks_end_time = 0; - private int current_kill_count = 0; + private const long KsDuration = 4000; + + private readonly EffectLayer _killstreakLayer = new("Dota 2 - Killstreak"); + private readonly SolidBrush _solidBrush = new(Color.Empty); + + private bool _isPlayingKillStreakAnimation; + private double _ksBlendAmount; + private long _ksEndTime; + private int _currentKillCount; protected override UserControl CreateControl() { return new Control_Dota2KillstreakLayer(this); } + private bool _empty = true; public override EffectLayer Render(IGameState state) { - if (isPlayingKillStreakAnimation && Utils.Time.GetMillisecondsSinceEpoch() >= ks_end_time) - isPlayingKillStreakAnimation = false; - - EffectLayer killstreak_layer = new EffectLayer("Dota 2 - Killstreak"); - - if (state is GameState_Dota2) + if (_isPlayingKillStreakAnimation && Utils.Time.GetMillisecondsSinceEpoch() >= _ksEndTime) { - GameState_Dota2 dota2state = state as GameState_Dota2; + _isPlayingKillStreakAnimation = false; + } - if(current_kill_count < dota2state.Player.Kills) - { - isPlayingKillStreakAnimation = true; + if (state is not GameState_Dota2 dota2State) return _killstreakLayer; + if(_currentKillCount < dota2State.Player.Kills) + { //player got a kill + _isPlayingKillStreakAnimation = true; - ks_end_time = Utils.Time.GetMillisecondsSinceEpoch() + ks_duration; - } - current_kill_count = dota2state.Player.Kills; + _ksEndTime = Utils.Time.GetMillisecondsSinceEpoch() + KsDuration; + } + _currentKillCount = dota2State.Player.Kills; + + var ksEffectValue = GetKsEffectValue(); + if (ksEffectValue <= 0 && !_empty) + { + _killstreakLayer.Clear(); + _empty = true; + } - if (dota2state.Player.KillStreak >= 2) - { - Color ks_color = getKillStreakColor(dota2state.Player.KillStreak); + if (dota2State.Player.KillStreak < 2) return _killstreakLayer; + var ksColor = GetKillStreakColor(dota2State.Player.KillStreak); - killstreak_layer.Fill(Utils.ColorUtils.BlendColors(Color.Transparent, ks_color, getKSEffectValue())); - } - } + if (!(ksEffectValue > 0)) return _killstreakLayer; + _killstreakLayer.Clear(); + _solidBrush.Color = Utils.ColorUtils.BlendColors(Color.Transparent, ksColor, ksEffectValue); + _killstreakLayer.Fill(_solidBrush); + _empty = false; - return killstreak_layer; + return _killstreakLayer; } public override void SetApplication(Application profile) { - (Control as Control_Dota2KillstreakLayer).SetProfile(profile); + (Control as Control_Dota2KillstreakLayer)?.SetProfile(profile); base.SetApplication(profile); } - private Color getKillStreakColor(int killstreak_count) + private Color GetKillStreakColor(int killstreakCount) { - if (killstreak_count == 0) - return Properties.NoKillstreakColor; - else if (killstreak_count == 1) - return Properties.FirstKillstreakColor; - else if (killstreak_count == 2) - return Properties.DoubleKillstreakColor; - else if (killstreak_count == 3) - return Properties.TripleKillstreakColor; - else if (killstreak_count == 4) - return Properties.QuadKillstreakColor; - else if (killstreak_count == 5) - return Properties.PentaKillstreakColor; - else if (killstreak_count == 6) - return Properties.HexaKillstreakColor; - else if (killstreak_count == 7) - return Properties.SeptaKillstreakColor; - else if (killstreak_count == 8) - return Properties.OctaKillstreakColor; - else if (killstreak_count == 9) - return Properties.NonaKillstreakColor; - else if (killstreak_count >= 10) - return Properties.DecaKillstreakColor; - else - return Color.Transparent; + return killstreakCount switch + { + 0 => Properties.NoKillstreakColor, + 1 => Properties.FirstKillstreakColor, + 2 => Properties.DoubleKillstreakColor, + 3 => Properties.TripleKillstreakColor, + 4 => Properties.QuadKillstreakColor, + 5 => Properties.PentaKillstreakColor, + 6 => Properties.HexaKillstreakColor, + 7 => Properties.SeptaKillstreakColor, + 8 => Properties.OctaKillstreakColor, + 9 => Properties.NonaKillstreakColor, + >= 10 => Properties.DecaKillstreakColor, + _ => Color.Transparent + }; } - private double getKSEffectValue() + private double GetKsEffectValue() { - if (isPlayingKillStreakAnimation) + if (_isPlayingKillStreakAnimation) { - ks_blendamount += 0.15; - return ks_blendamount = (ks_blendamount > 1.0 ? 1.0 : ks_blendamount); - } - else - { - ks_blendamount -= 0.15; - return ks_blendamount = (ks_blendamount < 0.0 ? 0.0 : ks_blendamount); + _ksBlendAmount += 0.15; + return _ksBlendAmount = (_ksBlendAmount > 1.0 ? 1.0 : _ksBlendAmount); } + + _ksBlendAmount -= 0.15; + return _ksBlendAmount = (_ksBlendAmount < 0.0 ? 0.0 : _ksBlendAmount); } } } \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2RespawnLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2RespawnLayerHandler.cs index 059320abb..19adc2b51 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2RespawnLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Dota 2/Layers/Dota2RespawnLayerHandler.cs @@ -19,17 +19,17 @@ public class Dota2RespawnLayerHandlerProperties : LayerHandlerProperties2Color Logic._RespawnColor ?? _RespawnColor ?? Color.Empty; public Color? _RespawningColor { get; set; } [JsonIgnore] - public Color RespawningColor { get { return Logic._RespawningColor ?? _RespawningColor ?? Color.Empty; } } + public Color RespawningColor => Logic._RespawningColor ?? _RespawningColor ?? Color.Empty; public Color? _BackgroundColor { get; set; } [JsonIgnore] - public Color BackgroundColor { get { return Logic._BackgroundColor ?? _BackgroundColor ?? Color.Empty; } } + public Color BackgroundColor => Logic._BackgroundColor ?? _BackgroundColor ?? Color.Empty; public Dota2RespawnLayerHandlerProperties() : base() { } @@ -39,56 +39,70 @@ public override void Default() { base.Default(); - this._RespawnColor = Color.FromArgb(255, 0, 0); - this._RespawningColor = Color.FromArgb(255, 170, 0); - this._BackgroundColor = Color.FromArgb(255, 255, 255); - this._Sequence = new KeySequence( - new Devices.DeviceKeys[] { + _RespawnColor = Color.FromArgb(255, 0, 0); + _RespawningColor = Color.FromArgb(255, 170, 0); + _BackgroundColor = Color.FromArgb(255, 255, 255); + _Sequence = new KeySequence( + new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12, Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS } - ); + ); } } public class Dota2RespawnLayerHandler : LayerHandler { + private readonly EffectLayer _respawnLayer = new("Dota 2 - Respawn"); + private readonly SolidBrush _solidBrush = new(Color.Empty); protected override UserControl CreateControl() { return new Control_Dota2RespawnLayer(this); } + private bool _empty; public override EffectLayer Render(IGameState state) { - EffectLayer respawn_layer = new EffectLayer("Dota 2 - Respawn"); + if (state is not GameState_Dota2 dota2State) return _respawnLayer; - if (state is GameState_Dota2) + if (dota2State.Player.Team != PlayerTeam.Undefined && dota2State.Player.Team != PlayerTeam.None && !dota2State.Hero.IsAlive) { - GameState_Dota2 dota2state = state as GameState_Dota2; - - if (dota2state.Player.Team != PlayerTeam.Undefined && dota2state.Player.Team != PlayerTeam.None && !dota2state.Hero.IsAlive) + var percent = dota2State.Hero.SecondsToRespawn > 5 ? 0.0 : 1.0 - dota2State.Hero.SecondsToRespawn / 5.0; + if (percent > 0) { - double percent = (dota2state.Hero.SecondsToRespawn > 5 ? 0.0 : 1.0 - (dota2state.Hero.SecondsToRespawn / 5.0)); - - respawn_layer.Fill(Utils.ColorUtils.BlendColors(Color.Transparent, Properties.BackgroundColor, percent)); - - respawn_layer.PercentEffect(Properties.RespawningColor, - Properties.RespawnColor, - Properties.Sequence, - percent, - 1.0, - PercentEffectType.AllAtOnce); + _empty = false; + _solidBrush.Color = Utils.ColorUtils.BlendColors(Color.Transparent, Properties.BackgroundColor, percent); + _respawnLayer.Fill(_solidBrush); + + _respawnLayer.PercentEffect( + Properties.RespawningColor, + Properties.RespawnColor, + Properties.Sequence, + percent, + 1.0, + PercentEffectType.AllAtOnce); } + else + { + _respawnLayer.Clear(); + _empty = true; + } + } + else + { + if (_empty) return _respawnLayer; + _respawnLayer.Clear(); + _empty = true; } - return respawn_layer; + return _respawnLayer; } public override void SetApplication(Application profile) { - (Control as Control_Dota2RespawnLayer).SetProfile(profile); + (Control as Control_Dota2RespawnLayer)?.SetProfile(profile); base.SetApplication(profile); } } diff --git a/Project-Aurora/Project-Aurora/Profiles/DyingLight/DyingLightProfile.cs b/Project-Aurora/Project-Aurora/Profiles/DyingLight/DyingLightProfile.cs index 8ca4274a0..aa6a8cb49 100644 --- a/Project-Aurora/Project-Aurora/Profiles/DyingLight/DyingLightProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/DyingLight/DyingLightProfile.cs @@ -32,7 +32,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.DodgerBlue, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.C, Devices.DeviceKeys.LEFT_SHIFT }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.C, Devices.DeviceKeys.LEFT_SHIFT }) } } ), @@ -41,7 +41,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.DarkOrange, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.Q, Devices.DeviceKeys.E, Devices.DeviceKeys.R, Devices.DeviceKeys.F, Devices.DeviceKeys.V, Devices.DeviceKeys.B }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.Q, Devices.DeviceKeys.E, Devices.DeviceKeys.R, Devices.DeviceKeys.F, Devices.DeviceKeys.V, Devices.DeviceKeys.B }) } } ), @@ -50,7 +50,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Magenta, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.I, Devices.DeviceKeys.M, Devices.DeviceKeys.L, Devices.DeviceKeys.U}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.I, Devices.DeviceKeys.M, Devices.DeviceKeys.L, Devices.DeviceKeys.U}) } } ), @@ -59,7 +59,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Green, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.H}), + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.H}), } } ), @@ -68,7 +68,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.White, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.T}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.T}) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler() diff --git a/Project-Aurora/Project-Aurora/Profiles/ETS2/ETS2Profile.cs b/Project-Aurora/Project-Aurora/Profiles/ETS2/ETS2Profile.cs index b4ed1d8ee..4de6aaa56 100644 --- a/Project-Aurora/Project-Aurora/Profiles/ETS2/ETS2Profile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/ETS2/ETS2Profile.cs @@ -42,7 +42,7 @@ public override void Reset() { new Layer("Ignition Key", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = hazardColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.E }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.E }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanNot(new BooleanGSIBoolean("Truck/engineOn"))) @@ -67,7 +67,7 @@ public override void Reset() { { 1, Color.FromArgb(0, 255, 0) } } }, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.W }), + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.W }), _VariablePath = "Truck/gameThrottle", _MaxVariablePath = "1", _PercentType = PercentEffectType.AllAtOnce @@ -83,7 +83,7 @@ public override void Reset() { { 1, Color.FromArgb(255, 0, 0) } } }, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.S }), + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.S }), _VariablePath = "Truck/gameBrake", _MaxVariablePath = "1", _PercentType = PercentEffectType.AllAtOnce @@ -93,7 +93,7 @@ public override void Reset() { new Layer("Bright Keys", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = brightColor, - _Sequence = new KeySequence(new DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.A, DeviceKeys.D, // Steering DeviceKeys.LEFT_SHIFT, DeviceKeys.LEFT_CONTROL, // Gear up/down DeviceKeys.F, // Hazard light @@ -114,7 +114,7 @@ public override void Reset() { { 1, Color.FromArgb(255, 0, 0) }, } }, - _Sequence = new KeySequence(new DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.ONE, DeviceKeys.TWO, DeviceKeys.THREE, DeviceKeys.FOUR, DeviceKeys.FIVE, DeviceKeys.SIX, DeviceKeys.SEVEN, DeviceKeys.EIGHT, DeviceKeys.NINE, DeviceKeys.ZERO }), @@ -126,7 +126,7 @@ public override void Reset() { new Layer("Parking Brake Key", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = brightColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.SPACE }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.SPACE }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -137,7 +137,7 @@ public override void Reset() { new Layer("Headlights (High Beam)", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.K }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.K }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -148,7 +148,7 @@ public override void Reset() { new Layer("Headlights", new SolidColorLayerHandler() { Properties = new LayerHandlerProperties() { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.L }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.L }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -160,7 +160,7 @@ public override void Reset() { new Layer("Left Blinkers", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = hazardColor, - _Sequence = new KeySequence(new[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4 }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4 }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Truck/blinkerLeftOn")) @@ -169,7 +169,7 @@ public override void Reset() { new Layer("Right Blinkers", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = hazardColor, - _Sequence = new KeySequence(new[] { DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }) } }, new OverrideLogicBuilder() .SetDynamicBoolean("_Enabled", new BooleanGSIBoolean("Truck/blinkerRightOn")) @@ -178,7 +178,7 @@ public override void Reset() { new Layer("Left Blinker Button", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.OPEN_BRACKET }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.OPEN_BRACKET }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -189,7 +189,7 @@ public override void Reset() { new Layer("Left Blinker Button", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.CLOSE_BRACKET }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.CLOSE_BRACKET }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -201,14 +201,14 @@ public override void Reset() { Properties = new ETS2BeaconLayerProperties { _BeaconStyle = ETS2_BeaconStyle.Fancy_Flash, _PrimaryColor = hazardColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8 }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8 }) } }), new Layer("Beacon Button", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.O }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.O }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -219,7 +219,7 @@ public override void Reset() { new Layer("Trailer Button", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = Color.FromArgb(128, 0, 0, 255), - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.T }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.T }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -230,7 +230,7 @@ public override void Reset() { new Layer("Cruise Control Button", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.C }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.C }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() @@ -250,7 +250,7 @@ public override void Reset() { { 1f, Color.FromArgb(0, 255, 0) } } }, - _Sequence = new KeySequence(new DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.NUM_ONE, DeviceKeys.NUM_FOUR, DeviceKeys.NUM_SEVEN, DeviceKeys.NUM_LOCK }), _VariablePath = "Truck/fuel", @@ -270,7 +270,7 @@ public override void Reset() { { 1f, Color.FromArgb(0, 255, 0) } } }, - _Sequence = new KeySequence(new DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.NUM_THREE, DeviceKeys.NUM_SIX, DeviceKeys.NUM_NINE, DeviceKeys.NUM_ASTERISK }), _VariablePath = "Truck/airPressure", @@ -281,7 +281,7 @@ public override void Reset() { new Layer("Wipers Button", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = dimColor, - _Sequence = new KeySequence(new DeviceKeys[]{ DeviceKeys.P }) + _Sequence = new KeySequence(new DeviceKey[]{ DeviceKeys.P }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() diff --git a/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BeaconLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BeaconLayerHandler.cs index 8285f7317..1f839d13f 100644 --- a/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BeaconLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BeaconLayerHandler.cs @@ -30,7 +30,7 @@ public ETS2BeaconLayerProperties(bool assign_default = false) : base(assign_defa public override void Default() { base.Default(); - this._Sequence = new KeySequence(new DeviceKeys[] { DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8 }); + this._Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8 }); this._PrimaryColor = Color.FromArgb(255, 128, 0); this._BeaconStyle = ETS2_BeaconStyle.Fancy_Flash; this._Speed = 1f; @@ -80,7 +80,7 @@ public override EffectLayer Render(IGameState gamestate) { // Sets half the sequence on and half off, then swaps. If odd number of keys, first half will be bigger case ETS2_BeaconStyle.Half_Alternating: - List half; + List half; if (frame < 5) // First half half = Properties.Sequence.keys.GetRange(0, (int)Math.Ceiling((double)Properties.Sequence.keys.Count / 2)); diff --git a/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BlinkerLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BlinkerLayerHandler.cs index e9a0e7875..352abee0b 100644 --- a/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BlinkerLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/ETS2/Layers/ETS2BlinkerLayerHandler.cs @@ -36,8 +36,8 @@ public ETS2BlinkerLayerHandlerProperties(bool assign_default = false) : base(ass public override void Default() { base.Default(); - this._LeftBlinkerSequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4 }); - this._RightBlinkerSequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 }); + this._LeftBlinkerSequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4 }); + this._RightBlinkerSequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 }); this._BlinkerOffColor = Color.Empty; this._BlinkerOnColor = Color.FromArgb(255, 127, 0); } diff --git a/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousAnimationLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousAnimationLayerHandler.cs index 5dcf353fe..4d20f738e 100644 --- a/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousAnimationLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousAnimationLayerHandler.cs @@ -135,14 +135,14 @@ static float findMod(float a, float b) private void BgFadeIn(EffectLayer animation_layer) { layerFadeState = Math.Min(1, layerFadeState + 0.07f); - animation_layer.Fill(ColorUtils.BlendColors(Color.Empty, Color.Black, layerFadeState)); + animation_layer.FillOver(ColorUtils.BlendColors(Color.Empty, Color.Black, layerFadeState)); } private void BgFadeOut(EffectLayer animation_layer) { if (!(layerFadeState > 0)) return; layerFadeState = Math.Max(0, layerFadeState - 0.03f); - animation_layer.Fill(ColorUtils.BlendColors(Color.Empty, Color.Black, layerFadeState)); + animation_layer.FillOver(ColorUtils.BlendColors(Color.Empty, Color.Black, layerFadeState)); } public override EffectLayer Render(IGameState state) @@ -243,25 +243,25 @@ public void UpdateAnimations() hyperspace_mix = new AnimationMix(); hyperspace_mix.AddTrack(GenerateHyperspaceStreak(0, 1.5f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 5, 0.1f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 12, 2.1f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 15, 2.7f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 20, 0.7f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 25, 2.4f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 30, 1.4f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 35, 0.3f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 40, 1.8f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 45, 1.0f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 50, 2.5f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 55, 1.5f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 60, 0.9f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 64, 2.3f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 68, 1.9f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 77, 0.0f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 82, 1.1f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 85, 1.3f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.canvas_width / 100 * 93, 2.1f, hyperspace_mix.GetTracks().Count)); - hyperspace_mix.AddTrack(GenerateHyperspaceStreak(Effects.canvas_width, 0.4f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 5, 0.1f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 12, 2.1f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 15, 2.7f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 20, 0.7f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 25, 2.4f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 30, 1.4f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 35, 0.3f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 40, 1.8f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 45, 1.0f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 50, 2.5f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 55, 1.5f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 60, 0.9f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 64, 2.3f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 68, 1.9f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 77, 0.0f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 82, 1.1f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 85, 1.3f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak((float)Effects.CanvasWidth / 100 * 93, 2.1f, hyperspace_mix.GetTracks().Count)); + hyperspace_mix.AddTrack(GenerateHyperspaceStreak(Effects.CanvasWidth, 0.4f, hyperspace_mix.GetTracks().Count)); } private void RegenerateHyperspaceExitAnimation(StarClass starClass = StarClass.K) @@ -269,21 +269,21 @@ private void RegenerateHyperspaceExitAnimation(StarClass starClass = StarClass.K if (starClass == hyperspace_exit_star) return; hypespace_exit_mix = new AnimationMix(); - float startingX = Effects.canvas_width_center - 10; + float startingX = Effects.CanvasWidthCenter - 10; Color hyperspaceExitColor = starColors.ContainsKey(starClass) ? starColors[starClass] : starColors[StarClass.K]; AnimationTrack star_entry = new AnimationTrack("Hyperspace exit", 2.0f); star_entry.SetFrame(0.0f, - new AnimationFilledCircle(startingX, Effects.canvas_height_center, 0, hyperspaceExitColor, 1) + new AnimationFilledCircle(startingX, Effects.CanvasHeightCenter, 0, hyperspaceExitColor, 1) ); star_entry.SetFrame(1.0f, - new AnimationFilledCircle(startingX, Effects.canvas_height_center, Effects.canvas_biggest, hyperspaceExitColor, 1) + new AnimationFilledCircle(startingX, Effects.CanvasHeightCenter, Effects.CanvasBiggest, hyperspaceExitColor, 1) ); star_entry.SetFrame(1.2f, - new AnimationFilledCircle(startingX, Effects.canvas_height_center, Effects.canvas_biggest, hyperspaceExitColor, 1) + new AnimationFilledCircle(startingX, Effects.CanvasHeightCenter, Effects.CanvasBiggest, hyperspaceExitColor, 1) ); star_entry.SetFrame(2f, - new AnimationFilledCircle(startingX, Effects.canvas_height_center, Effects.canvas_biggest, Color.Empty, 1) + new AnimationFilledCircle(startingX, Effects.CanvasHeightCenter, Effects.CanvasBiggest, Color.Empty, 1) ); AnimationTrack star_entry_bg = new AnimationTrack("Hyperspace exit bg", 2f); @@ -303,7 +303,7 @@ private AnimationTrack GenerateFsdPulse(int index = 0) Color pulseStartColor = Color.FromArgb(0, 126, 255); Color pulseEndColor = Color.FromArgb(200, 0, 126, 255); - float startingX = Effects.canvas_width_center - 10; + float startingX = Effects.CanvasWidthCenter - 10; int pulseStartWidth = 10; int pulseEndWidth = 2; @@ -312,10 +312,10 @@ private AnimationTrack GenerateFsdPulse(int index = 0) AnimationTrack countdown_pulse = new AnimationTrack("Fsd countdown pulse " + index, pulseFrameDuration, index); countdown_pulse.SetFrame(0.0f, - new AnimationCircle(startingX, Effects.canvas_height_center, 0, pulseStartColor, pulseStartWidth) + new AnimationCircle(startingX, Effects.CanvasHeightCenter, 0, pulseStartColor, pulseStartWidth) ); countdown_pulse.SetFrame(pulseDuration, - new AnimationCircle(startingX, Effects.canvas_height_center, Effects.canvas_biggest, pulseEndColor, pulseEndWidth) + new AnimationCircle(startingX, Effects.CanvasHeightCenter, Effects.CanvasBiggest, pulseEndColor, pulseEndWidth) ); return countdown_pulse; @@ -331,7 +331,7 @@ private AnimationTrack GenerateHyperspaceStreak(float xOffset, float timeShift, int streakWidth = 3; int startPosition = -40; - int endPosition = Effects.canvas_height + streakSize * 2; + int endPosition = Effects.CanvasHeight + streakSize * 2; AnimationTrack streak = new AnimationTrack("Hyperspace streak " + index, animationDuration, timeShift); streak.SetFrame(0.0f, diff --git a/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousBackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousBackgroundLayerHandler.cs index b2ad79551..465610ed0 100644 --- a/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousBackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/EliteDangerous/Layers/EliteDangerousBackgroundLayerHandler.cs @@ -49,7 +49,7 @@ public override EffectLayer Render(IGameState state) GameState_EliteDangerous gameState = state as GameState_EliteDangerous; Color combat_bg_color = gameState.Status.IsFlagSet(Flag.HUD_DISCOVERY_MODE) ? this.Properties.DiscoveryModeColor : this.Properties.CombatModeColor; - bg_layer.Fill(combat_bg_color); + bg_layer.FillOver(combat_bg_color); return bg_layer; } diff --git a/Project-Aurora/Project-Aurora/Profiles/Evolve/EvolveProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Evolve/EvolveProfile.cs index 3f3cf2dcb..0ea018aa8 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Evolve/EvolveProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Evolve/EvolveProfile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.DarkRed, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_CONTROL }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_CONTROL }) } } ), @@ -40,7 +40,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.OrangeRed, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5BackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5BackgroundLayerHandler.cs index 1a3250b49..b85295f74 100644 --- a/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5BackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5BackgroundLayerHandler.cs @@ -148,7 +148,7 @@ public override EffectLayer Render(IGameState state) break; } - bg_layer.Fill(bg_color); + bg_layer.FillOver(bg_color); } return bg_layer; diff --git a/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5PoliceSirenLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5PoliceSirenLayerHandler.cs index 910053d25..30725038c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5PoliceSirenLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/GTA5/Layers/GTA5PoliceSirenLayerHandler.cs @@ -56,11 +56,11 @@ public override void Default() this._LeftSirenColor = Color.FromArgb(255, 0, 0); this._RightSirenColor = Color.FromArgb(0, 0, 255); this._SirenType = GTA5_PoliceEffects.Default; - this._LeftSirenSequence = new KeySequence(new Devices.DeviceKeys[] { + this._LeftSirenSequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6 }); - this._RightSirenSequence = new KeySequence(new Devices.DeviceKeys[] { + this._RightSirenSequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 }); diff --git a/Project-Aurora/Project-Aurora/Profiles/Generic_Application/Event_GenericApplication.cs b/Project-Aurora/Project-Aurora/Profiles/Generic_Application/Event_GenericApplication.cs index 48245707a..ec5ac92c7 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Generic_Application/Event_GenericApplication.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Generic_Application/Event_GenericApplication.cs @@ -42,12 +42,5 @@ public override void UpdateLights(EffectFrame frame) frame.AddLayers(layers.ToArray()); } - - public void UpdateLights(EffectFrame frame, Application profile) - { - this.Application = profile; - - UpdateLights(frame); - } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Guild Wars 2/GW2Profile.cs b/Project-Aurora/Project-Aurora/Profiles/Guild Wars 2/GW2Profile.cs index bb54d81e2..9ba91f15f 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Guild Wars 2/GW2Profile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Guild Wars 2/GW2Profile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Orange, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.Q, Devices.DeviceKeys.E, Devices.DeviceKeys.V, Devices.DeviceKeys.R }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.Q, Devices.DeviceKeys.E, Devices.DeviceKeys.V, Devices.DeviceKeys.R }) } } ), @@ -40,7 +40,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Green, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.TILDE, Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.TILDE, Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO }) } } ), @@ -49,7 +49,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Red, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.T, Devices.DeviceKeys.TAB }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.T, Devices.DeviceKeys.TAB }) } } ), @@ -58,7 +58,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Brown, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.O, Devices.DeviceKeys.Y, Devices.DeviceKeys.G, Devices.DeviceKeys.H, Devices.DeviceKeys.I, Devices.DeviceKeys.K, Devices.DeviceKeys.F12, Devices.DeviceKeys.F11, Devices.DeviceKeys.P, Devices.DeviceKeys.ENTER, Devices.DeviceKeys.M, Devices.DeviceKeys.LEFT_CONTROL, Devices.DeviceKeys.LEFT_ALT }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.O, Devices.DeviceKeys.Y, Devices.DeviceKeys.G, Devices.DeviceKeys.H, Devices.DeviceKeys.I, Devices.DeviceKeys.K, Devices.DeviceKeys.F12, Devices.DeviceKeys.F11, Devices.DeviceKeys.P, Devices.DeviceKeys.ENTER, Devices.DeviceKeys.M, Devices.DeviceKeys.LEFT_CONTROL, Devices.DeviceKeys.LEFT_ALT }) } } ), @@ -67,7 +67,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Yellow, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.F, Devices.DeviceKeys.C }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F, Devices.DeviceKeys.C }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Profiles/HotlineMiami/HMProfile.cs b/Project-Aurora/Project-Aurora/Profiles/HotlineMiami/HMProfile.cs index a43baeee4..d2822c230 100644 --- a/Project-Aurora/Project-Aurora/Profiles/HotlineMiami/HMProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/HotlineMiami/HMProfile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Yellow, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D }) } } ), @@ -40,7 +40,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Red, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_SHIFT, Devices.DeviceKeys.R, Devices.DeviceKeys.ESC }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_SHIFT, Devices.DeviceKeys.R, Devices.DeviceKeys.ESC }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/MatchNode.cs b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/MatchNode.cs index 665f400cf..8b429f3e4 100644 --- a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/MatchNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/MatchNode.cs @@ -22,12 +22,14 @@ public class MatchNode : Node public int OceanDragonsKilled; - public int MountainDragonsKilled; - public int CloudDragonsKilled; public int EarthDragonsKilled; + public int ChemtechDragonsKilled; + + public int HextechDragonsKilled; + public int ElderDragonsKilled; public int DragonsKilled; @@ -48,6 +50,8 @@ public enum MapTerrain Infernal, Cloud, Mountain, + Chemtech, + Hextech, Ocean } diff --git a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/PlayerNode.cs b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/PlayerNode.cs index 613f722a1..604ac88b2 100644 --- a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/PlayerNode.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GSI/Nodes/PlayerNode.cs @@ -15,6 +15,7 @@ public enum Champion Aatrox, Ahri, Akali, + Akshan, Alistar, Amumu, Anivia, @@ -49,6 +50,7 @@ public enum Champion Gnar, Gragas, Graves, + Gwen, Hecarim, Heimerdinger, Illaoi, @@ -146,7 +148,9 @@ public enum Champion Vayne, Veigar, Velkoz, + Vex, Vi, + Viego, Viktor, Vladimir, Volibear, @@ -161,6 +165,7 @@ public enum Champion Yuumi, Zac, Zed, + Zeri, Ziggs, Zilean, Zoe, diff --git a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GameEvent_LoL.cs b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GameEvent_LoL.cs index fca011bce..66c68800c 100644 --- a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GameEvent_LoL.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/GameEvent_LoL.cs @@ -151,9 +151,11 @@ public override void UpdateTick() s.Match.EarthDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "earth"); s.Match.OceanDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "water"); s.Match.CloudDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "air"); + s.Match.ChemtechDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "chemtech"); + s.Match.HextechDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "hextech"); s.Match.ElderDragonsKilled = drags.Count(d => d.DragonType.ToLower() == "elder"); - s.Match.BaronsKilled = allGameData.events.Events.Count(ev => ev is _BaronKillEvent); + s.Match.BaronsKilled = allGameData.events.Events.Count(ev => ev is _BaronKillEvent); s.Match.HeraldsKilled = allGameData.events.Events.Count(ev => ev is _HeraldKillEvent); s.Match.DragonsKilled = allGameData.events.Events.Count(ev => ev is _DragonKillEvent); s.Match.TurretsKilled = allGameData.events.Events.Count(ev => ev is _TurretKillEvent); diff --git a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/DefaultChampionColors.cs b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/DefaultChampionColors.cs index b4bbb00b9..0d7561674 100644 --- a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/DefaultChampionColors.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/DefaultChampionColors.cs @@ -21,6 +21,7 @@ public static class DefaultChampionColors [Champion.Aatrox] = Color.FromArgb(237, 83, 79), [Champion.Ahri] = Color.FromArgb(61, 76, 178), [Champion.Akali] = Color.FromArgb(10, 115, 38), + [Champion.Akshan] = Color.FromArgb(222, 151, 50), [Champion.Alistar] = Color.FromArgb(64, 6, 97), [Champion.Amumu] = Color.FromArgb(87, 138, 74), [Champion.Anivia] = Color.FromArgb(8, 128, 200), @@ -55,6 +56,7 @@ public static class DefaultChampionColors [Champion.Gnar] = Color.FromArgb(244, 124, 36), [Champion.Gragas] = Color.FromArgb(196, 72, 36), [Champion.Graves] = Color.FromArgb(82, 16, 16), + [Champion.Gwen] = Color.FromArgb(68, 193, 225), [Champion.Hecarim] = Color.FromArgb(7, 145, 145), [Champion.Heimerdinger] = Color.FromArgb(191, 155, 70), [Champion.Illaoi] = Color.FromArgb(79, 186, 69), @@ -152,7 +154,9 @@ public static class DefaultChampionColors [Champion.Vayne] = Color.FromArgb(182, 18, 42), [Champion.Veigar] = Color.FromArgb(67, 42, 158), [Champion.Velkoz] = Color.FromArgb(202, 57, 201), + [Champion.Vex] = Color.FromArgb(171, 64, 191), [Champion.Vi] = Color.FromArgb(196, 55, 100), + [Champion.Viego] = Color.FromArgb(51, 188, 129), [Champion.Viktor] = Color.FromArgb(204, 76, 36), [Champion.Vladimir] = Color.FromArgb(190, 63, 57), [Champion.Volibear] = Color.FromArgb(74, 134, 175), @@ -167,6 +171,7 @@ public static class DefaultChampionColors [Champion.Yuumi] = Color.FromArgb(180, 116, 76), [Champion.Zac] = Color.FromArgb(97, 184, 75), [Champion.Zed] = Color.FromArgb(148, 0, 0), + [Champion.Zeri] = Color.FromArgb(119, 179, 56), [Champion.Ziggs] = Color.FromArgb(227, 67, 23), [Champion.Zilean] = Color.FromArgb(61, 148, 194), [Champion.Zoe] = Color.FromArgb(228, 104, 87), diff --git a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/LoLBackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/LoLBackgroundLayerHandler.cs index c5a3ee610..8d63f348b 100644 --- a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/LoLBackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/Layers/LoLBackgroundLayerHandler.cs @@ -52,13 +52,13 @@ public override EffectLayer Render(IGameState gamestate) //or if the color is adjusted in the UI //or if the canvas size changes due to the layout being changed if (currentChampion != lastChampion || currentColor != lastColor || - lastWidth != Effects.canvas_width || lastHeight != Effects.canvas_height) + lastWidth != Effects.CanvasWidth || lastHeight != Effects.CanvasHeight) { lastChampion = currentChampion; lastColor = currentColor; - lastHeight = Effects.canvas_height; - lastWidth = Effects.canvas_width; - layer.Fill(lastColor); + lastHeight = Effects.CanvasHeight; + lastWidth = Effects.CanvasWidth; + layer.FillOver(lastColor); //then we fill the layer again } //otherwise, we can just return the same layer as it's mostly static diff --git a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/LoLGSIProfile.cs b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/LoLGSIProfile.cs index edecbb0f4..31b287921 100644 --- a/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/LoLGSIProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LeagueOfLegends/LoLGSIProfile.cs @@ -48,7 +48,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.FromArgb(79, 234, 255), - _Sequence = new KeySequence(new DK[] { DK.B }) + _Sequence = new KeySequence(new DeviceKey[] { DK.B }) } }, EnabledWhen(new BooleanGSIBoolean("Match/InGame"))), new Layer("Health", new PercentLayerHandler() @@ -57,7 +57,7 @@ public override void Reset() { _PrimaryColor = Color.Green, _SecondaryColor = Color.Black, - _Sequence = new KeySequence(new DK[] { DK.F1, DK.F2, DK.F3, DK.F4, DK.F5, DK.F6, DK.F7, DK.F8, DK.F9, DK.F10, DK.F11, DK.F12 }), + _Sequence = new KeySequence(new DeviceKey[] { DK.F1, DK.F2, DK.F3, DK.F4, DK.F5, DK.F6, DK.F7, DK.F8, DK.F9, DK.F10, DK.F11, DK.F12 }), _VariablePath = "Player/ChampionStats/HealthCurrent", _MaxVariablePath = "Player/ChampionStats/HealthMax" } @@ -68,7 +68,7 @@ public override void Reset() { _PrimaryColor = Color.DarkBlue, _SecondaryColor = Color.Black, - _Sequence = new KeySequence(new DK[] { DK.Z, DK.X, DK.C, DK.V, DK.B, DK.N, DK.M, DK.COMMA, DK.PERIOD, DK.FORWARD_SLASH }), + _Sequence = new KeySequence(new DeviceKey[] { DK.Z, DK.X, DK.C, DK.V, DK.B, DK.N, DK.M, DK.COMMA, DK.PERIOD, DK.FORWARD_SLASH }), _VariablePath = "Player/ChampionStats/ResourceCurrent", _MaxVariablePath = "Player/ChampionStats/ResourceMax" } @@ -101,7 +101,7 @@ public static Layer GetItemLayer(string name, string item, DK key) Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Transparent, - _Sequence = new KeySequence(new DK[] { key }) + _Sequence = new KeySequence(new DeviceKey[] { key }) } }, new OverrideLogicBuilder() @@ -120,7 +120,7 @@ public static Layer GetAbilityLayer(string ability, DK key) Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Orange, - _Sequence = new KeySequence(new DK[] { key }) + _Sequence = new KeySequence(new DeviceKey[] { key }) } }, EnabledWhen(new BooleanGSIBoolean("Player/Abilities/" + ability + "/Learned"))); } @@ -132,7 +132,7 @@ public static Layer GetSpellLayer(string spell, DK key) Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Transparent, - _Sequence = new KeySequence(new DK[] { key }) + _Sequence = new KeySequence(new DeviceKey[] { key }) } }, new OverrideLogicBuilder() .SetLookupTable("_PrimaryColor", new OverrideLookupTableBuilder() diff --git a/Project-Aurora/Project-Aurora/Profiles/LightingStateManager.cs b/Project-Aurora/Project-Aurora/Profiles/LightingStateManager.cs index 0acdee219..c686d09f0 100755 --- a/Project-Aurora/Project-Aurora/Profiles/LightingStateManager.cs +++ b/Project-Aurora/Project-Aurora/Profiles/LightingStateManager.cs @@ -64,6 +64,11 @@ public class LightingStateManager : ObjectSettings, IIn private ActiveProcessMonitor processMonitor; private RunningProcessMonitor runningProcessMonitor; public RunningProcessMonitor RunningProcessMonitor => runningProcessMonitor; + + + + private Func _isRunningProcess; + private Func _isOverlayActiveProfile; public LightingStateManager() { @@ -77,8 +82,13 @@ public bool Initialize() if (Initialized) return true; - processMonitor = new ActiveProcessMonitor(); - runningProcessMonitor = new RunningProcessMonitor(); + processMonitor = ActiveProcessMonitor.Instance; + runningProcessMonitor = RunningProcessMonitor.Instance; + _isRunningProcess = name => runningProcessMonitor.IsProcessRunning(name); + _isOverlayActiveProfile = evt => + evt.IsOverlayEnabled && + (evt.Config.ProcessNames == null || + evt.Config.ProcessNames.Any(_isRunningProcess)); // Register all Application types in the assembly var profileTypes = from type in Assembly.GetExecutingAssembly().GetTypes() @@ -123,8 +133,6 @@ where type.GetInterfaces().Contains(typeof(ILayerHandler)) profile.Value.Initialize(); } - this.InitUpdate(); - // Listen for profile keybind triggers Global.InputEvents.KeyDown += CheckProfileKeybinds; @@ -147,7 +155,7 @@ protected override void LoadSettings(Type settingsType) Global.Configuration.ProfileOrder.Add(kvp.Key); } - foreach(string key in Global.Configuration.ProfileOrder.ToList()) + foreach (string key in Global.Configuration.ProfileOrder.ToList()) { if (!Events.ContainsKey(key) || !(Events[key] is Application)) Global.Configuration.ProfileOrder.Remove(key); @@ -161,7 +169,7 @@ public void SaveAll() { SaveSettings(); - foreach(var profile in Events) + foreach (var profile in Events) { if (profile.Value is Application) ((Application)profile.Value).SaveAll(); @@ -262,7 +270,8 @@ public ILightEvent GetProfileFromProcessData(string processName, string processT { return processTitleProfile; } - } else + } + else { return processNameProfile; } @@ -285,9 +294,12 @@ public ILightEvent GetProfileFromProcessName(string process) return null; } - public ILightEvent GetProfileFromProcessTitle(string title) { - foreach (var entry in EventTitles) { - if (Regex.IsMatch(title, entry.Key, RegexOptions.IgnoreCase)) { + public ILightEvent GetProfileFromProcessTitle(string title) + { + foreach (var entry in EventTitles) + { + if (Regex.IsMatch(title, entry.Key, RegexOptions.IgnoreCase)) + { if (!Events.ContainsKey(entry.Value)) Global.logger.Warn($"GetProfileFromProcess: The process with title '{title}' matchs an item in EventTitles but subsequently '{entry.Value}' does not in Events!"); else @@ -325,9 +337,6 @@ public bool RegisterLayer() where T : ILayerHandler private Timer updateTimer; - private const int defaultTimerInterval = 33; - private int timerInterval = defaultTimerInterval; - private long nextProcessNameUpdate; private long currentTick; private string previewModeProfileKey = ""; @@ -337,37 +346,54 @@ public bool RegisterLayer() where T : ILayerHandler public string PreviewProfileKey { get { return previewModeProfileKey; } set { previewModeProfileKey = value ?? string.Empty; } } - private void InitUpdate() + Stopwatch watch = new Stopwatch(); + + private Semaphore updateLock = new Semaphore(1, 1); + private bool locked = false; + public void InitUpdate() { - updateTimer = new System.Threading.Timer(g => { - Stopwatch watch = new Stopwatch(); - watch.Start(); - if (Global.isDebug) + watch.Start(); + updateTimer = new Timer(g => + { + TimerUpdate(); + }, null, 0, System.Threading.Timeout.Infinite); + } + + private void TimerUpdate() + { + if (locked) + { + return; + } + updateLock.WaitOne(); + locked = true; + + if (Global.isDebug) + Update(); + else + { + try + { Update(); - else + } + catch (Exception exc) { - try - { - Update(); - } - catch (Exception exc) - { - Global.logger.Error("ProfilesManager.Update() Exception, " + exc); - } + Global.logger.Error("ProfilesManager.Update() Exception, " + exc); + MessageBox.Show("Error while updating light effects: " + exc.Message); } - - watch.Stop(); - currentTick += timerInterval + watch.ElapsedMilliseconds; - updateTimer?.Change(Math.Max(timerInterval, 0), Timeout.Infinite); - }, null, 0, System.Threading.Timeout.Infinite); - GC.KeepAlive(updateTimer); + } + currentTick += watch.ElapsedMilliseconds; + updateTimer?.Change(Math.Max(Global.Configuration.UpdateDelay - watch.ElapsedMilliseconds, Global.Configuration.UpdateDelay), Timeout.Infinite); + watch.Reset(); + locked = false; + updateLock.Release(); } private void UpdateProcess() { - if (Global.Configuration.DetectionMode == ApplicationDetectionMode.ForegroroundApp && (currentTick >= nextProcessNameUpdate)) + if (Global.Configuration.DetectionMode == ApplicationDetectionMode.ForegroroundApp && currentTick >= nextProcessNameUpdate) { - processMonitor.GetActiveWindowsProcessname(); + processMonitor.GetActiveWindowsProcessName(); nextProcessNameUpdate = currentTick + 1000L; } } @@ -394,7 +420,7 @@ private void UpdateIdleEffects(EffectsEngine.EffectFrame newFrame) } } } - + private void UpdateEvent(ILightEvent @event, EffectsEngine.EffectFrame frame) { StartEvent(@event); @@ -404,7 +430,7 @@ private void UpdateEvent(ILightEvent @event, EffectsEngine.EffectFrame frame) private bool StartEvent(ILightEvent @event) { UpdatedEvents.Add(@event); - + // Skip if event was already started if (StartedEvents.Contains(@event)) return false; @@ -418,61 +444,66 @@ private bool StopUnUpdatedEvents() { // Skip if there are no started events or started events are the same since last update if (!StartedEvents.Any() || StartedEvents.SequenceEqual(UpdatedEvents)) return false; - + List eventsToStop = StartedEvents.Except(UpdatedEvents).ToList(); foreach (var eventToStop in eventsToStop) eventToStop.OnStop(); - + StartedEvents.Clear(); StartedEvents.AddRange(UpdatedEvents); - + return true; } private void Update() { + Stopwatch debugTimer = new Stopwatch(); PreUpdate?.Invoke(this, null); UpdatedEvents.Clear(); //Blackout. TODO: Cleanup this a bit. Maybe push blank effect frame to keyboard incase it has existing stuff displayed - if ((Global.Configuration.TimeBasedDimmingEnabled && - Utils.Time.IsCurrentTimeBetween(Global.Configuration.TimeBasedDimmingStartHour, Global.Configuration.TimeBasedDimmingStartMinute, Global.Configuration.TimeBasedDimmingEndHour, Global.Configuration.TimeBasedDimmingEndMinute))) + var dimmingStartTime = new TimeSpan(Global.Configuration.TimeBasedDimmingStartHour, Global.Configuration.TimeBasedDimmingStartMinute, 0); + var dimmingEndTime = new TimeSpan(Global.Configuration.TimeBasedDimmingEndHour, Global.Configuration.TimeBasedDimmingEndMinute, 0); + if (Global.Configuration.TimeBasedDimmingEnabled && + Time.IsCurrentTimeBetween(dimmingStartTime, dimmingEndTime)) { StopUnUpdatedEvents(); return; } - string raw_process_name = Path.GetFileName(processMonitor.ProcessPath); + var rawProcessName = Path.GetFileName(processMonitor.ProcessPath); UpdateProcess(); EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); - + debugTimer.Restart(); //TODO: Move these IdleEffects to an event //this.UpdateIdleEffects(newFrame); - - ILightEvent profile = GetCurrentProfile(out bool preview); - timerInterval = profile?.Config?.UpdateInterval ?? defaultTimerInterval; + var profile = GetCurrentProfile(out var preview); // If the current foreground process is excluded from Aurora, disable the lighting manager - if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.ExcludedPrograms.Contains(raw_process_name)) + if ((profile is Desktop.Desktop && !profile.IsEnabled) || Global.Configuration.ExcludedPrograms.Contains(rawProcessName)) { StopUnUpdatedEvents(); Global.dev_manager.ShutdownDevices(); - Global.effengine.PushFrame(newFrame); + lock (Effects.CanvasChangedLock) + { + Global.effengine.PushFrame(newFrame); + } return; } - else - Global.dev_manager.InitializeOnce(); + Global.dev_manager.InitializeOnce(); + debugTimer.Restart(); //Need to do another check in case Desktop is disabled or the selected preview is disabled if (profile.IsEnabled) UpdateEvent(profile, newFrame); // Overlay layers - if (!preview || Global.Configuration.OverlaysInPreview) { + if (!preview || Global.Configuration.OverlaysInPreview) + { foreach (var @event in GetOverlayActiveProfiles()) @event.UpdateOverlayLights(newFrame); @@ -483,55 +514,63 @@ private void Update() UpdateIdleEffects(newFrame); } - - Global.effengine.PushFrame(newFrame); + lock (Effects.CanvasChangedLock) + { + Global.effengine.PushFrame(newFrame); + } StopUnUpdatedEvents(); PostUpdate?.Invoke(this, null); + debugTimer.Restart(); } /// Gets the current application. /// Boolean indicating whether the application is selected because it is previewing (true) or because the process is open (false). - public ILightEvent GetCurrentProfile(out bool preview) { - string process_name = Path.GetFileName(processMonitor.ProcessPath).ToLower(); - string process_title = processMonitor.GetActiveWindowsProcessTitle(); + private ILightEvent GetCurrentProfile(out bool preview) + { + var processName = Path.GetFileName(processMonitor.ProcessPath).ToLower(); + var processTitle = processMonitor.GetActiveWindowsProcessTitle(); ILightEvent profile = null; ILightEvent tempProfile = null; preview = false; //TODO: GetProfile that checks based on event type - if ((tempProfile = GetProfileFromProcessData(process_name, process_title)) != null && tempProfile.IsEnabled) + if ((tempProfile = GetProfileFromProcessData(processName, processTitle)) != null && tempProfile.IsEnabled) profile = tempProfile; else if ((tempProfile = GetProfileFromProcessName(previewModeProfileKey)) != null) //Don't check for it being Enabled as a preview should always end-up with the previewed profile regardless of it being disabled { profile = tempProfile; preview = true; - } else if (Global.Configuration.AllowWrappersInBackground && Global.net_listener != null && Global.net_listener.IsWrapperConnected && ((tempProfile = GetProfileFromProcessName(Global.net_listener.WrappedProcess)) != null) && tempProfile.IsEnabled) + } + else if (Global.Configuration.AllowWrappersInBackground && Global.net_listener != null && Global.net_listener.IsWrapperConnected && ((tempProfile = GetProfileFromProcessName(Global.net_listener.WrappedProcess)) != null) && tempProfile.IsEnabled) profile = tempProfile; - profile = profile ?? DesktopProfile; + profile ??= DesktopProfile; return profile; } - /// Gets the current application. - public ILightEvent GetCurrentProfile() => GetCurrentProfile(out bool _); + /// Gets the current application. + public ILightEvent GetCurrentProfile() => GetCurrentProfile(out var _); /// /// Returns a list of all profiles that should have their overlays active. This will include processes that running but not in the foreground. /// /// - public IEnumerable GetOverlayActiveProfiles() => Events.Values - .Where(evt => evt.IsOverlayEnabled) - .Where(evt => evt.Config.ProcessNames == null || evt.Config.ProcessNames.Any(name => runningProcessMonitor.IsProcessRunning(name))); - //.Where(evt => evt.Config.ProcessTitles == null || ProcessUtils.AnyProcessWithTitleExists(evt.Config.ProcessTitles)); + public IEnumerable GetOverlayActiveProfiles() + { + return Events.Values.Where(_isOverlayActiveProfile); + } + //.Where(evt => evt.Config.ProcessTitles == null || ProcessUtils.AnyProcessWithTitleExists(evt.Config.ProcessTitles)); /// KeyDown handler that checks the current application's profiles for keybinds. /// In the case of multiple profiles matching the keybind, it will pick the next one as specified in the Application.Profile order. - public void CheckProfileKeybinds(object sender, SharpDX.RawInput.KeyboardInputEventArgs e) { + public void CheckProfileKeybinds(object sender, SharpDX.RawInput.KeyboardInputEventArgs e) + { ILightEvent profile = GetCurrentProfile(); // Check profile is valid and do not switch profiles if the user is trying to enter a keybind - if (profile is Application && Controls.Control_Keybind._ActiveKeybind == null) { + if (profile is Application && Controls.Control_Keybind._ActiveKeybind == null) + { // Find all profiles that have their keybinds pressed List possibleProfiles = new List(); @@ -540,7 +579,8 @@ public void CheckProfileKeybinds(object sender, SharpDX.RawInput.KeyboardInputEv possibleProfiles.Add(prof); // If atleast one profile has it's key pressed - if (possibleProfiles.Count > 0) { + if (possibleProfiles.Count > 0) + { // The target profile is the NEXT valid profile after the currently selected one (or the first valid one if the currently selected one doesn't share this keybind) int trg = (possibleProfiles.IndexOf((profile as Application).Profile) + 1) % possibleProfiles.Count; (profile as Application).SwitchToProfile(possibleProfiles[trg]); @@ -553,48 +593,48 @@ public void GameStateUpdate(IGameState gs) { //Debug.WriteLine("Received gs!"); -//Global.logger.LogLine(gs.ToString(), Logging_Level.None, false); + //Global.logger.LogLine(gs.ToString(), Logging_Level.None, false); -//UpdateProcess(); + //UpdateProcess(); -//string process_name = System.IO.Path.GetFileName(processMonitor.ProcessPath).ToLowerInvariant(); + //string process_name = System.IO.Path.GetFileName(processMonitor.ProcessPath).ToLowerInvariant(); -//EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); + //EffectsEngine.EffectFrame newFrame = new EffectsEngine.EffectFrame(); #if DEBUG #else try { #endif - ILightEvent profile;// = this.GetProfileFromProcess(process_name); - + ILightEvent profile;// = this.GetProfileFromProcess(process_name); - JObject provider = Newtonsoft.Json.Linq.JObject.Parse(gs.GetNode("provider")); - string appid = provider.GetValue("appid").ToString(); - string name = provider.GetValue("name").ToString().ToLowerInvariant(); - if ((profile = GetProfileFromAppID(appid)) != null || (profile = GetProfileFromProcessName(name)) != null) - { - IGameState gameState = gs; - if (profile.Config.GameStateType != null) - gameState = (IGameState)Activator.CreateInstance(profile.Config.GameStateType, gs.Json); - profile.SetGameState(gameState); - } - else if (gs is GameState_Wrapper && Global.Configuration.AllowAllLogitechBitmaps) - { - string gs_process_name = Newtonsoft.Json.Linq.JObject.Parse(gs.GetNode("provider")).GetValue("name").ToString().ToLowerInvariant(); - lock (Events) - { - profile = profile ?? GetProfileFromProcessName(gs_process_name); + JObject provider = Newtonsoft.Json.Linq.JObject.Parse(gs.GetNode("provider")); + string appid = provider.GetValue("appid").ToString(); + string name = provider.GetValue("name").ToString().ToLowerInvariant(); - if (profile == null) - { - Events.Add(gs_process_name, new GameEvent_Aurora_Wrapper(new LightEventConfig { GameStateType = typeof(GameState_Wrapper), ProcessNames = new[] { gs_process_name } })); - profile = Events[gs_process_name]; - } + if ((profile = GetProfileFromAppID(appid)) != null || (profile = GetProfileFromProcessName(name)) != null) + { + IGameState gameState = gs; + if (profile.Config.GameStateType != null) + gameState = (IGameState)Activator.CreateInstance(profile.Config.GameStateType, gs.Json); + profile.SetGameState(gameState); + } + else if (gs is GameState_Wrapper && Global.Configuration.AllowAllLogitechBitmaps) + { + string gs_process_name = Newtonsoft.Json.Linq.JObject.Parse(gs.GetNode("provider")).GetValue("name").ToString().ToLowerInvariant(); + lock (Events) + { + profile = profile ?? GetProfileFromProcessName(gs_process_name); - profile.SetGameState(gs); + if (profile == null) + { + Events.Add(gs_process_name, new GameEvent_Aurora_Wrapper(new LightEventConfig { GameStateType = typeof(GameState_Wrapper), ProcessNames = new[] { gs_process_name } })); + profile = Events[gs_process_name]; } + + profile.SetGameState(gs); } + } #if DEBUG #else } @@ -654,10 +694,12 @@ public void Dispose() /// /// POCO that stores data about a type of layer. /// - public class LayerHandlerMeta { + public class LayerHandlerMeta + { /// Creates a new LayerHandlerMeta object from the given meta attribute and type. - public LayerHandlerMeta(Type type, LayerHandlerMetaAttribute attribute) { + public LayerHandlerMeta(Type type, LayerHandlerMetaAttribute attribute) + { Name = attribute?.Name ?? type.Name.CamelCaseToSpaceCase().TrimEndStr(" Layer Handler"); Type = type; IsDefault = attribute?.IsDefault ?? type.Namespace == "Aurora.Settings.Layers"; // if the layer is in the Aurora.Settings.Layers namespace, make the IsDefault true unless otherwise specified. If it is in another namespace, it's probably a custom application layer and so make IsDefault false unless otherwise specified @@ -675,7 +717,8 @@ public LayerHandlerMeta(Type type, LayerHandlerMetaAttribute attribute) { /// Attribute to provide additional meta data about layers for them to be registered. /// [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] - public class LayerHandlerMetaAttribute : Attribute { + public class LayerHandlerMetaAttribute : Attribute + { /// A different name for the layer. If not specified, will automatically take it from the layer's class name. public string Name { get; set; } diff --git a/Project-Aurora/Project-Aurora/Profiles/MemoryReadingLightEvent.cs b/Project-Aurora/Project-Aurora/Profiles/MemoryReadingLightEvent.cs index e1c4f544f..2959ccdd2 100644 --- a/Project-Aurora/Project-Aurora/Profiles/MemoryReadingLightEvent.cs +++ b/Project-Aurora/Project-Aurora/Profiles/MemoryReadingLightEvent.cs @@ -22,7 +22,6 @@ namespace Aurora.Profiles { private readonly string processName; private readonly string processModule; private readonly bool needs64bitMemReader; - protected bool isInitialized = false; /// Main pointer data (parsed from the JSON file). protected TPointers pointers; @@ -72,12 +71,8 @@ private void ReloadPointers() { } } catch (Exception exc) { Global.logger.Error(exc.Message); - isInitialized = false; } - - isInitialized = true; } else { - isInitialized = false; } } @@ -88,11 +83,6 @@ public override void ResetGameState() { _game_state = new TGameState(); } - /// - /// Gets whether or not the application is enabled and if the memory reader has been initialised correctly. - /// - public new bool IsEnabled => Application.Settings.IsEnabled && isInitialized; - /// /// Updates all the gamestate for this frame. Will search for the given process name and attempt to attach the memory reader. /// diff --git a/Project-Aurora/Project-Aurora/Profiles/Metro Last Light/MetroLLProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Metro Last Light/MetroLLProfile.cs index 94589b8bc..5b5c555f1 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Metro Last Light/MetroLLProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Metro Last Light/MetroLLProfile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Orange, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.LEFT_CONTROL, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_SHIFT }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.LEFT_CONTROL, Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_SHIFT }) } } ), @@ -40,7 +40,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Red, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.R, Devices.DeviceKeys.C, Devices.DeviceKeys.V, Devices.DeviceKeys.E }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.R, Devices.DeviceKeys.C, Devices.DeviceKeys.V, Devices.DeviceKeys.E }) } } ), @@ -49,7 +49,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Blue, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.G, Devices.DeviceKeys.T, Devices.DeviceKeys.F, Devices.DeviceKeys.M, Devices.DeviceKeys.Q, Devices.DeviceKeys.N }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.G, Devices.DeviceKeys.T, Devices.DeviceKeys.F, Devices.DeviceKeys.M, Devices.DeviceKeys.Q, Devices.DeviceKeys.N }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftBurnLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftBurnLayerHandler.cs index 7cfa248f0..1e4cc0877 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftBurnLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftBurnLayerHandler.cs @@ -23,12 +23,12 @@ protected override UserControl CreateControl() { } private void CreateFireParticle() { - float randomX = (float)rnd.NextDouble() * Effects.canvas_width; + float randomX = (float)rnd.NextDouble() * Effects.CanvasWidth; float randomOffset = ((float)rnd.NextDouble() * 15) - 7.5f; particles.Add(new FireParticle() { mix = new AnimationMix(new[] { new AnimationTrack("particle", 0) - .SetFrame(0, new AnimationFilledCircle(randomX, Effects.canvas_height + 5, 5, Color.FromArgb(255, 230, 0))) + .SetFrame(0, new AnimationFilledCircle(randomX, Effects.CanvasHeight + 5, 5, Color.FromArgb(255, 230, 0))) .SetFrame(1, new AnimationFilledCircle(randomX + randomOffset, -6, 6, Color.FromArgb(0, 255, 230, 0))) }), time = 0 @@ -43,7 +43,7 @@ public override EffectLayer Render(IGameState gamestate) { return layer; // Set the background to red - layer.Fill(Color.Red); + layer.FillOver(Color.Red); // Add 3 particles every frame for (int i = 0; i < 3; i++) diff --git a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftHealthBarLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftHealthBarLayerHandler.cs index e31898f38..776861c40 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftHealthBarLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftHealthBarLayerHandler.cs @@ -71,34 +71,35 @@ public override void Default() { } } - public class MinecraftHealthBarLayerHandler : LayerHandler { + public class MinecraftHealthBarLayerHandler : LayerHandler + { + private readonly EffectLayer _layer = new(); + protected override UserControl CreateControl() { return new Control_MinecraftHealthBarLayer(this); } public override EffectLayer Render(IGameState gamestate) { // Ensure the gamestate is for Minecraft, and store a casted reference to it - if (!(gamestate is GameState_Minecraft)) return new EffectLayer(); - GameState_Minecraft state = gamestate as GameState_Minecraft; + if (gamestate is not GameState_Minecraft minecraftState) return EffectLayer.EmptyLayer; // Choose the main healthbar's color depending on whether the player is withered/poisoned/regen/normal. - Color barColor = Properties.NormalHealthColor; // Default normal color - if (Properties.EnableWitherHealthColor && state.Player.PlayerEffects.HasWither) // Wither takes priority over others + var barColor = Properties.NormalHealthColor; // Default normal color + if (Properties.EnableWitherHealthColor && minecraftState.Player.PlayerEffects.HasWither) // Wither takes priority over others barColor = Properties.WitherHealthColor; - else if (Properties.EnablePoisonHealthColor && state.Player.PlayerEffects.HasPoison) // Poison 2nd priority + else if (Properties.EnablePoisonHealthColor && minecraftState.Player.PlayerEffects.HasPoison) // Poison 2nd priority barColor = Properties.PoisonHealthColor; - else if (Properties.EnableRegenerationHealthColor && state.Player.PlayerEffects.HasRegeneration) // Regen 3rd priority + else if (Properties.EnableRegenerationHealthColor && minecraftState.Player.PlayerEffects.HasRegeneration) // Regen 3rd priority barColor = Properties.RegenerationHealthColor; // Render the main healthbar, with the color decided above. - EffectLayer layer = new EffectLayer() - .PercentEffect(barColor, Properties.BackgroundColor, Properties.Sequence, state.Player.Health, state.Player.HealthMax, Settings.PercentEffectType.Progressive); + _layer.PercentEffect(barColor, Properties.BackgroundColor, Properties.Sequence, minecraftState.Player.Health, minecraftState.Player.HealthMax); // If absorption is enabled, overlay the absorption display on the top of the original healthbar if (Properties.EnableAbsorptionHealthColor) - layer.PercentEffect(Properties.AbsorptionHealthColor, Properties.BackgroundColor, Properties.Sequence, state.Player.Absorption, state.Player.AbsorptionMax, Properties.GradualProgress ? Settings.PercentEffectType.Progressive_Gradual : Settings.PercentEffectType.Progressive); + _layer.PercentEffect(Properties.AbsorptionHealthColor, Properties.BackgroundColor, Properties.Sequence, minecraftState.Player.Absorption, minecraftState.Player.AbsorptionMax, Properties.GradualProgress ? Settings.PercentEffectType.Progressive_Gradual : Settings.PercentEffectType.Progressive); - return layer; + return _layer; } } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftKeyConflictLayer.cs b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftKeyConflictLayer.cs index 6fa10cbbf..a33b3e6d1 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftKeyConflictLayer.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftKeyConflictLayer.cs @@ -32,25 +32,26 @@ public override void Default() { public class MinecraftKeyConflictLayerHandler : LayerHandler { + private readonly EffectLayer _layer = new("Minecraft Key Conflict Layer"); + private readonly SolidBrush _backgroundBrush = new(Color.Black); protected override UserControl CreateControl() { return new Control_MinecraftKeyConflictLayer(this); } public override EffectLayer Render(IGameState gamestate) { - EffectLayer layer = new EffectLayer("Minecraft Key Conflict Layer"); - if (gamestate is GameState_Minecraft && (gamestate as GameState_Minecraft).Game.ControlsGuiOpen) { - layer.Fill(Color.Black); // Hide any other layers behind this one - // Set all keys in use by any binding to be the no-conflict colour - foreach (var kb in ((GameState_Minecraft)gamestate).Game.KeyBindings) - if(kb!=null) - layer.Set(kb.AffectedKeys, Properties.PrimaryColor); + if (gamestate is not GameState_Minecraft minecraftState || !minecraftState.Game.ControlsGuiOpen) + return _layer; + _layer.Fill(_backgroundBrush); // Hide any other layers behind this one + // Set all keys in use by any binding to be the no-conflict colour + foreach (var kb in minecraftState.Game.KeyBindings) + if(kb!=null) + _layer.Set(kb.AffectedKeys, Properties.PrimaryColor); - // Override the keys for all conflicting keys - foreach (var kvp in CalculateConflicts((GameState_Minecraft)gamestate)) - layer.Set(kvp.Key, kvp.Value ? Properties.TertiaryColor : Properties.SecondaryColor); - } - return layer; + // Override the keys for all conflicting keys + foreach (var kvp in CalculateConflicts(minecraftState)) + _layer.Set(kvp.Key, kvp.Value ? Properties.TertiaryColor : Properties.SecondaryColor); + return _layer; } /// @@ -82,8 +83,8 @@ private Dictionary CalculateConflicts(GameState_Minecraft stat if (hasConflict) foreach (var affectedKey in bind.AffectedKeys) // For each key that is affected by this keybind - keys[affectedKey] = keys.ContainsKey(affectedKey) // Check if this key is already flagged as a conflict - ? keys[affectedKey] && isOnlyModifierConflict // If so, ensure it shows full conflicts over modifier conflicts + keys[(DeviceKeys)affectedKey.Tag] = keys.ContainsKey((DeviceKeys)affectedKey.Tag) // Check if this key is already flagged as a conflict + ? keys[(DeviceKeys)affectedKey.Tag] && isOnlyModifierConflict // If so, ensure it shows full conflicts over modifier conflicts : isOnlyModifierConflict; // Else if not already flagged, simply set it. } return keys; diff --git a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftRainLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftRainLayerHandler.cs index ac1cfd20a..e4c285bca 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftRainLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Minecraft/Layers/MinecraftRainLayerHandler.cs @@ -45,12 +45,12 @@ protected override UserControl CreateControl() { } private void CreateRainDrop() { - float randomX = (float)rnd.NextDouble() * Effects.canvas_width; + float randomX = (float)rnd.NextDouble() * Effects.CanvasWidth; raindrops.Add(new Droplet() { mix = new AnimationMix(new[] { new AnimationTrack("raindrop", 0) .SetFrame(0, new AnimationFilledRectangle(randomX, 0, 3, 6, Properties.PrimaryColor)) - .SetFrame(1, new AnimationFilledRectangle(randomX + 5, Effects.canvas_height, 2, 4, Properties.PrimaryColor)) + .SetFrame(1, new AnimationFilledRectangle(randomX + 5, Effects.CanvasHeight, 2, 4, Properties.PrimaryColor)) }), time = 0 }); diff --git a/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftKeyBinding.cs b/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftKeyBinding.cs index 472ba1f64..bf8d700e1 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftKeyBinding.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftKeyBinding.cs @@ -1,4 +1,5 @@ using Aurora.Devices; +using Aurora.Settings; using System; using System.Collections.Generic; using System.Linq; @@ -17,9 +18,9 @@ public class MinecraftKeyBinding { /// /// Gets the keys for this binding, including modifiers. /// - public DeviceKeys[] AffectedKeys { + public DeviceKey[] AffectedKeys { get { - HashSet keys = new HashSet(); + HashSet keys = new HashSet(); keys.Add(DeviceKey); if (modifier == "SHIFT") { keys.Add(DeviceKeys.LEFT_SHIFT); keys.Add(DeviceKeys.RIGHT_SHIFT); diff --git a/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftProfile.cs index d1726d448..4d95d9772 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Minecraft/MinecraftProfile.cs @@ -27,7 +27,7 @@ public override void Reset() base.Reset(); // Keys that do something and should be highlighted in a static color - DK[] controlKeys = new[] { DK.W, DK.A, DK.S, DK.D, DK.E, DK.SPACE, DK.LEFT_SHIFT, DK.LEFT_CONTROL }; + DeviceKey[] controlKeys = new DeviceKey[] { DK.W, DK.A, DK.S, DK.D, DK.E, DK.SPACE, DK.LEFT_SHIFT, DK.LEFT_CONTROL }; Layers = new System.Collections.ObjectModel.ObservableCollection() { new Layer("Controls Assistant Layer", new MinecraftKeyConflictLayerHandler()), @@ -39,7 +39,7 @@ public override void Reset() _MaxVariablePath = "Player/HealthMax", _PrimaryColor = Color.Red, _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.Z, DK.X, DK.C, DK.V, DK.B, DK.N, DK.M, DK.COMMA, DK.PERIOD, DK.FORWARD_SLASH }) } @@ -60,7 +60,7 @@ public override void Reset() _MaxVariablePath = "Player/ExperienceMax", _PrimaryColor = Color.FromArgb(255, 255, 0), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.F1, DK.F2, DK.F3, DK.F4, DK.F5, DK.F6, DK.F7, DK.F8, DK.F9, DK.F10, DK.F11, DK.F12 }) } @@ -75,7 +75,7 @@ public override void Reset() _SecondaryColor = Color.White, _EnableScroll = true, _ScrollLoop = true, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.ONE, DK.TWO, DK.THREE, DK.FOUR, DK.FIVE, DK.SIX, DK.SEVEN, DK.EIGHT, DK.NINE }) } diff --git a/Project-Aurora/Project-Aurora/Profiles/Osu/OsuProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Osu/OsuProfile.cs index 562b1925d..7e6d6a3dc 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Osu/OsuProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Osu/OsuProfile.cs @@ -31,14 +31,14 @@ public override void Reset() { new Layer("Drawing", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = Color.DeepSkyBlue, - _Sequence = new KeySequence(new[] { DeviceKeys.C }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.C }) } }), new Layer("Clickers", new SolidColorLayerHandler { Properties = new LayerHandlerProperties { _PrimaryColor = Color.FromArgb(255, 0, 240), - _Sequence = new KeySequence(new[] { DeviceKeys.Z,DeviceKeys.LEFT_ALT }) + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.Z,DeviceKeys.LEFT_ALT }) } }), @@ -48,7 +48,7 @@ public override void Reset() { _SecondaryColor = Color.Red, _VariablePath = "Game/Accuracy", _MaxVariablePath = "100", - _Sequence = new KeySequence(new[] { DeviceKeys.ONE, DeviceKeys.TWO, DeviceKeys.THREE, DeviceKeys.FOUR, DeviceKeys.FIVE, DeviceKeys.SIX, DeviceKeys.SEVEN, DeviceKeys.EIGHT, DeviceKeys.NINE, DeviceKeys.ZERO }), + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.ONE, DeviceKeys.TWO, DeviceKeys.THREE, DeviceKeys.FOUR, DeviceKeys.FIVE, DeviceKeys.SIX, DeviceKeys.SEVEN, DeviceKeys.EIGHT, DeviceKeys.NINE, DeviceKeys.ZERO }), _PercentType = PercentEffectType.Progressive_Gradual } }), @@ -89,7 +89,7 @@ public override void Reset() { _SecondaryColor = Color.Black, _VariablePath = "Game/HP", _MaxVariablePath = "200", - _Sequence = new KeySequence(new[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4, DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8, DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }), + _Sequence = new KeySequence(new DeviceKey[] { DeviceKeys.F1, DeviceKeys.F2, DeviceKeys.F3, DeviceKeys.F4, DeviceKeys.F5, DeviceKeys.F6, DeviceKeys.F7, DeviceKeys.F8, DeviceKeys.F9, DeviceKeys.F10, DeviceKeys.F11, DeviceKeys.F12 }), _PercentType = PercentEffectType.Progressive_Gradual } }), diff --git a/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2BackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2BackgroundLayerHandler.cs index 2ce527132..75fb228dc 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2BackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2BackgroundLayerHandler.cs @@ -187,7 +187,7 @@ public override EffectLayer Render(IGameState state) */ } - bg_layer.Fill(bg_color); + bg_layer.FillOver(bg_color); if (Properties.PeripheralUse) bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); @@ -201,7 +201,7 @@ public override EffectLayer Render(IGameState state) ColorSpectrum suspicion_spec = new ColorSpectrum(Properties.LowSuspicionColor, Properties.HighSuspicionColor); suspicion_spec.SetColorAt(0.5f, Properties.MediumSuspicionColor); - Settings.KeySequence suspicionSequence = new Settings.KeySequence(new Settings.FreeFormObject(0, 0, 1.0f / (Effects.editor_to_canvas_width / Effects.canvas_width), 1.0f / (Effects.editor_to_canvas_height / Effects.canvas_height))); + Settings.KeySequence suspicionSequence = new Settings.KeySequence(new Settings.FreeFormObject(0, 0, 1.0f / (Effects.EditorToCanvasWidth / Effects.CanvasWidth), 1.0f / (Effects.EditorToCanvasHeight / Effects.CanvasHeight))); bg_layer.PercentEffect(suspicion_spec, suspicionSequence, percentSuspicious, 1.0D, Properties.SuspicionEffectType); @@ -224,14 +224,14 @@ public override EffectLayer Render(IGameState state) if (no_return_flashamount < 0.0f) no_return_flashamount = 0.0f; - bg_layer.Fill(no_return_color); + bg_layer.FillOver(no_return_color); if (Properties.PeripheralUse) bg_layer.Set(Devices.DeviceKeys.Peripheral, no_return_color); } else { - bg_layer.Fill(bg_color); + bg_layer.FillOver(bg_color); if (Properties.PeripheralUse) bg_layer.Set(Devices.DeviceKeys.Peripheral, bg_color); diff --git a/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2FlashbangLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2FlashbangLayerHandler.cs index 585e40ec4..f711da7f2 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2FlashbangLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2FlashbangLayerHandler.cs @@ -57,7 +57,7 @@ public override EffectLayer Render(IGameState state) { Color flash_color = Utils.ColorUtils.MultiplyColorByScalar(Properties.FlashbangColor, pd2state.LocalPlayer.FlashAmount); - flashed_layer.Fill(flash_color); + flashed_layer.FillOver(flash_color); } } diff --git a/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2StatesLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2StatesLayerHandler.cs index 42de48746..bf51c8686 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2StatesLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Payday 2/Layers/PD2StatesLayerHandler.cs @@ -86,11 +86,11 @@ public override EffectLayer Render(IGameState state) Color incapColor = Color.FromArgb(incapAlpha, Properties.DownedColor); - states_layer.Fill(incapColor).Set(Devices.DeviceKeys.Peripheral, incapColor); + states_layer.FillOver(incapColor).Set(Devices.DeviceKeys.Peripheral, incapColor); } else if (pd2state.LocalPlayer.State == PlayerState.Arrested) { - states_layer.Fill(Properties.ArrestedColor).Set(Devices.DeviceKeys.Peripheral, Properties.ArrestedColor); + states_layer.FillOver(Properties.ArrestedColor).Set(Devices.DeviceKeys.Peripheral, Properties.ArrestedColor); } if (pd2state.LocalPlayer.IsSwanSong && Properties.ShowSwanSong) diff --git a/Project-Aurora/Project-Aurora/Profiles/Payday 2/PD2Profile.cs b/Project-Aurora/Project-Aurora/Profiles/Payday 2/PD2Profile.cs index 974b6ea19..0c2ab81ad 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Payday 2/PD2Profile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Payday 2/PD2Profile.cs @@ -25,7 +25,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 255, 0), _SecondaryColor = Color.FromArgb(255, 0, 0), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -43,7 +43,7 @@ public override void Reset() _PrimaryColor = Color.FromArgb(0, 0, 255), _SecondaryColor = Color.FromArgb(255, 0, 0), _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS diff --git a/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/Control_QuantumConumdrum.xaml b/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/Control_QuantumConumdrum.xaml index 8607cf86b..cdcdad801 100644 --- a/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/Control_QuantumConumdrum.xaml +++ b/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/Control_QuantumConumdrum.xaml @@ -6,7 +6,7 @@ x:Class="Aurora.Profiles.QuantumConumdrum.Control_QuantumConumdrum" mc:Ignorable="d" d:DesignHeight="300" Height="Auto" Width="Auto" d:DesignWidth="850" Loaded="UserControl_Loaded" Unloaded="UserControl_Unloaded"> - + diff --git a/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/QuantumConumdrumProfile.cs b/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/QuantumConumdrumProfile.cs index ea2b81e73..1e0cc9e32 100644 --- a/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/QuantumConumdrumProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/QuantumConumdrum/QuantumConumdrumProfile.cs @@ -32,7 +32,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.DodgerBlue, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.SPACE}) } } ), @@ -41,7 +41,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Pink, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.Q}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.Q}) } } ), @@ -50,7 +50,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Red, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.E}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.E}) } } ), @@ -59,7 +59,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Yellow, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.ONE}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE}) } } ), @@ -68,7 +68,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Green, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.THREE}) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.THREE}) } } ), diff --git a/Project-Aurora/Project-Aurora/Profiles/Resident Evil 2/Layers/ResidentEvil2HealthLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Resident Evil 2/Layers/ResidentEvil2HealthLayerHandler.cs index 6d65b81bb..4c82c0321 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Resident Evil 2/Layers/ResidentEvil2HealthLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Resident Evil 2/Layers/ResidentEvil2HealthLayerHandler.cs @@ -54,20 +54,20 @@ public class ResidentEvil2HealthLayerHandler : LayerHandler() - .AddEntry(new KeySequence(new[] {DK.ONE}), new BooleanGSINumeric("VacPack/SellectedSlot",1)) - .AddEntry(new KeySequence(new[] {DK.TWO}), new BooleanGSINumeric("VacPack/SellectedSlot",2)) - .AddEntry(new KeySequence(new[] {DK.THREE}), new BooleanGSINumeric("VacPack/SellectedSlot",3)) - .AddEntry(new KeySequence(new[] {DK.FOUR}), new BooleanGSINumeric("VacPack/SellectedSlot",4)) - .AddEntry(new KeySequence(new[] {DK.FIVE}), new BooleanGSINumeric("VacPack/SellectedSlot",5)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.ONE}), new BooleanGSINumeric("VacPack/SellectedSlot",1)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.TWO}), new BooleanGSINumeric("VacPack/SellectedSlot",2)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.THREE}), new BooleanGSINumeric("VacPack/SellectedSlot",3)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.FOUR}), new BooleanGSINumeric("VacPack/SellectedSlot",4)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.FIVE}), new BooleanGSINumeric("VacPack/SellectedSlot",5)) ) .SetLookupTable("_Enabled", new OverrideLookupTableBuilder() .AddEntry(false, new BooleanGSIBoolean("VacPack/InGadgetMode")) @@ -65,11 +65,11 @@ public override void Reset() }, new OverrideLogicBuilder() .SetLookupTable("_Sequence", new OverrideLookupTableBuilder() - .AddEntry(new KeySequence(new[] {DK.ONE}), new BooleanGSINumeric("VacPack/UseableSlots",1)) - .AddEntry(new KeySequence(new[] {DK.ONE, DK.TWO}), new BooleanGSINumeric("VacPack/UseableSlots",2)) - .AddEntry(new KeySequence(new[] {DK.ONE, DK.TWO, DK.THREE}), new BooleanGSINumeric("VacPack/UseableSlots",3)) - .AddEntry(new KeySequence(new[] {DK.ONE, DK.TWO, DK.THREE, DK.FOUR}), new BooleanGSINumeric("VacPack/UseableSlots",4)) - .AddEntry(new KeySequence(new[] {DK.ONE, DK.TWO, DK.THREE, DK.FOUR, DK.FIVE}), new BooleanGSINumeric("VacPack/UseableSlots",ComparisonOperator.GTE,5)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.ONE}), new BooleanGSINumeric("VacPack/UseableSlots",1)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.ONE, DK.TWO}), new BooleanGSINumeric("VacPack/UseableSlots",2)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.ONE, DK.TWO, DK.THREE}), new BooleanGSINumeric("VacPack/UseableSlots",3)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.ONE, DK.TWO, DK.THREE, DK.FOUR}), new BooleanGSINumeric("VacPack/UseableSlots",4)) + .AddEntry(new KeySequence(new DeviceKey[] {DK.ONE, DK.TWO, DK.THREE, DK.FOUR, DK.FIVE}), new BooleanGSINumeric("VacPack/UseableSlots",ComparisonOperator.GTE,5)) ) .SetLookupTable("_Enabled", new OverrideLookupTableBuilder() .AddEntry(false, new BooleanGSIBoolean("VacPack/InGadgetMode")) @@ -88,7 +88,7 @@ public override void Reset() _MaxVariablePath = "Player/Health/Max", _PrimaryColor = Color.FromArgb(255, 17, 17), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.Q, DK.W, DK.E, DK.R, DK.T, DK.Y, DK.U, DK.I, DK.O, DK.P, DK.OPEN_BRACKET, DK.CLOSE_BRACKET }) } @@ -100,7 +100,7 @@ public override void Reset() _MaxVariablePath = "Player/Energy/Max", _PrimaryColor = Color.FromArgb(9, 173, 233), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.A, DK.S, DK.D, DK.F, DK.G, DK.H, DK.J, DK.K, DK.L, DK.SEMICOLON, DK.APOSTROPHE }) } @@ -112,7 +112,7 @@ public override void Reset() _MaxVariablePath = "Player/Radiation/Max", _PrimaryColor = Color.FromArgb(60, 233, 118), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.Z, DK.X, DK.C, DK.V, DK.B, DK.N, DK.M, DK.COMMA, DK.PERIOD, DK.FORWARD_SLASH }) } diff --git a/Project-Aurora/Project-Aurora/Profiles/Stardew Valley/StardewValleyProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Stardew Valley/StardewValleyProfile.cs index 1b2e67f60..6e2684931 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Stardew Valley/StardewValleyProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Stardew Valley/StardewValleyProfile.cs @@ -58,7 +58,7 @@ public override void Reset() _MaxVariablePath = "Player/Health/Max", _PrimaryColor = Color.Lime, _SecondaryColor = Color.Red, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.ONE, DK.TWO, DK.THREE, DK.FOUR, DK.FIVE, DK.SIX, DK.SEVEN, DK.EIGHT, DK.NINE, DK.ZERO }) } @@ -74,7 +74,7 @@ public override void Reset() _MaxVariablePath = "Player/Energy/Max", _PrimaryColor = Color.Yellow, _SecondaryColor = Color.Red, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.F1, DK.F2, DK.F3, DK.F4, DK.F5, DK.F6, DK.F7, DK.F8, DK.F9, DK.F10, DK.F11, DK.F12 }) } diff --git a/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs b/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs index 001832f69..692337735 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Subnautica/SubnauticaProfile.cs @@ -70,7 +70,7 @@ public override void Reset() { _MaxVariablePath = "100", _PrimaryColor = Color.FromArgb(255, 0, 0), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.F1, DK.F2, DK.F3, DK.F4, DK.F5, DK.F6, DK.F7, DK.F8, DK.F9, DK.F10, DK.F11, DK.F12 }), _BlinkThreshold = 0.25 @@ -83,7 +83,7 @@ public override void Reset() { _MaxVariablePath = "100", _PrimaryColor = Color.FromArgb(139, 69, 19), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.Q, DK.W, DK.E, DK.R, DK.T, DK.Y, DK.U, DK.I, DK.O, DK.P }), _BlinkThreshold = 0.25 @@ -96,7 +96,7 @@ public override void Reset() { _MaxVariablePath = "100", _PrimaryColor = Color.FromArgb(0, 0, 255), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.A, DK.S, DK.D, DK.F, DK.G, DK.H, DK.J, DK.K,DK.L }), _BlinkThreshold = 0.25 @@ -109,7 +109,7 @@ public override void Reset() { _MaxVariablePath = "Player/OxygenCapacity", _PrimaryColor = Color.FromArgb(0, 170, 65), _SecondaryColor = Color.Transparent, - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.ONE, DK.TWO, DK.THREE, DK.FOUR, DK.FIVE, DK.SIX, DK.SEVEN, DK.EIGHT, DK.NINE, DK.ZERO, DK.MINUS, DK.EQUALS }), _BlinkThreshold = 0.25 diff --git a/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderApplication.cs b/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderApplication.cs index fffd78187..60440ae2a 100644 --- a/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderApplication.cs +++ b/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderApplication.cs @@ -12,7 +12,7 @@ public TModLoader() : base(new LightEventConfig Name = "TModLoader", ID = "tmodloader", AppID = "1281930", - ProcessNames = new[] { "tModLoader.exe" }, + ProcessNames = new[] { "tModLoader.exe", "tModLoader64bit.exe" }, ProfileType = typeof(TModLoaderProfile), OverviewControlType = typeof(Control_TModLoader), GameStateType = typeof(GSI.GameState_TModLoader), diff --git a/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderProfile.cs b/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderProfile.cs index 3f1103df9..410039a71 100644 --- a/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/TModLoader/TModLoaderProfile.cs @@ -25,7 +25,7 @@ public override void Reset() { _MaxVariablePath = "Player/MaxHealth", _PrimaryColor = Color.FromArgb(255, 0, 0), _SecondaryColor = Color.FromArgb(128, 0, 255), - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.F1, DK.F2, DK.F3, DK.F4, DK.F5, DK.F6, DK.F7, DK.F8, DK.F9, DK.F10, DK.F11, DK.F12 }), _BlinkThreshold = 0.25 @@ -37,7 +37,7 @@ public override void Reset() { _MaxVariablePath = "Player/MaxMana", _PrimaryColor = Color.FromArgb(0, 0, 255), _SecondaryColor = Color.FromArgb(0, 0, 128), - _Sequence = new KeySequence(new[] { + _Sequence = new KeySequence(new DeviceKey[] { DK.ONE, DK.TWO, DK.THREE, DK.FOUR, DK.FIVE, DK.SIX, DK.SEVEN, DK.EIGHT, DK.NINE, DK.ZERO, DK.MINUS, DK.EQUALS }), _BlinkThreshold = 0.25 diff --git a/Project-Aurora/Project-Aurora/Profiles/TheTalosPrinciple/TalosPrincipleProfile.cs b/Project-Aurora/Project-Aurora/Profiles/TheTalosPrinciple/TalosPrincipleProfile.cs index 2d3673aa9..3aa94ae7d 100644 --- a/Project-Aurora/Project-Aurora/Profiles/TheTalosPrinciple/TalosPrincipleProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/TheTalosPrinciple/TalosPrincipleProfile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.LightBlue, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D }) } } ), @@ -40,7 +40,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Purple, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_SHIFT, Devices.DeviceKeys.H, Devices.DeviceKeys.X, Devices.DeviceKeys.TAB }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.SPACE, Devices.DeviceKeys.LEFT_SHIFT, Devices.DeviceKeys.H, Devices.DeviceKeys.X, Devices.DeviceKeys.TAB }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Profiles/Witcher3/Layers/Witcher3BackgroundLayerHandler.cs b/Project-Aurora/Project-Aurora/Profiles/Witcher3/Layers/Witcher3BackgroundLayerHandler.cs index 571adec73..0843333aa 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Witcher3/Layers/Witcher3BackgroundLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Witcher3/Layers/Witcher3BackgroundLayerHandler.cs @@ -95,7 +95,7 @@ public override EffectLayer Render(IGameState state) bg_color = Properties.DefaultColor; break; } - bg_layer.Fill(bg_color); + bg_layer.FillOver(bg_color); } return bg_layer; diff --git a/Project-Aurora/Project-Aurora/Profiles/Witcher3/Witcher3Profile.cs b/Project-Aurora/Project-Aurora/Profiles/Witcher3/Witcher3Profile.cs index 17b4a1872..7f6d60d93 100644 --- a/Project-Aurora/Project-Aurora/Profiles/Witcher3/Witcher3Profile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/Witcher3/Witcher3Profile.cs @@ -29,7 +29,7 @@ public override void Reset() _PrimaryColor = Color.Red, _SecondaryColor = Color.DarkRed, _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.F1, Devices.DeviceKeys.F2, Devices.DeviceKeys.F3, Devices.DeviceKeys.F4, Devices.DeviceKeys.F5, Devices.DeviceKeys.F6, Devices.DeviceKeys.F7, Devices.DeviceKeys.F8, Devices.DeviceKeys.F9, Devices.DeviceKeys.F10, Devices.DeviceKeys.F11, Devices.DeviceKeys.F12 @@ -47,7 +47,7 @@ public override void Reset() _PrimaryColor = Color.Olive, _SecondaryColor = Color.DarkOliveGreen, _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ONE, Devices.DeviceKeys.TWO, Devices.DeviceKeys.THREE, Devices.DeviceKeys.FOUR, Devices.DeviceKeys.FIVE, Devices.DeviceKeys.SIX, Devices.DeviceKeys.SEVEN, Devices.DeviceKeys.EIGHT, Devices.DeviceKeys.NINE, Devices.DeviceKeys.ZERO, Devices.DeviceKeys.MINUS, Devices.DeviceKeys.EQUALS @@ -65,7 +65,7 @@ public override void Reset() _PrimaryColor = Color.Orange, _SecondaryColor = Color.DarkOrange, _PercentType = PercentEffectType.Progressive_Gradual, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.NUM_ONE, Devices.DeviceKeys.NUM_TWO, Devices.DeviceKeys.NUM_THREE, Devices.DeviceKeys.NUM_FOUR, Devices.DeviceKeys.NUM_FIVE, Devices.DeviceKeys.NUM_SIX, Devices.DeviceKeys.NUM_SEVEN, Devices.DeviceKeys.NUM_EIGHT, Devices.DeviceKeys.NUM_NINE diff --git a/Project-Aurora/Project-Aurora/Profiles/XCOM/XCOMProfile.cs b/Project-Aurora/Project-Aurora/Profiles/XCOM/XCOMProfile.cs index 9ef63af85..9adc36a4a 100644 --- a/Project-Aurora/Project-Aurora/Profiles/XCOM/XCOMProfile.cs +++ b/Project-Aurora/Project-Aurora/Profiles/XCOM/XCOMProfile.cs @@ -31,7 +31,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.Orange, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.Q, Devices.DeviceKeys.E, Devices.DeviceKeys.HOME, Devices.DeviceKeys.Z }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.W, Devices.DeviceKeys.A, Devices.DeviceKeys.S, Devices.DeviceKeys.D, Devices.DeviceKeys.Q, Devices.DeviceKeys.E, Devices.DeviceKeys.HOME, Devices.DeviceKeys.Z }) } } ), @@ -40,7 +40,7 @@ public override void Reset() Properties = new LayerHandlerProperties() { _PrimaryColor = Color.DarkOrange, - _Sequence = new KeySequence(new Devices.DeviceKeys[] { Devices.DeviceKeys.ENTER, Devices.DeviceKeys.ESC, Devices.DeviceKeys.V, Devices.DeviceKeys.X, Devices.DeviceKeys.BACKSPACE, Devices.DeviceKeys.F1, Devices.DeviceKeys.R, Devices.DeviceKeys.B, Devices.DeviceKeys.Y }) + _Sequence = new KeySequence(new DeviceKey[] { Devices.DeviceKeys.ENTER, Devices.DeviceKeys.ESC, Devices.DeviceKeys.V, Devices.DeviceKeys.X, Devices.DeviceKeys.BACKSPACE, Devices.DeviceKeys.F1, Devices.DeviceKeys.R, Devices.DeviceKeys.B, Devices.DeviceKeys.Y }) } }), new Layer("Wrapper Lighting", new Aurora.Settings.Layers.WrapperLightsLayerHandler()), diff --git a/Project-Aurora/Project-Aurora/Project-Aurora.csproj b/Project-Aurora/Project-Aurora/Project-Aurora.csproj index 5e686d109..99af65efc 100644 --- a/Project-Aurora/Project-Aurora/Project-Aurora.csproj +++ b/Project-Aurora/Project-Aurora/Project-Aurora.csproj @@ -4,21 +4,23 @@ net48 AnyCPU;x64 true - 3 + 0 WinExe Properties Aurora Aurora v4.8 - 8.0 + 9 en true true true + true false $(SolutionDir)..\Build\$(Configuration) Resources\aurora_icon.ico app.manifest + true @@ -28,7 +30,8 @@ x64 - TRACE + + true @@ -56,39 +59,43 @@ False .\UniwillSDKDLL.dll + + .\YeeLightAPI.dll + - + - + + - - + + - - - + + + - - - - + + + + - + + - + - @@ -141,14 +148,14 @@ - + PreserveNewest - + PreserveNewest - - + + @@ -171,7 +178,6 @@ - diff --git a/Project-Aurora/Project-Aurora/Settings/ApplicationProfile.cs b/Project-Aurora/Project-Aurora/Settings/ApplicationProfile.cs index a4d78715b..8b39fb994 100755 --- a/Project-Aurora/Project-Aurora/Settings/ApplicationProfile.cs +++ b/Project-Aurora/Project-Aurora/Settings/ApplicationProfile.cs @@ -1,14 +1,10 @@ -using Aurora.Settings; using Aurora.Settings.Layers; -using Aurora.Utils; -using Microsoft.Scripting.Utils; using Newtonsoft.Json; using PropertyChanged; using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; -using System.Runtime.CompilerServices; namespace Aurora.Settings { @@ -62,7 +58,13 @@ public virtual void SetApplication(Profiles.Application app) l.SetProfile(app); } - public virtual void Dispose() + public void Dispose() + { + Dispose(true); + GC.SuppressFinalize(this); + } + + protected virtual void Dispose(bool disposing) { foreach (Layer l in Layers) l.Dispose(); @@ -70,5 +72,10 @@ public virtual void Dispose() foreach (Layer l in OverlayLayers) l.Dispose(); } + + ~ApplicationProfile() + { + Dispose(false); + } } } diff --git a/Project-Aurora/Project-Aurora/Settings/ColorZone.cs b/Project-Aurora/Project-Aurora/Settings/ColorZone.cs index 165bacb9d..cf3ccf89c 100644 --- a/Project-Aurora/Project-Aurora/Settings/ColorZone.cs +++ b/Project-Aurora/Project-Aurora/Settings/ColorZone.cs @@ -44,7 +44,7 @@ public ColorZone(string zone_name = "New Zone") GenerateRandomColor(); } - public ColorZone(Devices.DeviceKeys[] zone_keys, string zone_name = "New Zone") + public ColorZone(DeviceKey[] zone_keys, string zone_name = "New Zone") { name = zone_name; keysequence = new KeySequence(zone_keys); @@ -54,7 +54,7 @@ public ColorZone(Devices.DeviceKeys[] zone_keys, string zone_name = "New Zone") GenerateRandomColor(); } - public ColorZone(Devices.DeviceKeys[] zone_keys, LayerEffects zone_effect, string zone_name = "New Zone") + public ColorZone(DeviceKey[] zone_keys, LayerEffects zone_effect, string zone_name = "New Zone") { name = zone_name; keysequence = new KeySequence(zone_keys); @@ -64,7 +64,7 @@ public ColorZone(Devices.DeviceKeys[] zone_keys, LayerEffects zone_effect, strin GenerateRandomColor(); } - public ColorZone(Devices.DeviceKeys[] zone_keys, Color zone_color, string zone_name = "New Zone") + public ColorZone(DeviceKey[] zone_keys, Color zone_color, string zone_name = "New Zone") { name = zone_name; keysequence = new KeySequence(zone_keys); diff --git a/Project-Aurora/Project-Aurora/Settings/Configuration.cs b/Project-Aurora/Project-Aurora/Settings/Configuration.cs old mode 100755 new mode 100644 index 9c87116e2..f1e1e1d04 --- a/Project-Aurora/Project-Aurora/Settings/Configuration.cs +++ b/Project-Aurora/Project-Aurora/Settings/Configuration.cs @@ -190,6 +190,8 @@ public enum PreferredKeyboard Logitech_G815 = 105, [Description("Logitech - G513")] Logitech_G513 = 106, + [Description("Logitech - G915")] + Logitech_G915 = 107, //Corsair range is 200-299 [Description("Corsair - K95")] @@ -208,6 +210,8 @@ public enum PreferredKeyboard Corsair_K70MK2 = 206, [Description("Corsair - STRAFE MK2")] Corsair_STRAFE_MK2 = 207, + [Description("Corsair - K100")] + Corsair_K100 = 208, //Razer range is 300-399 [Description("Razer - Blackwidow")] @@ -238,6 +242,8 @@ public enum PreferredKeyboard //Roccat range is 600-699 [Description("Roccat Ryos")] Roccat_Ryos = 600, + [Description("Roccat Vulcan TKL")] + Roccat_Vualcan_TKL = 601, //Steelseries range is 700-799 [Description("SteelSeries Apex M800")] @@ -307,7 +313,14 @@ public enum PreferredKeyboard //HyperX range is 1400-1499 [Description("HyperX Alloy Elite RGB")] HyperX_Alloy_Elite_RGB = 1400, + //Keychron q1 knob + [Description("Keychron q1 knob ansi 75%")] + Keychron_Q1_Knob_Ansi = 0107, + //MSI range is 1500-1599 + [Description("MSI GP66 US")] + MSI_GP66_US = 1500, + } public enum PreferredKeyboardLocalization @@ -361,8 +374,6 @@ public enum PreferredMouse [Description("Generic Peripheral")] Generic_Peripheral = 1, - [Description("Razer/Corsair Mousepad + Mouse")] - Generic_Mousepad = 2, //Logitech range is 100-199 [Description("Logitech - G900")] @@ -381,6 +392,8 @@ public enum PreferredMouse //Razer range is 300-399 [Description("Razer - Mamba TE")] Razer_Mamba_TE = 300, + [Description("Razer - Naga Pro")] + Razer_naga_Pro = 301, //Clevo range is 400-499 [Description("Clevo - Touchpad")] @@ -397,10 +410,10 @@ public enum PreferredMouse SteelSeries_Rival_300 = 700, [Description("SteelSeries - Rival 300 HP OMEN Edition")] SteelSeries_Rival_300_HP_OMEN_Edition = 701, - [Description("SteelSeries - QcK Prism Mousepad + Mouse")] - SteelSeries_QcK_Prism = 702, - [Description("SteelSeries - Two-zone QcK Mousepad + Mouse")] - SteelSeries_QcK_2_Zone = 703, + + [Description("Bloody - W60")] + Bloody_W60 = 800, + //Asus range is 900-999 [Description("Asus - Pugio")] Asus_Pugio = 900, @@ -416,6 +429,27 @@ public enum PreferredMouse OMEN_Vector_Essentials = 1003, } + public enum PreferredMousepad + { + [Description("None")] + None = 0, + + [Description("Razer/Corsair Mousepad")] + Generic_Mousepad = 1, + + [Description("2 Zone + Logo Mousepad")] + Two_Zone_Plus_Logo_Mousepad, + + //Steelseries range is 100-299 + [Description("SteelSeries - QcK Prism Mousepad")] + SteelSeries_QcK_Prism = 100, + [Description("SteelSeries - Two-zone QcK Mousepad")] + SteelSeries_QcK_2_Zone = 101, + [Description("Bloody - MP-50RS")] + Bloody_MP50RS = 102, + } + + public enum KeycapType { [Description("Default")] @@ -454,6 +488,7 @@ public class Configuration : INotifyPropertyChanged //General Program Settings [JsonProperty("allow_peripheral_devices")] public bool AllowPeripheralDevices { get; set; } = true; + [JsonProperty("close_on_exception")] public bool CloseProgramOnException { get; set; } = true; [JsonProperty("allow_wrappers_in_background")] public bool AllowWrappersInBackground { get; set; } = true; [JsonProperty("allow_all_logitech_bitmaps")] public bool AllowAllLogitechBitmaps { get; set; } = true; @@ -468,18 +503,29 @@ public class Configuration : INotifyPropertyChanged public BitmapAccuracy BitmapAccuracy { get; set; } = BitmapAccuracy.Okay; public bool EnableAudioCapture { get; set; } = false; + + public int UpdateDelay { get; set; } = 30; + + public double Fps + { + get => 1000d / UpdateDelay; + } + [JsonProperty("updates_check_on_start_up")] public bool UpdatesCheckOnStartUp { get; set; } = true; [JsonProperty("start_silently")] public bool StartSilently { get; set; } = false; [JsonProperty("close_mode")] public AppExitMode CloseMode { get; set; } = AppExitMode.Ask; - [JsonProperty("mouse_orientation")] public MouseOrientationType MouseOrientation { get; set; } = MouseOrientationType.RightHanded; [JsonProperty("keyboard_brand")] public PreferredKeyboard KeyboardBrand { get; set; } = PreferredKeyboard.None; [JsonProperty("keyboard_localization")] public PreferredKeyboardLocalization KeyboardLocalization { get; set; } = PreferredKeyboardLocalization.None; [JsonProperty("mouse_preference")] public PreferredMouse MousePreference { get; set; } = PreferredMouse.None; + [JsonProperty("mousepad_preference")] public PreferredMousepad MousepadPreference { get; set; } = PreferredMousepad.None; [JsonProperty("virtualkeyboard_keycap_type")] public KeycapType VirtualkeyboardKeycapType { get; set; } = KeycapType.Default; [JsonProperty("detection_mode")] public ApplicationDetectionMode DetectionMode { get; set; } = ApplicationDetectionMode.WindowsEvents; [JsonProperty("devices_disable_keyboard")] public bool DevicesDisableKeyboard { get; set; } = false; [JsonProperty("devices_disable_mouse")] public bool DevicesDisableMouse { get; set; } = false; [JsonProperty("devices_disable_headset")] public bool DevicesDisableHeadset { get; set; } = false; + [JsonProperty("devices_disable_openrgb_keyboard")] public bool DevicesDisableOpenRGBKeyboard { get; set; } = false; + [JsonProperty("devices_disable_openrgb_mouse")] public bool DevicesDisableOpenRGBMouse { get; set; } = false; + [JsonProperty("devices_disable_openrgb_headset")] public bool DevicesDisableOpenRGBHeadset { get; set; } = false; [JsonProperty("unified_hid_disabled")] public bool UnifiedHidDisabled { get; set; } = false; public bool OverlaysInPreview { get; set; } = true; @@ -544,11 +590,6 @@ public class Configuration : INotifyPropertyChanged /// Called after the configuration file has been deserialized or created for the first time. /// public void OnPostLoad() { - if (!UnifiedHidDisabled) { - DevicesDisabled.Add(typeof(Devices.UnifiedHID.UnifiedHIDDevice)); - UnifiedHidDisabled = true; - } - // Setup events that will trigger PropertyChanged when child collections change (to trigger a save) ExcludedPrograms.CollectionChanged += (sender, e) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(ExcludedPrograms))); DevicesDisabled.CollectionChanged += (sender, e) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DevicesDisabled))); @@ -597,11 +638,6 @@ public static Configuration Load() private static void DeserializeErrorHandler(object sender, Newtonsoft.Json.Serialization.ErrorEventArgs e) { - if (e.ErrorContext.Error.Message.Contains("Aurora.Devices.SteelSeriesHID.SteelSeriesHIDDevice") && e.CurrentObject is HashSet dd) - { - dd.Add(typeof(Aurora.Devices.UnifiedHID.UnifiedHIDDevice)); - e.ErrorContext.Handled = true; - } if (e.ErrorContext.Error.Message.Contains("Aurora.Devices.NZXT.NZXTDevice") && e.CurrentObject is HashSet) { e.ErrorContext.Handled = true; diff --git a/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml b/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml old mode 100755 new mode 100644 index 3f5289669..80d85acef --- a/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml +++ b/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml @@ -1,384 +1,386 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Project-Aurora/Project-Aurora/Settings/DeviceLayoutViewer/Window_DeviceConfig.xaml.cs b/Project-Aurora/Project-Aurora/Settings/DeviceLayoutViewer/Window_DeviceConfig.xaml.cs new file mode 100644 index 000000000..82c7fa57a --- /dev/null +++ b/Project-Aurora/Project-Aurora/Settings/DeviceLayoutViewer/Window_DeviceConfig.xaml.cs @@ -0,0 +1,461 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Collections.Specialized; +using System.ComponentModel; +using System.IO; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Data; +using System.Windows.Documents; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Imaging; +using System.Windows.Navigation; + +namespace Aurora.Settings.DeviceLayoutViewer +{ + /// + /// Interaction logic for Window_DeviceConfig.xaml + /// + public partial class Window_DeviceConfig : Window + { + private Control_DeviceLayout originalDeviceLayout; + private CancellationTokenSource tokenSource = new CancellationTokenSource(); + public DeviceConfig Config => deviceLayout.DeviceConfig; + + public bool DeleteDevice = false; + private System.Windows.Point _positionInBlock; + + private bool isHorizontal = true; + private bool isPlus = true; + + // private Control_Keycap SelectedKey; + + public ObservableCollection KeycapCollection + { + get => (ObservableCollection)GetValue(KeycapCollectionProperty); + set => SetValue(KeycapCollectionProperty, value); + } + + public static readonly DependencyProperty KeycapCollectionProperty = + DependencyProperty.Register("KeycapCollection", typeof(ObservableCollection), typeof(Control_LayerList), new PropertyMetadata(null)); + + public Control_Keycap SelectedKeycap + { + get => (Control_Keycap)GetValue(SelectedKeycapProperty); + set => SetValue(SelectedKeycapProperty, value); + } + + public static readonly DependencyProperty SelectedKeycapProperty = + DependencyProperty.Register("SelectedKeycap", typeof(Control_Keycap), typeof(Control_LayerList), new PropertyMetadata(null, SelectedKeycapPropertyChanged)); + + private static void SelectedKeycapPropertyChanged(DependencyObject sender, DependencyPropertyChangedEventArgs e) + { + + // if (e.NewValue is Control_Keycap layer) + // layer.SetProfile(((Control_LayerList)sender).FocusedApplication); + if (sender is ListBox listView) + { + if (listView.SelectedItem is Control_Keycap key) + { + + } + } + } + public Window_DeviceConfig(Control_DeviceLayout config) + { + InitializeComponent(); + originalDeviceLayout = config; + deviceLayout.DeviceConfig = config.DeviceConfig; + + KeycapCollection = deviceLayout.KeycapLayouts;//.CollectionChanged += HandleChange; + KeycapCollection.CollectionChanged += HandleChange; + deviceLayout.ConfigChanged(); + /* foreach (var keycap in KeycapCollection) + { + keycap.MouseDown += KeyMouseDown; + keycap.MouseMove += KeyMouseMove; + keycap.MouseUp += KeyMouseUp; + }*/ + + LoadDeviceType(Config.Type); + var deviceIdList = Global.dev_manager.IndividualDevices.Where(d => d.id.ViewPort == null).Select(d => d.id).ToList(); + deviceIdList.Insert(0, new Devices.UniqueDeviceId()); + int selectedIndex = int.MaxValue; + for (int i = 0; i < deviceIdList.Count; i++) + { + if (deviceIdList[i] == Config.Id) + selectedIndex = i; + } + if (selectedIndex == int.MaxValue) + { + deviceIdList.Insert(0, Config.Id); + selectedIndex = 0; + } + + this.device_view.ItemsSource = deviceIdList; + this.device_view.SelectedIndex = selectedIndex; + + this.device_type.ItemsSource = new string[3]{"Keyboard", "Mouse", "Other Devices"}; + this.device_type.IsEnabled = Config.TypeChangeEnabled; + + this.device_layout.SelectedItem = Config.SelectedLayout; + + layoutName.Text = Config.SelectedLayout; + if (Config is KeyboardConfig keyboardConfig) + this.keyboard_layout.SelectedValue = keyboardConfig.SelectedKeyboardLayout; + this.devices_disable_lighting.IsChecked = !Config.LightingEnabled; + this.device_invisible_background.IsChecked = Config.InvisibleBackgroundEnabled; + DataContext = this; + + this.KeyDown += OnKeyDownHandler; + Task.Run(() => UpdateKeysThread(tokenSource.Token)); + } + private void HandleChange(object sender, NotifyCollectionChangedEventArgs e) + { + if (e.Action == NotifyCollectionChangedAction.Replace || e.Action == NotifyCollectionChangedAction.Add) + { + foreach (Control_Keycap key in e.NewItems) + { + //keycap_list.Items.Clear(); + key.MouseDown += KeyMouseDown; + key.MouseMove += KeyMouseMove; + key.MouseUp += KeyMouseUp; + + } + } + } + private void LoadDeviceType(int type) + { + switch (type) + { + case 0: + this.device_type.SelectedItem = "Keyboard"; + this.device_layout.ItemsSource = Global.devicesLayout.GetLayoutsForType(Devices.AuroraDeviceType.Keyboard); + this.keyboard_layout.Visibility = Visibility.Visible; + this.keyboard_layout_tb.Visibility = Visibility.Visible; + deviceLayout.DeviceConfig = new KeyboardConfig(Config); + this.keyboard_layout.SelectedItem = (Config as KeyboardConfig).SelectedKeyboardLayout; + break; + case 1: + this.device_type.SelectedItem = "Mouse"; + this.device_layout.ItemsSource = Global.devicesLayout.GetLayoutsForType(Devices.AuroraDeviceType.Mouse); + this.keyboard_layout.Visibility = Visibility.Collapsed; + this.keyboard_layout_tb.Visibility = Visibility.Collapsed; + Config.Type = 1; + deviceLayout.DeviceConfig = new MouseConfig(Config); + break; + default: + Config.Type = 2; + this.device_type.SelectedItem = "Other Devices"; + this.device_layout.ItemsSource = Global.devicesLayout.GetLayoutsForType(Devices.AuroraDeviceType.Unkown); + this.keyboard_layout.Visibility = Visibility.Collapsed; + this.keyboard_layout_tb.Visibility = Visibility.Collapsed; + deviceLayout.DeviceConfig = new DeviceConfig(Config); + break; + } + } + + private void device_view_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (IsLoaded) + { + var selectedDeviceId = (Devices.UniqueDeviceId)this.device_view.SelectedItem; + Global.dev_manager.RegisterViewPort(ref selectedDeviceId, (int)Config.Id.ViewPort); + Config.Id = selectedDeviceId; + deviceLayout.ConfigChanged(); + } + } + private void device_type_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (IsLoaded) + { + Config.Type = this.device_type.SelectedIndex; + LoadDeviceType(Config.Type); + } + } + private void device_layout_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (IsLoaded) + { + if (device_layout.SelectedItem is null) device_layout.SelectedItem = "None"; + Config.SelectedLayout = device_layout.SelectedItem?.ToString(); + deviceLayout.ConfigChanged(); + layoutName.Text = device_layout.SelectedItem.ToString(); + + } + } + private void keyboard_layout_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if (IsLoaded && Config is KeyboardConfig keyboardConfig) + { + keyboardConfig.SelectedKeyboardLayout = (KeyboardPhysicalLayout)keyboard_layout.SelectedValue; + deviceLayout.ConfigChanged(); + } + } + private void device_disable_lighting_Checked(object sender, RoutedEventArgs e) + { + if (IsLoaded && sender is CheckBox checkBox) + { + Config.LightingEnabled = (checkBox.IsChecked.HasValue) ? !checkBox.IsChecked.Value : true; + } + //deviceLayout = new Control_DeviceLayout(Config); + } + private void device_invisible_background_Checked(object sender, RoutedEventArgs e) + { + if (IsLoaded && sender is CheckBox checkBox) + { + Config.InvisibleBackgroundEnabled = (checkBox.IsChecked.HasValue) ? checkBox.IsChecked.Value : true; + } + } + + private void okButton_Click(object sender, RoutedEventArgs e) + { + Config.Offset = originalDeviceLayout.DeviceConfig.Offset; + originalDeviceLayout.DeviceConfig = Config; + Global.devicesLayout.SaveConfiguration(Config); + tokenSource.Cancel(); + Close(); + } + private void cancelButton_Click(object sender, RoutedEventArgs e) + { + tokenSource.Cancel(); + Close(); + } + private void deviceDelete_Click(object sender, RoutedEventArgs e) + { + if (MessageBox.Show("Are you sure that remove the device layout?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) + { + Global.devicesLayout.RemoveDeviceLayout(originalDeviceLayout.DeviceConfig); + tokenSource.Cancel(); + Close(); + } + + } + private void saveLayout_Click(object sender, RoutedEventArgs e) + { + if (MessageBox.Show("Are you sure that save the device layout?", "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes) + { + Config.SelectedLayout = layoutName.Text; + var offset = new Point(); + var escIndex= deviceLayout.KeyboardMap.Where(lp => lp.Key == Devices.DeviceKeys.ESC); + if (Config.Type == 0 && escIndex.Any()) + { + var escConfig = deviceLayout.KeycapLayouts[escIndex.First().Value].Config; + offset.X = -escConfig.X; + offset.Y = -escConfig.Y; + } + new DeviceLayout(Config).SaveLayout(deviceLayout.KeycapLayouts.ToList(), offset); + LoadDeviceType(Config.Type); + this.device_layout.SelectedValue = Config.SelectedLayout; + } + + } + private void KeyMouseDown(object sender, MouseButtonEventArgs e) + { + SelectedKeycap = sender as Control_Keycap; + keycap_list.SelectedItem = SelectedKeycap; + + // when the mouse is down, get the position within the current control. (so the control top/left doesn't move to the mouse position) + _positionInBlock = Mouse.GetPosition(sender as UIElement); + + // capture the mouse (so the mouse move events are still triggered (even when the mouse is not above the control) + SelectedKeycap?.CaptureMouse(); + + } + + private void KeyMouseMove(object sender, MouseEventArgs e) + { + // if the mouse is captured. you are moving it. (there is your 'real' boolean) + if ((sender as Control_Keycap).IsMouseCaptured) + { + // get the parent container + var container = VisualTreeHelper.GetParent(sender as UIElement) as UIElement; + + // get the position within the container + var mousePosition = e.GetPosition(container); + + // move the usercontrol. + (sender as Control_Keycap).Keycap.Config.X = (int)(mousePosition.X - _positionInBlock.X); + (sender as Control_Keycap).Keycap.Config.Y = (int)(mousePosition.Y - _positionInBlock.Y); + //keycap_x.Text = ((int)(mousePosition.X - _positionInBlock.X)).ToString(); + //keycap_y.Text = ((int)(mousePosition.Y - _positionInBlock.Y)).ToString(); + } + } + + private void KeyMouseUp(object sender, MouseButtonEventArgs e) + { + // release this control. + (sender as Control_Keycap)?.ReleaseMouseCapture(); + + } + private void OnKeyDownHandler(object sender, KeyEventArgs e) + { + /*if (e.Key == Key.Z && Keyboard.Modifiers == ModifierKeys.Control) + { + MessageBox.Show("CTRL + C Pressed!"); + } + else if (e.Key == Key.Z && (Keyboard.Modifiers & (ModifierKeys.Control | ModifierKeys.Shift)) == (ModifierKeys.Control | ModifierKeys.Shift)) + { + MessageBox.Show("CTRL + Z Pressed!"); + } + if (e.Key == Key.Up) + { + MessageBox.Show("Up Pressed!"); + }*/ + if (e.Key == Key.Delete && SelectedKeycap != null) + { + KeycapCollection.Remove(SelectedKeycap); + } + } + + private void keycap_list_SelectionChanged(object sender, SelectionChangedEventArgs e) + { + if(sender is ListBox listView) + { + if (listView.SelectedItem is Control_Keycap key) + { + SelectedKeycap = key; + } + } + } + private DeviceKey getValidKey(DeviceKey key) + { + var deviceQuery = Global.dev_manager.IndividualDevices.Where(d => d.id == (Devices.UniqueDeviceId)device_view.SelectedItem); + if (deviceQuery.Any()) + { + var deviceKeys = deviceQuery.First().GetAllDeviceKey(); + foreach (var deviceKey in deviceKeys) + { + if (!KeycapCollection.Where(l => l.Config.Tag == deviceKey.Tag).Any()) + { + return deviceKey; + } + } + } + if (KeycapCollection.Where(l => l.Config.Tag == key.Tag).Any()) + { + key.Tag += 1; + return getValidKey(key); + } + return key; + } + private DeviceKeyConfiguration newKeyConfigBase() + { + var keyConf = new DeviceKeyConfiguration(); + keyConf.Height = 30; + keyConf.Width = 30; + keyConf.Tag = 0; + keyConf.VisualName = ""; + int addValue = 7; + if (!isPlus) + addValue = -7; + if (SelectedKeycap != null) + { + keyConf.X = SelectedKeycap.Config.X; + keyConf.Y = SelectedKeycap.Config.Y; + if (isHorizontal) + { + if(isPlus) + keyConf.X += SelectedKeycap.Config.Width + 7; + else + keyConf.X -= SelectedKeycap.Config.Width + 7; + } + else + { + if (isPlus) + keyConf.Y += SelectedKeycap.Config.Height + 7; + else + keyConf.Y -= SelectedKeycap.Config.Height + 7; + + } + keyConf.Height = (int)SelectedKeycap.Height; + keyConf.Width = (int)SelectedKeycap.Width; ; + keyConf.Tag = SelectedKeycap.Config.Tag + 1; + keyConf.VisualName = SelectedKeycap.Config.VisualName; + } + return keyConf; + } + private void addKey_Click(object sender, RoutedEventArgs e) + { + var keyConf = newKeyConfigBase(); + keyConf.Key = getValidKey(keyConf.Key); + var keycap = new Control_Keycap(keyConf); + keycap.MouseDown += KeyMouseDown; + keycap.MouseMove += KeyMouseMove; + keycap.MouseUp += KeyMouseUp; + keycap.UpdateLayout(); + SelectedKeycap = keycap; + deviceLayout.KeycapLayouts.Add(keycap); + } + private void addGhostKey_Click(object sender, RoutedEventArgs e) + { + var keyConf = newKeyConfigBase(); + keyConf.Tag = -1; + var keycap = new Control_Keycap(keyConf); + keycap.MouseDown += KeyMouseDown; + keycap.MouseMove += KeyMouseMove; + keycap.MouseUp += KeyMouseUp; + keycap.UpdateLayout(); + SelectedKeycap = keycap; + deviceLayout.KeycapLayouts.Add(keycap); + } + private void removeKey_Click(object sender, RoutedEventArgs e) + { + if (SelectedKeycap != null) + { + deviceLayout.KeycapLayouts.Remove(SelectedKeycap); + SelectedKeycap = null; + } + } + private void changeNewKey_Click(object sender, RoutedEventArgs e) + { + isHorizontal = !isHorizontal; + if (isHorizontal) + { + (sender as Button).Content = "Horizontal"; + } + else + { + (sender as Button).Content = "Vertical"; + } + } + private void changeNewKeyPosition_Click(object sender, RoutedEventArgs e) + { + isPlus = !isPlus; + if (isPlus) + { + (sender as Button).Content = "Plus"; + } + else + { + (sender as Button).Content = "Minus"; + } + } + private void UpdateKeysThread(CancellationToken token) + { + while (!token.IsCancellationRequested) + { + Dispatcher.Invoke(() => + { + for (int i = 0; i < deviceLayout.KeycapLayouts.Count; i++) + { + deviceLayout.KeycapLayouts[i].SetColor(Color.FromRgb(200, 200, 200), deviceLayout.KeycapLayouts[i] == SelectedKeycap); + } + }); + Thread.Sleep(100); + } + } + + private void enable_layout_preview_Checked(object sender, RoutedEventArgs e) + { + + } + } +} diff --git a/Project-Aurora/Project-Aurora/Settings/FreeFormObject.cs b/Project-Aurora/Project-Aurora/Settings/FreeFormObject.cs index d596c9222..1970955c5 100644 --- a/Project-Aurora/Project-Aurora/Settings/FreeFormObject.cs +++ b/Project-Aurora/Project-Aurora/Settings/FreeFormObject.cs @@ -1,123 +1,102 @@ -namespace Aurora.Settings +using System; + +namespace Aurora.Settings { - /// - /// The type of the FreeForm region. - /// - public enum FreeFormType + public class FreeFormChangedArgs : EventArgs { - Line, - Rectangle, - Circle, - RectangleFilled, - CircleFilled - } - - /// - /// A delegate for a changed value - /// - /// The current instance of FreeFormObject - public delegate void ValuesChangedEventHandler(FreeFormObject newobject); + public FreeFormObject FreeForm { get; } + public FreeFormChangedArgs(FreeFormObject freeFormObject) + { + FreeForm = freeFormObject; + } + } + /// /// A class representing a region within a bitmap. /// public class FreeFormObject { - FreeFormType _type; - /// - /// Get/Set the type of this region. - /// - public FreeFormType Type - { - get { return _type; } - set - { - _type = value; - ValuesChanged?.Invoke(this); - } - } - - float _x; + private float _x; /// /// Get/Set the X coordinate for this region. /// public float X { - get { return _x; } + get => _x; set { _x = value; - ValuesChanged?.Invoke(this); + ValuesChanged?.Invoke(this, new FreeFormChangedArgs(this)); } } - float _y; + private float _y; /// /// Get/Set the Y coordinate for this region. /// public float Y { - get { return _y; } + get => _y; set { _y = value; - ValuesChanged?.Invoke(this); + ValuesChanged?.Invoke(this, new FreeFormChangedArgs(this)); } } - float _width; + private float _width; /// /// Get/Set the Width of this region. /// public float Width { - get { return _width; } + get => _width; set { _width = value; - ValuesChanged?.Invoke(this); + ValuesChanged?.Invoke(this, new FreeFormChangedArgs(this)); } } - float _height; + private float _height; /// /// Get/Set the Height of this region. /// public float Height { - get { return _height; } + get => _height; set { _height = value; - ValuesChanged?.Invoke(this); + ValuesChanged?.Invoke(this, new FreeFormChangedArgs(this)); } } - float _angle; + private float _angle; /// /// Get/Set the rotation angle of this region. /// public float Angle { - get { return _angle; } + get => _angle; set { _angle = value; - ValuesChanged?.Invoke(this); + ValuesChanged?.Invoke(this, new FreeFormChangedArgs(this)); } } /// /// Event for when any value of this FreeFormObject changes. /// - public event ValuesChangedEventHandler ValuesChanged; + public event EventHandler ValuesChanged; /// /// Creates a default instance of the FreeFormObject /// public FreeFormObject() { - _type = FreeFormType.Rectangle; _x = 0; _y = 0; _width = 30; @@ -135,7 +114,6 @@ public FreeFormObject() /// The rotation angle public FreeFormObject(float x, float y, float width = 30.0f, float height = 30.0f, float angle = 0.0f) { - _type = FreeFormType.Rectangle; _x = x; _y = y; _width = width; @@ -163,8 +141,7 @@ public override bool Equals(object obj) /// A boolean value representing equality public bool Equals(FreeFormObject p) { - return _type == p._type && - _x == p._x && + return _x == p._x && _y == p._y && _width == p._width && _height == p._height && @@ -180,7 +157,6 @@ public override int GetHashCode() unchecked { int hash = 17; - hash = hash * 23 + _type.GetHashCode(); hash = hash * 23 + _x.GetHashCode(); hash = hash * 23 + _y.GetHashCode(); hash = hash * 23 + _width.GetHashCode(); diff --git a/Project-Aurora/Project-Aurora/Settings/KeyRecorder.cs b/Project-Aurora/Project-Aurora/Settings/KeyRecorder.cs index d86603aab..bd1e233bc 100644 --- a/Project-Aurora/Project-Aurora/Settings/KeyRecorder.cs +++ b/Project-Aurora/Project-Aurora/Settings/KeyRecorder.cs @@ -15,8 +15,8 @@ public sealed class KeyRecorder : IDisposable private readonly InputEvents inputEvents; private String recordingType = ""; private bool isSingleKey = false; - private List recordedKeys = new List(); - public delegate void RecordingFinishedHandler(DeviceKeys[] resulting_keys); + private List recordedKeys = new List(); + public delegate void RecordingFinishedHandler(DeviceKey[] resulting_keys); public event RecordingFinishedHandler FinishedRecording; public KeyRecorder(InputEvents inputEvents) @@ -43,7 +43,7 @@ private void InputEventsOnKeyUp(object sender, KeyboardInputEventArgs e) } } - public void AddKey(DeviceKeys key) + public void AddKey(DeviceKey key) { if (!IsRecording()) return; @@ -59,7 +59,7 @@ public void AddKey(DeviceKeys key) } } - public void RemoveKey(DeviceKeys key) + public void RemoveKey(DeviceKey key) { if (!IsRecording()) return; @@ -70,12 +70,12 @@ public void RemoveKey(DeviceKeys key) } } - public bool HasRecorded(DeviceKeys key) + public bool HasRecorded(DeviceKey key) { return recordedKeys.Contains(key); } - public DeviceKeys[] GetKeys() + public DeviceKey[] GetKeys() { return recordedKeys.ToArray(); } @@ -120,7 +120,7 @@ public void Reset() { recordingType = ""; isSingleKey = false; - recordedKeys = new List(); + recordedKeys = new List(); } public bool IsSingleKey() diff --git a/Project-Aurora/Project-Aurora/Settings/KeySequence.cs b/Project-Aurora/Project-Aurora/Settings/KeySequence.cs index fd951148a..61d36ce34 100644 --- a/Project-Aurora/Project-Aurora/Settings/KeySequence.cs +++ b/Project-Aurora/Project-Aurora/Settings/KeySequence.cs @@ -30,7 +30,7 @@ public class KeySequence : ICloneable /// /// An array of DeviceKeys keys to be used with KeySequenceType.Sequence type. /// - public List keys; + public List keys; /// /// The type of this KeySequence instance. @@ -44,28 +44,28 @@ public class KeySequence : ICloneable public KeySequence() { - keys = new List(); + keys = new List(); type = KeySequenceType.Sequence; freeform = new FreeFormObject(); } public KeySequence(KeySequence otherKeysequence) { - this.keys = new List(otherKeysequence.keys); + keys = new List(otherKeysequence.keys); type = otherKeysequence.type; - this.freeform = otherKeysequence.freeform; + freeform = otherKeysequence.freeform; } public KeySequence(FreeFormObject freeform) { - this.keys = new List(); + this.keys = new List(); type = KeySequenceType.FreeForm; this.freeform = freeform; } - public KeySequence(Devices.DeviceKeys[] keys) + public KeySequence(DeviceKey[] keys) { - this.keys = new List(keys); + this.keys = new List(keys); type = KeySequenceType.Sequence; freeform = new FreeFormObject(); } @@ -75,15 +75,15 @@ public RectangleF GetAffectedRegion() switch (type) { case KeySequenceType.FreeForm: - return new RectangleF((this.freeform.X + Effects.grid_baseline_x) * Effects.editor_to_canvas_width, (this.freeform.Y + Effects.grid_baseline_y) * Effects.editor_to_canvas_height, this.freeform.Width * Effects.editor_to_canvas_width, this.freeform.Height * Effects.editor_to_canvas_height); + return new RectangleF((freeform.X + Effects.grid_baseline_x) * Effects.EditorToCanvasWidth, (freeform.Y + Effects.grid_baseline_y) * Effects.EditorToCanvasHeight, freeform.Width * Effects.EditorToCanvasWidth, freeform.Height * Effects.EditorToCanvasHeight); default: - float left = 0.0f; - float top = left; - float right = top; - float bottom = right; + var left = 0.0f; + var top = left; + var right = top; + var bottom = right; - foreach(Devices.DeviceKeys key in this.keys) + foreach(DeviceKey key in keys) { BitmapRectangle keyMapping = Effects.GetBitmappingFromDeviceKey(key); @@ -107,7 +107,7 @@ public RectangleF GetAffectedRegion() } } - return new RectangleF(left, top, (right - left), (bottom - top)); + return new RectangleF(left, top, right - left, bottom - top); } } @@ -116,8 +116,7 @@ public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) return false; if (ReferenceEquals(this, obj)) return true; - if (obj.GetType() != this.GetType()) return false; - return Equals((KeySequence)obj); + return obj.GetType() == GetType() && Equals((KeySequence)obj); } public bool Equals(KeySequence p) @@ -125,7 +124,7 @@ public bool Equals(KeySequence p) if (ReferenceEquals(null, p)) return false; if (ReferenceEquals(this, p)) return true; - return (new HashSet(keys).SetEquals(p.keys)) && + return (new HashSet(keys).SetEquals(p.keys)) && type == p.type && freeform.Equals(p.freeform); } diff --git a/Project-Aurora/Project-Aurora/Settings/KeyboardLayoutManager.cs b/Project-Aurora/Project-Aurora/Settings/KeyboardLayoutManager.cs old mode 100755 new mode 100644 index 80a9357d8..376f4547a --- a/Project-Aurora/Project-Aurora/Settings/KeyboardLayoutManager.cs +++ b/Project-Aurora/Project-Aurora/Settings/KeyboardLayoutManager.cs @@ -11,8 +11,9 @@ using Aurora.Devices; using System.Drawing; using System.Windows.Media.Imaging; -using Aurora.Settings.Keycaps; using System.Windows.Threading; +using System.Globalization; +using Aurora.Settings.DeviceLayoutViewer.Keycaps; namespace Aurora.Settings { @@ -99,12 +100,10 @@ public class VirtualGroup { public string group_tag; - public KeyboardRegion origin_region; + public KeyboardRegion? origin_region; public List grouped_keys = new List(); - public Dictionary KeyText = new Dictionary(); - private RectangleF _region = new RectangleF(0, 0, 0, 0); public RectangleF Region { get { return _region; } } @@ -119,122 +118,49 @@ public VirtualGroup() public VirtualGroup(KeyboardKey[] keys) { - double layout_height = 0; - double layout_width = 0; - double current_height = 0; - double current_width = 0; - - /*int width_bit = 0; - int height_bit = 0; - int width_bit_max = 1; - int height_bit_max = 1;*/ - foreach (var key in keys) { grouped_keys.Add(key); - KeyText.Add(key.tag, key.visualName); - - if (key.width + key.margin_left > 0) - current_width += key.width.Value + key.margin_left.Value; - - if (key.margin_top > 0) - current_height += key.margin_top.Value; - - - if (layout_width < current_width) - layout_width = current_width; - - if (key.line_break.Value) - { - current_height += 37; - current_width = 0; - } - - if (layout_height < current_height) - layout_height = current_height; - - - /*int key_tly = KeyboardLayoutManager.PixelToByte(key.margin_top.Value) + height_bit; - int key_tlx = KeyboardLayoutManager.PixelToByte(key.margin_left.Value) + width_bit; - - int key_bry = key_tly + KeyboardLayoutManager.PixelToByte(key.height.Value); - int key_brx = key_tlx + KeyboardLayoutManager.PixelToByte(key.width.Value); - - if (width_bit_max < key_brx) width_bit_max = key_brx; - if (height_bit_max < key_bry) height_bit_max = key_bry; - - - if (key.line_break.Value) - { - height_bit += KeyboardLayoutManager.PixelToByte(37); - width_bit = 0; - } - else - { - width_bit = key_brx; - height_bit = key_tly; - }*/ - } - - _region.Width = (float)layout_width; - _region.Height = (float)layout_height; - - /*_region_bitmap.Width = width_bit_max; - _region_bitmap.Height = height_bit_max;*/ - + CalculateDimensions(); //NormalizeKeys(); } - public void AddFeature(KeyboardKey[] keys, KeyboardRegion insertion_region = KeyboardRegion.TopLeft) + public void AddFeature(KeyboardKey[] keys, KeyboardRegion? insertion_region = KeyboardRegion.TopLeft) { double location_x = 0.0D; double location_y = 0.0D; - int location_x_bit = 0; - int location_y_bit = 0; if (insertion_region == KeyboardRegion.TopRight) { location_x = _region.Width; - //location_x_bit = _region_bitmap.Width; } else if (insertion_region == KeyboardRegion.BottomLeft) { location_y = _region.Height; - //location_y_bit = _region_bitmap.Height; } else if (insertion_region == KeyboardRegion.BottomRight) { location_x = _region.Width; location_y = _region.Height; - //location_x_bit = _region_bitmap.Width; - //location_y_bit = _region_bitmap.Height; + } float added_width = 0.0f; float added_height = 0.0f; - //int added_width_bits = 0; - //int added_height_bits = 0; foreach (var key in keys) { key.margin_left += location_x; key.margin_top += location_y; - //key.margin_left_bits += location_x_bit; - //key.margin_top_bits += location_y_bit; - grouped_keys.Add(key); - if (KeyText.ContainsKey(key.tag)) - KeyText.Remove(key.tag); - KeyText.Add(key.tag, key.visualName); if (key.width + key.margin_left > _region.Width) _region.Width = (float)(key.width + key.margin_left); else if (key.margin_left + added_width < 0) { added_width = -(float)(key.margin_left); - _region.Width -= (float)(key.margin_left); } if (key.height + key.margin_top > _region.Height) @@ -242,28 +168,11 @@ public void AddFeature(KeyboardKey[] keys, KeyboardRegion insertion_region = Key else if (key.margin_top + added_height < 0) { added_height = -(float)(key.margin_top); - _region.Height -= (float)(key.margin_top); } - - /*if (KeyboardLayoutManager.PixelToByte(key.width.Value) + KeyboardLayoutManager.PixelToByte(key.margin_left.Value) > _region_bitmap.Width) - _region_bitmap.Width += KeyboardLayoutManager.PixelToByte(key.width.Value) + KeyboardLayoutManager.PixelToByte(key.margin_left.Value) - location_x_bit; - else if (KeyboardLayoutManager.PixelToByte(key.margin_left.Value) + added_width_bits < 0) - { - added_width_bits = -KeyboardLayoutManager.PixelToByte(key.margin_left.Value); - _region_bitmap.Width -= KeyboardLayoutManager.PixelToByte(key.margin_left.Value); - } - - if (KeyboardLayoutManager.PixelToByte(key.height.Value) + KeyboardLayoutManager.PixelToByte(key.margin_top.Value) > _region_bitmap.Height) - _region_bitmap.Height += KeyboardLayoutManager.PixelToByte(key.height.Value) + KeyboardLayoutManager.PixelToByte(key.margin_top.Value) - location_y_bit; - else if (KeyboardLayoutManager.PixelToByte(key.margin_top.Value) + added_height_bits < 0) - { - added_height_bits = -KeyboardLayoutManager.PixelToByte(key.margin_top.Value); - _region_bitmap.Height -= KeyboardLayoutManager.PixelToByte(key.margin_top.Value); - }*/ - } - + _region.Width += added_width; + _region.Height += added_height; NormalizeKeys(); } @@ -272,9 +181,6 @@ private void NormalizeKeys() double x_correction = 0.0D; double y_correction = 0.0D; - //int x_correction_bit = 0; - //int y_correction_bit = 0; - foreach (var key in grouped_keys) { if (!key.absolute_location.Value) @@ -285,18 +191,11 @@ private void NormalizeKeys() if (key.margin_top < y_correction) y_correction = key.margin_top.Value; - - /*if (key.margin_left_bits < x_correction_bit) - x_correction_bit = key.margin_left_bits.Value; - - if (key.margin_top_bits < y_correction_bit) - y_correction_bit = key.margin_top_bits.Value;*/ } if (grouped_keys.Count > 0) { grouped_keys[0].margin_top -= y_correction; - //grouped_keys[0].margin_top_bits -= y_correction_bit; bool previous_linebreak = true; foreach (var key in grouped_keys) @@ -305,15 +204,12 @@ private void NormalizeKeys() { key.margin_top -= y_correction; key.margin_left -= x_correction; - /*key.margin_top_bits -= y_correction_bit; - key.margin_left_bits -= x_correction_bit;*/ } else { if (previous_linebreak && !key.line_break.Value) { key.margin_left -= x_correction; - //key.margin_left_bits -= x_correction_bit; } previous_linebreak = key.line_break.Value; @@ -326,7 +222,6 @@ private void NormalizeKeys() public void Clear() { _region = new RectangleF(0, 0, 0, 0); - //_region_bitmap = new Rectangle(0, 0, 0, 0); grouped_keys.Clear(); } @@ -336,14 +231,7 @@ internal void AdjustKeys(Dictionary keys) foreach (var key in applicable_keys) { - KeyboardKey otherKey = keys[key.tag]; - if (key.tag != otherKey.tag) - KeyText.Remove(key.tag); - key.UpdateFromOtherKey(otherKey); - if (KeyText.ContainsKey(key.tag)) - KeyText[key.tag] = key.visualName; - else - KeyText.Add(key.tag, key.visualName); + key.UpdateFromOtherKey(keys[key.tag]); } } @@ -351,18 +239,19 @@ internal void RemoveKeys(DeviceKeys[] keys_to_remove) { var applicable_keys = grouped_keys.RemoveAll(key => keys_to_remove.Contains(key.tag)); + CalculateDimensions(); + + } + private void CalculateDimensions() + { double layout_height = 0; double layout_width = 0; double current_height = 0; double current_width = 0; - /*int width_bit = 0; - int height_bit = 0; - int width_bit_max = 1; - int height_bit_max = 1;*/ - foreach (var key in grouped_keys) { + if (key.width + key.margin_left > 0) current_width += key.width.Value + key.margin_left.Value; @@ -373,7 +262,7 @@ internal void RemoveKeys(DeviceKeys[] keys_to_remove) if (layout_width < current_width) layout_width = current_width; - if (key.line_break.Value) + if (key.line_break ?? false) { current_height += 37; current_width = 0; @@ -382,37 +271,11 @@ internal void RemoveKeys(DeviceKeys[] keys_to_remove) if (layout_height < current_height) layout_height = current_height; - KeyText.Remove(key.tag); - - /*int key_tly = KeyboardLayoutManager.PixelToByte(key.margin_top.Value) + height_bit; - int key_tlx = KeyboardLayoutManager.PixelToByte(key.margin_left.Value) + width_bit; - - int key_bry = key_tly + KeyboardLayoutManager.PixelToByte(key.height.Value); - int key_brx = key_tlx + KeyboardLayoutManager.PixelToByte(key.width.Value); - - if (width_bit_max < key_brx) width_bit_max = key_brx; - if (height_bit_max < key_bry) height_bit_max = key_bry; - - - if (key.line_break.Value) - { - height_bit += 3; - width_bit = 0; - } - else - { - width_bit = key_brx; - height_bit = key_tly; - }*/ } _region.Width = (float)layout_width; _region.Height = (float)layout_height; - - //_region_bitmap.Width = width_bit_max; - //_region_bitmap.Height = height_bit_max; - } } @@ -422,13 +285,16 @@ public class KeyboardLayoutManager private VirtualGroup virtualKeyboardGroup; - private Dictionary _virtualKeyboardMap = new Dictionary(); + private Dictionary _virtualKeyboardMap = new Dictionary(); private bool _virtualKBInvalid = true; private Grid _virtualKeyboard = new Grid(); - public Dictionary KeyText { get { return virtualKeyboardGroup.KeyText; } } + public string GetVisualName(DeviceKeys key) + { + return virtualKeyboardGroup.grouped_keys.Find(k => k.tag == key)?.visualName ?? null; + } public Grid Virtual_keyboard { @@ -456,7 +322,7 @@ public Grid AbstractVirtualKeyboard public event LayoutUpdatedEventHandler KeyboardLayoutUpdated; - private String cultures_folder = "kb_layouts"; + private String cultures_folder = "DeviceLayouts"; private PreferredKeyboardLocalization _loaded_localization = PreferredKeyboardLocalization.None; @@ -478,333 +344,114 @@ public KeyboardLayoutManager() public void LoadBrandDefault() { - Application.Current.Dispatcher.Invoke(() => + /*Application.Current.Dispatcher.Invoke(() => { - LoadBrand(Global.Configuration.KeyboardBrand, Global.Configuration.MousePreference, Global.Configuration.MouseOrientation); - }); + LoadBrand(Global.Configuration.KeyboardBrand, Global.Configuration.MousePreference, MouseOrientationType.LeftHanded); + });*/ + } + private PreferredKeyboardLocalization GetSystemKeyboardCulture() + { + string culture = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; + switch (culture) + { + case ("tr-TR"): + return PreferredKeyboardLocalization.tr; + case ("ja-JP"): + return PreferredKeyboardLocalization.jpn; + case ("de-DE"): + case ("hsb-DE"): + case ("dsb-DE"): + return PreferredKeyboardLocalization.de; + case ("fr-CH"): + case ("de-CH"): + return PreferredKeyboardLocalization.swiss; + case ("fr-FR"): + case ("br-FR"): + case ("oc-FR"): + case ("co-FR"): + case ("gsw-FR"): + return PreferredKeyboardLocalization.fr; + case ("cy-GB"): + case ("gd-GB"): + case ("en-GB"): + return PreferredKeyboardLocalization.uk; + case ("ru-RU"): + case ("tt-RU"): + case ("ba-RU"): + case ("sah-RU"): + return PreferredKeyboardLocalization.ru; + case ("en-US"): + return PreferredKeyboardLocalization.us; + case ("da-DK"): + case ("se-SE"): + case ("nb-NO"): + case ("nn-NO"): + case ("nordic"): + return PreferredKeyboardLocalization.nordic; + case ("pt-BR"): + return PreferredKeyboardLocalization.abnt2; + case ("dvorak"): + return PreferredKeyboardLocalization.dvorak; + case ("dvorak_int"): + return PreferredKeyboardLocalization.dvorak_int; + case ("hu-HU"): + return PreferredKeyboardLocalization.hu; + case ("it-IT"): + return PreferredKeyboardLocalization.it; + case ("es-AR"): + case ("es-BO"): + case ("es-CL"): + case ("es-CO"): + case ("es-CR"): + case ("es-EC"): + case ("es-MX"): + case ("es-PA"): + case ("es-PY"): + case ("es-PE"): + case ("es-UY"): + case ("es-VE"): + case ("es-419"): + return PreferredKeyboardLocalization.la; + case ("es-ES"): + return PreferredKeyboardLocalization.es; + case ("iso"): + return PreferredKeyboardLocalization.iso; + case ("ansi"): + return PreferredKeyboardLocalization.ansi; + default: + return PreferredKeyboardLocalization.intl; + + } } + private string GetKeyboardCulture() + { + PreferredKeyboardLocalization layout = Global.Configuration.KeyboardLocalization; + + if (layout == PreferredKeyboardLocalization.None) + { + layout = GetSystemKeyboardCulture(); + } + _loaded_localization = layout; + return layout.ToString(); - public void LoadBrand(PreferredKeyboard keyboard_preference = PreferredKeyboard.None, PreferredMouse mouse_preference = PreferredMouse.None, MouseOrientationType mouse_orientation = MouseOrientationType.RightHanded) + } + public void LoadBrand(string keyboard_preference = "", string mouse_preference = "", MouseOrientationType? mouse_orientation = MouseOrientationType.RightHanded) { #if !DEBUG try { #endif - //System.Threading.Thread.CurrentThread.CurrentCulture = new CultureInfo("de-DE"); //Global.logger.LogLine("Loading brand: " + brand.ToString() + " for: " + System.Threading.Thread.CurrentThread.CurrentCulture.Name); - //Load keyboard layout - if (Directory.Exists(layoutsPath)) - { - PreferredKeyboardLocalization layout = Global.Configuration.KeyboardLocalization; - - if (layout == PreferredKeyboardLocalization.iso) - { - LoadCulture("iso"); - _loaded_localization = layout; - } - else if (layout == PreferredKeyboardLocalization.ansi) - { - LoadCulture("ansi"); - _loaded_localization = layout; - } - else - { - - string culture = System.Threading.Thread.CurrentThread.CurrentCulture.Name; - - switch (layout) - { - case PreferredKeyboardLocalization.None: - break; - case PreferredKeyboardLocalization.intl: - culture = "intl"; - break; - case PreferredKeyboardLocalization.us: - culture = "en-US"; - break; - case PreferredKeyboardLocalization.uk: - culture = "en-GB"; - break; - case PreferredKeyboardLocalization.ru: - culture = "ru-RU"; - break; - case PreferredKeyboardLocalization.fr: - culture = "fr-FR"; - break; - case PreferredKeyboardLocalization.de: - culture = "de-DE"; - break; - case PreferredKeyboardLocalization.jpn: - culture = "ja-JP"; - break; - case PreferredKeyboardLocalization.nordic: - culture = "nordic"; - break; - case PreferredKeyboardLocalization.tr: - culture = "tr-TR"; - break; - case PreferredKeyboardLocalization.swiss: - culture = "de-CH"; - break; - case PreferredKeyboardLocalization.abnt2: - culture = "pt-BR"; - break; - case PreferredKeyboardLocalization.dvorak: - culture = "dvorak"; - break; - case PreferredKeyboardLocalization.dvorak_int: - culture = "dvorak_int"; - break; - case PreferredKeyboardLocalization.hu: - culture = "hu-HU"; - break; - case PreferredKeyboardLocalization.it: - culture = "it-IT"; - break; - case PreferredKeyboardLocalization.la: - culture = "es-AR"; - break; - case PreferredKeyboardLocalization.es: - culture = "es-ES"; - break; - case PreferredKeyboardLocalization.iso: - culture = "iso"; - break; - case PreferredKeyboardLocalization.ansi: - culture = "ansi"; - break; - } - - switch (culture) - { - case ("tr-TR"): - LoadCulture("tr"); - break; - case ("ja-JP"): - LoadCulture("jpn"); - break; - case ("de-DE"): - case ("hsb-DE"): - case ("dsb-DE"): - _loaded_localization = PreferredKeyboardLocalization.de; - LoadCulture("de"); - break; - case ("fr-CH"): - case ("de-CH"): - _loaded_localization = PreferredKeyboardLocalization.swiss; - LoadCulture("swiss"); - break; - case ("fr-FR"): - case ("br-FR"): - case ("oc-FR"): - case ("co-FR"): - case ("gsw-FR"): - _loaded_localization = PreferredKeyboardLocalization.fr; - LoadCulture("fr"); - break; - case ("cy-GB"): - case ("gd-GB"): - case ("en-GB"): - _loaded_localization = PreferredKeyboardLocalization.uk; - LoadCulture("uk"); - break; - case ("ru-RU"): - case ("tt-RU"): - case ("ba-RU"): - case ("sah-RU"): - _loaded_localization = PreferredKeyboardLocalization.ru; - LoadCulture("ru"); - break; - case ("en-US"): - _loaded_localization = PreferredKeyboardLocalization.us; - LoadCulture("us"); - break; - case ("da-DK"): - case ("se-SE"): - case ("nb-NO"): - case ("nn-NO"): - case ("nordic"): - _loaded_localization = PreferredKeyboardLocalization.nordic; - LoadCulture("nordic"); - break; - case ("pt-BR"): - _loaded_localization = PreferredKeyboardLocalization.abnt2; - LoadCulture("abnt2"); - break; - case ("dvorak"): - _loaded_localization = PreferredKeyboardLocalization.dvorak; - LoadCulture("dvorak"); - break; - case ("dvorak_int"): - _loaded_localization = PreferredKeyboardLocalization.dvorak_int; - LoadCulture("dvorak_int"); - break; - case ("hu-HU"): - _loaded_localization = PreferredKeyboardLocalization.hu; - LoadCulture("hu"); - break; - case ("it-IT"): - _loaded_localization = PreferredKeyboardLocalization.it; - LoadCulture("it"); - break; - case ("es-AR"): - case ("es-BO"): - case ("es-CL"): - case ("es-CO"): - case ("es-CR"): - case ("es-EC"): - case ("es-MX"): - case ("es-PA"): - case ("es-PY"): - case ("es-PE"): - case ("es-UY"): - case ("es-VE"): - case ("es-419"): - _loaded_localization = PreferredKeyboardLocalization.la; - LoadCulture("la"); - break; - case ("es-ES"): - _loaded_localization = PreferredKeyboardLocalization.es; - LoadCulture("es"); - break; - case ("iso"): - _loaded_localization = PreferredKeyboardLocalization.iso; - LoadCulture("iso"); - break; - case ("ansi"): - _loaded_localization = PreferredKeyboardLocalization.ansi; - LoadCulture("ansi"); - break; - default: - _loaded_localization = PreferredKeyboardLocalization.intl; - LoadCulture("intl"); - break; - - } - } - } - var layoutConfigPath = ""; - if (keyboard_preference == PreferredKeyboard.Logitech_G910) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_g910.json"); - else if (keyboard_preference == PreferredKeyboard.Logitech_G810) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_g810.json"); - else if (keyboard_preference == PreferredKeyboard.Logitech_GPRO) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_gpro.json"); - else if (keyboard_preference == PreferredKeyboard.Logitech_G410) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_g410.json"); - else if (keyboard_preference == PreferredKeyboard.Logitech_G815) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_g815.json"); - else if (keyboard_preference == PreferredKeyboard.Logitech_G513) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_g513.json"); - else if (keyboard_preference == PreferredKeyboard.Logitech_G213) - layoutConfigPath = Path.Combine(layoutsPath, "logitech_g213.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_K95) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_k95.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_K95_PL) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_k95_platinum.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_K70) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_k70.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_K70MK2) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_k70_mk2.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_K65) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_k65.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_STRAFE) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_strafe.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_STRAFE_MK2) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_strafe_mk2.json"); - else if (keyboard_preference == PreferredKeyboard.Corsair_K68) - layoutConfigPath = Path.Combine(layoutsPath, "corsair_k68.json"); - else if (keyboard_preference == PreferredKeyboard.Razer_Blackwidow) - layoutConfigPath = Path.Combine(layoutsPath, "razer_blackwidow.json"); - else if (keyboard_preference == PreferredKeyboard.Razer_Blackwidow_X) - layoutConfigPath = Path.Combine(layoutsPath, "razer_blackwidow_x.json"); - else if (keyboard_preference == PreferredKeyboard.Razer_Blackwidow_TE) - layoutConfigPath = Path.Combine(layoutsPath, "razer_blackwidow_te.json"); - else if (keyboard_preference == PreferredKeyboard.Razer_Blade) - layoutConfigPath = Path.Combine(layoutsPath, "razer_blade.json"); - else if (keyboard_preference == PreferredKeyboard.Masterkeys_Pro_L) - layoutConfigPath = Path.Combine(layoutsPath, "masterkeys_pro_l.json"); - else if (keyboard_preference == PreferredKeyboard.Masterkeys_Pro_S) - layoutConfigPath = Path.Combine(layoutsPath, "masterkeys_pro_s.json"); - else if (keyboard_preference == PreferredKeyboard.Masterkeys_Pro_M) - layoutConfigPath = Path.Combine(layoutsPath, "masterkeys_pro_m.json"); - else if (keyboard_preference == PreferredKeyboard.Masterkeys_MK750) - layoutConfigPath = Path.Combine(layoutsPath, "masterkeys_mk750.json"); - else if (keyboard_preference == PreferredKeyboard.Masterkeys_MK730) - layoutConfigPath = Path.Combine(layoutsPath, "masterkeys_mk730.json"); - else if (keyboard_preference == PreferredKeyboard.Cooler_Master_SK650) - layoutConfigPath = Path.Combine(layoutsPath, "cooler_master_sk650.json"); - else if (keyboard_preference == PreferredKeyboard.Roccat_Ryos) - layoutConfigPath = Path.Combine(layoutsPath, "roccat_ryos.json"); - else if (keyboard_preference == PreferredKeyboard.SteelSeries_Apex_M800) - layoutConfigPath = Path.Combine(layoutsPath, "steelseries_apex_m800.json"); - else if (keyboard_preference == PreferredKeyboard.SteelSeries_Apex_M750) - layoutConfigPath = Path.Combine(layoutsPath, "steelseries_apex_m750.json"); - else if (keyboard_preference == PreferredKeyboard.SteelSeries_Apex_M750_TKL) - layoutConfigPath = Path.Combine(layoutsPath, "steelseries_apex_m750_tkl.json"); - else if (keyboard_preference == PreferredKeyboard.Wooting_One) - layoutConfigPath = Path.Combine(layoutsPath, "wooting_one.json"); - else if (keyboard_preference == PreferredKeyboard.Asus_Strix_Flare) - layoutConfigPath = Path.Combine(layoutsPath, "asus_strix_flare.json"); - else if (keyboard_preference == PreferredKeyboard.Asus_Strix_Scope) - layoutConfigPath = Path.Combine(layoutsPath, "asus_strix_scope.json"); - else if (keyboard_preference == PreferredKeyboard.SoundBlasterX_Vanguard_K08) - layoutConfigPath = Path.Combine(layoutsPath, "soundblasterx_vanguardk08.json"); - else if (keyboard_preference == PreferredKeyboard.GenericLaptop) - layoutConfigPath = Path.Combine(layoutsPath, "generic_laptop.json"); - else if (keyboard_preference == PreferredKeyboard.GenericLaptopNumpad) - layoutConfigPath = Path.Combine(layoutsPath, "generic_laptop_numpad.json"); - else if (keyboard_preference == PreferredKeyboard.Drevo_BladeMaster) - layoutConfigPath = Path.Combine(layoutsPath, "drevo_blademaster.json"); - else if (keyboard_preference == PreferredKeyboard.Wooting_Two) - layoutConfigPath = Path.Combine(layoutsPath, "wooting_two.json"); - - else if (keyboard_preference == PreferredKeyboard.Uniwill2ND_35X_1) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2ND_35X_1.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2ND_35X_2) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2ND_35X_2.json"); - //keyboare 2.1 - else if (keyboard_preference == PreferredKeyboard.Uniwill2P1_550_US) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P1_550_US.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2P1_550_UK) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P1_550_UK.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2P1_550_BR) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P1_550_BR.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2P1_550_JP) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P1_550_JP.json"); - //keyboare 2.2 - else if (keyboard_preference == PreferredKeyboard.Uniwill2P2_650_US) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P2_650_US.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2P2_650_UK) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P2_650_UK.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2P2_650_BR) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P2_650_BR.json"); - else if (keyboard_preference == PreferredKeyboard.Uniwill2P2_650_JP) - layoutConfigPath = Path.Combine(layoutsPath, "Uniwill2P2_650_JP.json"); - - else if (keyboard_preference == PreferredKeyboard.Ducky_Shine_7) - layoutConfigPath = Path.Combine(layoutsPath, "ducky_shine_7.json"); - else if (keyboard_preference == PreferredKeyboard.Ducky_One_2_RGB_TKL) - layoutConfigPath = Path.Combine(layoutsPath, "ducky_one_2_rgb_tkl.json"); - else if (keyboard_preference == PreferredKeyboard.OMEN_Sequencer) - layoutConfigPath = Path.Combine(layoutsPath, "omen_sequencer.json"); - else if (keyboard_preference == PreferredKeyboard.OMEN_Four_Zone) - layoutConfigPath = Path.Combine(layoutsPath, "omen_four_zone.json"); - else if (keyboard_preference == PreferredKeyboard.HyperX_Alloy_Elite_RGB) - layoutConfigPath = Path.Combine(layoutsPath, "hyperx_alloy_elite_rgb.json"); - - else - { - LoadNone(); - return; - } if (!String.IsNullOrWhiteSpace(layoutConfigPath) && File.Exists(layoutConfigPath)) { + //Load keyboard layout + LoadCulture(GetKeyboardCulture()); + string content = File.ReadAllText(layoutConfigPath, Encoding.UTF8); VirtualGroupConfiguration layoutConfig = JsonConvert.DeserializeObject(content, new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }); @@ -822,7 +469,7 @@ public void LoadBrand(PreferredKeyboard keyboard_preference = PreferredKeyboard. foreach (string feature in layoutConfig.included_features) { - string feature_path = Path.Combine(layoutsPath, "Extra Features", feature); + string feature_path = Path.Combine(layoutsPath, "Keyboard", "Extra Features", feature); if (File.Exists(feature_path)) { @@ -840,123 +487,53 @@ public void LoadBrand(PreferredKeyboard keyboard_preference = PreferredKeyboard. } } } + } + else + { + LoadNone(); + return; + } - //Extra fix for Master keys Pro M White foreign layouts - if (keyboard_preference == PreferredKeyboard.Masterkeys_Pro_M) - { - switch (_loaded_localization) - { - case PreferredKeyboardLocalization.intl: - case PreferredKeyboardLocalization.de: - case PreferredKeyboardLocalization.fr: - case PreferredKeyboardLocalization.jpn: - case PreferredKeyboardLocalization.ru: - case PreferredKeyboardLocalization.uk: - virtualKeyboardGroup.AdjustKeys(new Dictionary() { { DeviceKeys.NUM_SEVEN, new KeyboardKey(null, DeviceKeys.NUM_SEVEN, null, null, null, 60, null, null, null, null, null, 5, null) } }); - break; - default: - break; - } - } + string mouseConfigPath = ""; - string mouse_feature_path = ""; + if (mouse_preference != "" && mouse_preference != "None") + { + mouseConfigPath = Path.Combine(layoutsPath, "Mouse", mouse_preference + ".json"); + } - switch (mouse_preference) - { - case PreferredMouse.Generic_Peripheral: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "generic_peripheral.json"); - break; - case PreferredMouse.Generic_Mousepad: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "generic_mousepad.json"); - break; - case PreferredMouse.Logitech_G900: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "logitech_g900_features.json"); - break; - case PreferredMouse.Logitech_G502: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "logitech_g502_features.json"); - break; - case PreferredMouse.Corsair_Sabre: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "corsair_sabre_features.json"); - break; - case PreferredMouse.Corsair_M65: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "corsair_m65_features.json"); - break; - case PreferredMouse.Corsair_Katar: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "corsair_katar_features.json"); - break; - case PreferredMouse.Clevo_Touchpad: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "clevo_touchpad_features.json"); - break; - case PreferredMouse.Roccat_Kone_Pure: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "roccat_kone_pure_features.json"); - break; - case PreferredMouse.SteelSeries_Rival_300: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "steelseries_rival_300_features.json"); - break; - case PreferredMouse.SteelSeries_Rival_300_HP_OMEN_Edition: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "steelseries_rival_300_hp_omen_edition_features.json"); - break; - case PreferredMouse.SteelSeries_QcK_Prism: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "steelseries_qck_prism_features.json"); - break; - case PreferredMouse.SteelSeries_QcK_2_Zone: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "steelseries_qck_2zone_features.json"); - break; - case PreferredMouse.Asus_Pugio: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "asus_pugio_features.json"); - break; - case PreferredMouse.OMEN_Photon: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "omen_photon_features.json"); - break; - case PreferredMouse.OMEN_Outpost_Plus_Photon: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "omen_outpost_plus_photon_features.json"); - break; - case PreferredMouse.OMEN_Vector: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "omen_vector_features.json"); - break; - case PreferredMouse.OMEN_Vector_Essentials: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "omen_vector_essentials_features.json"); - break; - case PreferredMouse.Razer_Mamba_TE: - mouse_feature_path = Path.Combine(layoutsPath, "Extra Features", "razer_mamba_te_features.json"); - break; - } + if (!string.IsNullOrWhiteSpace(mouseConfigPath) && File.Exists(mouseConfigPath)) + { + string mouseConfigContent = File.ReadAllText(mouseConfigPath, Encoding.UTF8); + VirtualGroup mouseConfig = JsonConvert.DeserializeObject(mouseConfigContent, new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }); - if (!string.IsNullOrWhiteSpace(mouse_feature_path)) + if (mouse_orientation == MouseOrientationType.LeftHanded) { - string feature_content = File.ReadAllText(mouse_feature_path, Encoding.UTF8); - VirtualGroup featureConfig = JsonConvert.DeserializeObject(feature_content, new JsonSerializerSettings { ObjectCreationHandling = ObjectCreationHandling.Replace }); - - if (mouse_orientation == MouseOrientationType.LeftHanded) - { - if (featureConfig.origin_region == KeyboardRegion.TopRight) - featureConfig.origin_region = KeyboardRegion.TopLeft; - else if (featureConfig.origin_region == KeyboardRegion.BottomRight) - featureConfig.origin_region = KeyboardRegion.BottomLeft; + if (mouseConfig.origin_region == KeyboardRegion.TopRight) + mouseConfig.origin_region = KeyboardRegion.TopLeft; + else if (mouseConfig.origin_region == KeyboardRegion.BottomRight) + mouseConfig.origin_region = KeyboardRegion.BottomLeft; - double outlineWidth = 0.0; - int outlineWidthBits = 0; + double outlineWidth = 0.0; + int outlineWidthBits = 0; - foreach (var key in featureConfig.grouped_keys) + foreach (var key in mouseConfig.grouped_keys) + { + if (outlineWidth == 0.0 && outlineWidthBits == 0) //We found outline (NOTE: Outline has to be first in the grouped keys) { - if (outlineWidth == 0.0 && outlineWidthBits == 0) //We found outline (NOTE: Outline has to be first in the grouped keys) + if (key.tag == DeviceKeys.NONE) { - if (key.tag == DeviceKeys.NONE) - { - outlineWidth = key.width.Value + 2 * key.margin_left.Value; - //outlineWidthBits = key.width_bits.Value + 2 * key.margin_left_bits.Value; - } + outlineWidth = key.width.Value + 2 * key.margin_left.Value; + //outlineWidthBits = key.width_bits.Value + 2 * key.margin_left_bits.Value; } - - key.margin_left -= outlineWidth; - //key.margin_left_bits -= outlineWidthBits; } + key.margin_left -= outlineWidth; + //key.margin_left_bits -= outlineWidthBits; } - virtualKeyboardGroup.AddFeature(featureConfig.grouped_keys.ToArray(), featureConfig.origin_region); } + virtualKeyboardGroup.AddFeature(mouseConfig.grouped_keys.ToArray(), mouseConfig.origin_region); } #if !DEBUG } @@ -974,108 +551,6 @@ public void LoadBrand(PreferredKeyboard keyboard_preference = PreferredKeyboard. CreateUserControl(); - //Better description for these keys by using the DeviceKeys description instead - Dictionary keytext = KeyText; - keytext.Remove(DeviceKeys.NUM_ASTERISK); - keytext.Remove(DeviceKeys.NUM_EIGHT); - keytext.Remove(DeviceKeys.NUM_ENTER); - keytext.Remove(DeviceKeys.NUM_FIVE); - keytext.Remove(DeviceKeys.NUM_FOUR); - keytext.Remove(DeviceKeys.NUM_MINUS); - keytext.Remove(DeviceKeys.NUM_NINE); - keytext.Remove(DeviceKeys.NUM_ONE); - keytext.Remove(DeviceKeys.NUM_PERIOD); - keytext.Remove(DeviceKeys.NUM_PLUS); - keytext.Remove(DeviceKeys.NUM_SEVEN); - keytext.Remove(DeviceKeys.NUM_SIX); - keytext.Remove(DeviceKeys.NUM_SLASH); - keytext.Remove(DeviceKeys.NUM_THREE); - keytext.Remove(DeviceKeys.NUM_TWO); - keytext.Remove(DeviceKeys.NUM_ZERO); - keytext.Remove(DeviceKeys.NUM_ZEROZERO); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT1); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT2); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT3); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT4); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT5); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT6); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT7); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT8); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT9); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT10); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT11); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT12); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT13); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT14); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT15); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT16); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT17); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT18); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT19); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT20); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT21); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT22); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT23); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT24); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT25); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT26); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT27); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT28); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT29); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT30); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT31); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT32); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT32); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT33); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT34); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT35); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT36); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT37); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT38); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT39); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT40); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT41); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT42); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT43); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT44); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT45); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT46); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT47); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT48); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT49); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT50); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT51); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT52); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT53); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT54); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT55); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT56); - keytext.Remove(DeviceKeys.ADDITIONALLIGHT57); - keytext.Remove(DeviceKeys.LEFT_CONTROL); - keytext.Remove(DeviceKeys.LEFT_WINDOWS); - keytext.Remove(DeviceKeys.LEFT_ALT); - keytext.Remove(DeviceKeys.LEFT_SHIFT); - keytext.Remove(DeviceKeys.RIGHT_ALT); - keytext.Remove(DeviceKeys.FN_Key); - keytext.Remove(DeviceKeys.RIGHT_WINDOWS); - keytext.Remove(DeviceKeys.RIGHT_CONTROL); - keytext.Remove(DeviceKeys.RIGHT_SHIFT); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT1); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT2); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT3); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT4); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT5); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT6); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT7); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT8); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT9); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT10); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT11); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT12); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT13); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT14); - keytext.Remove(DeviceKeys.MOUSEPADLIGHT15); - KeyboardLayoutUpdated?.Invoke(this); } @@ -1099,7 +574,7 @@ private void Configuration_PropertyChanged(object sender, System.ComponentModel. private void LightingStateManager_PostUpdate(object sender, EventArgs e) { - this.LoadBrandDefault(); + //this.LoadBrandDefault(); Global.LightingStateManager.PostUpdate -= this.LightingStateManager_PostUpdate; } @@ -1137,7 +612,7 @@ public void CalculateBitmap() double x = x_offset + cur_width; double y = y_offset + cur_height; - this.bitmap_map[key.tag] = new BitmapRectangle(PixelToByte(x), PixelToByte(y), width_bit, height_bit); + bitmap_map[key.tag] = new BitmapRectangle(PixelToByte(x), PixelToByte(y), width_bit, height_bit); br_x = (x + width); br_y = (y + height); @@ -1154,16 +629,13 @@ public void CalculateBitmap() cur_height = y; } } - if (br_x > width_max) width_max = br_x; - if (br_y > height_max) height_max = br_y; } _bitmapMapInvalid = false; //+1 for rounding error, where the bitmap rectangle B(X)+B(Width) > B(X+Width) Global.effengine.SetCanvasSize(PixelToByte(virtualKeyboardGroup.Region.Width) + 1, PixelToByte(virtualKeyboardGroup.Region.Height) + 1); - Global.effengine.SetBitmapping(this.bitmap_map); + //Global.effengine.SetBitmapping(bitmap_map); } - } private void virtualkeyboard_key_selected(FrameworkElement key) @@ -1229,7 +701,7 @@ private Grid CreateUserControl(bool abstractKeycaps = false) double current_height = 0; double current_width = 0; - string images_path = Path.Combine(layoutsPath, "Extra Features", "images"); + string images_path = Path.Combine(layoutsPath, "Images"); foreach (KeyboardKey key in virtualKeyboardGroup.grouped_keys) { @@ -1244,11 +716,12 @@ private Grid CreateUserControl(bool abstractKeycaps = false) UserControl keycap; //Ghost keycap is used for abstract representation of keys - if (abstractKeycaps) + /*if (abstractKeycaps) keycap = new Control_GhostKeycap(key, image_path); - else + else*/ { - switch (Global.Configuration.VirtualkeyboardKeycapType) + + /*switch (Global.Configuration.VirtualkeyboardKeycapType) { case KeycapType.Default_backglow: keycap = new Control_DefaultKeycapBackglow(key, image_path); @@ -1263,26 +736,26 @@ private Grid CreateUserControl(bool abstractKeycaps = false) keycap = new Control_ColorizedKeycapBlank(key, image_path); break; default: - keycap = new Control_DefaultKeycap(key, image_path); + keycap = null;// new Control_DefaultKeycap(key, image_path); break; - } + }*/ } - new_virtual_keyboard.Children.Add(keycap); + //new_virtual_keyboard.Children.Add(keycap); - if (key.tag != DeviceKeys.NONE && !_virtualKeyboardMap.ContainsKey(key.tag) && keycap is IKeycap && !abstractKeycaps) - _virtualKeyboardMap.Add(key.tag, keycap as IKeycap); + //if (key.tag != DeviceKeys.NONE && !_virtualKeyboardMap.ContainsKey(key.tag) && keycap is IKeycap && !abstractKeycaps) + // _virtualKeyboardMap.Add(key.tag, keycap as IKeycap); - if (key.absolute_location.Value) + /*if (key.absolute_location.Value) keycap.Margin = new Thickness(key.margin_left.Value, key.margin_top.Value, 0, 0); else keycap.Margin = new Thickness(current_width + key.margin_left.Value, current_height + key.margin_top.Value, 0, 0); - + if (key.tag == DeviceKeys.ESC) { baseline_x = keycap.Margin.Left; baseline_y = keycap.Margin.Top; - } + }*/ if (!key.absolute_location.Value) { @@ -1400,7 +873,7 @@ private class KeyboardLayout private void LoadCulture(String culture) { var fileName = "Plain Keyboard\\layout." + culture + ".json"; - var layoutPath = Path.Combine(layoutsPath, fileName); + var layoutPath = Path.Combine(layoutsPath, "Keyboard", fileName); if (!File.Exists(layoutPath)) LoadDefault(); @@ -1476,7 +949,7 @@ public void LoadDefault() keyboard.Add(new KeyboardKey("INSERT", Devices.DeviceKeys.INSERT, true, false, 9, 14)); keyboard.Add(new KeyboardKey("HOME", Devices.DeviceKeys.HOME, true, false, 9)); - keyboard.Add(new KeyboardKey("PAGE\r\nUP", Devices.DeviceKeys.HOME, true, false, 9)); + keyboard.Add(new KeyboardKey("PAGE\r\nUP", Devices.DeviceKeys.PAGE_DOWN, true, false, 9)); keyboard.Add(new KeyboardKey("NUM\r\nLOCK", Devices.DeviceKeys.NUM_LOCK, true, false, 9, 14)); keyboard.Add(new KeyboardKey("/", Devices.DeviceKeys.NUM_SLASH)); @@ -1575,9 +1048,9 @@ public void SetKeyboardColors(Dictionary - /// Interaction logic for Control_ColorizedKeycap.xaml - /// - public partial class Control_ColorizedKeycap : UserControl, IKeycap - { - private Color? current_color = null; - private Devices.DeviceKeys associatedKey = DeviceKeys.NONE; - private bool isImage = false; - - public Control_ColorizedKeycap() - { - InitializeComponent(); - } - - public Control_ColorizedKeycap(KeyboardKey key, string image_path) - { - InitializeComponent(); - - associatedKey = key.tag; - - this.Width = key.width.Value; - this.Height = key.height.Value; - - //Keycap adjustments - if (string.IsNullOrWhiteSpace(key.image)) - keyBorder.BorderThickness = new Thickness(1.5); - else - keyBorder.BorderThickness = new Thickness(0.0); - keyBorder.IsEnabled = key.enabled.Value; - - if (!key.enabled.Value) - { - ToolTipService.SetShowOnDisabled(keyBorder, true); - keyBorder.ToolTip = new ToolTip { Content = "Changes to this key are not supported" }; - } - - if (string.IsNullOrWhiteSpace(key.image)) - { - keyCap.Text = key.visualName; - keyCap.Tag = key.tag; - if (key.font_size != null) - keyCap.FontSize = key.font_size.Value; - keyCap.Visibility = System.Windows.Visibility.Visible; - } - else - { - keyCap.Visibility = System.Windows.Visibility.Hidden; - - if (System.IO.File.Exists(image_path)) - { - var memStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(image_path)); - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = memStream; - image.EndInit(); - - if (key.tag == DeviceKeys.NONE) - keyBorder.Background = new ImageBrush(image); - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); - keyBorder.OpacityMask = new ImageBrush(image); - } - - isImage = true; - } - } - } - - public DeviceKeys GetKey() - { - return associatedKey; - } - - public void SetColor(Color key_color) - { - if (!key_color.Equals(current_color)) - { - if (!isImage) - { - keyBorder.Background = new SolidColorBrush(Utils.ColorUtils.MultiplyColorByScalar(key_color, 0.6)); - keyBorder.BorderBrush = new SolidColorBrush(key_color); - } - else - { - if (associatedKey != DeviceKeys.NONE) - keyBorder.Background = new SolidColorBrush(key_color); - } - current_color = key_color; - } - - if (Global.key_recorder.HasRecorded(associatedKey)) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)0, (byte)(Math.Min(Math.Pow(Math.Cos((double)(Utils.Time.GetMilliSeconds() / 1000.0) * Math.PI) + 0.05, 2.0), 1.0) * 255), (byte)0)); - else - { - if (keyBorder.IsEnabled) - { - if (isImage) - keyBorder.Background = new SolidColorBrush(key_color); - else - keyBorder.Background = new SolidColorBrush(Utils.ColorUtils.MultiplyColorByScalar(key_color, 0.6)); - } - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 100, 100, 100)); - keyBorder.BorderThickness = new Thickness(0); - } - } - UpdateText(); - } - - private void keyBorder_MouseDown(object sender, MouseButtonEventArgs e) - { - if (sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - private void keyBorder_MouseMove(object sender, MouseEventArgs e) - { - } - - private void virtualkeyboard_key_selected(Devices.DeviceKeys key) - { - if (key != DeviceKeys.NONE) - { - if (Global.key_recorder.HasRecorded(key)) - Global.key_recorder.RemoveKey(key); - else - Global.key_recorder.AddKey(key); - } - } - - private void keyBorder_MouseLeave(object sender, MouseEventArgs e) - { - } - - private void keyBorder_MouseEnter(object sender, MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed && sender is Border) - virtualkeyboard_key_selected(associatedKey); - - - } - - public void UpdateText() - { - if (Global.kbLayout.Loaded_Localization.IsAutomaticGeneration()) - { - - //if (keyCap.Text.Length > 1) - // return; - - StringBuilder sb = new StringBuilder(2); - var scan_code = KeyUtils.GetScanCode(associatedKey); - if (scan_code == -1) - return; - /*var key = KeyUtils.GetFormsKey((KeyboardKeys)associatedKey.LedID); - var scan_code = KeyUtils.MapVirtualKeyEx((uint)key, KeyUtils.MapVirtualKeyMapTypes.MapvkVkToVsc, (IntPtr)0x8090809);*/ - - int ret = KeyUtils.GetKeyNameTextW((uint)scan_code << 16, sb, 2); - keyCap.Text = sb.ToString(); - } - } - } -} diff --git a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_ColorizedKeycapBlank.xaml.cs b/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_ColorizedKeycapBlank.xaml.cs deleted file mode 100644 index 814fa7a7d..000000000 --- a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_ColorizedKeycapBlank.xaml.cs +++ /dev/null @@ -1,159 +0,0 @@ -using Aurora.Devices; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Aurora.Settings.Keycaps -{ - /// - /// Interaction logic for Control_ColorizedKeycapBlank.xaml - /// - public partial class Control_ColorizedKeycapBlank : UserControl, IKeycap - { - private Color current_color = Color.FromArgb(0, 0, 0, 0); - private Devices.DeviceKeys associatedKey = DeviceKeys.NONE; - private bool isImage = false; - - public Control_ColorizedKeycapBlank() - { - InitializeComponent(); - } - - public Control_ColorizedKeycapBlank(KeyboardKey key, string image_path) - { - InitializeComponent(); - - associatedKey = key.tag; - - this.Width = key.width.Value; - this.Height = key.height.Value; - - //Keycap adjustments - if (string.IsNullOrWhiteSpace(key.image)) - keyBorder.BorderThickness = new Thickness(1.5); - else - keyBorder.BorderThickness = new Thickness(0.0); - keyBorder.IsEnabled = key.enabled.Value; - - if (!key.enabled.Value) - { - ToolTipService.SetShowOnDisabled(keyBorder, true); - keyBorder.ToolTip = new ToolTip { Content = "Changes to this key are not supported" }; - } - - if (string.IsNullOrWhiteSpace(key.image)) - { - keyCap.Text = key.visualName; - keyCap.Tag = key.tag; - if (key.font_size != null) - keyCap.FontSize = key.font_size.Value; - } - else - { - keyCap.Visibility = System.Windows.Visibility.Hidden; - - if (System.IO.File.Exists(image_path)) - { - var memStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(image_path)); - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = memStream; - image.EndInit(); - - if (key.tag == DeviceKeys.NONE) - keyBorder.Background = new ImageBrush(image); - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); - keyBorder.OpacityMask = new ImageBrush(image); - } - - isImage = true; - } - } - } - - public DeviceKeys GetKey() - { - return associatedKey; - } - - public void SetColor(Color key_color) - { - if (!current_color.Equals(key_color)) - { - if (!isImage) - { - keyBorder.Background = new SolidColorBrush(Utils.ColorUtils.MultiplyColorByScalar(key_color, 0.6)); - keyBorder.BorderBrush = new SolidColorBrush(key_color); - } - else - { - if (associatedKey != DeviceKeys.NONE) - keyBorder.Background = new SolidColorBrush(key_color); - } - current_color = key_color; - } - - if (Global.key_recorder.HasRecorded(associatedKey)) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)0, (byte)(Math.Min(Math.Pow(Math.Cos((double)(Utils.Time.GetMilliSeconds() / 1000.0) * Math.PI) + 0.05, 2.0), 1.0) * 255), (byte)0)); - else - { - if (keyBorder.IsEnabled) - { - if (isImage) - keyBorder.Background = new SolidColorBrush(key_color); - else - keyBorder.Background = new SolidColorBrush(Utils.ColorUtils.MultiplyColorByScalar(key_color, 0.6)); - } - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 100, 100, 100)); - keyBorder.BorderThickness = new Thickness(0); - } - } - } - - private void keyBorder_MouseDown(object sender, MouseButtonEventArgs e) - { - if (sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - private void keyBorder_MouseMove(object sender, MouseEventArgs e) - { - } - - private void virtualkeyboard_key_selected(Devices.DeviceKeys key) - { - if (key != DeviceKeys.NONE) - { - if (Global.key_recorder.HasRecorded(key)) - Global.key_recorder.RemoveKey(key); - else - Global.key_recorder.AddKey(key); - } - } - - private void keyBorder_MouseLeave(object sender, MouseEventArgs e) - { - } - - private void keyBorder_MouseEnter(object sender, MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed && sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - } -} diff --git a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycap.xaml.cs b/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycap.xaml.cs deleted file mode 100755 index b26638f82..000000000 --- a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycap.xaml.cs +++ /dev/null @@ -1,202 +0,0 @@ -using Aurora.Devices; -using Aurora.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Aurora.Settings.Keycaps -{ - /// - /// Interaction logic for Control_DefaultKeycap.xaml - /// - public partial class Control_DefaultKeycap : UserControl, IKeycap - { - private Color current_color = Color.FromArgb(0, 0, 0, 0); - private Devices.DeviceKeys associatedKey = DeviceKeys.NONE; - private bool isImage = false; - - public Control_DefaultKeycap() - { - InitializeComponent(); - } - - public Control_DefaultKeycap(KeyboardKey key, string image_path) - { - InitializeComponent(); - - associatedKey = key.tag; - - this.Width = key.width.Value; - this.Height = key.height.Value; - - //Keycap adjustments - if (string.IsNullOrWhiteSpace(key.image)) - keyBorder.BorderThickness = new Thickness(1.5); - else - keyBorder.BorderThickness = new Thickness(0.0); - keyBorder.IsEnabled = key.enabled.Value; - - if (!key.enabled.Value) - { - ToolTipService.SetShowOnDisabled(keyBorder, true); - keyBorder.ToolTip = new ToolTip { Content = "Changes to this key are not supported" }; - } - - if (string.IsNullOrWhiteSpace(key.image)) - { - keyCap.Text = key.visualName; - keyCap.Tag = key.tag; - if (key.font_size != null) - keyCap.FontSize = key.font_size.Value; - keyCap.Visibility = System.Windows.Visibility.Visible; - } - else - { - keyCap.Visibility = System.Windows.Visibility.Hidden; - - if (System.IO.File.Exists(image_path)) - { - var memStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(image_path)); - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = memStream; - image.EndInit(); - - if (key.tag == DeviceKeys.NONE) - keyBorder.Background = new ImageBrush(image); - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); - keyBorder.OpacityMask = new ImageBrush(image); - } - - isImage = true; - } - } - } - - public DeviceKeys GetKey() - { - return associatedKey; - } - - public void SetColor(Color key_color) - { - if (!current_color.Equals(key_color)) - { - if (!isImage) - { - if (string.IsNullOrWhiteSpace(keyCap.Text)) - keyBorder.BorderBrush = new SolidColorBrush(key_color); - else - keyCap.Foreground = new SolidColorBrush(key_color); - } - else - { - if (associatedKey != DeviceKeys.NONE) - keyBorder.Background = new SolidColorBrush(key_color); - } - current_color = key_color; - } - - if (Global.key_recorder.HasRecorded(associatedKey)) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)0, (byte)(Math.Min(Math.Pow(Math.Cos((double)(Utils.Time.GetMilliSeconds() / 1000.0) * Math.PI) + 0.05, 2.0), 1.0) * 255), (byte)0)); - else - { - if (keyBorder.IsEnabled) - { - if (!isImage) - { - if (string.IsNullOrWhiteSpace(keyCap.Text)) - keyBorder.Background = new SolidColorBrush(Utils.ColorUtils.MultiplyColorByScalar(key_color, 0.6)); - else - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)30, (byte)30, (byte)30)); - } - else - keyBorder.Background = new SolidColorBrush(key_color); - } - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 100, 100, 100)); - keyBorder.BorderThickness = new Thickness(0); - } - } - UpdateText(); - } - - private void keyBorder_MouseDown(object sender, MouseButtonEventArgs e) - { - if (sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - private void keyBorder_MouseMove(object sender, MouseEventArgs e) - { - /* - if (e.LeftButton == MouseButtonState.Pressed) - { - if (sender is Border && (sender as Border).Child != null && (sender as Border).Child is TextBlock && last_selected_element != ((sender as Border).Child as TextBlock)) - { - virtualkeyboard_key_selected((sender as Border).Child as TextBlock); - } - else if (sender is Border && (sender as Border).Tag != null && last_selected_element != (sender as Border)) - { - virtualkeyboard_key_selected(sender as Border); - } - } - */ - } - - private void virtualkeyboard_key_selected(Devices.DeviceKeys key) - { - if(key != DeviceKeys.NONE) - { - if (Global.key_recorder.HasRecorded(key)) - Global.key_recorder.RemoveKey(key); - else - Global.key_recorder.AddKey(key); - } - } - - private void keyBorder_MouseLeave(object sender, MouseEventArgs e) - { - } - - private void keyBorder_MouseEnter(object sender, MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed && sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - public void UpdateText() - { - if (Global.kbLayout.Loaded_Localization.IsAutomaticGeneration()) - { - - //if (keyCap.Text.Length > 1) - // return; - - StringBuilder sb = new StringBuilder(2); - var scan_code = KeyUtils.GetScanCode(associatedKey); - if (scan_code == -1) - return; - /*var key = KeyUtils.GetFormsKey((KeyboardKeys)associatedKey.LedID); - var scan_code = KeyUtils.MapVirtualKeyEx((uint)key, KeyUtils.MapVirtualKeyMapTypes.MapvkVkToVsc, (IntPtr)0x8090809);*/ - - int ret = KeyUtils.GetKeyNameTextW((uint)scan_code << 16, sb, 2); - keyCap.Text = sb.ToString(); - } - } - } -} diff --git a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycapBackglow.xaml.cs b/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycapBackglow.xaml.cs deleted file mode 100755 index 84e5f1eff..000000000 --- a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycapBackglow.xaml.cs +++ /dev/null @@ -1,183 +0,0 @@ -using Aurora.Devices; -using Aurora.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Aurora.Settings.Keycaps -{ - /// - /// Interaction logic for Control_DefaultKeycapBackglow.xaml - /// - public partial class Control_DefaultKeycapBackglow : UserControl, IKeycap - { - private Color current_color = Color.FromArgb(0, 0, 0, 0); - private Devices.DeviceKeys associatedKey = DeviceKeys.NONE; - private bool isImage = false; - - public Control_DefaultKeycapBackglow() - { - InitializeComponent(); - } - - public Control_DefaultKeycapBackglow(KeyboardKey key, string image_path) - { - InitializeComponent(); - - associatedKey = key.tag; - - this.Width = key.width.Value; - this.Height = key.height.Value; - - //Keycap adjustments - if (string.IsNullOrWhiteSpace(key.image)) - keyBorder.BorderThickness = new Thickness(1.5); - else - keyBorder.BorderThickness = new Thickness(0.0); - keyBorder.IsEnabled = key.enabled.Value; - - if (!key.enabled.Value) - { - ToolTipService.SetShowOnDisabled(keyBorder, true); - keyBorder.ToolTip = new ToolTip { Content = "Changes to this key are not supported" }; - } - - if (string.IsNullOrWhiteSpace(key.image)) - { - keyCap.Text = key.visualName; - keyCap.Tag = key.tag; - if (key.font_size != null) - keyCap.FontSize = key.font_size.Value; - keyCap.Visibility = System.Windows.Visibility.Visible; - } - else - { - keyCap.Visibility = System.Windows.Visibility.Hidden; - grid_backglow.Visibility = Visibility.Hidden; - - if (System.IO.File.Exists(image_path)) - { - var memStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(image_path)); - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = memStream; - image.EndInit(); - - if (key.tag == DeviceKeys.NONE) - keyBorder.Background = new ImageBrush(image); - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); - keyBorder.OpacityMask = new ImageBrush(image); - } - - isImage = true; - } - } - } - - public DeviceKeys GetKey() - { - return associatedKey; - } - - public void SetColor(Color key_color) - { - if (!current_color.Equals(key_color)) - { - if (!isImage) - { - keyCap.Foreground = new SolidColorBrush(key_color); - grid_backglow.Background = new SolidColorBrush(key_color); - } - else - { - if (associatedKey != DeviceKeys.NONE) - keyBorder.Background = new SolidColorBrush(key_color); - } - current_color = key_color; - } - - if (Global.key_recorder.HasRecorded(associatedKey)) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)0, (byte)(Math.Min(Math.Pow(Math.Cos((double)(Utils.Time.GetMilliSeconds() / 1000.0) * Math.PI) + 0.05, 2.0), 1.0) * 255), (byte)0)); - else - { - if (keyBorder.IsEnabled) - { - if (!isImage) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)30, (byte)30, (byte)30)); - else - keyBorder.Background = new SolidColorBrush(key_color); - } - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 100, 100, 100)); - keyBorder.BorderThickness = new Thickness(0); - } - } - UpdateText(); - } - - private void keyBorder_MouseDown(object sender, MouseButtonEventArgs e) - { - if (sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - private void keyBorder_MouseMove(object sender, MouseEventArgs e) - { - } - - private void virtualkeyboard_key_selected(Devices.DeviceKeys key) - { - if (key != DeviceKeys.NONE) - { - if (Global.key_recorder.HasRecorded(key)) - Global.key_recorder.RemoveKey(key); - else - Global.key_recorder.AddKey(key); - } - } - - private void keyBorder_MouseLeave(object sender, MouseEventArgs e) - { - } - - private void keyBorder_MouseEnter(object sender, MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed && sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - public void UpdateText() - { - if (Global.kbLayout.Loaded_Localization.IsAutomaticGeneration()) - { - - //if (keyCap.Text.Length > 1) - // return; - - StringBuilder sb = new StringBuilder(2); - var scan_code = KeyUtils.GetScanCode(associatedKey); - if (scan_code == -1) - return; - /*var key = KeyUtils.GetFormsKey((KeyboardKeys)associatedKey.LedID); - var scan_code = KeyUtils.MapVirtualKeyEx((uint)key, KeyUtils.MapVirtualKeyMapTypes.MapvkVkToVsc, (IntPtr)0x8090809);*/ - - int ret = KeyUtils.GetKeyNameTextW((uint)scan_code << 16, sb, 2); - keyCap.Text = sb.ToString(); - } - } - } -} diff --git a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycapBackglowOnly.xaml.cs b/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycapBackglowOnly.xaml.cs deleted file mode 100755 index 01724f290..000000000 --- a/Project-Aurora/Project-Aurora/Settings/Keycaps/Control_DefaultKeycapBackglowOnly.xaml.cs +++ /dev/null @@ -1,180 +0,0 @@ -using Aurora.Devices; -using Aurora.Utils; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; - -namespace Aurora.Settings.Keycaps -{ - /// - /// Interaction logic for Control_DefaultKeycapBackglowOnly.xaml - /// - public partial class Control_DefaultKeycapBackglowOnly : UserControl, IKeycap - { - private Color current_color = Color.FromArgb(0, 0, 0, 0); - private Devices.DeviceKeys associatedKey = DeviceKeys.NONE; - private bool isImage = false; - - public Control_DefaultKeycapBackglowOnly() - { - InitializeComponent(); - } - - public Control_DefaultKeycapBackglowOnly(KeyboardKey key, string image_path) - { - InitializeComponent(); - - associatedKey = key.tag; - - this.Width = key.width.Value; - this.Height = key.height.Value; - - //Keycap adjustments - if (string.IsNullOrWhiteSpace(key.image)) - keyBorder.BorderThickness = new Thickness(1.5); - else - keyBorder.BorderThickness = new Thickness(0.0); - keyBorder.IsEnabled = key.enabled.Value; - - if (!key.enabled.Value) - { - ToolTipService.SetShowOnDisabled(keyBorder, true); - keyBorder.ToolTip = new ToolTip { Content = "Changes to this key are not supported" }; - } - - if (string.IsNullOrWhiteSpace(key.image)) - { - keyCap.Text = key.visualName; - keyCap.Tag = key.tag; - if (key.font_size != null) - keyCap.FontSize = key.font_size.Value; - keyCap.Visibility = System.Windows.Visibility.Visible; - } - else - { - keyCap.Visibility = System.Windows.Visibility.Hidden; - grid_backglow.Visibility = Visibility.Hidden; - - if (System.IO.File.Exists(image_path)) - { - var memStream = new System.IO.MemoryStream(System.IO.File.ReadAllBytes(image_path)); - BitmapImage image = new BitmapImage(); - image.BeginInit(); - image.StreamSource = memStream; - image.EndInit(); - - if (key.tag == DeviceKeys.NONE) - keyBorder.Background = new ImageBrush(image); - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 0, 0, 0)); - keyBorder.OpacityMask = new ImageBrush(image); - } - - isImage = true; - } - } - } - - public DeviceKeys GetKey() - { - return associatedKey; - } - - public void SetColor(Color key_color) - { - if (!current_color.Equals(key_color)) - { - if (!isImage) - grid_backglow.Background = new SolidColorBrush(key_color); - else - { - if (associatedKey != DeviceKeys.NONE) - keyBorder.Background = new SolidColorBrush(key_color); - } - current_color = key_color; - } - - if (Global.key_recorder.HasRecorded(associatedKey)) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)0, (byte)(Math.Min(Math.Pow(Math.Cos((double)(Utils.Time.GetMilliSeconds() / 1000.0) * Math.PI) + 0.05, 2.0), 1.0) * 255), (byte)0)); - else - { - if (keyBorder.IsEnabled) - { - if(!isImage) - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb((byte)255, (byte)30, (byte)30, (byte)30)); - else - keyBorder.Background = new SolidColorBrush(key_color); - } - else - { - keyBorder.Background = new SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 100, 100, 100)); - keyBorder.BorderThickness = new Thickness(0); - } - } - UpdateText(); - } - - private void keyBorder_MouseDown(object sender, MouseButtonEventArgs e) - { - if (sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - private void keyBorder_MouseMove(object sender, MouseEventArgs e) - { - } - - private void virtualkeyboard_key_selected(Devices.DeviceKeys key) - { - if (key != DeviceKeys.NONE) - { - if (Global.key_recorder.HasRecorded(key)) - Global.key_recorder.RemoveKey(key); - else - Global.key_recorder.AddKey(key); - } - } - - private void keyBorder_MouseLeave(object sender, MouseEventArgs e) - { - } - - private void keyBorder_MouseEnter(object sender, MouseEventArgs e) - { - if (e.LeftButton == MouseButtonState.Pressed && sender is Border) - virtualkeyboard_key_selected(associatedKey); - } - - public void UpdateText() - { - if (Global.kbLayout.Loaded_Localization.IsAutomaticGeneration()) - { - - //if (keyCap.Text.Length > 1) - // return; - - StringBuilder sb = new StringBuilder(2); - var scan_code = KeyUtils.GetScanCode(associatedKey); - if (scan_code == -1) - return; - /*var key = KeyUtils.GetFormsKey((KeyboardKeys)associatedKey.LedID); - var scan_code = KeyUtils.MapVirtualKeyEx((uint)key, KeyUtils.MapVirtualKeyMapTypes.MapvkVkToVsc, (IntPtr)0x8090809);*/ - - int ret = KeyUtils.GetKeyNameTextW((uint)scan_code << 16, sb, 2); - keyCap.Text = sb.ToString(); - } - } - } -} diff --git a/Project-Aurora/Project-Aurora/Settings/Keycaps/IKeycap.cs b/Project-Aurora/Project-Aurora/Settings/Keycaps/IKeycap.cs deleted file mode 100644 index 69e25e780..000000000 --- a/Project-Aurora/Project-Aurora/Settings/Keycaps/IKeycap.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Media; - -namespace Aurora.Settings.Keycaps -{ - public interface IKeycap - { - void SetColor(Color key_color); - - Devices.DeviceKeys GetKey(); - } -} diff --git a/Project-Aurora/Project-Aurora/Settings/Layers/AmbilightLayerHandler.cs b/Project-Aurora/Project-Aurora/Settings/Layers/AmbilightLayerHandler.cs index 3037f8837..bac5b6dc9 100644 --- a/Project-Aurora/Project-Aurora/Settings/Layers/AmbilightLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Settings/Layers/AmbilightLayerHandler.cs @@ -17,11 +17,12 @@ using System.Linq; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Text; -using System.Threading.Tasks; -using System.Timers; +using System.Threading; +using System.Windows; using System.Windows.Forms; -using Timer = System.Timers.Timer; +using Amib.Threading; +using Point = System.Drawing.Point; +using Size = System.Drawing.Size; namespace Aurora.Settings.Layers { @@ -68,122 +69,184 @@ public enum AmbilightFpsChoice Highest, } - public enum AmbilightQuality - { - [Description("Lowest")] - VeryLow = 0, - - [Description("Low")] - Low, - - [Description("Medium")] - Medium, - - [Description("High")] - High, - - [Description("Highest")] - Highest, - } #endregion public class AmbilightLayerHandlerProperties : LayerHandlerProperties2Color { - public AmbilightType? _AmbilightType { get; set; } - [JsonIgnore] - public AmbilightType AmbilightType { get { return Logic._AmbilightType ?? _AmbilightType ?? AmbilightType.Default; } } + private AmbilightType? _ambilightType; - public AmbilightCaptureType? _AmbilightCaptureType { get; set; } + [JsonProperty("_AmbilightType")] + public AmbilightType AmbilightType + { + get => Logic._ambilightType ?? _ambilightType ?? AmbilightType.Default; + set + { + _ambilightType = value; + OnPropertiesChanged(this); + } + } [JsonIgnore] - public AmbilightCaptureType AmbilightCaptureType { get { return Logic._AmbilightCaptureType ?? _AmbilightCaptureType ?? AmbilightCaptureType.EntireMonitor; } } + private AmbilightCaptureType? _ambilightCaptureType; + + [JsonProperty("_AmbilightCaptureType")] + public AmbilightCaptureType AmbilightCaptureType + { + get => Logic._ambilightCaptureType ?? _ambilightCaptureType ?? AmbilightCaptureType.EntireMonitor; + set + { + _ambilightCaptureType = value; + OnPropertiesChanged(this); + } + } public int? _AmbilightOutputId { get; set; } [JsonIgnore] - public int AmbilightOutputId { get { return Logic._AmbilightOutputId ?? _AmbilightOutputId ?? 0; } } - - public AmbilightFpsChoice? _AmbiLightUpdatesPerSecond { get; set; } + public int AmbilightOutputId => Logic._AmbilightOutputId ?? _AmbilightOutputId ?? 0; [JsonIgnore] - public AmbilightFpsChoice AmbiLightUpdatesPerSecond => Logic._AmbiLightUpdatesPerSecond ?? _AmbiLightUpdatesPerSecond ?? AmbilightFpsChoice.Medium; + private AmbilightFpsChoice? _ambiLightUpdatesPerSecond; - public String _SpecificProcess { get; set; } + [JsonProperty("_AmbiLightUpdatesPerSecond")] + public AmbilightFpsChoice AmbiLightUpdatesPerSecond + { + get => Logic._ambiLightUpdatesPerSecond ?? _ambiLightUpdatesPerSecond ?? AmbilightFpsChoice.Medium; + set + { + _ambiLightUpdatesPerSecond = value; + OnPropertiesChanged(this); + } + } [JsonIgnore] - public String SpecificProcess { get { return Logic._SpecificProcess ?? _SpecificProcess ?? String.Empty; } } - - [LogicOverridable("Coordinates")] public Rectangle? _Coordinates { get; set; } + private string _specificProcess; + + [JsonProperty("_SpecificProcess")] + public string SpecificProcess + { + get => Logic._specificProcess ?? _specificProcess ?? string.Empty; + set + { + _specificProcess = value; + OnPropertiesChanged(this); + } + } [JsonIgnore] - public Rectangle Coordinates { get { return Logic._Coordinates ?? _Coordinates ?? Rectangle.Empty; } } - - public AmbilightQuality? _AmbilightQuality { get; set; } + private Rectangle? _coordinates; - [JsonIgnore] - public AmbilightQuality AmbilightQuality { get { return Logic._AmbilightQuality ?? _AmbilightQuality ?? AmbilightQuality.Medium; } } + [JsonProperty("_Coordinates")] + [LogicOverridable("Coordinates")] + public Rectangle Coordinates + { + get => Logic._coordinates ?? _coordinates ?? Rectangle.Empty; + set + { + _coordinates = value; + OnPropertiesChanged(this); + } + } public bool? _BrightenImage { get; set; } [JsonIgnore] - public bool BrightenImage { get { return Logic._BrightenImage ?? _BrightenImage ?? false; } } + public bool BrightenImage => Logic._BrightenImage ?? _BrightenImage ?? false; - public float? _BrightnessChange { get; set; } [JsonIgnore] - public float BrightnessChange => Logic._BrightnessChange ?? _BrightnessChange ?? 0.0f; + private float? _brightnessChange; + + [JsonProperty("_BrightnessChange")] + public float BrightnessChange + { + get => Logic._brightnessChange ?? _brightnessChange ?? 0.0f; + set + { + _brightnessChange = value; + OnPropertiesChanged(this); + } + } public bool? _SaturateImage { get; set; } [JsonIgnore] - public bool SaturateImage { get { return Logic._SaturateImage ?? _SaturateImage ?? false; } } + public bool SaturateImage => Logic._SaturateImage ?? _SaturateImage ?? false; - public float? _SaturationChange { get; set; } [JsonIgnore] - public float SaturationChange => Logic._SaturationChange ?? _SaturationChange ?? 0.0f; + private float? _saturationChange; + + [JsonProperty("_SaturationChange")] + public float SaturationChange + { + get => Logic._saturationChange ?? _saturationChange ?? 0.0f; + set + { + _saturationChange = value; + OnPropertiesChanged(this); + } + } public bool? _FlipVertically { get; set; } [JsonIgnore] public bool FlipVertically => Logic._FlipVertically ?? _FlipVertically ?? false; - public bool? _ExperimentalMode { get; set; } - [JsonIgnore] - public bool ExperimentalMode => Logic._ExperimentalMode ?? _ExperimentalMode ?? false; + private bool? _experimentalMode; + + [JsonProperty("_ExperimentalMode")] + public bool ExperimentalMode + { + get => Logic._experimentalMode ?? _experimentalMode ?? false; + set + { + _experimentalMode = value; + OnPropertiesChanged(this); + } + } public bool? _HueShiftImage { get; set; } [JsonIgnore] - public bool HueShiftImage { get { return Logic._HueShiftImage ?? _HueShiftImage ?? false; } } + public bool HueShiftImage => Logic._HueShiftImage ?? _HueShiftImage ?? false; - public float? _HueShiftAngle { get; set; } [JsonIgnore] - public float HueShiftAngle => Logic._HueShiftAngle ?? _HueShiftAngle ?? 0.0f; + private float? _hueShiftAngle; + [JsonProperty("_HueShiftAngle")] + public float HueShiftAngle + { + get => Logic._hueShiftAngle ?? _hueShiftAngle ?? 0.0f; + set + { + _hueShiftAngle = value; + OnPropertiesChanged(this); + } + } - public AmbilightLayerHandlerProperties() : base() { } + public AmbilightLayerHandlerProperties() + { } - public AmbilightLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } + public AmbilightLayerHandlerProperties(bool assignDefault = false) : base(assignDefault) { } public override void Default() { base.Default(); - this._AmbilightOutputId = 0; - this._AmbiLightUpdatesPerSecond = AmbilightFpsChoice.Medium; - this._AmbilightType = AmbilightType.Default; - this._AmbilightCaptureType = AmbilightCaptureType.EntireMonitor; - this._SpecificProcess = ""; - this._Coordinates = new Rectangle(0, 0, 0, 0); - this._AmbilightQuality = AmbilightQuality.Medium; - this._BrightenImage = false; - this._BrightnessChange = 1.0f; - this._SaturateImage = false; - this._SaturationChange = 1.0f; - this._FlipVertically = false; - this._ExperimentalMode = false; - this._HueShiftImage = false; - this._HueShiftAngle = 0.0f; - this._Sequence = new KeySequence(Effects.WholeCanvasFreeForm); + _AmbilightOutputId = 0; + _ambiLightUpdatesPerSecond = AmbilightFpsChoice.Medium; + _ambilightType = AmbilightType.Default; + _ambilightCaptureType = AmbilightCaptureType.EntireMonitor; + _specificProcess = ""; + _coordinates = new Rectangle(0, 0, 0, 0); + _BrightenImage = false; + _brightnessChange = 1.0f; + _SaturateImage = false; + _saturationChange = 1.0f; + _FlipVertically = false; + _experimentalMode = false; + _HueShiftImage = false; + _hueShiftAngle = 0.0f; + _Sequence = new KeySequence(Effects.WholeCanvasFreeForm); } } @@ -193,160 +256,115 @@ public override void Default() [DoNotNotify] public class AmbilightLayerHandler : LayerHandler, INotifyPropertyChanged { - private IScreenCapture screenCapture; - private readonly Timer captureTimer; - private Bitmap screen; - private long last_use_time = 0; - private IntPtr specificProcessHandle = IntPtr.Zero; - private Rectangle cropRegion; + private IScreenCapture _screenCapture; + + private readonly SmartThreadPool _captureWorker = new(1000, 1); + private TimeSpan _screenshotInterval; + private readonly WorkItemCallback _screenshotWork; + + private Brush _screenBrush; + private IntPtr _specificProcessHandle = IntPtr.Zero; + private Rectangle _cropRegion = new(8, 8, 8, 8); + private readonly EffectLayer _ambilightLayer = new("Ambilight Layer"); + private ImageAttributes _imageAttributes = new(); #region Bindings - public IEnumerable Displays => screenCapture.GetDisplays(); + public IEnumerable Displays => _screenCapture.GetDisplays(); - public int OutputId - { - get => Properties.AmbilightOutputId; - set - { - if (Properties._AmbilightOutputId != value) - { - Properties._AmbilightOutputId = value; - InvokePropertyChanged(nameof(OutputId)); - Initialize(); - } - } - } + public bool UseDx => Properties.ExperimentalMode; - public bool UseDX - { - get => Properties.ExperimentalMode; - set - { - if (Properties._ExperimentalMode != value) - { - Properties._ExperimentalMode = value; - InvokePropertyChanged(nameof(UseDX)); - Initialize(); - } - } - } #endregion public AmbilightLayerHandler() { Initialize(); - captureTimer = new Timer(GetIntervalFromFPS(Properties.AmbiLightUpdatesPerSecond)); - captureTimer.Elapsed += TakeScreenshot; + _screenshotWork = TakeScreenshot; + RunningProcessMonitor.Instance.RunningProcessesChanged += ProcessesChanged; //TODO this is memory leak. WeakEventHandler doesnt work } - public void Initialize() + private void Initialize() { if (Properties.ExperimentalMode) { - screenCapture = new DXScreenCapture(); + _screenCapture?.Dispose(); + _screenCapture = new DXScreenCapture(); try { //this won't work on some systems - screenCapture.SetDisplay(Properties.AmbilightOutputId); - //Console.WriteLine("Started experimental ambilight mode"); Global.logger.Info("Started experimental ambilight mode"); + InvokePropertyChanged(nameof(Displays)); + return; } catch (SharpDXException e) { - (screenCapture as DXScreenCapture)?.Dispose(); //Console.WriteLine("Error using experimental ambilight mode: " + e); Global.logger.Error("Error using experimental ambilight mode: " + e); - Properties._ExperimentalMode = false; - InvokePropertyChanged(nameof(UseDX)); - - screenCapture = new GDIScreenCapture(); - screenCapture.SetDisplay(Properties.AmbilightOutputId); + Properties.ExperimentalMode = false; + InvokePropertyChanged(nameof(UseDx)); } } - else - { - screenCapture = new GDIScreenCapture(); - screenCapture.SetDisplay(Properties.AmbilightOutputId); - Global.logger.Info("Started regular ambilight mode"); - //Console.WriteLine("Started regular ambilight mode"); - } - - cropRegion = screenCapture.CurrentScreenBounds; + _screenCapture?.Dispose(); + _screenCapture = new GDIScreenCapture(); + Global.logger.Info("Started regular ambilight mode"); InvokePropertyChanged(nameof(Displays)); } public override EffectLayer Render(IGameState gamestate) { - var ambilight_layer = new EffectLayer(); - - last_use_time = Time.GetMillisecondsSinceEpoch(); - - if (!captureTimer.Enabled) - captureTimer.Start(); + //This is needed to prevent the layer from disappearing + //for a frame when the user alt-tabs with the foregroundapp option selected + if (TryGetCropRegion(out var newCropRegion)) + _cropRegion = newCropRegion; - var interval = GetIntervalFromFPS(Properties.AmbiLightUpdatesPerSecond); - if (captureTimer.Interval != interval) - captureTimer.Interval = interval; + if (_captureWorker.WaitingCallbacks < 1) + { + _captureWorker.QueueWorkItem(_screenshotWork); + } - if (screen is null) - return ambilight_layer; + if (_screenBrush is null) + return _ambilightLayer; var region = Properties.Sequence.GetAffectedRegion(); - if (region.Width == 0 || region.Height == 0) - return ambilight_layer; - - //This is needed to prevent the layer from disappearing - //for a frame when the user alt-tabs with the foregroundapp option selected - if (TryGetCropRegion(out var newCropRegion)) - cropRegion = newCropRegion; + if (region.IsEmpty) + return _ambilightLayer; //and because of that, this should never happen - if (cropRegion.Width == 0 || cropRegion.Height == 0) - return ambilight_layer; + if (_cropRegion.IsEmpty) + return _ambilightLayer; switch (Properties.AmbilightType) { + default: case AmbilightType.Default: - ambilight_layer.DrawTransformed(Properties.Sequence, + lock (_screenBrush) + _ambilightLayer.DrawTransformed(Properties.Sequence, m => { if (Properties.FlipVertically) { m.Scale(1, -1, MatrixOrder.Prepend); - m.Translate(0, -Effects.canvas_height, MatrixOrder.Prepend); + m.Translate(0, -_cropRegion.Height, MatrixOrder.Prepend); } }, g => { - var mtx = BitmapUtils.GetEmptyColorMatrix(); - if (Properties.BrightenImage) - mtx = BitmapUtils.ColorMatrixMultiply(mtx, BitmapUtils.GetBrightnessColorMatrix(Properties.BrightnessChange)); - - if (Properties.SaturateImage) - mtx = BitmapUtils.ColorMatrixMultiply(mtx, BitmapUtils.GetSaturationColorMatrix(Properties.SaturationChange)); - - if (Properties.HueShiftImage) - mtx = BitmapUtils.ColorMatrixMultiply(mtx, BitmapUtils.GetHueShiftColorMatrix(Properties.HueShiftAngle)); - - var att = new ImageAttributes(); - att.SetColorMatrix(new ColorMatrix(mtx)); - - g.DrawImage( - screen, - new Rectangle(0, 0, Effects.canvas_width, Effects.canvas_height), - cropRegion.X, - cropRegion.Y, - cropRegion.Width, - cropRegion.Height, - GraphicsUnit.Pixel, - att); + g.Clear(Color.Transparent); + g.FillRectangle(_screenBrush, 0, 0, _cropRegion.Width, _cropRegion.Height); }, - new Rectangle(0, 0, Effects.canvas_width, Effects.canvas_height) + new Rectangle(0, 0, _cropRegion.Width, _cropRegion.Height) ); break; case AmbilightType.AverageColor: - var average = BitmapUtils.GetRegionColor(screen, cropRegion); + var oneColorBitmap = new Bitmap(1, 1); + using (var g = Graphics.FromImage(oneColorBitmap)) + { + g.InterpolationMode = InterpolationMode.HighQualityBicubic; + g.SmoothingMode = SmoothingMode.AntiAlias; + g.FillRectangle(_screenBrush, 0, 0, 1, 1); + } + + var average = oneColorBitmap.GetPixel(0, 0); if (Properties.BrightenImage) average = ColorUtils.ChangeBrightness(average, Properties.BrightnessChange); @@ -357,11 +375,11 @@ public override EffectLayer Render(IGameState gamestate) if (Properties.HueShiftImage) average = ColorUtils.ChangeHue(average, Properties.HueShiftAngle); - ambilight_layer.Set(Properties.Sequence, average); + _ambilightLayer.Set(Properties.Sequence, average); break; } - return ambilight_layer; + return _ambilightLayer; } protected override System.Windows.Controls.UserControl CreateControl() @@ -369,25 +387,93 @@ protected override System.Windows.Controls.UserControl CreateControl() return new Control_AmbilightLayer(this); } - private void TakeScreenshot(object sender, ElapsedEventArgs e) + private readonly Stopwatch _captureStopwatch = new(); + private object TakeScreenshot(object sender) { - if (Time.GetMillisecondsSinceEpoch() - last_use_time > 2000) - captureTimer.Stop(); + try + { + return TryTakeScreenshot(); + } + catch (Exception e) + { + Console.WriteLine(e); + return null; + } + } - var bigScreen = screenCapture.Capture(); + private object TryTakeScreenshot() + { + _captureStopwatch.Restart(); + var bigScreen = _screenCapture.Capture(_cropRegion); + WaitTimer(_captureStopwatch.Elapsed); if (bigScreen is null) - return; + return null; + + CreateScreenBrush(bigScreen, _cropRegion); + return null; + } + + private void WaitTimer(TimeSpan elapsed) + { + if (_screenshotInterval > elapsed) + Thread.Sleep(_screenshotInterval - elapsed); + else + Thread.Sleep(_screenshotInterval); + } + + private void CreateScreenBrush(Bitmap bigScreen, Rectangle cropRegion) + { + switch (Properties.AmbilightType) + { + default: + case AmbilightType.Default: + _screenBrush = new TextureBrush(bigScreen, new Rectangle(0, 0, bigScreen.Width, bigScreen.Height), _imageAttributes); + break; + case AmbilightType.AverageColor: + var average = BitmapUtils.GetRegionColor(bigScreen, new Rectangle(Point.Empty, cropRegion.Size)); - var scale = GetScaleFromQuality(Properties.AmbilightQuality); + if (Properties.BrightenImage) + average = ColorUtils.ChangeBrightness(average, Properties.BrightnessChange); + if (Properties.SaturateImage) + average = ColorUtils.ChangeSaturation(average, Properties.SaturationChange); + if (Properties.HueShiftImage) + average = ColorUtils.ChangeHue(average, Properties.HueShiftAngle); + + _screenBrush = new SolidBrush(average); + break; + } + } - Bitmap smallScreen = new Bitmap(bigScreen.Width / scale, bigScreen.Height / scale); + [MethodImpl(MethodImplOptions.Synchronized)] + protected override void PropertiesChanged(object sender, PropertyChangedEventArgs args) + { + base.PropertiesChanged(sender, args); - using (var graphics = Graphics.FromImage(smallScreen)) - graphics.DrawImage(bigScreen, 0, 0, bigScreen.Width / scale, bigScreen.Height / scale); + _screenshotInterval = GetIntervalFromFps(Properties.AmbiLightUpdatesPerSecond); + + Initialize(); - bigScreen?.Dispose(); + var mtx = BitmapUtils.GetEmptyColorMatrix(); + if (Properties.BrightenImage) + mtx = BitmapUtils.ColorMatrixMultiply(mtx, BitmapUtils.GetBrightnessColorMatrix(Properties.BrightnessChange)); + if (Properties.SaturateImage) + mtx = BitmapUtils.ColorMatrixMultiply(mtx, BitmapUtils.GetSaturationColorMatrix(Properties.SaturationChange)); + if (Properties.HueShiftImage) + mtx = BitmapUtils.ColorMatrixMultiply(mtx, BitmapUtils.GetHueShiftColorMatrix(Properties.HueShiftAngle)); + _imageAttributes = new ImageAttributes(); + _imageAttributes.SetColorMatrix(new ColorMatrix(mtx)); + _imageAttributes.SetWrapMode(WrapMode.Clamp); + + UpdateSpecificProcessHandle(Properties.SpecificProcess); + + _ambilightLayer.Clear(); + _screenBrush = null; + } - screen = smallScreen; + private void ProcessesChanged(object sender, RunningProcessChanged args) + { + if (args.ProcessName.StartsWith(Properties.SpecificProcess)) + UpdateSpecificProcessHandle(Properties.SpecificProcess); } #region Helper Methods @@ -404,16 +490,13 @@ private bool TryGetCropRegion(out Rectangle crop) { case AmbilightCaptureType.EntireMonitor: //we're using the whole screen, so we don't crop at all - crop = new Rectangle(Point.Empty, screen.Size); + crop = Screen.AllScreens[Properties.AmbilightOutputId].Bounds; break; case AmbilightCaptureType.SpecificProcess: case AmbilightCaptureType.ForegroundApp: - IntPtr handle; - - if (Properties.AmbilightCaptureType == AmbilightCaptureType.ForegroundApp) - handle = User32.GetForegroundWindow(); - else - handle = specificProcessHandle; + default: + var handle = Properties.AmbilightCaptureType == AmbilightCaptureType.ForegroundApp ? + User32.GetForegroundWindow() : _specificProcessHandle; if (handle == IntPtr.Zero) return false;//happens when alt tabbing @@ -421,57 +504,33 @@ private bool TryGetCropRegion(out Rectangle crop) var appRect = new User32.Rect(); User32.GetWindowRect(handle, ref appRect); - var appDisplay = Screen.FromHandle(handle).Bounds; - - screenCapture.SwitchDisplay(appDisplay); - - crop = GetResized(new Rectangle( - appRect.Left - appDisplay.Left, - appRect.Top - appDisplay.Top, - appRect.Right - appRect.Left, - appRect.Bottom - appRect.Top)); + crop = new Rectangle( + appRect.Left, + appRect.Top, + appRect.Right - appRect.Left, + appRect.Bottom - appRect.Top); break; case AmbilightCaptureType.Coordinates: - screenCapture.SwitchDisplay(Screen.FromRectangle(Properties.Coordinates).Bounds); - - crop = GetResized(new Rectangle( - Properties.Coordinates.Left - screenCapture.CurrentScreenBounds.Left, - Properties.Coordinates.Top - screenCapture.CurrentScreenBounds.Top, - Properties.Coordinates.Width, - Properties.Coordinates.Height)); + var screenBounds = Screen.AllScreens[Properties.AmbilightOutputId].Bounds; + crop = new Rectangle( + Properties.Coordinates.Left - screenBounds.Left, + Properties.Coordinates.Top - screenBounds.Top, + Properties.Coordinates.Width, + Properties.Coordinates.Height); break; } - return crop.Width != 0 && crop.Height != 0; - } - - /// - /// Resizes a given screen region for the position to coincide with the (also resized) screenshot - /// - /// - /// - private Rectangle GetResized(Rectangle r) - { - var scale = GetScaleFromQuality(Properties.AmbilightQuality); - return new Rectangle(r.X / scale, r.Y / scale, r.Width / scale, r.Height / scale); + return crop.Width > 4 && crop.Height > 4; } - /// - /// Converts the AmbilightQuality Enum in an integer for the bitmap to be divided by. - /// Lower quality values result in a higher divisor, which results in a smaller bitmap - /// - /// - /// - private static int GetScaleFromQuality(AmbilightQuality quality) => (int)Math.Pow(2, 4 - (int)quality); - /// /// Returns an interval in ms usign the AmbilightFpsChoice enum. /// Higher values result in lower intervals /// /// /// - private static int GetIntervalFromFPS(AmbilightFpsChoice fps) => 1000 / (10 + 5 * (int)fps); + private static TimeSpan GetIntervalFromFps(AmbilightFpsChoice fps) => new(0, 0,0, 0, 1000 / (10 + 5 * (int)fps)); /// /// Updates the handle of the window used to crop the screenshot @@ -479,12 +538,14 @@ private Rectangle GetResized(Rectangle r) /// public void UpdateSpecificProcessHandle(string process) { - var a = Array.Find(Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(process)) - , p => p.MainWindowHandle != IntPtr.Zero); + var a = Array.Find( + Process.GetProcessesByName(System.IO.Path.GetFileNameWithoutExtension(process)), + p => p.MainWindowHandle != IntPtr.Zero + ); - if (a != null && a.MainWindowHandle != IntPtr.Zero) + if (a != null) { - specificProcessHandle = a.MainWindowHandle; + _specificProcessHandle = a.MainWindowHandle; } } #endregion @@ -504,165 +565,135 @@ public struct Rect [DllImport("user32.dll")] public static extern IntPtr GetWindowRect(IntPtr hWnd, ref Rect rect); - [System.Runtime.InteropServices.DllImport("user32.dll")] + [DllImport("user32.dll")] public static extern IntPtr GetForegroundWindow(); } #endregion #region PropertyChanged public event PropertyChangedEventHandler PropertyChanged; - protected void InvokePropertyChanged([CallerMemberName] string propertyName = null) => + + private void InvokePropertyChanged([CallerMemberName] string propertyName = null) => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); #endregion } - internal interface IScreenCapture + internal interface IScreenCapture : IDisposable { - /// - /// Represents the bounds of the screen currently being captured. - /// - Rectangle CurrentScreenBounds { get; set; } - - /// - /// Initializes an IScreenCapture taking the displayID - /// - /// - void SetDisplay(int screen); - - /// - /// Using the target coordinates, switches to capture the correct display if needed - /// - /// - void SwitchDisplay(Rectangle target); - /// /// Captures a screenshot of the full screen, returning a full resolution bitmap /// /// - Bitmap Capture(); + Bitmap Capture(Rectangle desktopRegion); IEnumerable GetDisplays(); } internal class GDIScreenCapture : IScreenCapture { - public Rectangle CurrentScreenBounds { get; set; } - - public void SetDisplay(int screen) - { - var outputs = Screen.AllScreens; - - if (screen > (outputs.Length - 1) || screen < 0) - screen = 0; + private Bitmap _targetBitmap = new(8, 8); + private Size _targetSize = new(8, 8); - CurrentScreenBounds = outputs.ElementAtOrDefault(screen).Bounds; - } - - public Bitmap Capture() - { - if (CurrentScreenBounds.Width == 0 || CurrentScreenBounds.Height == 0) - return null; - - var bigScreen = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height); - - using (var g = Graphics.FromImage(bigScreen)) - g.CopyFromScreen(CurrentScreenBounds.X, CurrentScreenBounds.Y, 0, 0, CurrentScreenBounds.Size); - - return bigScreen; - } - - public void SwitchDisplay(Rectangle target) + public Bitmap Capture(Rectangle desktopRegion) { - if (CurrentScreenBounds == target) - return; - - int targetDisplay = Array.FindIndex(Screen.AllScreens, d => d.Bounds == target); - if (targetDisplay == -1) - return; + if (_targetSize != desktopRegion.Size) + { + _targetBitmap.Dispose(); + _targetBitmap = new Bitmap(desktopRegion.Width, desktopRegion.Height); + _targetSize = desktopRegion.Size; + } + using (var g = Graphics.FromImage(_targetBitmap)) + { + g.CompositingMode = CompositingMode.SourceCopy; + g.CopyFromScreen(desktopRegion.X, desktopRegion.Y, 0, 0, desktopRegion.Size); + } - SetDisplay(targetDisplay); + return _targetBitmap; } public IEnumerable GetDisplays() => Screen.AllScreens.Select((s, index) => $"Display {index + 1}: X:{s.Bounds.X}, Y:{s.Bounds.Y}, W:{s.Bounds.Width}, H:{s.Bounds.Height}"); + + public void Dispose() + { + _targetBitmap?.Dispose(); + } } internal class DXScreenCapture : IScreenCapture { - public Rectangle CurrentScreenBounds { get; set; } - private DesktopDuplicator desktopDuplicator; - private bool processing = false; - private int display; - private static readonly object deskDupLock = new object(); + private static readonly Semaphore Semaphore = new(1, 1); + private Rectangle _currentBounds; + private DesktopDuplicator _desktopDuplicator; + private int _display; - public Bitmap Capture() + public Bitmap Capture(Rectangle desktopRegion) { - if (CurrentScreenBounds.Width == 0 || CurrentScreenBounds.Height == 0) - return null; - if (desktopDuplicator is null) - return null; - if (processing) - return null; - - var bigScreen = new Bitmap(CurrentScreenBounds.Width, CurrentScreenBounds.Height); + SetTarget(desktopRegion); + try{ + Semaphore.WaitOne(); + return _currentBounds.IsEmpty ? null : _desktopDuplicator?.Capture(5000); + }finally{ + Semaphore.Release(); + } + } - try + private void SetTarget(Rectangle desktopRegion) + { + var outputs = GetAdapters(); + Adapter1 currentAdapter = null; + Output1 currentOutput = null; + if (desktopRegion.Left < 0 || desktopRegion.Top < 0) { - processing = true; - lock (deskDupLock) - bigScreen = desktopDuplicator.Capture(5000); - processing = false; + (Adapter1 Adapter, Output1 Output) firstScreen = outputs.First(); + currentAdapter = firstScreen.Adapter; + currentOutput = firstScreen.Output; } - catch (SharpDXException e) + else { - Global.logger.Error("[Ambilight] Error capturing screen, restarting: : " + e); - processing = false; - SetDisplay(display); + foreach (var (adapter, output) in outputs) + { + if (!RectangleContains(output.Description.DesktopBounds, desktopRegion)) continue; + currentAdapter = adapter; + currentOutput = output; + break; + } } - if (bigScreen is null) - processing = false; - - return bigScreen; - } - - public void SwitchDisplay(Rectangle target) - { - if (CurrentScreenBounds == target) + if (currentAdapter == null) + { return; + } - var screens = GetAdapters().ToArray(); - var targetDisplay = Array.FindIndex(screens, d => RectangleEquals(d.Output.Description.DesktopBounds, target)); - if (targetDisplay == -1) + var desktopBounds = currentOutput.Description.DesktopBounds; + var screenWindowRectangle = new Rectangle( + Math.Max(0, desktopRegion.Left - desktopBounds.Left), + Math.Max(0, desktopRegion.Top - desktopBounds.Top), + Math.Min(desktopRegion.Width, desktopBounds.Right - desktopRegion.Left), + Math.Min(desktopRegion.Height, desktopBounds.Bottom - desktopRegion.Top) + ); + + if (screenWindowRectangle == _currentBounds && _desktopDuplicator != null) + { return; + } - SetDisplay(targetDisplay); - } - - public void SetDisplay(int screen) - { - desktopDuplicator?.Dispose(); + _currentBounds = screenWindowRectangle; - var outputs = GetAdapters(); - if (screen > (outputs.Count() - 1) || screen < 0) - screen = 0; - display = screen; - var output = outputs.ElementAt(screen); - var desktopbounds = output.Output.Description.DesktopBounds; - CurrentScreenBounds = new Rectangle(desktopbounds.Left, - desktopbounds.Top, - desktopbounds.Right - desktopbounds.Left, - desktopbounds.Bottom - desktopbounds.Top); - - lock (deskDupLock) + try { - while (processing) { } - desktopDuplicator = new DesktopDuplicator(output.Adapter, output.Output, CurrentScreenBounds); + Semaphore.WaitOne(); + _desktopDuplicator?.Dispose(); + _desktopDuplicator = new DesktopDuplicator(currentAdapter, currentOutput, _currentBounds); + } + finally + { + Semaphore.Release(); } } - public IEnumerable GetDisplays() => GetAdapters().Select(((Adapter1 Adapter, Output1 Output) s, int index) => + public IEnumerable GetDisplays() => GetAdapters().Select((s, index) => { var b = s.Output.Description.DesktopBounds; @@ -671,15 +702,28 @@ public IEnumerable GetDisplays() => GetAdapters().Select(((Adapter1 Adap private static IEnumerable<(Adapter1 Adapter, Output1 Output)> GetAdapters() { - using (var fac = new Factory1()) - return fac.Adapters1.SelectMany(M => M.Outputs.Select(N => (M, N.QueryInterface()))); + using var fac = new Factory1(); + return fac.Adapters1.SelectMany(m => m.Outputs.Select(n => (M: m, n.QueryInterface()))); } - private static bool RectangleEquals(RawRectangle raw, Rectangle rec) + private static bool RectangleContains(RawRectangle containingRactangle, Rectangle rec) { - return (raw.Left == rec.Left) && (raw.Top == rec.Top) && (raw.Right == rec.Right) && (raw.Bottom == rec.Bottom); + return containingRactangle.Left <= rec.X && containingRactangle.Right > rec.X && + containingRactangle.Top <= rec.Y && containingRactangle.Bottom > rec.Y; } - public void Dispose() => desktopDuplicator?.Dispose(); + public void Dispose() + { + try + { + Semaphore.WaitOne(); + _desktopDuplicator?.Dispose(); + } + finally + { + Semaphore.Release(); + } + _desktopDuplicator = null; + } } } diff --git a/Project-Aurora/Project-Aurora/Settings/Layers/AnimationLayerHandler.cs b/Project-Aurora/Project-Aurora/Settings/Layers/AnimationLayerHandler.cs index 7d1bcd3a3..2e7ac1b42 100755 --- a/Project-Aurora/Project-Aurora/Settings/Layers/AnimationLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Settings/Layers/AnimationLayerHandler.cs @@ -126,8 +126,8 @@ public override EffectLayer Render(IGameState gamestate) { long dt = _animTimeStopwatch.ElapsedMilliseconds; _animTimeStopwatch.Restart(); - // Update all running animations. We have to call "ToList()" to prevent "Collection was modified; enumeration operation may not execute" - runningAnimations.ToList().ForEach(anim => { + // Update all running animations. + runningAnimations.ForEach(anim => { anim.currentTime += dt / 1000f; if (Properties.AnimationRepeat > 0) anim.playTimes += (int)(anim.currentTime / Properties.AnimationDuration); @@ -141,18 +141,18 @@ public override EffectLayer Render(IGameState gamestate) { // Check to see if the gamestate will cause any animations to trigger CheckTriggers(gamestate); - // Render each playing animation. We have to call "ToList()" to prevent "Collection was modified; enumeration operation may not execute" - runningAnimations.ToList().ForEach(anim => { + // Render each playing animation. + runningAnimations.ForEach(anim => { EffectLayer temp = new EffectLayer(); // Default values for the destination rect (the area that the canvas is drawn to) and animation offset - Rectangle destRect = new Rectangle(0, 0, Effects.canvas_width, Effects.canvas_height); + Rectangle destRect = new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight); PointF offset = Properties.KeyTriggerTranslate ? anim.offset : PointF.Empty; // When ScaleToKeySequenceBounds is true, additional calculations are needed on the destRect and offset: - if (Properties.ScaleToKeySequenceBounds) { + RectangleF affectedRegion = Properties.Sequence.GetAffectedRegion(); + if (Properties.ScaleToKeySequenceBounds && !affectedRegion.IsEmpty) { // The dest rect should simply be the bounding region of the affected keys - RectangleF affectedRegion = Properties.Sequence.GetAffectedRegion(); destRect = Rectangle.Truncate(affectedRegion); // If we are scaling to key sequence bounds, we need to adapt the offset of the pressed key so that it @@ -167,17 +167,17 @@ public override EffectLayer Render(IGameState gamestate) { // and that's our new X offset. // This probably makes no sense and I'll forget how it works immediately, but hopefully it helps a little in // future if this code ever needs to be revised. It's embarassing how long it took to work this equation out. - offset.X = (offset.X - affectedRegion.X) * (Effects.canvas_width / affectedRegion.Width); - offset.Y = (offset.Y - affectedRegion.Y) * (Effects.canvas_height / affectedRegion.Height); + offset.X = (offset.X - affectedRegion.X) * (Effects.CanvasWidth / affectedRegion.Width); + offset.Y = (offset.Y - affectedRegion.Y) * (Effects.CanvasHeight / affectedRegion.Height); } // Draw the animation to a temporary canvas using (Graphics g = temp.GetGraphics()) - Properties.AnimationMix.Draw(g, anim.currentTime, 1f, offset); + Properties.AnimationMix.Draw(g, anim.currentTime, offset); // Draw from this temp canvas to the actual layer, performing the scale down if it's needed. using (Graphics g = animationLayer.GetGraphics()) - g.DrawImage(temp.GetBitmap(), destRect, new Rectangle(0, 0, Effects.canvas_width, Effects.canvas_height), GraphicsUnit.Pixel); + g.DrawImage(temp.GetBitmap(), destRect, new Rectangle(0, 0, Effects.CanvasWidth, Effects.CanvasHeight), GraphicsUnit.Pixel); temp.Dispose(); }); diff --git a/Project-Aurora/Project-Aurora/Settings/Layers/BreathingLayerHandler.cs b/Project-Aurora/Project-Aurora/Settings/Layers/BreathingLayerHandler.cs index 61d5a6522..d38ab2709 100644 --- a/Project-Aurora/Project-Aurora/Settings/Layers/BreathingLayerHandler.cs +++ b/Project-Aurora/Project-Aurora/Settings/Layers/BreathingLayerHandler.cs @@ -1,13 +1,11 @@ -using Aurora.EffectsEngine; -using Aurora.Profiles; -using Newtonsoft.Json; -using System; -using System.Collections.Generic; +using System; using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using System.Windows.Controls; +using Aurora.EffectsEngine; +using Aurora.Profiles; +using Aurora.Settings.Overrides; +using Aurora.Utils; +using Newtonsoft.Json; namespace Aurora.Settings.Layers { @@ -16,38 +14,40 @@ public class BreathingLayerHandlerProperties : LayerHandlerProperties2Color Logic._RandomPrimaryColor ?? _RandomPrimaryColor ?? false; public bool? _RandomSecondaryColor { get; set; } [JsonIgnore] - public bool RandomSecondaryColor { get { return Logic._RandomSecondaryColor ?? _RandomSecondaryColor ?? false; } } + public bool RandomSecondaryColor => Logic._RandomSecondaryColor ?? _RandomSecondaryColor ?? false; - [Overrides.LogicOverridable("Effect Speed")] + [LogicOverridable("Effect Speed")] public float? _EffectSpeed { get; set; } [JsonIgnore] - public float EffectSpeed { get { return Logic._EffectSpeed ?? _EffectSpeed ?? 0.0f; } } + public float EffectSpeed => Logic._EffectSpeed ?? _EffectSpeed ?? 0.0f; - public BreathingLayerHandlerProperties() : base() { } + public BreathingLayerHandlerProperties() + { } public BreathingLayerHandlerProperties(bool assign_default = false) : base(assign_default) { } public override void Default() { base.Default(); - this._RandomPrimaryColor = false; - this._RandomSecondaryColor = false; - this._EffectSpeed = 1.0f; + _RandomPrimaryColor = false; + _RandomSecondaryColor = false; + _EffectSpeed = 1.0f; } } public class BreathingLayerHandler : LayerHandler { - private float current_sine = 0.0f; + EffectLayer breathing_layer = new("Breathing Layer"); + private float _currentSine; - private Color current_primary_color = Color.Transparent; - private Color current_secondary_color = Color.Transparent; + private Color _currentPrimaryColor = Color.Transparent; + private Color _currentSecondaryColor = Color.Transparent; protected override UserControl CreateControl() { @@ -56,20 +56,19 @@ protected override UserControl CreateControl() public override EffectLayer Render(IGameState gamestate) { - current_sine = (float)Math.Pow(Math.Sin((double)((Utils.Time.GetMillisecondsSinceEpoch() % 10000L) / 10000.0f) * 2 * Math.PI * Properties.EffectSpeed), 2); + _currentSine = (float)Math.Pow(Math.Sin((double)((Time.GetMillisecondsSinceEpoch() % 10000L) / 10000.0f) * 2 * Math.PI * Properties.EffectSpeed), 2); - if (current_sine <= 0.0025f * Properties.EffectSpeed && Properties.RandomSecondaryColor) - current_secondary_color = Utils.ColorUtils.GenerateRandomColor(); + if (_currentSine <= 0.0025f * Properties.EffectSpeed && Properties.RandomSecondaryColor) + _currentSecondaryColor = ColorUtils.GenerateRandomColor(); else if(!Properties.RandomSecondaryColor) - current_secondary_color = Properties.SecondaryColor; + _currentSecondaryColor = Properties.SecondaryColor; - if (current_sine >= 1.0f - (0.0025f * Properties.EffectSpeed) && Properties.RandomPrimaryColor) - current_primary_color = Utils.ColorUtils.GenerateRandomColor(); + if (_currentSine >= 1.0f - (0.0025f * Properties.EffectSpeed) && Properties.RandomPrimaryColor) + _currentPrimaryColor = ColorUtils.GenerateRandomColor(); else if (!Properties.RandomPrimaryColor) - current_primary_color = Properties.PrimaryColor; + _currentPrimaryColor = Properties.PrimaryColor; - EffectLayer breathing_layer = new EffectLayer(); - breathing_layer.Set(Properties.Sequence, Utils.ColorUtils.BlendColors(current_primary_color, current_secondary_color, current_sine)); + breathing_layer.Set(Properties.Sequence, ColorUtils.BlendColors(_currentPrimaryColor, _currentSecondaryColor, _currentSine)); return breathing_layer; } diff --git a/Project-Aurora/Project-Aurora/Settings/Layers/Control_AmbilightLayer.xaml b/Project-Aurora/Project-Aurora/Settings/Layers/Control_AmbilightLayer.xaml index 3fc672f38..c3b346c69 100644 --- a/Project-Aurora/Project-Aurora/Settings/Layers/Control_AmbilightLayer.xaml +++ b/Project-Aurora/Project-Aurora/Settings/Layers/Control_AmbilightLayer.xaml @@ -35,39 +35,35 @@