diff --git a/MacroDeck.Tests/MacroDeck.Tests.csproj b/MacroDeck.Tests/MacroDeck.Tests.csproj
index 7bb79506..51559205 100644
--- a/MacroDeck.Tests/MacroDeck.Tests.csproj
+++ b/MacroDeck.Tests/MacroDeck.Tests.csproj
@@ -9,11 +9,18 @@
-
+
+
-
-
-
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
+
+ all
+ runtime; build; native; contentfiles; analyzers; buildtransitive
+
diff --git a/MacroDeck.Tests/StringCipherTest.cs b/MacroDeck.Tests/StringCipherTest.cs
index 993ffdc9..596a5f8e 100644
--- a/MacroDeck.Tests/StringCipherTest.cs
+++ b/MacroDeck.Tests/StringCipherTest.cs
@@ -2,6 +2,7 @@
namespace MacroDeck.Tests;
+[TestFixture]
public class StringCipherTests
{
private string machineId;
diff --git a/MacroDeck.Tests/TemplateManagerTests.cs b/MacroDeck.Tests/TemplateManagerTests.cs
new file mode 100644
index 00000000..5161533b
--- /dev/null
+++ b/MacroDeck.Tests/TemplateManagerTests.cs
@@ -0,0 +1,71 @@
+using System.Collections;
+using Cottle;
+using SuchByte.MacroDeck.CottleIntegration;
+
+namespace MacroDeck.Tests;
+
+[TestFixture]
+internal class TemplateManagerTests
+{
+
+ [Test]
+ public void AllKeywords_Contains_NoNulls()
+ {
+ Assert.That(TemplateManager.AllKeywords, Has.No.Null.Or.Empty);
+ }
+
+ [Test]
+ public void AllKeywords_Length_IsEqualTo_Content()
+ {
+ var contentLength = TemplateManager.AllKeywords.Count(x => !string.IsNullOrEmpty(x));
+ Assert.That(TemplateManager.AllKeywords, Has.Length.EqualTo(contentLength));
+ }
+
+ [Test]
+ public void AllKeywords_Length_IsEqualTo_ArrayLengths()
+ {
+ var expectedLength = TemplateManager.Commands.Length +
+ TemplateManager.Functions.Length +
+ TemplateManager.Operators.Length +
+ TemplateManager.Special.Length +
+ TemplateManager.MacroDeckFunctions.Length;
+ Assert.That(TemplateManager.AllKeywords, Has.Length.EqualTo(expectedLength));
+ }
+
+ [TestCaseSource(typeof(TemplateManagerTestData), nameof(TemplateManagerTestData.Templates))]
+ public string Render_Templates_NoDb(string template)
+ {
+ var doc = TemplateManager.GetDocument(template);
+ return doc.Render(Context.CreateBuiltin(Context.Empty));
+ }
+
+}
+public class TemplateManagerTestData
+{
+ public static IEnumerable Templates
+ {
+ get
+ {
+ yield return new TestCaseData("""
+ { "these "}
+ { "are "}
+ { "words "}
+ { "on "}
+ { "new "}
+ { "lines."}
+ """)
+ .Returns("these \r\nare \r\nwords \r\non \r\nnew \r\nlines."); //note spacing and new lines
+
+ yield return new TestCaseData("""
+ _trimblank_
+ { "these "}
+ { "are "}
+ { "words "}
+ { "on "}
+ { "new "}
+ { "lines."}
+ """)
+ .Returns("these are words on new lines.");
+ }
+ }
+}
diff --git a/MacroDeck.Tests/Usings.cs b/MacroDeck.Tests/Usings.cs
index cefced49..5e315e7d 100644
--- a/MacroDeck.Tests/Usings.cs
+++ b/MacroDeck.Tests/Usings.cs
@@ -1 +1,3 @@
-global using NUnit.Framework;
\ No newline at end of file
+global using NUnit.Framework;
+global using Bogus;
+global using Bogus.DataSets;
\ No newline at end of file
diff --git a/MacroDeck/ActionButton/ActionButton.cs b/MacroDeck/ActionButton/ActionButton.cs
index 0b9f9006..45f0bb35 100644
--- a/MacroDeck/ActionButton/ActionButton.cs
+++ b/MacroDeck/ActionButton/ActionButton.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
+using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using Newtonsoft.Json;
diff --git a/MacroDeck/ActionButton/ButtonLabel.cs b/MacroDeck/ActionButton/ButtonLabel.cs
index c79bba0d..a5c86387 100644
--- a/MacroDeck/ActionButton/ButtonLabel.cs
+++ b/MacroDeck/ActionButton/ButtonLabel.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using Newtonsoft.Json;
using SuchByte.MacroDeck.Utils;
diff --git a/MacroDeck/ActionButton/ConditionAction.cs b/MacroDeck/ActionButton/ConditionAction.cs
index aedcbf4a..828c0718 100644
--- a/MacroDeck/ActionButton/ConditionAction.cs
+++ b/MacroDeck/ActionButton/ConditionAction.cs
@@ -1,7 +1,6 @@
-using System;
-using System.Collections.Generic;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
+using SuchByte.MacroDeck.CottleIntegration;
using SuchByte.MacroDeck.GUI;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Plugins;
@@ -153,7 +152,7 @@ public override void Trigger(string clientId, ActionButton actionButton) {
}
break;
case ConditionType.Template:
- if (bool.TryParse(VariableManager.RenderTemplate(_conditionValue1Source), out var boolResult))
+ if (bool.TryParse(TemplateManager.RenderTemplate(_conditionValue1Source), out var boolResult))
{
result = boolResult;
}
diff --git a/MacroDeck/Backup/BackupManager.cs b/MacroDeck/Backup/BackupManager.cs
index c7aa0e7f..e1b72ae9 100644
--- a/MacroDeck/Backup/BackupManager.cs
+++ b/MacroDeck/Backup/BackupManager.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
+using System.IO;
using System.IO.Compression;
-using System.Linq;
using System.Windows.Forms;
using Newtonsoft.Json;
using SuchByte.MacroDeck.Backup;
diff --git a/MacroDeck/Backup/MacroDeckBackupInfo.cs b/MacroDeck/Backup/MacroDeckBackupInfo.cs
index aa900d1c..1395a262 100644
--- a/MacroDeck/Backup/MacroDeckBackupInfo.cs
+++ b/MacroDeck/Backup/MacroDeckBackupInfo.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace SuchByte.MacroDeck.Backups;
+namespace SuchByte.MacroDeck.Backups;
public class MacroDeckBackupInfo
{
diff --git a/MacroDeck/Configuration/MainConfiguration.cs b/MacroDeck/Configuration/MainConfiguration.cs
index b3def91a..e7e741e6 100644
--- a/MacroDeck/Configuration/MainConfiguration.cs
+++ b/MacroDeck/Configuration/MainConfiguration.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
using Newtonsoft.Json;
diff --git a/MacroDeck/CottleIntegration/TemplateManager.cs b/MacroDeck/CottleIntegration/TemplateManager.cs
new file mode 100644
index 00000000..c3748f24
--- /dev/null
+++ b/MacroDeck/CottleIntegration/TemplateManager.cs
@@ -0,0 +1,163 @@
+using System.Diagnostics;
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using Cottle;
+using SuchByte.MacroDeck.Variables;
+
+namespace SuchByte.MacroDeck.CottleIntegration;
+
+public static class TemplateManager
+{
+ public const string TemplateTrimBlank = "_trimblank_";
+
+ public static readonly string[] Operators = { "and", "cmp", "default", "defined", "eq", "ge", "gt", "has", "le", "lt", "ne",
+ "not", "or", "xor", "when", "declare", "as", "dump", "echo", "empty", "set", "to",
+ "return", "true", "false", "void"};
+ public static readonly string[] Functions = { "abs", "add", "call", "cast", "cat", "ceil", "char", "cmp", "cos", "cross", "default", "defined",
+ "div", "eq", "except", "filter", "find", "flip", "floor", "format", "ge", "gt", "has", "join", "lcase",
+ "le", "len", "lt", "map", "match", "max", "min", "mod", "mul", "ne", "ord", "pow", "rand", "range", "round", "sin",
+ "slice", "sort", "split", "sub", "token", "type", "ucase", "union", "when", "xor", "zip"};
+ public static readonly string[] Commands = { "if", "elif", "else", "for", "while" };
+ public static readonly string[] Special = { TemplateTrimBlank };
+
+ public static bool HasTrimBlank(ReadOnlySpan template) => template.StartsWith(TemplateTrimBlank, StringComparison.OrdinalIgnoreCase);
+
+ private static string GetRenderTemplate(ReadOnlySpan template, out DocumentConfiguration templateConfiguration)
+ {
+ templateConfiguration = new DocumentConfiguration
+ {
+ Trimmer = DocumentConfiguration.TrimNothing,
+ };
+
+ if (!template.StartsWith(TemplateTrimBlank, StringComparison.OrdinalIgnoreCase))
+ {
+ return template.ToString();
+ }
+
+ templateConfiguration.Trimmer = DocumentConfiguration.TrimFirstAndLastBlankLines;
+ return template[TemplateTrimBlank.Length..].ToString();
+ }
+
+ public static IDocument GetDocument(ReadOnlySpan template)
+ {
+ var renderTemplate = GetRenderTemplate(template, out var configuration);
+ return Document.CreateDefault(renderTemplate, configuration).DocumentOrThrow;
+ }
+
+ public static string RenderDocument(IDocument document)
+ {
+ var symbols = new Dictionary();
+
+ AddVariables(symbols);
+ AddCustomFunctions(symbols);
+
+ return document.Render(Context.CreateBuiltin(symbols));
+ }
+
+ public static string RenderTemplate(ReadOnlySpan template)
+ {
+ if (template.IsEmpty)
+ {
+ return template.ToString();
+ }
+ string result;
+ try
+ {
+ var document = GetDocument(template);
+ result = RenderDocument(document);
+ }
+ catch (Exception e)
+ {
+ result = "Error: " + e.Message;
+ }
+
+ return result;
+ }
+
+ private static void AddVariables(IDictionary symbols)
+ {
+ foreach (var v in VariableManager.ListVariables)
+ {
+ if (symbols.ContainsKey(v.Name)) continue;
+ Value value = "";
+
+ switch (v.Type)
+ {
+ case nameof(VariableType.Bool):
+ bool.TryParse(
+ v.Value.Replace("On", "True", StringComparison.CurrentCultureIgnoreCase)
+ .Replace("Off", "False", StringComparison.OrdinalIgnoreCase), out var resultBool);
+ value = Value.FromBoolean(resultBool);
+ break;
+ case nameof(VariableType.Float):
+ float.TryParse(v.Value, out var resultFloat);
+ value = Value.FromNumber(resultFloat);
+ break;
+ case nameof(VariableType.Integer):
+ int.TryParse(v.Value, out var resultInteger);
+ value = Value.FromNumber(resultInteger);
+ break;
+ case nameof(VariableType.String):
+ value = Value.FromString(v.Value);
+ break;
+ }
+
+ symbols.Add(v.Name, value);
+ }
+ }
+
+ private static void AddCustomFunctions(IDictionary symbols)
+ {
+ foreach (var function in CustomFunctions)
+ {
+ symbols.Add(function.Key, function.Value);
+ }
+
+ }
+
+ private static readonly Value GetDateTime = Value.FromFunction(
+ Function.CreatePure1((state, formatString) =>
+ //formatString.Type != ValueContent.String
+ // ? throw new InvalidCastException()
+ // :
+ DateTimeOffset.Now.ToString(formatString.AsString)
+ )
+ );
+
+ private static readonly Value GetTimestamp = Value.FromFunction(Function.CreatePure0((state) => Stopwatch.GetTimestamp()));
+
+ private static readonly Value GetTimerEnd = Value.FromLazy(() => Value.FromFunction(
+ Function.CreatePure1((state, timestamp) =>
+ Value.FromReflection(Stopwatch.GetElapsedTime((long)timestamp.AsNumber), BindingFlags.Instance | BindingFlags.Public)
+ ))
+ );
+
+ private static readonly IDictionary CustomFunctions = new Dictionary
+ {
+ {"getdatetime", GetDateTime },
+ {"gettimestamp", GetTimestamp },
+ {"gettimerend", GetTimerEnd }
+ };
+
+ public static readonly string[] MacroDeckFunctions = CustomFunctions.Keys.ToArray();
+
+ public static readonly string[] AllKeywords = GetAllKeywords();
+
+ private static string[] GetAllKeywords()
+ {
+ string[] keywords = new string[Operators.Length + Functions.Length + Commands.Length + Special.Length + MacroDeckFunctions.Length];
+
+ Copy(Operators);
+ Copy(Functions);
+ Copy(Commands);
+ Copy(Special);
+ Copy(MacroDeckFunctions);
+
+ return keywords;
+
+ void Copy(string[] array)
+ {
+ Array.Copy(array, 0,keywords, keywords.Count(x => !string.IsNullOrEmpty(x)), array.Length);
+ }
+ }
+}
diff --git a/MacroDeck/Device/DeviceManager.cs b/MacroDeck/Device/DeviceManager.cs
index 32c85e03..ee4f67de 100644
--- a/MacroDeck/Device/DeviceManager.cs
+++ b/MacroDeck/Device/DeviceManager.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.IO;
using System.Media;
using System.Windows.Forms;
using Newtonsoft.Json;
diff --git a/MacroDeck/Events/EventListener.cs b/MacroDeck/Events/EventListener.cs
index f14c20cc..9633f483 100644
--- a/MacroDeck/Events/EventListener.cs
+++ b/MacroDeck/Events/EventListener.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using SuchByte.MacroDeck.Plugins;
+using SuchByte.MacroDeck.Plugins;
namespace SuchByte.MacroDeck.Events;
diff --git a/MacroDeck/Events/EventManager.cs b/MacroDeck/Events/EventManager.cs
index ae4c3c61..c7e8708a 100644
--- a/MacroDeck/Events/EventManager.cs
+++ b/MacroDeck/Events/EventManager.cs
@@ -1,8 +1,4 @@
-using System.Collections.Generic;
-using System.Linq;
-using System.Threading.Tasks;
-
-namespace SuchByte.MacroDeck.Events;
+namespace SuchByte.MacroDeck.Events;
public static class EventManager
{
diff --git a/MacroDeck/Events/MacroDeckEvent.cs b/MacroDeck/Events/MacroDeckEvent.cs
index 759fb648..1625cacb 100644
--- a/MacroDeck/Events/MacroDeckEvent.cs
+++ b/MacroDeck/Events/MacroDeckEvent.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-
-namespace SuchByte.MacroDeck.Events;
+namespace SuchByte.MacroDeck.Events;
public class MacroDeckEventArgs : EventArgs
{
diff --git a/MacroDeck/ExtensionStore/ExtensionStoreHelper.cs b/MacroDeck/ExtensionStore/ExtensionStoreHelper.cs
index 12de1c89..bd6a7545 100644
--- a/MacroDeck/ExtensionStore/ExtensionStoreHelper.cs
+++ b/MacroDeck/ExtensionStore/ExtensionStoreHelper.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Threading.Tasks;
+using System.IO;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.GUI.Dialogs;
diff --git a/MacroDeck/Folders/MacroDeckFolder.cs b/MacroDeck/Folders/MacroDeckFolder.cs
index 783719f6..0d57e737 100644
--- a/MacroDeck/Folders/MacroDeckFolder.cs
+++ b/MacroDeck/Folders/MacroDeckFolder.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
using System.Text.Json.Serialization;
namespace SuchByte.MacroDeck.Folders;
diff --git a/MacroDeck/GUI/CustomControls/ActionConfiguratorActionItem.cs b/MacroDeck/GUI/CustomControls/ActionConfiguratorActionItem.cs
index f166c48f..8c6e2026 100644
--- a/MacroDeck/GUI/CustomControls/ActionConfiguratorActionItem.cs
+++ b/MacroDeck/GUI/CustomControls/ActionConfiguratorActionItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Plugins;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/ActionConfiguratorPluginItem.cs b/MacroDeck/GUI/CustomControls/ActionConfiguratorPluginItem.cs
index 98ec64cb..744c11d1 100644
--- a/MacroDeck/GUI/CustomControls/ActionConfiguratorPluginItem.cs
+++ b/MacroDeck/GUI/CustomControls/ActionConfiguratorPluginItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Plugins;
using SuchByte.MacroDeck.Properties;
diff --git a/MacroDeck/GUI/CustomControls/ButtonEditor/ActionItem.cs b/MacroDeck/GUI/CustomControls/ButtonEditor/ActionItem.cs
index 6fd2daf5..1f884db1 100644
--- a/MacroDeck/GUI/CustomControls/ButtonEditor/ActionItem.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonEditor/ActionItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Interfaces;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/GUI/CustomControls/ButtonEditor/ActionSelectorOnPress.cs b/MacroDeck/GUI/CustomControls/ButtonEditor/ActionSelectorOnPress.cs
index 5851e250..eec39f22 100644
--- a/MacroDeck/GUI/CustomControls/ButtonEditor/ActionSelectorOnPress.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonEditor/ActionSelectorOnPress.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.ActionButton;
using SuchByte.MacroDeck.ActionButton.Plugin;
diff --git a/MacroDeck/GUI/CustomControls/ButtonEditor/ConditionItem.cs b/MacroDeck/GUI/CustomControls/ButtonEditor/ConditionItem.cs
index cbcc159d..f4ab575e 100644
--- a/MacroDeck/GUI/CustomControls/ButtonEditor/ConditionItem.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonEditor/ConditionItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.ActionButton;
using SuchByte.MacroDeck.ActionButton.Plugin;
diff --git a/MacroDeck/GUI/CustomControls/ButtonEditor/DelayItem.cs b/MacroDeck/GUI/CustomControls/ButtonEditor/DelayItem.cs
index 93bc2d5e..6387534c 100644
--- a/MacroDeck/GUI/CustomControls/ButtonEditor/DelayItem.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonEditor/DelayItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.ActionButton.Plugin;
using SuchByte.MacroDeck.Interfaces;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/GUI/CustomControls/ButtonEditor/EventItem.cs b/MacroDeck/GUI/CustomControls/ButtonEditor/EventItem.cs
index 9ad7cdec..23e21f02 100644
--- a/MacroDeck/GUI/CustomControls/ButtonEditor/EventItem.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonEditor/EventItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.ActionButton;
using SuchByte.MacroDeck.ActionButton.Plugin;
diff --git a/MacroDeck/GUI/CustomControls/ButtonEditor/EventSelector.cs b/MacroDeck/GUI/CustomControls/ButtonEditor/EventSelector.cs
index 68880731..a9698420 100644
--- a/MacroDeck/GUI/CustomControls/ButtonEditor/EventSelector.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonEditor/EventSelector.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Language;
namespace SuchByte.MacroDeck.GUI.CustomControls.ButtonEditor;
diff --git a/MacroDeck/GUI/CustomControls/ButtonPrimary.cs b/MacroDeck/GUI/CustomControls/ButtonPrimary.cs
index 725a8c4a..a9569845 100644
--- a/MacroDeck/GUI/CustomControls/ButtonPrimary.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonPrimary.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using SuchByte.MacroDeck.Properties;
diff --git a/MacroDeck/GUI/CustomControls/ButtonRadioButton.cs b/MacroDeck/GUI/CustomControls/ButtonRadioButton.cs
index 70710332..2e0b8f97 100644
--- a/MacroDeck/GUI/CustomControls/ButtonRadioButton.cs
+++ b/MacroDeck/GUI/CustomControls/ButtonRadioButton.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/ComboBox.cs b/MacroDeck/GUI/CustomControls/ComboBox.cs
index 1f128614..5774c05b 100644
--- a/MacroDeck/GUI/CustomControls/ComboBox.cs
+++ b/MacroDeck/GUI/CustomControls/ComboBox.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/ContentSelectorButton.cs b/MacroDeck/GUI/CustomControls/ContentSelectorButton.cs
index 6f8a7e3d..9fb2d1a2 100644
--- a/MacroDeck/GUI/CustomControls/ContentSelectorButton.cs
+++ b/MacroDeck/GUI/CustomControls/ContentSelectorButton.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/DeviceInfo.cs b/MacroDeck/GUI/CustomControls/DeviceInfo.cs
index 78c6b7a5..bf542c71 100644
--- a/MacroDeck/GUI/CustomControls/DeviceInfo.cs
+++ b/MacroDeck/GUI/CustomControls/DeviceInfo.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.GUI.Dialogs;
diff --git a/MacroDeck/GUI/CustomControls/DialogForm.cs b/MacroDeck/GUI/CustomControls/DialogForm.cs
index 2289ca73..076bc1da 100644
--- a/MacroDeck/GUI/CustomControls/DialogForm.cs
+++ b/MacroDeck/GUI/CustomControls/DialogForm.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Runtime.InteropServices;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/DropShadow.cs b/MacroDeck/GUI/CustomControls/DropShadow.cs
index d677c5b2..7d0750a4 100644
--- a/MacroDeck/GUI/CustomControls/DropShadow.cs
+++ b/MacroDeck/GUI/CustomControls/DropShadow.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Runtime.InteropServices;
///
diff --git a/MacroDeck/GUI/CustomControls/ExtensionStoreDownloader/ExtensionStoreDownloaderItem.cs b/MacroDeck/GUI/CustomControls/ExtensionStoreDownloader/ExtensionStoreDownloaderItem.cs
index acc24530..ca4be577 100644
--- a/MacroDeck/GUI/CustomControls/ExtensionStoreDownloader/ExtensionStoreDownloaderItem.cs
+++ b/MacroDeck/GUI/CustomControls/ExtensionStoreDownloader/ExtensionStoreDownloaderItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Drawing;
using System.IO;
using System.Net;
diff --git a/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionItemView.cs b/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionItemView.cs
index 9ed2cc86..d1e124be 100644
--- a/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionItemView.cs
+++ b/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionItemView.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.Extension;
using SuchByte.MacroDeck.ExtensionStore;
diff --git a/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionStoreView.cs b/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionStoreView.cs
index 3ed83b17..a996cc33 100644
--- a/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionStoreView.cs
+++ b/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionStoreView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using CefSharp;
using SuchByte.MacroDeck.ExtensionStore;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionZipInstallerView.cs b/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionZipInstallerView.cs
index 252abdde..5fe91f31 100644
--- a/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionZipInstallerView.cs
+++ b/MacroDeck/GUI/CustomControls/ExtensionsView/ExtensionZipInstallerView.cs
@@ -1,10 +1,8 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Windows.Forms;
using SuchByte.MacroDeck.ExtensionStore;
using SuchByte.MacroDeck.Icons;
using SuchByte.MacroDeck.Logging;
-using SuchByte.MacroDeck.Model;
using SuchByte.MacroDeck.Models;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/GUI/CustomControls/ExtensionsView/InstalledExtensionsView.cs b/MacroDeck/GUI/CustomControls/ExtensionsView/InstalledExtensionsView.cs
index 154a5b3c..0806182f 100644
--- a/MacroDeck/GUI/CustomControls/ExtensionsView/InstalledExtensionsView.cs
+++ b/MacroDeck/GUI/CustomControls/ExtensionsView/InstalledExtensionsView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.Extension;
using SuchByte.MacroDeck.ExtensionStore;
diff --git a/MacroDeck/GUI/CustomControls/Form.cs b/MacroDeck/GUI/CustomControls/Form.cs
index 393cb188..5437fdcf 100644
--- a/MacroDeck/GUI/CustomControls/Form.cs
+++ b/MacroDeck/GUI/CustomControls/Form.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Runtime.InteropServices;
diff --git a/MacroDeck/GUI/CustomControls/HorizontalTabControl.cs b/MacroDeck/GUI/CustomControls/HorizontalTabControl.cs
index 26ea4eee..8b13deaa 100644
--- a/MacroDeck/GUI/CustomControls/HorizontalTabControl.cs
+++ b/MacroDeck/GUI/CustomControls/HorizontalTabControl.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/Notifications/NotificationButton.cs b/MacroDeck/GUI/CustomControls/Notifications/NotificationButton.cs
index bca53f35..14b5bdde 100644
--- a/MacroDeck/GUI/CustomControls/Notifications/NotificationButton.cs
+++ b/MacroDeck/GUI/CustomControls/Notifications/NotificationButton.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
namespace SuchByte.MacroDeck.GUI.CustomControls.Notifications;
diff --git a/MacroDeck/GUI/CustomControls/Notifications/NotificationItem.cs b/MacroDeck/GUI/CustomControls/Notifications/NotificationItem.cs
index f959418b..b3a1233e 100644
--- a/MacroDeck/GUI/CustomControls/Notifications/NotificationItem.cs
+++ b/MacroDeck/GUI/CustomControls/Notifications/NotificationItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Models;
using SuchByte.MacroDeck.Notifications;
diff --git a/MacroDeck/GUI/CustomControls/Notifications/NotificationsList.cs b/MacroDeck/GUI/CustomControls/Notifications/NotificationsList.cs
index aad86bfd..d7855190 100644
--- a/MacroDeck/GUI/CustomControls/Notifications/NotificationsList.cs
+++ b/MacroDeck/GUI/CustomControls/Notifications/NotificationsList.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Linq;
-using SuchByte.MacroDeck.Notifications;
+using SuchByte.MacroDeck.Notifications;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/PictureButton.cs b/MacroDeck/GUI/CustomControls/PictureButton.cs
index 4855b500..0a3b0221 100644
--- a/MacroDeck/GUI/CustomControls/PictureButton.cs
+++ b/MacroDeck/GUI/CustomControls/PictureButton.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/PlaceHolderTextBox.cs b/MacroDeck/GUI/CustomControls/PlaceHolderTextBox.cs
index 11beb84a..392aae20 100644
--- a/MacroDeck/GUI/CustomControls/PlaceHolderTextBox.cs
+++ b/MacroDeck/GUI/CustomControls/PlaceHolderTextBox.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/RoundedButton.cs b/MacroDeck/GUI/CustomControls/RoundedButton.cs
index 2d86e347..de08d356 100644
--- a/MacroDeck/GUI/CustomControls/RoundedButton.cs
+++ b/MacroDeck/GUI/CustomControls/RoundedButton.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
using SuchByte.MacroDeck.Properties;
diff --git a/MacroDeck/GUI/CustomControls/RoundedComboBox.cs b/MacroDeck/GUI/CustomControls/RoundedComboBox.cs
index 4e7e76eb..e1d9f75f 100644
--- a/MacroDeck/GUI/CustomControls/RoundedComboBox.cs
+++ b/MacroDeck/GUI/CustomControls/RoundedComboBox.cs
@@ -1,5 +1,4 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/RoundedTextBox.cs b/MacroDeck/GUI/CustomControls/RoundedTextBox.cs
index e16320e3..c61d83ff 100644
--- a/MacroDeck/GUI/CustomControls/RoundedTextBox.cs
+++ b/MacroDeck/GUI/CustomControls/RoundedTextBox.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/Settings/BackupItem.cs b/MacroDeck/GUI/CustomControls/Settings/BackupItem.cs
index 393235f2..1fdc8b32 100644
--- a/MacroDeck/GUI/CustomControls/Settings/BackupItem.cs
+++ b/MacroDeck/GUI/CustomControls/Settings/BackupItem.cs
@@ -1,6 +1,4 @@
-using System;
-using System.IO;
-using System.Threading.Tasks;
+using System.IO;
using System.Windows.Forms;
using SuchByte.MacroDeck.Backups;
using SuchByte.MacroDeck.GUI.Dialogs;
diff --git a/MacroDeck/GUI/CustomControls/Settings/LicenseItem.cs b/MacroDeck/GUI/CustomControls/Settings/LicenseItem.cs
index adf0fcb4..de2782cf 100644
--- a/MacroDeck/GUI/CustomControls/Settings/LicenseItem.cs
+++ b/MacroDeck/GUI/CustomControls/Settings/LicenseItem.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/CustomControls/Settings/UpdateAvailableControl.cs b/MacroDeck/GUI/CustomControls/Settings/UpdateAvailableControl.cs
index 6f6d764d..9c5c930d 100644
--- a/MacroDeck/GUI/CustomControls/Settings/UpdateAvailableControl.cs
+++ b/MacroDeck/GUI/CustomControls/Settings/UpdateAvailableControl.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using System.Xml;
using SuchByte.MacroDeck.Backups;
diff --git a/MacroDeck/GUI/CustomControls/TabRadioButton.cs b/MacroDeck/GUI/CustomControls/TabRadioButton.cs
index 694c1d1b..1120b9fe 100644
--- a/MacroDeck/GUI/CustomControls/TabRadioButton.cs
+++ b/MacroDeck/GUI/CustomControls/TabRadioButton.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/Variables/VariableItem.cs b/MacroDeck/GUI/CustomControls/Variables/VariableItem.cs
index 8c69d070..d58855ff 100644
--- a/MacroDeck/GUI/CustomControls/Variables/VariableItem.cs
+++ b/MacroDeck/GUI/CustomControls/Variables/VariableItem.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.GUI.Dialogs;
+using SuchByte.MacroDeck.GUI.Dialogs;
using SuchByte.MacroDeck.Variables;
namespace SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/CustomControls/VerticalTabControl.cs b/MacroDeck/GUI/CustomControls/VerticalTabControl.cs
index 5939fd45..54a75133 100644
--- a/MacroDeck/GUI/CustomControls/VerticalTabControl.cs
+++ b/MacroDeck/GUI/CustomControls/VerticalTabControl.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/Dialogs/ActionConfigurator.cs b/MacroDeck/GUI/Dialogs/ActionConfigurator.cs
index bc0a1009..0db770b0 100644
--- a/MacroDeck/GUI/Dialogs/ActionConfigurator.cs
+++ b/MacroDeck/GUI/Dialogs/ActionConfigurator.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/AddFolder.cs b/MacroDeck/GUI/Dialogs/AddFolder.cs
index b5071d53..20c771e0 100644
--- a/MacroDeck/GUI/Dialogs/AddFolder.cs
+++ b/MacroDeck/GUI/Dialogs/AddFolder.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Threading.Tasks;
+using System.Diagnostics;
using System.Windows.Forms;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.Folders;
diff --git a/MacroDeck/GUI/Dialogs/ButtonEditor.cs b/MacroDeck/GUI/Dialogs/ButtonEditor.cs
index 138cd1d1..f0d339e2 100644
--- a/MacroDeck/GUI/Dialogs/ButtonEditor.cs
+++ b/MacroDeck/GUI/Dialogs/ButtonEditor.cs
@@ -1,11 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json;
using SuchByte.MacroDeck.ActionButton;
+using SuchByte.MacroDeck.CottleIntegration;
using SuchByte.MacroDeck.Events;
using SuchByte.MacroDeck.Folders;
using SuchByte.MacroDeck.GUI.CustomControls;
@@ -132,7 +130,7 @@ private void UpdateLabel()
btnForeColor.HoverColor = buttonLabel.LabelColor;
var labelBitmap = new Bitmap(250, 250);
var labelText = buttonLabel.LabelText;
- labelText = VariableManager.RenderTemplate(labelText);
+ labelText = TemplateManager.RenderTemplate(labelText);
labelBitmap = (Bitmap)LabelGenerator.GetLabel(labelBitmap, labelText, buttonLabel.LabelPosition, new Font(buttonLabel.FontFamily, buttonLabel.Size), buttonLabel.LabelColor, Color.Black, new SizeF(2.0F, 2.0F));
buttonLabel.LabelBase64 = Base64.GetBase64FromImage(labelBitmap);
diff --git a/MacroDeck/GUI/Dialogs/CreateIconPack.cs b/MacroDeck/GUI/Dialogs/CreateIconPack.cs
index b3c06138..eb7986b6 100644
--- a/MacroDeck/GUI/Dialogs/CreateIconPack.cs
+++ b/MacroDeck/GUI/Dialogs/CreateIconPack.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Icons;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/CreateProfileDialog.cs b/MacroDeck/GUI/Dialogs/CreateProfileDialog.cs
index e5577508..c7716780 100644
--- a/MacroDeck/GUI/Dialogs/CreateProfileDialog.cs
+++ b/MacroDeck/GUI/Dialogs/CreateProfileDialog.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Profiles;
diff --git a/MacroDeck/GUI/Dialogs/DebugConsole.cs b/MacroDeck/GUI/Dialogs/DebugConsole.cs
index 6419041c..a65e3e78 100644
--- a/MacroDeck/GUI/Dialogs/DebugConsole.cs
+++ b/MacroDeck/GUI/Dialogs/DebugConsole.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
-using System.Linq;
using System.Windows.Forms;
using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Notifications;
diff --git a/MacroDeck/GUI/Dialogs/DefenderFirewallAlert.cs b/MacroDeck/GUI/Dialogs/DefenderFirewallAlert.cs
index 573ba0ce..1d7de19f 100644
--- a/MacroDeck/GUI/Dialogs/DefenderFirewallAlert.cs
+++ b/MacroDeck/GUI/Dialogs/DefenderFirewallAlert.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.GUI.CustomControls;
+using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
namespace SuchByte.MacroDeck.GUI.Dialogs;
diff --git a/MacroDeck/GUI/Dialogs/DeviceConfigurator.cs b/MacroDeck/GUI/Dialogs/DeviceConfigurator.cs
index 3605465d..83d2bf37 100644
--- a/MacroDeck/GUI/Dialogs/DeviceConfigurator.cs
+++ b/MacroDeck/GUI/Dialogs/DeviceConfigurator.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Device;
+using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/GUI/Dialogs/ExportIconPackDialog.cs b/MacroDeck/GUI/Dialogs/ExportIconPackDialog.cs
index 3f5d1741..e2948a8f 100644
--- a/MacroDeck/GUI/Dialogs/ExportIconPackDialog.cs
+++ b/MacroDeck/GUI/Dialogs/ExportIconPackDialog.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Icons;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/ExtensionStoreDownloader.cs b/MacroDeck/GUI/Dialogs/ExtensionStoreDownloader.cs
index 3f4f259d..70e857ad 100644
--- a/MacroDeck/GUI/Dialogs/ExtensionStoreDownloader.cs
+++ b/MacroDeck/GUI/Dialogs/ExtensionStoreDownloader.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Threading.Tasks;
+using System.Runtime.InteropServices;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.GUI.CustomControls.ExtensionStoreDownloader;
diff --git a/MacroDeck/GUI/Dialogs/GiphySelector.cs b/MacroDeck/GUI/Dialogs/GiphySelector.cs
index 2bb296ba..6d2afda5 100644
--- a/MacroDeck/GUI/Dialogs/GiphySelector.cs
+++ b/MacroDeck/GUI/Dialogs/GiphySelector.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.IO;
using System.Net;
-using System.Threading.Tasks;
using System.Windows.Forms;
using GiphyDotNet.Manager;
using GiphyDotNet.Model.Parameters;
diff --git a/MacroDeck/GUI/Dialogs/HotkeySelector.cs b/MacroDeck/GUI/Dialogs/HotkeySelector.cs
index 9f32660f..7aa227e1 100644
--- a/MacroDeck/GUI/Dialogs/HotkeySelector.cs
+++ b/MacroDeck/GUI/Dialogs/HotkeySelector.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Hotkeys;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/IconCreator.cs b/MacroDeck/GUI/Dialogs/IconCreator.cs
index 62da6576..83efa34f 100644
--- a/MacroDeck/GUI/Dialogs/IconCreator.cs
+++ b/MacroDeck/GUI/Dialogs/IconCreator.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.IO;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/Dialogs/IconImportQuality.cs b/MacroDeck/GUI/Dialogs/IconImportQuality.cs
index 682f2952..f08e1e6f 100644
--- a/MacroDeck/GUI/Dialogs/IconImportQuality.cs
+++ b/MacroDeck/GUI/Dialogs/IconImportQuality.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/IconSelector.cs b/MacroDeck/GUI/Dialogs/IconSelector.cs
index 66075706..87285cb8 100644
--- a/MacroDeck/GUI/Dialogs/IconSelector.cs
+++ b/MacroDeck/GUI/Dialogs/IconSelector.cs
@@ -1,11 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows.Forms;
using ImageMagick;
using SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/Dialogs/JsonButtonEditor.cs b/MacroDeck/GUI/Dialogs/JsonButtonEditor.cs
index 146d568d..8c16e0c5 100644
--- a/MacroDeck/GUI/Dialogs/JsonButtonEditor.cs
+++ b/MacroDeck/GUI/Dialogs/JsonButtonEditor.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using Newtonsoft.Json;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/GUI/Dialogs/LicensesDialog.cs b/MacroDeck/GUI/Dialogs/LicensesDialog.cs
index a7e1933f..33e2f57c 100644
--- a/MacroDeck/GUI/Dialogs/LicensesDialog.cs
+++ b/MacroDeck/GUI/Dialogs/LicensesDialog.cs
@@ -1,5 +1,4 @@
-using System;
-using System.IO;
+using System.IO;
using System.Xml;
using SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/Dialogs/NewConnectionDialog.cs b/MacroDeck/GUI/Dialogs/NewConnectionDialog.cs
index 9e25b0d1..94902436 100644
--- a/MacroDeck/GUI/Dialogs/NewConnectionDialog.cs
+++ b/MacroDeck/GUI/Dialogs/NewConnectionDialog.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/RestoreBackupDialog.cs b/MacroDeck/GUI/Dialogs/RestoreBackupDialog.cs
index 95753321..7795798c 100644
--- a/MacroDeck/GUI/Dialogs/RestoreBackupDialog.cs
+++ b/MacroDeck/GUI/Dialogs/RestoreBackupDialog.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Backup;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/Dialogs/TemplateEditor.cs b/MacroDeck/GUI/Dialogs/TemplateEditor.cs
index 77cf1c23..56803dc2 100644
--- a/MacroDeck/GUI/Dialogs/TemplateEditor.cs
+++ b/MacroDeck/GUI/Dialogs/TemplateEditor.cs
@@ -1,12 +1,10 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
-using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
using FastColoredTextBoxNS;
using FastColoredTextBoxNS.Types;
+using SuchByte.MacroDeck.CottleIntegration;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Variables;
@@ -15,18 +13,8 @@ namespace SuchByte.MacroDeck.GUI.Dialogs;
public partial class TemplateEditor : DialogForm
{
- private const string TrimBlankNewLine = VariableManager.TemplateTrimBlank + "\r\n";
-
- private static readonly string[] Operators = { "and", "cmp", "default", "defined", "eq", "ge", "gt", "has", "le", "lt", "ne",
- "not", "or", "xor", "when", "declare", "as", "dump", "echo", "empty", "set", "to",
- "return", "true", "false", "void"};
- private static readonly string[] Functions = { "abs", "add", "call", "cast", "cat", "ceil", "char", "cmp", "cos", "cross", "default", "defined",
- "div", "eq", "except", "filter", "find", "flip", "floor", "format", "ge", "gt", "has", "join", "lcase",
- "le", "len", "lt", "map", "match", "max", "min", "mod", "mul", "ne", "ord", "pow", "rand", "range", "round", "sin",
- "slice", "sort", "split", "sub", "token", "type", "ucase", "union", "when", "xor", "zip"};
- private static readonly string[] Commands = { "if", "elif", "else", "for", "while" };
- private static readonly string[] Special = { VariableManager.TemplateTrimBlank };
-
+ private const string TrimBlankNewLine = TemplateManager.TemplateTrimBlank + "\r\n";
+
private readonly TextStyle functionStyle = new(Brushes.DarkKhaki, null, FontStyle.Regular);
private readonly TextStyle commentStyle = new(Brushes.Green, null, FontStyle.Regular);
private readonly TextStyle operatorStyle = new(Brushes.SteelBlue, null, FontStyle.Regular);
@@ -35,13 +23,13 @@ public partial class TemplateEditor : DialogForm
private readonly TextStyle specialStyle = new(Brushes.Lime, null, FontStyle.Regular);
private readonly Regex commentRegex = new(@"{\s*_\}", RegexOptions.Multiline | RegexOptions.Compiled);
- private readonly Regex operatorRegex = new(@$"\b(?x: {string.Join(" | ", Operators)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
- private readonly Regex functionRegex = new(@$"\b(?x: {string.Join(" | ", Functions)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
- private readonly Regex commandRegex = new(@$"\b(?x: {string.Join(" | ", Commands)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
- private readonly Regex specialRegex = new(@$"\b(?x: {string.Join(" | ", Special)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
+ private readonly Regex operatorRegex = new(@$"\b(?x: {string.Join(" | ", TemplateManager.Operators)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
+ private readonly Regex functionRegex = new(@$"\b(?x: {string.Join(" | ", TemplateManager.Functions)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
+ private readonly Regex commandRegex = new(@$"\b(?x: {string.Join(" | ", TemplateManager.Commands)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
+ private readonly Regex specialRegex = new(@$"\b(?x: {string.Join(" | ", TemplateManager.Special)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
private readonly Regex variableRegex;
- private bool HasTrimBlank => Template.StartsWith(VariableManager.TemplateTrimBlank, StringComparison.OrdinalIgnoreCase);
+ private bool HasTrimBlank => TemplateManager.HasTrimBlank(Template);
public string Template
{
@@ -65,7 +53,7 @@ public TemplateEditor(string template = "")
variableRegex = new Regex(@$"\b(?x: {string.Join(" | ", variablesList)})\b", RegexOptions.Singleline | RegexOptions.Compiled);
- autocompleteMenu.Items.SetAutocompleteItems(variablesList.Concat(Operators).Concat(Functions).Concat(Commands).Concat(Special).ToArray());
+ autocompleteMenu.Items.SetAutocompleteItems(TemplateManager.AllKeywords.Concat(variablesList).ToArray());
this.template.TextChanged += Template_TextChanged;
Template = template;
@@ -73,7 +61,7 @@ public TemplateEditor(string template = "")
private void Template_TextChanged(object? sender, TextChangedEventArgs e)
{
- lblResult.Text = VariableManager.RenderTemplate(Template);
+ lblResult.Text = TemplateManager.RenderTemplate(Template);
checkTrimBlankLines.Checked = HasTrimBlank;
@@ -169,7 +157,7 @@ private void CheckTrimBlankLines_CheckedChanged(object sender, EventArgs e)
}
else if (!checkTrimBlankLines.Checked && hasTrimBlank)
{
- Template = Template.Replace(TrimBlankNewLine, string.Empty).Replace(VariableManager.TemplateTrimBlank, string.Empty);
+ Template = Template.Replace(TrimBlankNewLine, string.Empty).Replace(TemplateManager.TemplateTrimBlank, string.Empty);
}
}
}
\ No newline at end of file
diff --git a/MacroDeck/GUI/Dialogs/VariableDialog.cs b/MacroDeck/GUI/Dialogs/VariableDialog.cs
index 1fc2812d..1792a6a0 100644
--- a/MacroDeck/GUI/Dialogs/VariableDialog.cs
+++ b/MacroDeck/GUI/Dialogs/VariableDialog.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Variables;
diff --git a/MacroDeck/GUI/InitialSetup.cs b/MacroDeck/GUI/InitialSetup.cs
index 282064f8..154bcd0d 100644
--- a/MacroDeck/GUI/InitialSetup.cs
+++ b/MacroDeck/GUI/InitialSetup.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Globalization;
+using System.Globalization;
using System.Windows.Forms;
using SuchByte.MacroDeck.Configuration;
using SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/InitialSetupPages/SetupPage1.cs b/MacroDeck/GUI/InitialSetupPages/SetupPage1.cs
index 3ff551fa..71d1b22d 100644
--- a/MacroDeck/GUI/InitialSetupPages/SetupPage1.cs
+++ b/MacroDeck/GUI/InitialSetupPages/SetupPage1.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Language;
namespace SuchByte.MacroDeck.GUI.InitialSetupPages;
diff --git a/MacroDeck/GUI/InitialSetupPages/SetupPage2.cs b/MacroDeck/GUI/InitialSetupPages/SetupPage2.cs
index a790b936..4d537145 100644
--- a/MacroDeck/GUI/InitialSetupPages/SetupPage2.cs
+++ b/MacroDeck/GUI/InitialSetupPages/SetupPage2.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Linq;
-using System.Net;
+using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/InitialSetupPages/SetupPage3.cs b/MacroDeck/GUI/InitialSetupPages/SetupPage3.cs
index f6273f65..389b616f 100644
--- a/MacroDeck/GUI/InitialSetupPages/SetupPage3.cs
+++ b/MacroDeck/GUI/InitialSetupPages/SetupPage3.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Language;
namespace SuchByte.MacroDeck.GUI.InitialSetupPages;
diff --git a/MacroDeck/GUI/InitialSetupPages/SetupPage4.cs b/MacroDeck/GUI/InitialSetupPages/SetupPage4.cs
index 2016f963..48c6a15c 100644
--- a/MacroDeck/GUI/InitialSetupPages/SetupPage4.cs
+++ b/MacroDeck/GUI/InitialSetupPages/SetupPage4.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Threading.Tasks;
+using System.Net;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
using SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/InitialSetupPages/SetupPage5.cs b/MacroDeck/GUI/InitialSetupPages/SetupPage5.cs
index 26412a3f..9dd08ccf 100644
--- a/MacroDeck/GUI/InitialSetupPages/SetupPage5.cs
+++ b/MacroDeck/GUI/InitialSetupPages/SetupPage5.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Net;
-using System.Threading.Tasks;
+using System.Net;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
using SuchByte.MacroDeck.GUI.CustomControls;
diff --git a/MacroDeck/GUI/InitialSetupPages/SetupPage6.cs b/MacroDeck/GUI/InitialSetupPages/SetupPage6.cs
index 3cd537ca..4087e440 100644
--- a/MacroDeck/GUI/InitialSetupPages/SetupPage6.cs
+++ b/MacroDeck/GUI/InitialSetupPages/SetupPage6.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Language;
namespace SuchByte.MacroDeck.GUI.InitialSetupPages;
diff --git a/MacroDeck/GUI/MainWindow.cs b/MacroDeck/GUI/MainWindow.cs
index f0c79753..019f4f6f 100644
--- a/MacroDeck/GUI/MainWindow.cs
+++ b/MacroDeck/GUI/MainWindow.cs
@@ -1,7 +1,5 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
-using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
using System.Windows.Forms;
diff --git a/MacroDeck/GUI/MainWindowViews/DeckView.cs b/MacroDeck/GUI/MainWindowViews/DeckView.cs
index f6f85a64..f2379e92 100644
--- a/MacroDeck/GUI/MainWindowViews/DeckView.cs
+++ b/MacroDeck/GUI/MainWindowViews/DeckView.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Threading.Tasks;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.ActionButton;
using SuchByte.MacroDeck.Enums;
diff --git a/MacroDeck/GUI/MainWindowViews/DeviceManagerView.cs b/MacroDeck/GUI/MainWindowViews/DeviceManagerView.cs
index 4dc1004b..402cfd06 100644
--- a/MacroDeck/GUI/MainWindowViews/DeviceManagerView.cs
+++ b/MacroDeck/GUI/MainWindowViews/DeviceManagerView.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Linq;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/MainWindowViews/ExtensionsView.cs b/MacroDeck/GUI/MainWindowViews/ExtensionsView.cs
index 7d9a1e30..2c602563 100644
--- a/MacroDeck/GUI/MainWindowViews/ExtensionsView.cs
+++ b/MacroDeck/GUI/MainWindowViews/ExtensionsView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls.ExtensionsView;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/GUI/MainWindowViews/SettingsView.cs b/MacroDeck/GUI/MainWindowViews/SettingsView.cs
index b67a5c83..5cf2817e 100644
--- a/MacroDeck/GUI/MainWindowViews/SettingsView.cs
+++ b/MacroDeck/GUI/MainWindowViews/SettingsView.cs
@@ -1,10 +1,7 @@
-using System;
-using System.Diagnostics;
-using System.Linq;
+using System.Diagnostics;
using System.Net;
using System.Net.NetworkInformation;
using System.Net.Sockets;
-using System.Threading.Tasks;
using System.Windows.Forms;
using SuchByte.MacroDeck.Backups;
using SuchByte.MacroDeck.GUI.CustomControls.Settings;
diff --git a/MacroDeck/GUI/MainWindowViews/VariablesView.cs b/MacroDeck/GUI/MainWindowViews/VariablesView.cs
index a5b226e7..dade44cb 100644
--- a/MacroDeck/GUI/MainWindowViews/VariablesView.cs
+++ b/MacroDeck/GUI/MainWindowViews/VariablesView.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
-using System.Threading.Tasks;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.GUI.Dialogs;
diff --git a/MacroDeck/GlobalUsings.cs b/MacroDeck/GlobalUsings.cs
new file mode 100644
index 00000000..179dd70e
--- /dev/null
+++ b/MacroDeck/GlobalUsings.cs
@@ -0,0 +1,5 @@
+global using System;
+global using System.Collections.Generic;
+global using System.Linq;
+global using System.Text;
+global using System.Threading.Tasks;
\ No newline at end of file
diff --git a/MacroDeck/Hotkeys/HotkeyManager.cs b/MacroDeck/Hotkeys/HotkeyManager.cs
index 35f82b1c..a89ca667 100644
--- a/MacroDeck/Hotkeys/HotkeyManager.cs
+++ b/MacroDeck/Hotkeys/HotkeyManager.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
using System.Windows.Forms;
using SuchByte.MacroDeck.Enums;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/Icons/Icon.cs b/MacroDeck/Icons/Icon.cs
index 4f7a222d..e207387e 100644
--- a/MacroDeck/Icons/Icon.cs
+++ b/MacroDeck/Icons/Icon.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.IO;
using SuchByte.MacroDeck.Utils;
diff --git a/MacroDeck/Icons/IconManager.cs b/MacroDeck/Icons/IconManager.cs
index bf61bcce..9af57f1a 100644
--- a/MacroDeck/Icons/IconManager.cs
+++ b/MacroDeck/Icons/IconManager.cs
@@ -1,13 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.IO.Compression;
-using System.Linq;
using System.Net;
-using System.Threading.Tasks;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using SuchByte.MacroDeck.ExtensionStore;
diff --git a/MacroDeck/Icons/IconManagerLegacy.cs b/MacroDeck/Icons/IconManagerLegacy.cs
index 86ec159a..7fd3b42d 100644
--- a/MacroDeck/Icons/IconManagerLegacy.cs
+++ b/MacroDeck/Icons/IconManagerLegacy.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Windows.Forms;
diff --git a/MacroDeck/Icons/IconPack.cs b/MacroDeck/Icons/IconPack.cs
index 385587f1..fa95e455 100644
--- a/MacroDeck/Icons/IconPack.cs
+++ b/MacroDeck/Icons/IconPack.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
namespace SuchByte.MacroDeck.Icons;
diff --git a/MacroDeck/Icons/IconPackLegacy.cs b/MacroDeck/Icons/IconPackLegacy.cs
index edd0e88c..50ee382e 100644
--- a/MacroDeck/Icons/IconPackLegacy.cs
+++ b/MacroDeck/Icons/IconPackLegacy.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-
-namespace SuchByte.MacroDeck.Icons;
+namespace SuchByte.MacroDeck.Icons;
[Obsolete]
public class IconPackLegacy
diff --git a/MacroDeck/Interfaces/IActionConditionItem.cs b/MacroDeck/Interfaces/IActionConditionItem.cs
index 752e6a59..dbe93d5b 100644
--- a/MacroDeck/Interfaces/IActionConditionItem.cs
+++ b/MacroDeck/Interfaces/IActionConditionItem.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Plugins;
+using SuchByte.MacroDeck.Plugins;
namespace SuchByte.MacroDeck.Interfaces;
diff --git a/MacroDeck/InternalPlugins/ActionButtonPlugin/ActionButtonPlugin.cs b/MacroDeck/InternalPlugins/ActionButtonPlugin/ActionButtonPlugin.cs
index 0e309334..1bd215f5 100644
--- a/MacroDeck/InternalPlugins/ActionButtonPlugin/ActionButtonPlugin.cs
+++ b/MacroDeck/InternalPlugins/ActionButtonPlugin/ActionButtonPlugin.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using SuchByte.MacroDeck.InternalPlugins.ActionButtonPlugin.Actions;
+using SuchByte.MacroDeck.InternalPlugins.ActionButtonPlugin.Actions;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/InternalPlugins/ActionButtonPlugin/Actions/ActionButtonSetBackgroundColorAction.cs b/MacroDeck/InternalPlugins/ActionButtonPlugin/Actions/ActionButtonSetBackgroundColorAction.cs
index a85819d6..6e0c3110 100644
--- a/MacroDeck/InternalPlugins/ActionButtonPlugin/Actions/ActionButtonSetBackgroundColorAction.cs
+++ b/MacroDeck/InternalPlugins/ActionButtonPlugin/Actions/ActionButtonSetBackgroundColorAction.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using SuchByte.MacroDeck.GUI;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.InternalPlugins.ActionButtonPlugin.Enums;
diff --git a/MacroDeck/InternalPlugins/ActionButtonPlugin/ViewModels/ActionButtonSetBackgroundColorActionConfigViewModel.cs b/MacroDeck/InternalPlugins/ActionButtonPlugin/ViewModels/ActionButtonSetBackgroundColorActionConfigViewModel.cs
index 6f305af6..da6cbd6e 100644
--- a/MacroDeck/InternalPlugins/ActionButtonPlugin/ViewModels/ActionButtonSetBackgroundColorActionConfigViewModel.cs
+++ b/MacroDeck/InternalPlugins/ActionButtonPlugin/ViewModels/ActionButtonSetBackgroundColorActionConfigViewModel.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using SuchByte.MacroDeck.InternalPlugins.ActionButtonPlugin.Enums;
using SuchByte.MacroDeck.InternalPlugins.ActionButtonPlugin.Models;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/InternalPlugins/ActionButtonPlugin/Views/ActionButtonSetBackgroundColorActionConfigView.cs b/MacroDeck/InternalPlugins/ActionButtonPlugin/Views/ActionButtonSetBackgroundColorActionConfigView.cs
index cb9b9946..35fa8a57 100644
--- a/MacroDeck/InternalPlugins/ActionButtonPlugin/Views/ActionButtonSetBackgroundColorActionConfigView.cs
+++ b/MacroDeck/InternalPlugins/ActionButtonPlugin/Views/ActionButtonSetBackgroundColorActionConfigView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.InternalPlugins.ActionButtonPlugin.Enums;
diff --git a/MacroDeck/InternalPlugins/DevicePlugin/DevicePlugin.cs b/MacroDeck/InternalPlugins/DevicePlugin/DevicePlugin.cs
index 69db1312..6fc5c7f8 100644
--- a/MacroDeck/InternalPlugins/DevicePlugin/DevicePlugin.cs
+++ b/MacroDeck/InternalPlugins/DevicePlugin/DevicePlugin.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using SuchByte.MacroDeck.InternalPlugins.DevicePlugin.Actions;
using SuchByte.MacroDeck.Plugins;
using SuchByte.MacroDeck.Properties;
diff --git a/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetBrightnessActionConfigViewModel.cs b/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetBrightnessActionConfigViewModel.cs
index c6e50cc8..b46be6db 100644
--- a/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetBrightnessActionConfigViewModel.cs
+++ b/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetBrightnessActionConfigViewModel.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Device;
+using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.InternalPlugins.DevicePlugin.Models;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetProfileActionConfigViewModel.cs b/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetProfileActionConfigViewModel.cs
index c1c49082..1a32dbc8 100644
--- a/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetProfileActionConfigViewModel.cs
+++ b/MacroDeck/InternalPlugins/DevicePlugin/ViewModels/SetProfileActionConfigViewModel.cs
@@ -1,4 +1,3 @@
-using System;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.InternalPlugins.DevicePlugin.Models;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/InternalPlugins/DevicePlugin/Views/SetBrightnessActionConfigView.cs b/MacroDeck/InternalPlugins/DevicePlugin/Views/SetBrightnessActionConfigView.cs
index 8bfe76ed..c3620e1b 100644
--- a/MacroDeck/InternalPlugins/DevicePlugin/Views/SetBrightnessActionConfigView.cs
+++ b/MacroDeck/InternalPlugins/DevicePlugin/Views/SetBrightnessActionConfigView.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Device;
+using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.InternalPlugins.DevicePlugin.ViewModels;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/InternalPlugins/DevicePlugin/Views/SetProfileActionConfigView.cs b/MacroDeck/InternalPlugins/DevicePlugin/Views/SetProfileActionConfigView.cs
index 7bc19743..b7ba004b 100644
--- a/MacroDeck/InternalPlugins/DevicePlugin/Views/SetProfileActionConfigView.cs
+++ b/MacroDeck/InternalPlugins/DevicePlugin/Views/SetProfileActionConfigView.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Device;
+using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.InternalPlugins.DevicePlugin.ViewModels;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/InternalPlugins/FolderPlugin/FolderPlugin.cs b/MacroDeck/InternalPlugins/FolderPlugin/FolderPlugin.cs
index d5f0eb20..b3832bf1 100644
--- a/MacroDeck/InternalPlugins/FolderPlugin/FolderPlugin.cs
+++ b/MacroDeck/InternalPlugins/FolderPlugin/FolderPlugin.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using SuchByte.MacroDeck.Folders.Plugin.GUI;
+using SuchByte.MacroDeck.Folders.Plugin.GUI;
using SuchByte.MacroDeck.GUI;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/InternalPlugins/FolderPlugin/GUI/FolderSwitcherConfigurator.cs b/MacroDeck/InternalPlugins/FolderPlugin/GUI/FolderSwitcherConfigurator.cs
index c678390f..5fe05f61 100644
--- a/MacroDeck/InternalPlugins/FolderPlugin/GUI/FolderSwitcherConfigurator.cs
+++ b/MacroDeck/InternalPlugins/FolderPlugin/GUI/FolderSwitcherConfigurator.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Plugins;
using SuchByte.MacroDeck.Profiles;
diff --git a/MacroDeck/InternalPlugins/Variables/VariablesPlugin.cs b/MacroDeck/InternalPlugins/Variables/VariablesPlugin.cs
index 8b447881..0fb06386 100644
--- a/MacroDeck/InternalPlugins/Variables/VariablesPlugin.cs
+++ b/MacroDeck/InternalPlugins/Variables/VariablesPlugin.cs
@@ -1,10 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Globalization;
using System.IO;
-using System.Threading.Tasks;
using System.Timers;
+using SuchByte.MacroDeck.CottleIntegration;
using SuchByte.MacroDeck.Events;
using SuchByte.MacroDeck.GUI;
using SuchByte.MacroDeck.GUI.CustomControls;
@@ -132,7 +130,7 @@ public override void Trigger(string clientId, ActionButton.ActionButton actionBu
{
if (string.IsNullOrWhiteSpace(Configuration)) return;
var changeVariableActionConfigModel = ChangeVariableValueActionConfigModel.Deserialize(Configuration);
- var variable = VariableManager.ListVariables.Where(v => v.Name == changeVariableActionConfigModel.Variable).FirstOrDefault();
+ var variable = VariableManager.ListVariables.FirstOrDefault(v => v.Name == changeVariableActionConfigModel.Variable);
if (variable == null) return;
switch (changeVariableActionConfigModel.Method)
{
@@ -144,7 +142,7 @@ public override void Trigger(string clientId, ActionButton.ActionButton actionBu
VariableManager.SetValue(variable.Name, float.Parse(variable.Value) - 1, (VariableType)Enum.Parse(typeof(VariableType), variable.Type), variable.Creator);
break;
case ChangeVariableMethod.set:
- var value = VariableManager.RenderTemplate(changeVariableActionConfigModel.Value);
+ var value = TemplateManager.RenderTemplate(changeVariableActionConfigModel.Value);
VariableManager.SetValue(variable.Name, value, (VariableType)Enum.Parse(typeof(VariableType), variable.Type), variable.Creator);
break;
case ChangeVariableMethod.toggle:
@@ -168,7 +166,7 @@ public override void Trigger(string clientId, ActionButton.ActionButton actionBu
var configurationModel = ReadVariableFromFileActionConfigModel.Deserialize(Configuration);
if (configurationModel == null) return;
var filePath = configurationModel.FilePath;
- var variable = VariableManager.ListVariables.Where(x => x.Name == configurationModel.Variable).FirstOrDefault();
+ var variable = VariableManager.ListVariables.FirstOrDefault(x => x.Name == configurationModel.Variable);
string variableValue;
if (variable == null)
{
@@ -208,7 +206,7 @@ public override void Trigger(string clientId, ActionButton.ActionButton actionBu
var configurationModel = SaveVariableToFileActionConfigModel.Deserialize(Configuration);
if (configurationModel == null) return;
var filePath = configurationModel.FilePath;
- var variable = VariableManager.ListVariables.Where(x => x.Name == configurationModel.Variable).FirstOrDefault();
+ var variable = VariableManager.ListVariables.FirstOrDefault(x => x.Name == configurationModel.Variable);
try
{
Retry.Do(() =>
diff --git a/MacroDeck/InternalPlugins/Variables/ViewModels/ChangeVariableValueActionConfigViewModel.cs b/MacroDeck/InternalPlugins/Variables/ViewModels/ChangeVariableValueActionConfigViewModel.cs
index 5170e4cd..75aee91b 100644
--- a/MacroDeck/InternalPlugins/Variables/ViewModels/ChangeVariableValueActionConfigViewModel.cs
+++ b/MacroDeck/InternalPlugins/Variables/ViewModels/ChangeVariableValueActionConfigViewModel.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.InternalPlugins.Variables.Enums;
+using SuchByte.MacroDeck.InternalPlugins.Variables.Enums;
using SuchByte.MacroDeck.InternalPlugins.Variables.Models;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/InternalPlugins/Variables/ViewModels/ReadVariableFromFileActionConfigViewModel.cs b/MacroDeck/InternalPlugins/Variables/ViewModels/ReadVariableFromFileActionConfigViewModel.cs
index 9a47116f..0ce5d342 100644
--- a/MacroDeck/InternalPlugins/Variables/ViewModels/ReadVariableFromFileActionConfigViewModel.cs
+++ b/MacroDeck/InternalPlugins/Variables/ViewModels/ReadVariableFromFileActionConfigViewModel.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Logging;
+using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Models;
using SuchByte.MacroDeck.Plugins;
using SuchByte.MacroDeck.Variables.Plugin.Models;
diff --git a/MacroDeck/InternalPlugins/Variables/ViewModels/SaveVariableToFileActionConfigViewModel.cs b/MacroDeck/InternalPlugins/Variables/ViewModels/SaveVariableToFileActionConfigViewModel.cs
index 017b1ee6..d4ef2284 100644
--- a/MacroDeck/InternalPlugins/Variables/ViewModels/SaveVariableToFileActionConfigViewModel.cs
+++ b/MacroDeck/InternalPlugins/Variables/ViewModels/SaveVariableToFileActionConfigViewModel.cs
@@ -1,5 +1,4 @@
-using System;
-using SuchByte.MacroDeck.Logging;
+using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Models;
using SuchByte.MacroDeck.Plugins;
using SuchByte.MacroDeck.Variables.Plugin.Models;
diff --git a/MacroDeck/InternalPlugins/Variables/Views/ChangeVariableValueActionConfigView.cs b/MacroDeck/InternalPlugins/Variables/Views/ChangeVariableValueActionConfigView.cs
index d7db8c4f..a04674bb 100644
--- a/MacroDeck/InternalPlugins/Variables/Views/ChangeVariableValueActionConfigView.cs
+++ b/MacroDeck/InternalPlugins/Variables/Views/ChangeVariableValueActionConfigView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.GUI.Dialogs;
using SuchByte.MacroDeck.InternalPlugins.Variables.Enums;
diff --git a/MacroDeck/InternalPlugins/Variables/Views/ReadVariableFromFileActionConfigView.cs b/MacroDeck/InternalPlugins/Variables/Views/ReadVariableFromFileActionConfigView.cs
index f9050e78..1f28e405 100644
--- a/MacroDeck/InternalPlugins/Variables/Views/ReadVariableFromFileActionConfigView.cs
+++ b/MacroDeck/InternalPlugins/Variables/Views/ReadVariableFromFileActionConfigView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.GUI.Dialogs;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/InternalPlugins/Variables/Views/SaveVariableToFileActionConfigView.cs b/MacroDeck/InternalPlugins/Variables/Views/SaveVariableToFileActionConfigView.cs
index c1b68166..155f7e1c 100644
--- a/MacroDeck/InternalPlugins/Variables/Views/SaveVariableToFileActionConfigView.cs
+++ b/MacroDeck/InternalPlugins/Variables/Views/SaveVariableToFileActionConfigView.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Windows.Forms;
+using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.Language;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/JSON/ConcreteConverter.cs b/MacroDeck/JSON/ConcreteConverter.cs
index fe6ce256..dcaa934e 100644
--- a/MacroDeck/JSON/ConcreteConverter.cs
+++ b/MacroDeck/JSON/ConcreteConverter.cs
@@ -1,5 +1,4 @@
-using System;
-using Newtonsoft.Json;
+using Newtonsoft.Json;
namespace SuchByte.MacroDeck.JSON;
diff --git a/MacroDeck/Language/LanguageManager.cs b/MacroDeck/Language/LanguageManager.cs
index dde28af2..f2bf14aa 100644
--- a/MacroDeck/Language/LanguageManager.cs
+++ b/MacroDeck/Language/LanguageManager.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.IO;
using Newtonsoft.Json;
using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Startup;
diff --git a/MacroDeck/Logging/MacroDeckLogger.cs b/MacroDeck/Logging/MacroDeckLogger.cs
index db71d85c..227d0189 100644
--- a/MacroDeck/Logging/MacroDeckLogger.cs
+++ b/MacroDeck/Logging/MacroDeckLogger.cs
@@ -1,10 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
using System.IO;
-using System.Linq;
-using System.Text;
using System.Windows.Forms;
using SuchByte.MacroDeck.GUI.CustomControls;
using SuchByte.MacroDeck.GUI.Dialogs;
diff --git a/MacroDeck/MacroDeck.cs b/MacroDeck/MacroDeck.cs
index ad826f27..70f4db5f 100644
--- a/MacroDeck/MacroDeck.cs
+++ b/MacroDeck/MacroDeck.cs
@@ -1,13 +1,7 @@
-using System;
-using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
-using System.Linq;
using System.Net.NetworkInformation;
using System.Net.Sockets;
-using System.Reflection;
-using System.Security.Principal;
-using System.Text;
using System.Threading;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
diff --git a/MacroDeck/Models/ExtensionManifestModel.cs b/MacroDeck/Models/ExtensionManifestModel.cs
index 502f76a3..c98fc5c4 100644
--- a/MacroDeck/Models/ExtensionManifestModel.cs
+++ b/MacroDeck/Models/ExtensionManifestModel.cs
@@ -1,8 +1,5 @@
-using System;
-using System.IO;
+using System.IO;
using System.IO.Compression;
-using System.Linq;
-using System.Text;
using Newtonsoft.Json;
using SuchByte.MacroDeck.ExtensionStore;
diff --git a/MacroDeck/Models/NotificationModel.cs b/MacroDeck/Models/NotificationModel.cs
index d4141d48..790e3ae6 100644
--- a/MacroDeck/Models/NotificationModel.cs
+++ b/MacroDeck/Models/NotificationModel.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
namespace SuchByte.MacroDeck.Models;
diff --git a/MacroDeck/Models/VariableViewCreatorFilterModel.cs b/MacroDeck/Models/VariableViewCreatorFilterModel.cs
index 1bbe526e..5a4a25cc 100644
--- a/MacroDeck/Models/VariableViewCreatorFilterModel.cs
+++ b/MacroDeck/Models/VariableViewCreatorFilterModel.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Text.Json;
+using System.Text.Json;
namespace SuchByte.MacroDeck.Models;
diff --git a/MacroDeck/Models/VersionModel.cs b/MacroDeck/Models/VersionModel.cs
index e8c9515a..eb30a82d 100644
--- a/MacroDeck/Models/VersionModel.cs
+++ b/MacroDeck/Models/VersionModel.cs
@@ -1,5 +1,4 @@
using System.Diagnostics;
-using System;
using System.Text.RegularExpressions;
namespace SuchByte.MacroDeck.Models;
diff --git a/MacroDeck/Notifications/NotificationManager.cs b/MacroDeck/Notifications/NotificationManager.cs
index 08e5020f..649e8004 100644
--- a/MacroDeck/Notifications/NotificationManager.cs
+++ b/MacroDeck/Notifications/NotificationManager.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Windows.Forms;
using SuchByte.MacroDeck.Models;
using SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/Pipe/MacroDeckPipeClient.cs b/MacroDeck/Pipe/MacroDeckPipeClient.cs
index 884eac89..6892d9ae 100644
--- a/MacroDeck/Pipe/MacroDeckPipeClient.cs
+++ b/MacroDeck/Pipe/MacroDeckPipeClient.cs
@@ -1,5 +1,4 @@
using System.IO.Pipes;
-using System.Text;
namespace SuchByte.MacroDeck.Pipes;
diff --git a/MacroDeck/Pipe/MacroDeckPipeServer.cs b/MacroDeck/Pipe/MacroDeckPipeServer.cs
index 33628dfd..acf7f84b 100644
--- a/MacroDeck/Pipe/MacroDeckPipeServer.cs
+++ b/MacroDeck/Pipe/MacroDeckPipeServer.cs
@@ -1,6 +1,4 @@
-using System;
-using System.IO.Pipes;
-using System.Text;
+using System.IO.Pipes;
using System.Threading;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/Plugins/MacroDeckPlugin.cs b/MacroDeck/Plugins/MacroDeckPlugin.cs
index d4b85ab2..18abd74f 100644
--- a/MacroDeck/Plugins/MacroDeckPlugin.cs
+++ b/MacroDeck/Plugins/MacroDeckPlugin.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.Drawing;
+using System.Drawing;
using System.Reflection;
using Newtonsoft.Json;
using SuchByte.MacroDeck.GUI;
diff --git a/MacroDeck/Plugins/PluginConfiguration.cs b/MacroDeck/Plugins/PluginConfiguration.cs
index 7ed27218..17346d00 100644
--- a/MacroDeck/Plugins/PluginConfiguration.cs
+++ b/MacroDeck/Plugins/PluginConfiguration.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.IO;
+using System.IO;
using Newtonsoft.Json;
using SuchByte.MacroDeck.Startup;
diff --git a/MacroDeck/Plugins/PluginCredentials.cs b/MacroDeck/Plugins/PluginCredentials.cs
index f3fab90d..3bce835a 100644
--- a/MacroDeck/Plugins/PluginCredentials.cs
+++ b/MacroDeck/Plugins/PluginCredentials.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
+using System.IO;
using Newtonsoft.Json;
using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Startup;
diff --git a/MacroDeck/Plugins/PluginManager.cs b/MacroDeck/Plugins/PluginManager.cs
index 5da65fef..3e991430 100644
--- a/MacroDeck/Plugins/PluginManager.cs
+++ b/MacroDeck/Plugins/PluginManager.cs
@@ -1,13 +1,9 @@
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.IO.Compression;
-using System.Linq;
using System.Net;
using System.Reflection;
-using System.Threading.Tasks;
using System.Windows.Forms;
using System.Xml.Serialization;
using Newtonsoft.Json.Linq;
diff --git a/MacroDeck/Plugins/PluginManifest.cs b/MacroDeck/Plugins/PluginManifest.cs
index f181f7e9..a5f24820 100644
--- a/MacroDeck/Plugins/PluginManifest.cs
+++ b/MacroDeck/Plugins/PluginManifest.cs
@@ -1,8 +1,5 @@
-using System;
-using System.IO;
+using System.IO;
using System.IO.Compression;
-using System.Linq;
-using System.Text;
using System.Xml.Serialization;
namespace SuchByte.MacroDeck.Plugins;
diff --git a/MacroDeck/Profiles/MacroDeckProfile.cs b/MacroDeck/Profiles/MacroDeckProfile.cs
index 6d399b1a..25d47482 100644
--- a/MacroDeck/Profiles/MacroDeckProfile.cs
+++ b/MacroDeck/Profiles/MacroDeckProfile.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.Folders;
diff --git a/MacroDeck/Profiles/ProfileManager.cs b/MacroDeck/Profiles/ProfileManager.cs
index 90fb7b3c..d3c66f36 100644
--- a/MacroDeck/Profiles/ProfileManager.cs
+++ b/MacroDeck/Profiles/ProfileManager.cs
@@ -1,11 +1,8 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
-using System.Linq;
+using System.Drawing;
using System.Text.RegularExpressions;
-using System.Threading.Tasks;
using Newtonsoft.Json;
using SQLite;
+using SuchByte.MacroDeck.CottleIntegration;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.Folders;
using SuchByte.MacroDeck.JSON;
@@ -117,8 +114,8 @@ public static void UpdateVariableLabels(ActionButton.ActionButton actionButton)
var labelOffText = actionButton.LabelOff.LabelText;
var labelOnText = actionButton.LabelOn.LabelText;
- labelOffText = VariableManager.RenderTemplate(labelOffText);
- labelOnText = VariableManager.RenderTemplate(labelOnText);
+ labelOffText = TemplateManager.RenderTemplate(labelOffText);
+ labelOnText = TemplateManager.RenderTemplate(labelOnText);
actionButton.LabelOff.LabelBase64 = Base64.GetBase64FromImage(LabelGenerator.GetLabel(new Bitmap(250, 250), labelOffText, actionButton.LabelOff.LabelPosition, new Font(actionButton.LabelOff.FontFamily, actionButton.LabelOff.Size), actionButton.LabelOff.LabelColor, Color.Black, new SizeF(2.0f, 2.0f)));
actionButton.LabelOn.LabelBase64 = Base64.GetBase64FromImage(LabelGenerator.GetLabel(new Bitmap(250, 250), labelOnText, actionButton.LabelOn.LabelPosition, new Font(actionButton.LabelOn.FontFamily, actionButton.LabelOn.Size), actionButton.LabelOn.LabelColor, Color.Black, new SizeF(2.0f, 2.0f)));
diff --git a/MacroDeck/Program.cs b/MacroDeck/Program.cs
index b4018511..bd4a4914 100644
--- a/MacroDeck/Program.cs
+++ b/MacroDeck/Program.cs
@@ -1,9 +1,7 @@
using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Pipes;
using SuchByte.MacroDeck.Startup;
-using System;
using System.Diagnostics;
-using System.Linq;
using System.Threading;
using System.Windows.Forms;
diff --git a/MacroDeck/Server/ADBServerHelper.cs b/MacroDeck/Server/ADBServerHelper.cs
index d2f8f511..d2aa2cc1 100644
--- a/MacroDeck/Server/ADBServerHelper.cs
+++ b/MacroDeck/Server/ADBServerHelper.cs
@@ -1,8 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
+using System.IO;
using System.Net;
-using System.Threading.Tasks;
using SharpAdbClient;
using SuchByte.MacroDeck.Enums;
using SuchByte.MacroDeck.Logging;
diff --git a/MacroDeck/Server/BroadcastServer.cs b/MacroDeck/Server/BroadcastServer.cs
index 7f6a6255..356edd46 100644
--- a/MacroDeck/Server/BroadcastServer.cs
+++ b/MacroDeck/Server/BroadcastServer.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Net.Sockets;
-using System.Text;
-using System.Threading.Tasks;
+using System.Net.Sockets;
using System.Timers;
using Newtonsoft.Json.Linq;
diff --git a/MacroDeck/Server/DeviceMessage/SoftwareClientMessage.cs b/MacroDeck/Server/DeviceMessage/SoftwareClientMessage.cs
index 3d7f5954..5645b5cc 100644
--- a/MacroDeck/Server/DeviceMessage/SoftwareClientMessage.cs
+++ b/MacroDeck/Server/DeviceMessage/SoftwareClientMessage.cs
@@ -1,7 +1,4 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Threading.Tasks;
+using System.Collections.Concurrent;
using Newtonsoft.Json.Linq;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.Icons;
diff --git a/MacroDeck/Server/MacroDeckClient.cs b/MacroDeck/Server/MacroDeckClient.cs
index 41f9f25b..c253a3de 100644
--- a/MacroDeck/Server/MacroDeckClient.cs
+++ b/MacroDeck/Server/MacroDeckClient.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Runtime.InteropServices;
+using System.Runtime.InteropServices;
using Fleck;
using SuchByte.MacroDeck.Device;
using SuchByte.MacroDeck.Folders;
diff --git a/MacroDeck/Server/MacroDeckServer.cs b/MacroDeck/Server/MacroDeckServer.cs
index 47c4362f..8e67f535 100644
--- a/MacroDeck/Server/MacroDeckServer.cs
+++ b/MacroDeck/Server/MacroDeckServer.cs
@@ -1,8 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Net;
-using System.Threading.Tasks;
+using System.Net;
using System.Windows.Forms;
using Fleck;
using Newtonsoft.Json.Linq;
diff --git a/MacroDeck/Startup/ApplicationPaths.cs b/MacroDeck/Startup/ApplicationPaths.cs
index 6a3a588e..a4e31318 100644
--- a/MacroDeck/Startup/ApplicationPaths.cs
+++ b/MacroDeck/Startup/ApplicationPaths.cs
@@ -1,5 +1,4 @@
-using System;
-using System.IO;
+using System.IO;
using SuchByte.MacroDeck.Logging;
namespace SuchByte.MacroDeck.Startup;
diff --git a/MacroDeck/Startup/CefSetup.cs b/MacroDeck/Startup/CefSetup.cs
index cfcc59bc..6f1b5ad9 100644
--- a/MacroDeck/Startup/CefSetup.cs
+++ b/MacroDeck/Startup/CefSetup.cs
@@ -1,7 +1,6 @@
using CefSharp.WinForms;
using CefSharp;
using SuchByte.MacroDeck.Logging;
-using System;
using System.IO;
namespace SuchByte.MacroDeck.Startup;
diff --git a/MacroDeck/Startup/StartParameters.cs b/MacroDeck/Startup/StartParameters.cs
index 8a7989cf..a9eade70 100644
--- a/MacroDeck/Startup/StartParameters.cs
+++ b/MacroDeck/Startup/StartParameters.cs
@@ -1,5 +1,4 @@
-using System;
-using CommandLine;
+using CommandLine;
namespace SuchByte.MacroDeck.Startup;
diff --git a/MacroDeck/Startup/TrayIconSetup.cs b/MacroDeck/Startup/TrayIconSetup.cs
index e64d4f7f..50fde1b1 100644
--- a/MacroDeck/Startup/TrayIconSetup.cs
+++ b/MacroDeck/Startup/TrayIconSetup.cs
@@ -1,5 +1,4 @@
using SuchByte.MacroDeck.Language;
-using System;
using System.Drawing;
using System.Windows.Forms;
diff --git a/MacroDeck/Updater/Updater.cs b/MacroDeck/Updater/Updater.cs
index 349745b0..2b7ea0ff 100644
--- a/MacroDeck/Updater/Updater.cs
+++ b/MacroDeck/Updater/Updater.cs
@@ -1,10 +1,8 @@
-using System;
-using System.ComponentModel;
+using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Security.Cryptography;
-using System.Threading.Tasks;
using System.Windows.Forms;
using Newtonsoft.Json.Linq;
using SuchByte.MacroDeck.Language;
diff --git a/MacroDeck/Utils/Base64.cs b/MacroDeck/Utils/Base64.cs
index 590fed32..952bf1c4 100644
--- a/MacroDeck/Utils/Base64.cs
+++ b/MacroDeck/Utils/Base64.cs
@@ -1,9 +1,6 @@
-using System;
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
-using System.Linq;
using System.Runtime.InteropServices;
namespace SuchByte.MacroDeck.Utils;
diff --git a/MacroDeck/Utils/CombineBitmaps.cs b/MacroDeck/Utils/CombineBitmaps.cs
index 9b2f4ac4..13fa5e4f 100644
--- a/MacroDeck/Utils/CombineBitmaps.cs
+++ b/MacroDeck/Utils/CombineBitmaps.cs
@@ -1,5 +1,4 @@
-using System.Collections.Generic;
-using System.Drawing;
+using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
diff --git a/MacroDeck/Utils/IconPackPreview.cs b/MacroDeck/Utils/IconPackPreview.cs
index eb94e498..c8ebdc51 100644
--- a/MacroDeck/Utils/IconPackPreview.cs
+++ b/MacroDeck/Utils/IconPackPreview.cs
@@ -1,6 +1,5 @@
using System.Drawing;
using System.Drawing.Drawing2D;
-using System.Linq;
using SuchByte.MacroDeck.Icons;
namespace SuchByte.MacroDeck.Utils;
diff --git a/MacroDeck/Utils/OperatingSystemInformation.cs b/MacroDeck/Utils/OperatingSystemInformation.cs
index 902a3874..dc430f64 100644
--- a/MacroDeck/Utils/OperatingSystemInformation.cs
+++ b/MacroDeck/Utils/OperatingSystemInformation.cs
@@ -1,6 +1,4 @@
-using System;
-
-namespace SuchByte.MacroDeck.Utils;
+namespace SuchByte.MacroDeck.Utils;
public static class OperatingSystemInformation
{
diff --git a/MacroDeck/Utils/Retry.cs b/MacroDeck/Utils/Retry.cs
index d221a0d5..405d3a72 100644
--- a/MacroDeck/Utils/Retry.cs
+++ b/MacroDeck/Utils/Retry.cs
@@ -1,6 +1,4 @@
-using System;
-using System.Collections.Generic;
-using System.Threading;
+using System.Threading;
namespace SuchByte.MacroDeck.Utils;
diff --git a/MacroDeck/Utils/StringCipher.cs b/MacroDeck/Utils/StringCipher.cs
index 362098cc..83f6cf91 100644
--- a/MacroDeck/Utils/StringCipher.cs
+++ b/MacroDeck/Utils/StringCipher.cs
@@ -1,9 +1,5 @@
-using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
+using System.IO;
using System.Security.Cryptography;
-using System.Text;
using Microsoft.Win32;
namespace SuchByte.MacroDeck.Utils;
diff --git a/MacroDeck/Variables/Variable.cs b/MacroDeck/Variables/Variable.cs
index 229eb638..ab158804 100644
--- a/MacroDeck/Variables/Variable.cs
+++ b/MacroDeck/Variables/Variable.cs
@@ -1,5 +1,4 @@
-using System;
-using SQLite;
+using SQLite;
namespace SuchByte.MacroDeck.Variables;
diff --git a/MacroDeck/Variables/VariableManager.cs b/MacroDeck/Variables/VariableManager.cs
index 6286ef4c..1f5cd561 100644
--- a/MacroDeck/Variables/VariableManager.cs
+++ b/MacroDeck/Variables/VariableManager.cs
@@ -1,12 +1,8 @@
-using System;
-using System.Collections.Concurrent;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text.RegularExpressions;
+using System.Text.RegularExpressions;
using System.Threading;
-using System.Threading.Tasks;
using Cottle;
using SQLite;
+using SuchByte.MacroDeck.CottleIntegration;
using SuchByte.MacroDeck.Logging;
using SuchByte.MacroDeck.Plugins;
using SuchByte.MacroDeck.Startup;
@@ -17,8 +13,6 @@ public static class VariableManager
{
private static SQLiteConnection _database;
- internal const string TemplateTrimBlank = "_trimblank_";
-
internal static event EventHandler OnVariableChanged;
internal static event EventHandler OnVariableRemoved;
@@ -48,13 +42,7 @@ public static Variable GetVariable(MacroDeckPlugin macroDeckPlugin, string varia
x.Creator == macroDeckPlugin.Name &&
string.Equals(x.Name, variableName, StringComparison.CurrentCultureIgnoreCase));
}
-
-
- private static DocumentConfiguration templateConfiguration = new()
- {
- Trimmer = DocumentConfiguration.TrimFirstAndLastBlankLines,
- };
-
+
internal static void InsertVariable(Variable variable)
{
if (ListVariables.Any(x => string.Equals(x.Name, variable.Name, StringComparison.CurrentCultureIgnoreCase)))
@@ -181,55 +169,10 @@ public static void DeleteVariable(string name)
MacroDeckLogger.Info("Deleted variable " + name);
}
-
+ [Obsolete("Use TemplateManager.RenderTemplate")]
public static string RenderTemplate(string template)
{
- string result;
- try
- {
- templateConfiguration.Trimmer = template.StartsWith(TemplateTrimBlank, StringComparison.OrdinalIgnoreCase)
- ? DocumentConfiguration.TrimFirstAndLastBlankLines
- : DocumentConfiguration.TrimNothing;
- template = template.Replace(TemplateTrimBlank, "", StringComparison.OrdinalIgnoreCase);
- var document = Document.CreateDefault(template, templateConfiguration).DocumentOrThrow;
-
- var vars = new Dictionary();
-
- foreach (var v in ListVariables)
- {
- if (vars.ContainsKey(v.Name)) continue;
- Value value = "";
-
- switch (v.Type)
- {
- case nameof(VariableType.Bool):
- bool.TryParse(
- v.Value.Replace("On", "True", StringComparison.CurrentCultureIgnoreCase)
- .Replace("Off", "False", StringComparison.OrdinalIgnoreCase), out var resultBool);
- value = Value.FromBoolean(resultBool);
- break;
- case nameof(VariableType.Float):
- float.TryParse(v.Value, out var resultFloat);
- value = Value.FromNumber(resultFloat);
- break;
- case nameof(VariableType.Integer):
- int.TryParse(v.Value, out var resultInteger);
- value = Value.FromNumber(resultInteger);
- break;
- case nameof(VariableType.String):
- value = Value.FromString(v.Value);
- break;
- }
-
- vars.Add(v.Name, value);
- }
- result = document.Render(Context.CreateBuiltin(vars));
- } catch (Exception e)
- {
- result = "Error: " + e.Message;
- }
-
- return result;
+ return TemplateManager.RenderTemplate(template);
}
internal static void Initialize()
diff --git a/MacroDeck/WindowFocus/WindowFocusDetection.cs b/MacroDeck/WindowFocus/WindowFocusDetection.cs
index 2f33af3b..7c8b7815 100644
--- a/MacroDeck/WindowFocus/WindowFocusDetection.cs
+++ b/MacroDeck/WindowFocus/WindowFocusDetection.cs
@@ -1,5 +1,4 @@
-using System;
-using System.Diagnostics;
+using System.Diagnostics;
using System.Runtime.InteropServices;
using SuchByte.MacroDeck.Variables;