commit e0b9eea23d89f6890eb1d32e7ef061a4eb4e4c58 Author: Burathar Date: Fri Apr 24 15:29:11 2020 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..50295da --- /dev/null +++ b/.gitignore @@ -0,0 +1,225 @@ +# The following command works for downloading when using Git for Windows: +# curl -LOf http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore +# +# Download this file using PowerShell v3 under Windows with the following comand: +# Invoke-WebRequest https://gist.githubusercontent.com/kmorcinek/2710267/raw/ -OutFile .gitignore +# +# or wget: +# wget --no-check-certificate http://gist.githubusercontent.com/kmorcinek/2710267/raw/.gitignore + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Rr]elease/ +x64/ +[Bb]in/ +[Oo]bj/ +# build folder is nowadays used for build scripts and should not be ignored +#build/ + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# Uncomment if necessary however generally it will be regenerated when needed +#!**/packages/repositories.config + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# OS generated files # +.DS_Store* +Icon? + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings +modulesbin/ +tempbin/ + +# EPiServer Site file (VPP) +AppData/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# vim +*.txt~ +*.swp +*.swo + +# Temp files when opening LibreOffice on ubuntu +.~lock.* + + # svn + .svn + + # CVS - Source Control + **/CVS/ + + # Remainings from resolving conflicts in Source Control + *.orig + + # SQL Server files + **/App_Data/*.mdf + **/App_Data/*.ldf + **/App_Data/*.sdf + + + #LightSwitch generated files + GeneratedArtifacts/ + _Pvt_Extensions/ + ModelManifest.xml + + # ========================= + # Windows detritus + # ========================= + + # Windows image file caches + Thumbs.db + ehthumbs.db + + # Folder config file + Desktop.ini + + # Recycle Bin used on file shares + $RECYCLE.BIN/ + + # Mac desktop service store files + .DS_Store + + # SASS Compiler cache + .sass-cache + + # Visual Studio 2014 CTP + **/*.sln.ide + + # Visual Studio temp something + .vs/ + + # dotnet stuff + project.lock.json + + # VS 2015+ + *.vc.vc.opendb + *.vc.db + + # Rider + .idea/ + + # Visual Studio Code + .vscode/ + + # Output folder used by Webpack or other FE stuff + **/node_modules/* + **/wwwroot/* + + # SpecFlow specific + *.feature.cs + *.feature.xlsx.* + *.Specs_*.html + + ##### + # End of core ignore list, below put you custom 'per project' settings (patterns or path) + ##### diff --git a/Calculator/Calc.cs b/Calculator/Calc.cs new file mode 100755 index 0000000..e68a995 --- /dev/null +++ b/Calculator/Calc.cs @@ -0,0 +1,187 @@ +using NCalc; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using FormsKey = System.Windows.Forms.Keys; + +namespace Calculator +{ + public class Calc + { + private const int Precision = 3; + private readonly List calculation; + private bool FirstKeyPressed = true; + + public Calc() + { + calculation = new List(); + } + + public CalculationResponse KeyPressed(FormsKey key) + { + switch (key) + { + case FormsKey.Enter: + return Calculate(); + + case FormsKey.Delete: + return Delete(); + + case FormsKey.NumPad0: + return AddCalculationElement(new NumberElement(0)); + + case FormsKey.NumPad1: + return AddCalculationElement(new NumberElement(1)); + + case FormsKey.NumPad2: + return AddCalculationElement(new NumberElement(2)); + + case FormsKey.NumPad3: + return AddCalculationElement(new NumberElement(3)); + + case FormsKey.NumPad4: + return AddCalculationElement(new NumberElement(4)); + + case FormsKey.NumPad5: + return AddCalculationElement(new NumberElement(5)); + + case FormsKey.NumPad6: + return AddCalculationElement(new NumberElement(6)); + + case FormsKey.NumPad7: + return AddCalculationElement(new NumberElement(7)); + + case FormsKey.NumPad8: + return AddCalculationElement(new NumberElement(8)); + + case FormsKey.NumPad9: + return AddCalculationElement(new NumberElement(9)); + + case FormsKey.Add: + return AddCalculationElement(new OperationElement(Operation.Add)); + + case FormsKey.Subtract: + return AddCalculationElement(new OperationElement(Operation.Subtract)); + + case FormsKey.Multiply: + return AddCalculationElement(new OperationElement(Operation.Muliply)); + + case FormsKey.Divide: + return AddCalculationElement(new OperationElement(Operation.Divide)); + + case FormsKey.Decimal: + return AddCalculationElement(new DecimalElement()); + + default: + return CalculationResponse.WrongInput; + } + } + + private CalculationResponse Delete() + { + calculation.Clear(); + return CalculationResponse.ClearedMemory; + } + + private bool CheckIfOperationIsAllowed(CalculationElement element) + { + if (calculation.Count == 0 && (element as OperationElement).Operation != Operation.Subtract) + return false; + if (calculation.LastOrDefault() is OperationElement) + return false; + return true; + } + + private bool CheckIfNumberIsAlreadyDecimal() + { + bool decimalFound = false; + foreach (CalculationElement item in calculation) + { + if (decimalFound) + { + if (item is OperationElement) + decimalFound = false; + } + else + if (item is DecimalElement) + decimalFound = true; + } + return decimalFound; + } + + private bool CheckIfDecimalIsAllowed() + { + if (FirstKeyPressed) + { + calculation.Clear(); + FirstKeyPressed = false; + calculation.Add(new NumberElement(0)); + return true; + } + CalculationElement last = calculation.LastOrDefault(); + if (last is DecimalElement) + return false; + else if (last is NumberElement) + { //check if another decimal exists before we encounter an OperationElement + if (CheckIfNumberIsAlreadyDecimal()) return false; + } + else if (last == null || last is OperationElement) + calculation.Add(new NumberElement(0)); + return true; + } + + private CalculationResponse AddCalculationElement(CalculationElement element) + { + if (element is OperationElement) + if (!CheckIfOperationIsAllowed(element)) + return CalculationResponse.WrongInput; + if (element is DecimalElement) + if (!CheckIfDecimalIsAllowed()) + return CalculationResponse.WrongInput; + if (element is NumberElement && FirstKeyPressed) + calculation.Clear(); + FirstKeyPressed = false; + calculation.Add(element); + return CalculationResponse.Ok; + } + + private CalculationResponse Calculate() + { + if (calculation.Count == 0) return new CalculationResponse(Response.Result, "0"); + StringBuilder calcString = new StringBuilder(); + calculation.ForEach(element => calcString.Append(element.ToString())); + Expression e = new Expression(calcString.ToString().TrimEnd('.', '/', '*', '-', '+')); + double solution = Convert.ToDouble(e.Evaluate()); + ClearCalculation(); + string result = solution.ToString(string.Format("F{0}", Precision)); //Region Specific!! + result = result.TrimEnd('0', ','); + AddResultToCalculation(result); + return new CalculationResponse(Response.Result, result); + } + + private void ClearCalculation() + { + calculation.Clear(); + FirstKeyPressed = true; + } + + private string DecimalsZero() + { + return ',' + new string('0', Precision); + } + + private void AddResultToCalculation(string result) + { + for (int i = 0; i < result.Length; i++) + { + if (result[i] == ',') + calculation.Add(new DecimalElement()); + else if (result[i] == '-') + calculation.Add(new OperationElement(Operation.Subtract)); + else + calculation.Add(new NumberElement((byte)char.GetNumericValue(result[i]))); + } + } + } +} \ No newline at end of file diff --git a/Calculator/CalculationElement.cs b/Calculator/CalculationElement.cs new file mode 100755 index 0000000..2145721 --- /dev/null +++ b/Calculator/CalculationElement.cs @@ -0,0 +1,7 @@ +namespace Calculator +{ + abstract internal class CalculationElement + { + public abstract override string ToString(); + } +} \ No newline at end of file diff --git a/Calculator/CalculationResponse.cs b/Calculator/CalculationResponse.cs new file mode 100755 index 0000000..e5d34db --- /dev/null +++ b/Calculator/CalculationResponse.cs @@ -0,0 +1,30 @@ +using System; + +namespace Calculator +{ + public class CalculationResponse + { + public static CalculationResponse Ok = new CalculationResponse(Response.Ok, null); + public static CalculationResponse ClearedMemory = new CalculationResponse(Response.ClearedMemory, null); + public static CalculationResponse WrongInput = new CalculationResponse(Response.WrongInput, null); + + public Response Response { get; } + public string Result { get; } + + public CalculationResponse(Response response, string result) + { + if (response == Response.Result && result == "") + throw new ArgumentNullException("CalculationResponse cannot have Response = RESULT and result = null"); + Response = response; + Result = result; + } + } + + public enum Response + { + Ok, + Result, + ClearedMemory, + WrongInput + } +} \ No newline at end of file diff --git a/Calculator/Calculator.csproj b/Calculator/Calculator.csproj new file mode 100755 index 0000000..c79bf5d --- /dev/null +++ b/Calculator/Calculator.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {239B6A10-C8D7-4AF0-845B-F99A0AFC2F5C} + Library + Properties + Calculator + Calculator + v4.7.2 + 512 + true + + + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + ..\packages\ncalc.1.3.8\lib\NCalc.dll + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Calculator/DecimalElement.cs b/Calculator/DecimalElement.cs new file mode 100755 index 0000000..eae2f56 --- /dev/null +++ b/Calculator/DecimalElement.cs @@ -0,0 +1,10 @@ +namespace Calculator +{ + internal class DecimalElement : CalculationElement + { + public override string ToString() + { + return "."; + } + } +} \ No newline at end of file diff --git a/Calculator/NumberElement.cs b/Calculator/NumberElement.cs new file mode 100755 index 0000000..41f0273 --- /dev/null +++ b/Calculator/NumberElement.cs @@ -0,0 +1,33 @@ +namespace Calculator +{ + internal class NumberElement : CalculationElement + { + public byte Value { get; } + + public NumberElement(byte value) + { + Value = value; + } + + public override string ToString() + { + return Value.ToString(); + } + + public override bool Equals(object obj) + { + return Equals(obj as NumberElement); + } + + public bool Equals(NumberElement other) + { + return other != null && + Value == other.Value; + } + + public override int GetHashCode() + { + return -1937169414 + Value.GetHashCode(); + } + } +} \ No newline at end of file diff --git a/Calculator/OperationElement.cs b/Calculator/OperationElement.cs new file mode 100755 index 0000000..4d3ca23 --- /dev/null +++ b/Calculator/OperationElement.cs @@ -0,0 +1,57 @@ +namespace Calculator +{ + internal class OperationElement : CalculationElement + { + public Operation Operation { get; } + + public OperationElement(Operation operation) + { + Operation = operation; + } + + public override string ToString() + { + switch (Operation) + { + case Operation.Add: + return "+"; + + case Operation.Subtract: + return "-"; + + case Operation.Muliply: + return "*"; + + case Operation.Divide: + return "/"; + + default: + return "Null"; + } + } + + public override bool Equals(object obj) + { + return Equals(obj as OperationElement); + } + + public bool Equals(OperationElement other) + { + return other != null && + Operation == other.Operation; + } + + public override int GetHashCode() + { + return 1706920598 + Operation.GetHashCode(); + } + } + + internal enum Operation + { + Add, + Subtract, + Muliply, + Divide + } +} \ No newline at end of file diff --git a/Calculator/Properties/AssemblyInfo.cs b/Calculator/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..62987f2 --- /dev/null +++ b/Calculator/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Calculator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Calculator")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("239b6a10-c8d7-4af0-845b-f99a0afc2f5c")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/Calculator/packages.config b/Calculator/packages.config new file mode 100755 index 0000000..3b4c695 --- /dev/null +++ b/Calculator/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/ChromaController/App.config b/ChromaController/App.config new file mode 100755 index 0000000..a060b6b --- /dev/null +++ b/ChromaController/App.config @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/ChromaController/ChromaController.csproj b/ChromaController/ChromaController.csproj new file mode 100755 index 0000000..3de6365 --- /dev/null +++ b/ChromaController/ChromaController.csproj @@ -0,0 +1,152 @@ + + + + + Debug + AnyCPU + {39F3D543-544C-40FF-881A-02307788ECD0} + WinExe + ChromaController + ChromaController + v4.7.2 + 512 + true + true + + + false + C:\Users\Burathar\Desktop\Publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 10 + 1.0.0.%2a + false + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + ChromaController.Program + + + ABCB6CA9D4FDF93BE849DD917E880FE268E8DB7B + + + ChromaController_TemporaryKey.pfx + + + true + + + true + + + true + + + + ..\packages\Colore.6.0.0-rc0005\lib\net451\Colore.dll + + + ..\packages\JetBrains.Annotations.2020.1.0\lib\net20\JetBrains.Annotations.dll + + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + + + + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Extensions.dll + + + ..\packages\Microsoft.Net.Http.2.2.29\lib\net45\System.Net.Http.Primitives.dll + + + + ..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll + True + True + + + ..\packages\System.ValueTuple.4.5.0\lib\net47\System.ValueTuple.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + {239b6a10-c8d7-4af0-845b-f99a0afc2f5c} + Calculator + + + {d42162e9-9057-49e6-a6ae-660f108c721b} + NumpadMonitor + + + + + False + Microsoft .NET Framework 4.7.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + \ No newline at end of file diff --git a/ChromaController/ChromaEffectsReader.cs b/ChromaController/ChromaEffectsReader.cs new file mode 100755 index 0000000..003f4f4 --- /dev/null +++ b/ChromaController/ChromaEffectsReader.cs @@ -0,0 +1,209 @@ +using Colore.Data; +using Colore.Effects.Keyboard; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Xml.Linq; + +namespace ChromaController +{ + internal class ChromaEffectsReader + { + public EffectRegion[] ReadFirstStatic(string filePath) + { + XDocument root = XDocument.Load(filePath); + IEnumerable effectLayers = root.Descendants("EffectLayer").Where(x => x.Descendants("Effect").First().Value == "static"); + return effectLayers.SelectMany(layer => layer.Descendants("EffectRegion").Select(region => + { + return new EffectRegion( + GetKeys(region), + GetColor(region)); + })).ToArray(); + } + + private Key[] GetKeys(XElement region) + { + IEnumerable deviceCells = region.Descendants("DeviceCell"); + List keys = new List(); + foreach (XElement cell in deviceCells) + { + int row = Convert.ToInt32(cell.Descendants("Row").First().Value); + int column = Convert.ToInt32(cell.Descendants("Col").First().Value); + keys.Add((RazerKey)column + row * 256); + } + return keys.Select(razerKey => (Key)Enum.Parse(typeof(Key), razerKey.ToString())).ToArray(); + } + + private Color GetColor(XElement region) + { + XElement rzColor = region.Descendants("RzColor").First(); + int red = 0, green = 0, blue = 0; + foreach (XElement element in rzColor.Descendants()) + { + switch (element.Name.ToString()) + { + case "Red": + red = Convert.ToInt32(element.Value); + break; + + case "Green": + green = Convert.ToInt32(element.Value); + break; + + case "Blue": + blue = Convert.ToInt32(element.Value); + break; + + default: + throw new ArgumentException("Argument value not expected", "element"); + } + } + return KeyEffect.GetColoreColor(red, green, blue); + } + } + + /// + /// Definition of almost all keyboard keys, with id's matching the Razer Synapse Grid. + /// Keys not present on the US-International are not tested, and so commented out. If you need these, just test where they should be using a known ChromaEffects map. + /// + internal enum RazerKey + { + Escape = 1, + F1 = 4, + F2 = 5, + F3 = 6, + F4 = 7, + F5 = 8, + F6 = 9, + F7 = 10, + F8 = 11, + F9 = 12, + F10 = 13, + F11 = 14, + F12 = 15, + PrintScreen = 16, + Scroll = 17, + Pause = 18, + + //JpnYen = 21, + //KorPipe = 21, + + Macro1 = 256, + OemTilde = 257, + D1 = 258, + D2 = 259, + D3 = 260, + D4 = 261, + D5 = 262, + D6 = 263, + D7 = 264, + D8 = 265, + D9 = 266, + D0 = 267, + OemMinus = 268, + OemEquals = 269, + Backspace = 270, + Insert = 272, + Home = 273, + PageUp = 274, + NumLock = 275, + NumDivide = 276, + NumMultiply = 277, + NumSubtract = 278, + Macro2 = 512, + Tab = 513, + Q = 514, + W = 515, + E = 516, + R = 517, + T = 518, + Y = 519, + U = 520, + I = 521, + O = 522, + P = 523, + OemLeftBracket = 524, + OemRightBracket = 525, + OemBackslash = 526, + Delete = 528, + End = 529, + PageDown = 530, + Num7 = 531, + Num8 = 532, + Num9 = 533, + NumAdd = 534, + Macro3 = 768, + CapsLock = 770, + A = 771, + S = 772, + D = 773, + F = 774, + G = 775, + H = 776, + J = 777, + K = 778, + L = 779, + OemSemicolon = 780, + OemApostrophe = 781, + + //EurPound = 782, + //Kor2 = 782, + + Enter = 782, + Num4 = 787, + Num5 = 788, + Num6 = 789, + Macro4 = 1024, + + //EurBackslash = 1025, + //Kor3 = 1025, + + LeftShift = 1026, + Z = 1027, + X = 1028, + C = 1029, + V = 1039, + B = 1031, + N = 1032, + M = 1033, + OemComma = 1034, + OemPeriod = 1035, + OemSlash = 1036, + + //JpnSlash = 1037, + //Kor4 = 1037, + + RightShift = 1038, + Up = 1041, + Num1 = 1043, + Num2 = 1044, + Num3 = 1045, + Macro5 = 1280, + LeftControl = 1281, + LeftWindows = 1282, + LeftAlt = 1283, + + //Jpn3 = 1284, + //Kor5 = 1284, + + Space = 1287, + + //Jpn4 = 1289, + //Kor6 = 1289, + //Jpn5 = 1290, + //Kor7 = 1290, + + RightAlt = 1292, + Function = 1293, + RightMenu = 1294, + RightControl = 1295, + Left = 1296, + Down = 1297, + Right = 1298, + Num0 = 1300, + NumDecimal = 1301, + NumEnter = 1302, + Logo = 1548, + Invalid = 65535 + } +} \ No newline at end of file diff --git a/ChromaController/ColoreOutput.cs b/ChromaController/ColoreOutput.cs new file mode 100755 index 0000000..a253292 --- /dev/null +++ b/ChromaController/ColoreOutput.cs @@ -0,0 +1,196 @@ +using Calculator; +using Colore; +using Colore.Data; +using Colore.Effects.Keyboard; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading; + +namespace ChromaController +{ + internal class ColoreOutput + { + private IChroma chroma; + private bool _exit = false; + + private readonly object keyEffectsLock = new object(); + + private readonly List keyEffects = new List(); + private readonly List keyEffectTrash = new List(); + private readonly string chromaEffectPath; + private readonly Color dNumberPassiveColor = Color.FromRgb(0x002800); + private readonly Color numpadPassiveColor = Color.FromRgb(0x000028); + + private readonly Key[] numpadKeys = new Key[] + { + Key.Num0, + Key.Num1, + Key.Num3, + Key.Num2, + Key.Num4, + Key.Num5, + Key.Num6, + Key.Num7, + Key.Num8, + Key.Num9, + Key.NumDivide, + Key.NumMultiply, + Key.NumSubtract, + Key.NumAdd, + Key.NumEnter, + Key.NumDecimal + }; + + private readonly Key[] dNumberKeys = new Key[] + { + Key.D0, + Key.D1, + Key.D2, + Key.D3, + Key.D4, + Key.D5, + Key.D6, + Key.D7, + Key.D8, + Key.D9, + }; + + public ColoreOutput(string chromaEffectPath) + { + this.chromaEffectPath = chromaEffectPath; + } + + public void Start() + { + chroma = chroma = ColoreProvider.CreateNativeAsync().Result; + KeyboardCustom keyboardGrid = KeyboardCustom.Create(); + LoadChromaEffect(chromaEffectPath, keyboardGrid); + LoadInitialColors(keyboardGrid); + SetKeyboardGrid(keyboardGrid); + lock (keyEffectsLock) + { + keyEffects.Add(new FlashKey(Key.LeftControl, Color.Black, Color.Black, 50)); + } + Loop(); + } + + private void SetKeyboardGrid(KeyboardCustom keyboardGrid) + { + chroma.Keyboard.SetCustomAsync(keyboardGrid); + } + + private void LoadInitialColors(KeyboardCustom keyboardGrid) + { + keyboardGrid[Key.End] = Color.Red; + Array.ForEach(dNumberKeys, key => keyboardGrid[key] = dNumberPassiveColor); + Array.ForEach(numpadKeys, key => keyboardGrid[key] = numpadPassiveColor); + } + + private void LoadChromaEffect(string path, KeyboardCustom keyboardGrid) + { + ChromaEffectsReader reader = new ChromaEffectsReader(); + EffectRegion[] regions = reader.ReadFirstStatic(path); + Array.ForEach(regions, x => x.AddToGrid(keyboardGrid)); + } + + private void Loop() + { + while (!_exit) + { + Thread.Sleep(50); + IterKeyEffects(); + DeleteFinishedKeyEffects(); + } + chroma.UninitializeAsync(); + } + + public void MemorySet() + { + chroma.Keyboard.SetKeyAsync(Key.Delete, Color.Orange, false); + } + + public void MemoryCleared() + { + chroma.Keyboard.SetKeyAsync(Key.Delete, Color.Black, false); + } + + public void PrintNumber(string result) + { + for (int i = 0; i < result.Length; i++) + { + Key[] key = new Key[] { GetKey(result[i]) }; + lock (keyEffectsLock) + { + //KeyEffect errorFlash = keyEffects.Find(x => x.Keys.SequenceEqual(NumpadKeys)); + //if (errorFlash != null) keyEffects.Remove(errorFlash); + keyEffects.Add(new FlashKey(key, Color.White, dNumberPassiveColor, 10, i * 12)); + } + } + } + + public void Exit() + { + _exit = true; + } + + private Key GetKey(char character) + { + if (character == ',') + return Key.OemPeriod; + if (character == '-') + return Key.OemMinus; + if (char.GetNumericValue(character) >= 0) + return dNumberKeys[(int)char.GetNumericValue(character)]; + throw new ArgumentException($"Character '{character}' was not expected", "character"); + } + + private void DeleteFinishedKeyEffects() + { + if (keyEffectTrash.Count > 0) + { + lock (keyEffectsLock) + { + keyEffectTrash.ForEach(effect => keyEffects.Remove(effect)); + } + keyEffectTrash.Clear(); + } + } + + private void IterKeyEffects() + { + lock (keyEffectsLock) + { + if (keyEffects.Count == 0) + return; + foreach (KeyEffect keyEffect in keyEffects) + { + if (keyEffect.Step(chroma)) + keyEffectTrash.Add(keyEffect); + } + } + } + + internal void ErrorFlash() + { + lock (keyEffectsLock) + { + KeyEffect errorFlash = keyEffects.Find(x => x.Keys.SequenceEqual(numpadKeys)); + if (errorFlash != null) keyEffects.Remove(errorFlash); + keyEffects.Add(new FlashKey(numpadKeys, Color.Red, numpadPassiveColor, 10)); + } + } + + internal void NumpadKeyPressed(Key pressedKey) + { + Key[] key = new Key[] { pressedKey }; + lock (keyEffectsLock) + { + KeyEffect keyEffect = keyEffects.Find(x => x.Keys.SequenceEqual(key)); + if (keyEffect != null) + keyEffects.Remove(keyEffect); + keyEffects.Add(new FadeKey(key, Color.White, numpadPassiveColor, 0.05f)); + } + } + } +} \ No newline at end of file diff --git a/ChromaController/EffectRegion.cs b/ChromaController/EffectRegion.cs new file mode 100755 index 0000000..c0f2901 --- /dev/null +++ b/ChromaController/EffectRegion.cs @@ -0,0 +1,35 @@ +using Colore; +using Colore.Data; +using Colore.Effects.Keyboard; +using System; + +namespace ChromaController +{ + internal class EffectRegion + { + public Key[] Keys { get; private set; } + public Color Color { get; private set; } + + public EffectRegion(Key[] keys, Color color) + { + Keys = keys; + Color = color; + } + + public EffectRegion(Key keys, Color color) + { + Keys = new Key[] { keys }; + Color = color; + } + + internal void Show(IChroma chroma) + { + Array.ForEach(Keys, x => chroma.Keyboard.SetKeyAsync(x, Color, false)); + } + + internal void AddToGrid(KeyboardCustom keyboardGrid) + { + Array.ForEach(Keys, x => keyboardGrid[x] = Color); + } + } +} \ No newline at end of file diff --git a/ChromaController/KeyConverter.cs b/ChromaController/KeyConverter.cs new file mode 100755 index 0000000..db2d0fe --- /dev/null +++ b/ChromaController/KeyConverter.cs @@ -0,0 +1,129 @@ +using System.Collections.Generic; +using System.Linq; +using ColoreKey = Colore.Effects.Keyboard.Key; +using FormsKey = System.Windows.Forms.Keys; + +namespace ChromaController +{ + internal class KeyConverter + { + private readonly Dictionary formsKeys = new Dictionary + { + {ColoreKey.A, FormsKey.A }, + {ColoreKey.B, FormsKey.B }, + {ColoreKey.C, FormsKey.C }, + {ColoreKey.D, FormsKey.D }, + {ColoreKey.E, FormsKey.E }, + {ColoreKey.F, FormsKey.F }, + {ColoreKey.G, FormsKey.G }, + {ColoreKey.H, FormsKey.H }, + {ColoreKey.I, FormsKey.I }, + {ColoreKey.J, FormsKey.J }, + {ColoreKey.K, FormsKey.K }, + {ColoreKey.L, FormsKey.L }, + {ColoreKey.M, FormsKey.M }, + {ColoreKey.N, FormsKey.N }, + {ColoreKey.O, FormsKey.O }, + {ColoreKey.P, FormsKey.P }, + {ColoreKey.Q, FormsKey.Q }, + {ColoreKey.R, FormsKey.R }, + {ColoreKey.S, FormsKey.S }, + {ColoreKey.T, FormsKey.T }, + {ColoreKey.U, FormsKey.U }, + {ColoreKey.V, FormsKey.V }, + {ColoreKey.W, FormsKey.W }, + {ColoreKey.X, FormsKey.X }, + {ColoreKey.Y, FormsKey.Y }, + {ColoreKey.Z, FormsKey.Z }, + {ColoreKey.D0, FormsKey.D0 }, + {ColoreKey.D1, FormsKey.D1 }, + {ColoreKey.D2, FormsKey.D2 }, + {ColoreKey.D3, FormsKey.D3 }, + {ColoreKey.D4, FormsKey.D4 }, + {ColoreKey.D5, FormsKey.D5 }, + {ColoreKey.D6, FormsKey.D6 }, + {ColoreKey.D7, FormsKey.D7 }, + {ColoreKey.D8, FormsKey.D8 }, + {ColoreKey.D9, FormsKey.D9 }, + {ColoreKey.Num0, FormsKey.NumPad0 }, + {ColoreKey.Num1, FormsKey.NumPad1 }, + {ColoreKey.Num2, FormsKey.NumPad2 }, + {ColoreKey.Num3, FormsKey.NumPad3 }, + {ColoreKey.Num4, FormsKey.NumPad4 }, + {ColoreKey.Num5, FormsKey.NumPad5 }, + {ColoreKey.Num6, FormsKey.NumPad6 }, + {ColoreKey.Num7, FormsKey.NumPad7 }, + {ColoreKey.Num8, FormsKey.NumPad8 }, + {ColoreKey.Num9, FormsKey.NumPad9 }, + {ColoreKey.F1, FormsKey.F1 }, + {ColoreKey.F2, FormsKey.F2 }, + {ColoreKey.F3, FormsKey.F3 }, + {ColoreKey.F4, FormsKey.F4 }, + {ColoreKey.F5, FormsKey.F5 }, + {ColoreKey.F6, FormsKey.F6 }, + {ColoreKey.F7, FormsKey.F7 }, + {ColoreKey.F8, FormsKey.F8 }, + {ColoreKey.F9, FormsKey.F9 }, + {ColoreKey.F10, FormsKey.F10 }, + {ColoreKey.F11, FormsKey.F11 }, + {ColoreKey.F12, FormsKey.F12 }, + {ColoreKey.NumDivide, FormsKey.Divide }, + {ColoreKey.NumMultiply, FormsKey.Multiply }, + {ColoreKey.NumSubtract, FormsKey.Subtract }, + {ColoreKey.NumAdd, FormsKey.Add }, + {ColoreKey.NumDecimal, FormsKey.Decimal }, + {ColoreKey.NumEnter, FormsKey.Enter }, + {ColoreKey.NumLock, FormsKey.NumLock }, + {ColoreKey.Escape, FormsKey.Escape }, + {ColoreKey.PrintScreen, FormsKey.PrintScreen }, + {ColoreKey.Scroll, FormsKey.Scroll }, + {ColoreKey.Pause, FormsKey.Pause }, + {ColoreKey.Insert, FormsKey.Insert }, + {ColoreKey.Home, FormsKey.Home }, + {ColoreKey.PageUp, FormsKey.PageUp }, + {ColoreKey.PageDown, FormsKey.PageDown }, + {ColoreKey.Delete, FormsKey.Delete }, + {ColoreKey.End, FormsKey.End }, + {ColoreKey.OemTilde, FormsKey.Oemtilde }, + {ColoreKey.Tab, FormsKey.Tab }, + {ColoreKey.CapsLock, FormsKey.CapsLock }, + {ColoreKey.LeftShift, FormsKey.LShiftKey }, + {ColoreKey.RightShift, FormsKey.RShiftKey }, + {ColoreKey.LeftControl, FormsKey.LControlKey }, + {ColoreKey.RightControl, FormsKey.RControlKey }, + {ColoreKey.LeftWindows, FormsKey.LWin }, + {ColoreKey.LeftAlt, FormsKey.Alt }, + {ColoreKey.Space, FormsKey.Space }, + {ColoreKey.Backspace, FormsKey.Back }, + {ColoreKey.Up, FormsKey.Up }, + {ColoreKey.Down, FormsKey.Down }, + {ColoreKey.Left, FormsKey.Left }, + {ColoreKey.Right, FormsKey.Right }, + {ColoreKey.OemLeftBracket, FormsKey.OemOpenBrackets }, + {ColoreKey.OemRightBracket, FormsKey.OemCloseBrackets }, + {ColoreKey.OemComma, FormsKey.Oemcomma }, + {ColoreKey.OemPeriod, FormsKey.OemPeriod }, + {ColoreKey.KorPipe, FormsKey.OemPipe }, + {ColoreKey.OemSemicolon, FormsKey.OemSemicolon}, + {ColoreKey.OemApostrophe, FormsKey.OemQuotes }, + {ColoreKey.OemSlash, FormsKey.OemQuestion }, + }; + + private readonly Dictionary coloreKeys = new Dictionary(); + + public KeyConverter() + { + coloreKeys = formsKeys.ToDictionary(x => x.Value, x => x.Key); + } + + public ColoreKey ToColoreKey(FormsKey key) + { + return coloreKeys[key]; + } + + public FormsKey ToFormsKey(ColoreKey key) + { + return formsKeys[key]; + } + } +} \ No newline at end of file diff --git a/ChromaController/KeyEffects/FadeKey.cs b/ChromaController/KeyEffects/FadeKey.cs new file mode 100755 index 0000000..d2ca58b --- /dev/null +++ b/ChromaController/KeyEffects/FadeKey.cs @@ -0,0 +1,38 @@ +using Colore; +using Colore.Data; +using Colore.Effects.Keyboard; +using System; + +namespace ChromaController +{ + internal class FadeKey : KeyEffect + { + public float StepPercentage { get; } + + /// + /// Fades from to in the specified time + /// + /// The that will have the fade effect + /// The startcolor + /// The endcolor + /// Must be between 0 and 1. Each step, the transition will be incremented by this amount + public FadeKey(Key[] keys, Color color1, Color color2, float stepPercentage = 0.1F, int delayTime = 0) : base(keys, color1, color2, delayTime) + { + if (stepPercentage <= 0 || stepPercentage > 1) throw new ArgumentException("argument should be between 0 and 1", "stepPercentage"); + StepPercentage = stepPercentage; + } + + public override bool Step(IChroma chroma) + { + bool baseResult = base.Step(chroma); + if (StepCounter <= DelayTime) return baseResult; + if ((StepPercentage * (StepCounter - DelayTime)) > 1) + { + chroma.Keyboard.SetKeysAsync(Keys, Color2, false); + return true; + } + chroma.Keyboard.SetKeysAsync(Keys, ColorMixer(Color1, Color2, StepPercentage * (StepCounter - DelayTime)), clear: false); + return baseResult; + } + } +} \ No newline at end of file diff --git a/ChromaController/KeyEffects/FlashKey.cs b/ChromaController/KeyEffects/FlashKey.cs new file mode 100755 index 0000000..1309d11 --- /dev/null +++ b/ChromaController/KeyEffects/FlashKey.cs @@ -0,0 +1,43 @@ +using Colore; +using Colore.Data; +using Colore.Effects.Keyboard; +using System; + +namespace ChromaController +{ + internal class FlashKey : KeyEffect + { + public float FlashTime { get; } + + /// + /// Flashes key with specified color for specified time. + /// + /// The that will flash + /// The startcolor + /// The endcolor + /// The amount of steps that will be shown + public FlashKey(Key[] keys, Color color1, Color color2, int flashTime, int delayTime = 0) : base(keys, color1, color2, delayTime) + { + if (flashTime <= 0) throw new ArgumentException("argument should be between 0 and 1", "stepPercentage"); + FlashTime = flashTime; + } + + public FlashKey(Key key, Color color1, Color color2, int flashTime, int delayTime = 0) + : this(new Key[] { key }, color1, color2, flashTime, delayTime) + { + } + + public override bool Step(IChroma chroma) + { + bool baseResult = base.Step(chroma); + if (StepCounter <= DelayTime) return baseResult; + if (StepCounter > FlashTime + DelayTime) + { + chroma.Keyboard.SetKeysAsync(Keys, Color2, false); + return true; + } + chroma.Keyboard.SetKeysAsync(Keys, Color1, false); + return baseResult; + } + } +} \ No newline at end of file diff --git a/ChromaController/KeyEffects/KeyEffect.cs b/ChromaController/KeyEffects/KeyEffect.cs new file mode 100755 index 0000000..6789d1b --- /dev/null +++ b/ChromaController/KeyEffects/KeyEffect.cs @@ -0,0 +1,43 @@ +using Colore; +using Colore.Data; +using Colore.Effects.Keyboard; + +namespace ChromaController +{ + internal partial class KeyEffect + { + public Key[] Keys { get; } + public Color Color1 { get; } + public Color Color2 { get; } + public int StepCounter { get; private set; } + public int DelayTime { get; } + + public KeyEffect(Key[] keys, Color color1, Color color2, int delayTime) + { + Keys = keys; + Color1 = color1; + Color2 = color2; + StepCounter = 0; + DelayTime = delayTime; + } + + virtual public bool Step(IChroma chroma) + { + StepCounter++; + return false; + } + + protected static Color ColorMixer(Color color1, Color color2, float mix) + { + int red = (int)(color1.R * (1 - mix) + color2.R * mix); + int green = (int)(color1.G * (1 - mix) + color2.G * mix); + int blue = (int)(color1.B * (1 - mix) + color2.B * mix); + return GetColoreColor(red, green, blue); + } + + internal static Color GetColoreColor(int red, int green, int blue) + { + return Color.FromRgb((uint)((red << 16) | (green << 8) | blue)); + } + } +} \ No newline at end of file diff --git a/ChromaController/MonitorManager.cs b/ChromaController/MonitorManager.cs new file mode 100755 index 0000000..5e1379e --- /dev/null +++ b/ChromaController/MonitorManager.cs @@ -0,0 +1,79 @@ +using Calculator; +using NumpadMonitor; +using System; +using System.Windows.Forms; + +namespace ChromaController +{ + internal class MonitorManager + { + private readonly NumpadMonitorForm monitor; + private readonly KeyConverter keyConverter; + private readonly ColoreOutput coloreOutput; + private readonly Calc calculator; + + public MonitorManager(ColoreOutput coloreOutput, KeyConverter keyConverter, Calc calculator) + { + this.keyConverter = keyConverter; + this.coloreOutput = coloreOutput; + this.calculator = calculator; + monitor = NumpadMonitor.Program.Initiate(false, true, false); + monitor.KeyPressEvent += new NumpadMonitorForm.NotifyKeyPressEvent(KeyPressEventHandler); + Application.Run(monitor); + } + + public void KeyPressEventHandler(NumpadMonitorForm sender, KeyInfo keyInfo) + { + Console.WriteLine(keyInfo.ToString()); + if (keyInfo.Key == Keys.End) + { + Exit(); + return; + } + CalculationResponse response = calculator.KeyPressed(keyInfo.Key); + HandleResponse(keyInfo, response); + } + + private void HandleResponse(KeyInfo keyInfo, CalculationResponse response) + { + switch (response.Response) + { + case Response.Ok: + coloreOutput.NumpadKeyPressed(keyConverter.ToColoreKey(keyInfo.Key)); + break; + + case Response.ClearedMemory: + coloreOutput.MemoryCleared(); + break; + + case Response.Result: + Console.WriteLine(response.Result); + if (response.Result == "∞") + { + coloreOutput.ErrorFlash(); + HandleResponse(new KeyInfo(Keys.Delete), calculator.KeyPressed(Keys.Delete)); + } + else + { + coloreOutput.PrintNumber(response.Result); + coloreOutput.MemorySet(); + } + break; + + case Response.WrongInput: + coloreOutput.ErrorFlash(); + break; + + default: + throw new ArgumentException("Argument is not value within Response Enum", "response.Response"); + } + } + + private void Exit() + { + monitor.DisposeElements(); + monitor.Close(); + coloreOutput.Exit(); + } + } +} \ No newline at end of file diff --git a/ChromaController/Program.cs b/ChromaController/Program.cs new file mode 100755 index 0000000..07cf211 --- /dev/null +++ b/ChromaController/Program.cs @@ -0,0 +1,30 @@ +using Calculator; +using System; +using System.IO; +using System.Threading; + +namespace ChromaController +{ + internal class Program + { + private static void Main(string[] args) + { + ColoreOutput coloreOutput = new ColoreOutput(ChromaFX()); + Thread coloreThread = new Thread(coloreOutput.Start); + coloreThread.Start(); + KeyConverter keyConverter = new KeyConverter(); + Calc calculator = new Calc(); + MonitorManager monitorManager = new MonitorManager(coloreOutput, keyConverter, calculator); + coloreThread.Join(); + } + + private static string ChromaFX() + { + string path = Environment.ExpandEnvironmentVariables(@"%APPDATA%\KeyboardCalculator\"); + string filename = "ChromaEffects.xml"; + if (!File.Exists(path + filename)) + throw new ApplicationException("No ChromaEffect.xml found in %APPDATA%\\KeyboardCalculator\\"); + return path + filename; + } + } +} \ No newline at end of file diff --git a/ChromaController/Properties/AssemblyInfo.cs b/ChromaController/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..11507b4 --- /dev/null +++ b/ChromaController/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Calculator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Calculator")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("39f3d543-544c-40ff-881a-02307788ecd0")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/ChromaController/packages.config b/ChromaController/packages.config new file mode 100755 index 0000000..4237a7a --- /dev/null +++ b/ChromaController/packages.config @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/Keyboard Calculator.sln b/Keyboard Calculator.sln new file mode 100755 index 0000000..7f4351e --- /dev/null +++ b/Keyboard Calculator.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NumpadMonitor", "NumpadMonitor\NumpadMonitor.csproj", "{D42162E9-9057-49E6-A6AE-660F108C721B}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromaController", "ChromaController\ChromaController.csproj", "{39F3D543-544C-40FF-881A-02307788ECD0}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Calculator", "Calculator\Calculator.csproj", "{239B6A10-C8D7-4AF0-845B-F99A0AFC2F5C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {D42162E9-9057-49E6-A6AE-660F108C721B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D42162E9-9057-49E6-A6AE-660F108C721B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D42162E9-9057-49E6-A6AE-660F108C721B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D42162E9-9057-49E6-A6AE-660F108C721B}.Release|Any CPU.Build.0 = Release|Any CPU + {39F3D543-544C-40FF-881A-02307788ECD0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {39F3D543-544C-40FF-881A-02307788ECD0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {39F3D543-544C-40FF-881A-02307788ECD0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {39F3D543-544C-40FF-881A-02307788ECD0}.Release|Any CPU.Build.0 = Release|Any CPU + {239B6A10-C8D7-4AF0-845B-F99A0AFC2F5C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {239B6A10-C8D7-4AF0-845B-F99A0AFC2F5C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {239B6A10-C8D7-4AF0-845B-F99A0AFC2F5C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {239B6A10-C8D7-4AF0-845B-F99A0AFC2F5C}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {C5E8DD27-BFEF-4F98-9D3A-26B5DB0406A6} + EndGlobalSection +EndGlobal diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..e34c876 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,621 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for + software and other kinds of works. + + The licenses for most software and other practical works are designed + to take away your freedom to share and change the works. By contrast, + the GNU General Public License is intended to guarantee your freedom to + share and change all versions of a program--to make sure it remains free + software for all its users. We, the Free Software Foundation, use the + GNU General Public License for most of our software; it applies also to + any other work released this way by its authors. You can apply it to + your programs, too. + + When we speak of free software, we are referring to freedom, not + price. Our General Public Licenses are designed to make sure that you + have the freedom to distribute copies of free software (and charge for + them if you wish), that you receive source code or can get it if you + want it, that you can change the software or use pieces of it in new + free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you + these rights or asking you to surrender the rights. Therefore, you have + certain responsibilities if you distribute copies of the software, or if + you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether + gratis or for a fee, you must pass on to the recipients the same + freedoms that you received. You must make sure that they, too, receive + or can get the source code. And you must show them these terms so they + know their rights. + + Developers that use the GNU GPL protect your rights with two steps: + (1) assert copyright on the software, and (2) offer you this License + giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains + that there is no warranty for this free software. For both users' and + authors' sake, the GPL requires that modified versions be marked as + changed, so that their problems will not be attributed erroneously to + authors of previous versions. + + Some devices are designed to deny users access to install or run + modified versions of the software inside them, although the manufacturer + can do so. This is fundamentally incompatible with the aim of + protecting users' freedom to change the software. The systematic + pattern of such abuse occurs in the area of products for individuals to + use, which is precisely where it is most unacceptable. Therefore, we + have designed this version of the GPL to prohibit the practice for those + products. If such problems arise substantially in other domains, we + stand ready to extend this provision to those domains in future versions + of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. + States should not allow patents to restrict development and use of + software on general-purpose computers, but in those that do, we wish to + avoid the special danger that patents applied to a free program could + make it effectively proprietary. To prevent this, the GPL assures that + patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and + modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of + works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this + License. Each licensee is addressed as "you". "Licensees" and + "recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work + in a fashion requiring copyright permission, other than the making of an + exact copy. The resulting work is called a "modified version" of the + earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based + on the Program. + + To "propagate" a work means to do anything with it that, without + permission, would make you directly or secondarily liable for + infringement under applicable copyright law, except executing it on a + computer or modifying a private copy. Propagation includes copying, + distribution (with or without modification), making available to the + public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other + parties to make or receive copies. Mere interaction with a user through + a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" + to the extent that it includes a convenient and prominently visible + feature that (1) displays an appropriate copyright notice, and (2) + tells the user that there is no warranty for the work (except to the + extent that warranties are provided), that licensees may convey the + work under this License, and how to view a copy of this License. If + the interface presents a list of user commands or options, such as a + menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work + for making modifications to it. "Object code" means any non-source + form of a work. + + A "Standard Interface" means an interface that either is an official + standard defined by a recognized standards body, or, in the case of + interfaces specified for a particular programming language, one that + is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other + than the work as a whole, that (a) is included in the normal form of + packaging a Major Component, but which is not part of that Major + Component, and (b) serves only to enable use of the work with that + Major Component, or to implement a Standard Interface for which an + implementation is available to the public in source code form. A + "Major Component", in this context, means a major essential component + (kernel, window system, and so on) of the specific operating system + (if any) on which the executable work runs, or a compiler used to + produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all + the source code needed to generate, install, and (for an executable + work) run the object code and to modify the work, including scripts to + control those activities. However, it does not include the work's + System Libraries, or general-purpose tools or generally available free + programs which are used unmodified in performing those activities but + which are not part of the work. For example, Corresponding Source + includes interface definition files associated with source files for + the work, and the source code for shared libraries and dynamically + linked subprograms that the work is specifically designed to require, + such as by intimate data communication or control flow between those + subprograms and other parts of the work. + + The Corresponding Source need not include anything that users + can regenerate automatically from other parts of the Corresponding + Source. + + The Corresponding Source for a work in source code form is that + same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of + copyright on the Program, and are irrevocable provided the stated + conditions are met. This License explicitly affirms your unlimited + permission to run the unmodified Program. The output from running a + covered work is covered by this License only if the output, given its + content, constitutes a covered work. This License acknowledges your + rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not + convey, without conditions so long as your license otherwise remains + in force. You may convey covered works to others for the sole purpose + of having them make modifications exclusively for you, or provide you + with facilities for running those works, provided that you comply with + the terms of this License in conveying all material for which you do + not control copyright. Those thus making or running the covered works + for you must do so exclusively on your behalf, under your direction + and control, on terms that prohibit them from making any copies of + your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under + the conditions stated below. Sublicensing is not allowed; section 10 + makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological + measure under any applicable law fulfilling obligations under article + 11 of the WIPO copyright treaty adopted on 20 December 1996, or + similar laws prohibiting or restricting circumvention of such + measures. + + When you convey a covered work, you waive any legal power to forbid + circumvention of technological measures to the extent such circumvention + is effected by exercising rights under this License with respect to + the covered work, and you disclaim any intention to limit operation or + modification of the work as a means of enforcing, against the work's + users, your or third parties' legal rights to forbid circumvention of + technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you + receive it, in any medium, provided that you conspicuously and + appropriately publish on each copy an appropriate copyright notice; + keep intact all notices stating that this License and any + non-permissive terms added in accord with section 7 apply to the code; + keep intact all notices of the absence of any warranty; and give all + recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, + and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to + produce it from the Program, in the form of source code under the + terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent + works, which are not by their nature extensions of the covered work, + and which are not combined with it such as to form a larger program, + in or on a volume of a storage or distribution medium, is called an + "aggregate" if the compilation and its resulting copyright are not + used to limit the access or legal rights of the compilation's users + beyond what the individual works permit. Inclusion of a covered work + in an aggregate does not cause this License to apply to the other + parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms + of sections 4 and 5, provided that you also convey the + machine-readable Corresponding Source under the terms of this License, + in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded + from the Corresponding Source as a System Library, need not be + included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any + tangible personal property which is normally used for personal, family, + or household purposes, or (2) anything designed or sold for incorporation + into a dwelling. In determining whether a product is a consumer product, + doubtful cases shall be resolved in favor of coverage. For a particular + product received by a particular user, "normally used" refers to a + typical or common use of that class of product, regardless of the status + of the particular user or of the way in which the particular user + actually uses, or expects or is expected to use, the product. A product + is a consumer product regardless of whether the product has substantial + commercial, industrial or non-consumer uses, unless such uses represent + the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, + procedures, authorization keys, or other information required to install + and execute modified versions of a covered work in that User Product from + a modified version of its Corresponding Source. The information must + suffice to ensure that the continued functioning of the modified object + code is in no case prevented or interfered with solely because + modification has been made. + + If you convey an object code work under this section in, or with, or + specifically for use in, a User Product, and the conveying occurs as + part of a transaction in which the right of possession and use of the + User Product is transferred to the recipient in perpetuity or for a + fixed term (regardless of how the transaction is characterized), the + Corresponding Source conveyed under this section must be accompanied + by the Installation Information. But this requirement does not apply + if neither you nor any third party retains the ability to install + modified object code on the User Product (for example, the work has + been installed in ROM). + + The requirement to provide Installation Information does not include a + requirement to continue to provide support service, warranty, or updates + for a work that has been modified or installed by the recipient, or for + the User Product in which it has been modified or installed. Access to a + network may be denied when the modification itself materially and + adversely affects the operation of the network or violates the rules and + protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, + in accord with this section must be in a format that is publicly + documented (and with an implementation available to the public in + source code form), and must require no special password or key for + unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this + License by making exceptions from one or more of its conditions. + Additional permissions that are applicable to the entire Program shall + be treated as though they were included in this License, to the extent + that they are valid under applicable law. If additional permissions + apply only to part of the Program, that part may be used separately + under those permissions, but the entire Program remains governed by + this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option + remove any additional permissions from that copy, or from any part of + it. (Additional permissions may be written to require their own + removal in certain cases when you modify the work.) You may place + additional permissions on material, added by you to a covered work, + for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you + add to a covered work, you may (if authorized by the copyright holders of + that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further + restrictions" within the meaning of section 10. If the Program as you + received it, or any part of it, contains a notice stating that it is + governed by this License along with a term that is a further + restriction, you may remove that term. If a license document contains + a further restriction but permits relicensing or conveying under this + License, you may add to a covered work material governed by the terms + of that license document, provided that the further restriction does + not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you + must place, in the relevant source files, a statement of the + additional terms that apply to those files, or a notice indicating + where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the + form of a separately written license, or stated as exceptions; + the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly + provided under this License. Any attempt otherwise to propagate or + modify it is void, and will automatically terminate your rights under + this License (including any patent licenses granted under the third + paragraph of section 11). + + However, if you cease all violation of this License, then your + license from a particular copyright holder is reinstated (a) + provisionally, unless and until the copyright holder explicitly and + finally terminates your license, and (b) permanently, if the copyright + holder fails to notify you of the violation by some reasonable means + prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is + reinstated permanently if the copyright holder notifies you of the + violation by some reasonable means, this is the first time you have + received notice of violation of this License (for any work) from that + copyright holder, and you cure the violation prior to 30 days after + your receipt of the notice. + + Termination of your rights under this section does not terminate the + licenses of parties who have received copies or rights from you under + this License. If your rights have been terminated and not permanently + reinstated, you do not qualify to receive new licenses for the same + material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or + run a copy of the Program. Ancillary propagation of a covered work + occurring solely as a consequence of using peer-to-peer transmission + to receive a copy likewise does not require acceptance. However, + nothing other than this License grants you permission to propagate or + modify any covered work. These actions infringe copyright if you do + not accept this License. Therefore, by modifying or propagating a + covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically + receives a license from the original licensors, to run, modify and + propagate that work, subject to this License. You are not responsible + for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an + organization, or substantially all assets of one, or subdividing an + organization, or merging organizations. If propagation of a covered + work results from an entity transaction, each party to that + transaction who receives a copy of the work also receives whatever + licenses to the work the party's predecessor in interest had or could + give under the previous paragraph, plus a right to possession of the + Corresponding Source of the work from the predecessor in interest, if + the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the + rights granted or affirmed under this License. For example, you may + not impose a license fee, royalty, or other charge for exercise of + rights granted under this License, and you may not initiate litigation + (including a cross-claim or counterclaim in a lawsuit) alleging that + any patent claim is infringed by making, using, selling, offering for + sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this + License of the Program or a work on which the Program is based. The + work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims + owned or controlled by the contributor, whether already acquired or + hereafter acquired, that would be infringed by some manner, permitted + by this License, of making, using, or selling its contributor version, + but do not include claims that would be infringed only as a + consequence of further modification of the contributor version. For + purposes of this definition, "control" includes the right to grant + patent sublicenses in a manner consistent with the requirements of + this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free + patent license under the contributor's essential patent claims, to + make, use, sell, offer for sale, import and otherwise run, modify and + propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express + agreement or commitment, however denominated, not to enforce a patent + (such as an express permission to practice a patent or covenant not to + sue for patent infringement). To "grant" such a patent license to a + party means to make such an agreement or commitment not to enforce a + patent against the party. + + If you convey a covered work, knowingly relying on a patent license, + and the Corresponding Source of the work is not available for anyone + to copy, free of charge and under the terms of this License, through a + publicly available network server or other readily accessible means, + then you must either (1) cause the Corresponding Source to be so + available, or (2) arrange to deprive yourself of the benefit of the + patent license for this particular work, or (3) arrange, in a manner + consistent with the requirements of this License, to extend the patent + license to downstream recipients. "Knowingly relying" means you have + actual knowledge that, but for the patent license, your conveying the + covered work in a country, or your recipient's use of the covered work + in a country, would infringe one or more identifiable patents in that + country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or + arrangement, you convey, or propagate by procuring conveyance of, a + covered work, and grant a patent license to some of the parties + receiving the covered work authorizing them to use, propagate, modify + or convey a specific copy of the covered work, then the patent license + you grant is automatically extended to all recipients of the covered + work and works based on it. + + A patent license is "discriminatory" if it does not include within + the scope of its coverage, prohibits the exercise of, or is + conditioned on the non-exercise of one or more of the rights that are + specifically granted under this License. You may not convey a covered + work if you are a party to an arrangement with a third party that is + in the business of distributing software, under which you make payment + to the third party based on the extent of your activity of conveying + the work, and under which the third party grants, to any of the + parties who would receive the covered work from you, a discriminatory + patent license (a) in connection with copies of the covered work + conveyed by you (or copies made from those copies), or (b) primarily + for and in connection with specific products or compilations that + contain the covered work, unless you entered into that arrangement, + or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting + any implied license or other defenses to infringement that may + otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot convey a + covered work so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you may + not convey it at all. For example, if you agree to terms that obligate you + to collect a royalty for further conveying from those to whom you convey + the Program, the only way you could satisfy both those terms and this + License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have + permission to link or combine any covered work with a work licensed + under version 3 of the GNU Affero General Public License into a single + combined work, and to convey the resulting work. The terms of this + License will continue to apply to the part which is the covered work, + but the special requirements of the GNU Affero General Public License, + section 13, concerning interaction through a network will apply to the + combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of + the GNU General Public License from time to time. Such new versions will + be similar in spirit to the present version, but may differ in detail to + address new problems or concerns. + + Each version is given a distinguishing version number. If the + Program specifies that a certain numbered version of the GNU General + Public License "or any later version" applies to it, you have the + option of following the terms and conditions either of that numbered + version or of any later version published by the Free Software + Foundation. If the Program does not specify a version number of the + GNU General Public License, you may choose any version ever published + by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future + versions of the GNU General Public License can be used, that proxy's + public statement of acceptance of a version permanently authorizes you + to choose that version for the Program. + + Later license versions may give you additional or different + permissions. However, no additional obligations are imposed on any + author or copyright holder as a result of your choosing to follow a + later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY + APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT + HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY + OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, + THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM + IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF + ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS + THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY + GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE + USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF + DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD + PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), + EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF + SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided + above cannot be given local legal effect according to their terms, + reviewing courts shall apply local law that most closely approximates + an absolute waiver of all civil liability in connection with the + Program, unless a warranty or assumption of liability accompanies a + copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/NumpadMonitor/App.config b/NumpadMonitor/App.config new file mode 100755 index 0000000..54a3dfa --- /dev/null +++ b/NumpadMonitor/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/NumpadMonitor/Constants.cs b/NumpadMonitor/Constants.cs new file mode 100755 index 0000000..a0cf4b1 --- /dev/null +++ b/NumpadMonitor/Constants.cs @@ -0,0 +1,9 @@ +namespace NumpadMonitor +{ + internal static class Constants + { + // windows message id for hotkey + // https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-hotkey + public const int WM_HOTKEY_MSG_ID = 0x0312; + } +} \ No newline at end of file diff --git a/NumpadMonitor/KeyCodeReaderWriter.cs b/NumpadMonitor/KeyCodeReaderWriter.cs new file mode 100755 index 0000000..8905b00 --- /dev/null +++ b/NumpadMonitor/KeyCodeReaderWriter.cs @@ -0,0 +1,37 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.IO; +using System.Text; + +namespace NumpadMonitor +{ + internal class KeyCodeReaderWriter + { + private const string Path = @"%APPDATA%\KeyboardCalculator\"; + private const string Filename = "KeyConfig.json"; + + static public void Write(List keyHandlers) + { + List keyinfo = new List(); + foreach (KeyHandler handler in keyHandlers) + { + keyinfo.Add(handler.KeyInfo); + } + string output = JsonConvert.SerializeObject(keyinfo); + + string path = Environment.ExpandEnvironmentVariables(Path); + Directory.CreateDirectory(path); + File.WriteAllText(path + Filename, output, Encoding.UTF8); + } + + internal static List Read() + { + string path = Environment.ExpandEnvironmentVariables(Path); + if (!File.Exists(path + Filename)) return null; + string filestring = File.ReadAllText(path + Filename, Encoding.UTF8); + List keyInfo = JsonConvert.DeserializeObject>(filestring); + return keyInfo; + } + } +} \ No newline at end of file diff --git a/NumpadMonitor/KeyConfig.Designer.cs b/NumpadMonitor/KeyConfig.Designer.cs new file mode 100755 index 0000000..e36b122 --- /dev/null +++ b/NumpadMonitor/KeyConfig.Designer.cs @@ -0,0 +1,103 @@ +namespace NumpadMonitor +{ + partial class KeyConfig + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label_key = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label_keyCode = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(92, 13); + this.label1.TabIndex = 0; + this.label1.Text = "Please Press Key:"; + // + // label_key + // + this.label_key.AutoSize = true; + this.label_key.Location = new System.Drawing.Point(110, 9); + this.label_key.Name = "label_key"; + this.label_key.Size = new System.Drawing.Size(37, 13); + this.label_key.TabIndex = 0; + this.label_key.Text = ""; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 32); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(116, 13); + this.label2.TabIndex = 0; + this.label2.Text = "Last Pressed Keycode:"; + // + // label_keyCode + // + this.label_keyCode.AutoSize = true; + this.label_keyCode.Location = new System.Drawing.Point(134, 32); + this.label_keyCode.Name = "label_keyCode"; + this.label_keyCode.Size = new System.Drawing.Size(10, 13); + this.label_keyCode.TabIndex = 0; + this.label_keyCode.Text = "-"; + // + // KeyConfig + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(197, 56); + this.ControlBox = false; + this.Controls.Add(this.label_key); + this.Controls.Add(this.label_keyCode); + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(213, 95); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(213, 95); + this.Name = "KeyConfig"; + this.ShowIcon = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "KeyConfig"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label_key; + private System.Windows.Forms.Label label2; + private System.Windows.Forms.Label label_keyCode; + } +} \ No newline at end of file diff --git a/NumpadMonitor/KeyConfig.cs b/NumpadMonitor/KeyConfig.cs new file mode 100755 index 0000000..d9cedba --- /dev/null +++ b/NumpadMonitor/KeyConfig.cs @@ -0,0 +1,68 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace NumpadMonitor +{ + internal partial class KeyConfig : Form + { + private readonly List keyHandlers = new List(); + private KeyHandler askedKey; + private readonly bool AlternativeKeySet; + + public KeyConfig(bool alternativeKeyset) + { + InitializeComponent(); + AlternativeKeySet = alternativeKeyset; + KeyInfo[] keyset = alternativeKeyset ? KeySet.Alternative : KeySet.Numpad; + foreach (KeyInfo key in keyset) + AddKeyHandler(key); + AskNextKey(); + } + + private void AddKeyHandler(KeyInfo key) + { + KeyHandler keyHandler = new KeyHandler(key, this); + keyHandler.Register(); + keyHandlers.Add(keyHandler); + } + + private void AskNextKey() + { + KeyHandler keyHandler = keyHandlers.Find(x => x.KeyInfo.KeyCode == IntPtr.Zero); + if (keyHandler == null) + { + KeyCodeReaderWriter.Write(keyHandlers); + DisposeElements(); + Close(); + return; + } + AskKey(keyHandler); + } + + private void AskKey(KeyHandler keyHandler) + { + askedKey = keyHandler; + label_key.Text = AlternativeKeySet ? KeySet.AlternativeToNumpad(keyHandler.KeyInfo).ToString() : keyHandler.KeyInfo.ToString(); + } + + private void HandleHotkey(IntPtr LParam) + { + label_keyCode.Text = LParam.ToInt64().ToString(); + askedKey.SetKeyCode(LParam); + AskNextKey(); + } + + protected override void WndProc(ref Message m) + { + if (m.Msg == Constants.WM_HOTKEY_MSG_ID) + HandleHotkey(m.LParam); + base.WndProc(ref m); + } + + public void DisposeElements() + { + keyHandlers.ForEach(x => x.Unregiser()); + } + } +} \ No newline at end of file diff --git a/NumpadMonitor/KeyConfig.resx b/NumpadMonitor/KeyConfig.resx new file mode 100755 index 0000000..29dcb1b --- /dev/null +++ b/NumpadMonitor/KeyConfig.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NumpadMonitor/KeyHandler.cs b/NumpadMonitor/KeyHandler.cs new file mode 100755 index 0000000..44e61f2 --- /dev/null +++ b/NumpadMonitor/KeyHandler.cs @@ -0,0 +1,56 @@ +using System; +using System.Runtime.InteropServices; +using System.Windows.Forms; + +namespace NumpadMonitor +{ + internal class KeyHandler + { + [DllImport("user32.dll")] + private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vk); + + [DllImport("user32.dll")] + private static extern bool UnregisterHotKey(IntPtr hWnd, int id); + + public KeyInfo KeyInfo { get; private set; } + private readonly IntPtr hWnd; + private readonly int id; + + public void SetKeyCode(IntPtr keyCode) + { + KeyInfo.SetKeyCode(keyCode); + } + + public KeyHandler(Keys key, Form form) + { + KeyInfo = new KeyInfo(key); + hWnd = form.Handle; + id = GetHashCode(); + } + + public KeyHandler(KeyInfo keyInfo, Form form) + { + KeyInfo = keyInfo; + hWnd = form.Handle; + id = GetHashCode(); + } + + public override int GetHashCode() + { + int hash = 17; + hash = hash * 23 + KeyInfo.GetHashCode(); + hash = hash * 23 + hWnd.ToInt32(); + return hash; + } + + public bool Register() + { + return RegisterHotKey(hWnd, id, KeyInfo.FsModifiers, (int)KeyInfo.Key); + } + + public bool Unregiser() + { + return UnregisterHotKey(hWnd, id); + } + } +} \ No newline at end of file diff --git a/NumpadMonitor/KeyInfo.cs b/NumpadMonitor/KeyInfo.cs new file mode 100755 index 0000000..bf1862f --- /dev/null +++ b/NumpadMonitor/KeyInfo.cs @@ -0,0 +1,107 @@ +using Newtonsoft.Json; +using System; +using System.Text; +using System.Windows.Forms; + +namespace NumpadMonitor +{ + public class KeyInfo + { + public Keys Key { get; private set; } + public int FsModifiers { get; private set; } + public IntPtr KeyCode { get; private set; } + + internal void SetKeyCode(IntPtr keyCode) + { + if (KeyCode == IntPtr.Zero) + KeyCode = keyCode; + else + throw new ArgumentException("Parameter was already set, and cannot be set again"); + } + + public KeyInfo(Keys key, int fsModifiers = 0) + { + Key = key; + FsModifiers = fsModifiers; + } + + [JsonConstructor] + public KeyInfo(Keys key, int fsModifiers, IntPtr keyCode) + { + Key = key; + FsModifiers = fsModifiers; + KeyCode = keyCode; + } + + public static int GetModifierInt(Modifier[] modifiers) + { + int modifierCode = 0; + foreach (Modifier modifier in modifiers) + { + switch (modifier) + { + case Modifier.Alt: + modifierCode |= 0b0001; + break; + + case Modifier.Ctrl: + modifierCode |= 0b0010; + break; + + case Modifier.Shift: + modifierCode |= 0b0100; + break; + + case Modifier.Win: + modifierCode |= 0b1000; + break; + + default: + throw new ArgumentOutOfRangeException("modifier", "Modifier not in enum"); + } + } + return modifierCode; + } + + public override string ToString() + { + StringBuilder sb = new StringBuilder(); + if (FsModifiers != 0) + { + if ((FsModifiers & 0b0010) == 0b0010) + sb.Append("Ctrl + "); + if ((FsModifiers & 0b0001) == 0b0001) + sb.Append("Alt + "); + if ((FsModifiers & 0b0100) == 0b0100) + sb.Append("Shift + "); + if ((FsModifiers & 0b1000) == 0b1000) + sb.Append("Win + "); + } + sb.Append(Key.ToString()); + return sb.ToString(); + } + + public override bool Equals(object obj) + { + return obj is KeyInfo info && + Key == info.Key && + FsModifiers == info.FsModifiers; + } + + public override int GetHashCode() + { + int hash = 17; + hash = hash * 23 + (int)Key; + hash = hash * 23 + FsModifiers; + return hash; + } + } + + public enum Modifier + { + Alt, + Ctrl, + Shift, + Win + } +} \ No newline at end of file diff --git a/NumpadMonitor/KeySet.cs b/NumpadMonitor/KeySet.cs new file mode 100755 index 0000000..f073cbb --- /dev/null +++ b/NumpadMonitor/KeySet.cs @@ -0,0 +1,56 @@ +using System; +using System.Windows.Forms; + +namespace NumpadMonitor +{ + public class KeySet + { + internal readonly static KeyInfo[] Numpad = new KeyInfo[] { + new KeyInfo(Keys.NumPad0), + new KeyInfo(Keys.NumPad1), + new KeyInfo(Keys.NumPad2), + new KeyInfo(Keys.NumPad3), + new KeyInfo(Keys.NumPad4), + new KeyInfo(Keys.NumPad5), + new KeyInfo(Keys.NumPad6), + new KeyInfo(Keys.NumPad7), + new KeyInfo(Keys.NumPad8), + new KeyInfo(Keys.NumPad9), + new KeyInfo(Keys.Divide), + new KeyInfo(Keys.Multiply), + new KeyInfo(Keys.Subtract), + new KeyInfo(Keys.Add), + new KeyInfo(Keys.Enter), + new KeyInfo(Keys.Decimal), + new KeyInfo(Keys.Delete), + new KeyInfo(Keys.End) + }; + + internal readonly static KeyInfo[] Alternative = new KeyInfo[] { + new KeyInfo(Keys.F13, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F14, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F15, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F16, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F17, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F18, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F19, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F20, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F21, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F22, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F23, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F24, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Shift})), + new KeyInfo(Keys.F13, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Ctrl})), + new KeyInfo(Keys.F14, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Ctrl})), + new KeyInfo(Keys.F15, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Ctrl})), + new KeyInfo(Keys.F16, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Ctrl})), + new KeyInfo(Keys.F17, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Ctrl})), + new KeyInfo(Keys.F18, KeyInfo.GetModifierInt(new Modifier[]{Modifier.Ctrl})) + }; + + public static KeyInfo AlternativeToNumpad(KeyInfo key) + { + int index = Array.FindIndex(Alternative, x => x.Equals(key)); + return Numpad[index]; + } + } +} \ No newline at end of file diff --git a/NumpadMonitor/NumpadMonitor.Designer.cs b/NumpadMonitor/NumpadMonitor.Designer.cs new file mode 100755 index 0000000..2f93dd9 --- /dev/null +++ b/NumpadMonitor/NumpadMonitor.Designer.cs @@ -0,0 +1,81 @@ +namespace NumpadMonitor +{ + partial class NumpadMonitorForm + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(89, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(31, 13); + this.label1.TabIndex = 0; + this.label1.Text = "none"; + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(12, 9); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(71, 13); + this.label2.TabIndex = 1; + this.label2.Text = "Last Pressed:"; + // + // NumpadMonitorForm + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(154, 31); + this.ControlBox = false; + this.Controls.Add(this.label2); + this.Controls.Add(this.label1); + this.MaximizeBox = false; + this.MaximumSize = new System.Drawing.Size(170, 70); + this.MinimizeBox = false; + this.MinimumSize = new System.Drawing.Size(170, 70); + this.Name = "NumpadMonitorForm"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.Text = "Numpad Monitor"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + private System.Windows.Forms.Label label2; + } +} + diff --git a/NumpadMonitor/NumpadMonitor.cs b/NumpadMonitor/NumpadMonitor.cs new file mode 100755 index 0000000..840f3d7 --- /dev/null +++ b/NumpadMonitor/NumpadMonitor.cs @@ -0,0 +1,61 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace NumpadMonitor +{ + public partial class NumpadMonitorForm : Form + { + private readonly List keyHandlers = new List(); + + public delegate void NotifyKeyPressEvent(NumpadMonitorForm sender, KeyInfo key); + + public event NotifyKeyPressEvent KeyPressEvent; + + private readonly bool AlternativeKeySet; + + internal NumpadMonitorForm(List keyinfo, bool alternativeKeyset = false, bool visible = false) + { + AlternativeKeySet = alternativeKeyset; + InitializeComponent(); + Opacity = visible ? 100 : 0; + AddAllKeyHandlers(keyinfo); + } + + private void AddAllKeyHandlers(List keyinfo) + { + foreach (KeyInfo key in keyinfo) + { + AddKeyHandler(key); + } + } + + private void AddKeyHandler(KeyInfo key) + { + KeyHandler keyHandler = new KeyHandler(key, this); + keyHandler.Register(); + keyHandlers.Add(keyHandler); + } + + private void HandleHotkey(IntPtr LParam) + { + KeyHandler handler = keyHandlers.Find(x => x.KeyInfo.KeyCode.Equals(LParam)); + if (handler == null) return; + KeyInfo pressedKey = AlternativeKeySet ? KeySet.AlternativeToNumpad(handler.KeyInfo) : handler.KeyInfo; + KeyPressEvent?.Invoke(this, pressedKey); + label1.Text = pressedKey.ToString(); + } + + protected override void WndProc(ref Message m) + { + if (m.Msg == Constants.WM_HOTKEY_MSG_ID) + HandleHotkey(m.LParam); + base.WndProc(ref m); + } + + public void DisposeElements() + { + keyHandlers.ForEach(x => x.Unregiser()); + } + } +} \ No newline at end of file diff --git a/NumpadMonitor/NumpadMonitor.csproj b/NumpadMonitor/NumpadMonitor.csproj new file mode 100755 index 0000000..163ec06 --- /dev/null +++ b/NumpadMonitor/NumpadMonitor.csproj @@ -0,0 +1,143 @@ + + + + + Debug + AnyCPU + {D42162E9-9057-49E6-A6AE-660F108C721B} + WinExe + NumpadMonitor + NumpadMonitor + v4.7.2 + 512 + true + true + false + C:\Users\Burathar\Desktop\Publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + true + 1 + 1.0.0.%2a + false + true + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + 2B8670BC1261BE64A1A40E5310DE341A81A2CCE5 + + + NumpadMonitor_TemporaryKey.pfx + + + true + + + true + + + + ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + + + + + + + + + + + + Form + + + NumpadMonitor.cs + + + + Form + + + KeyConfig.cs + + + + + + + NumpadMonitor.cs + + + KeyConfig.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + False + Microsoft .NET Framework 4.7.2 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/NumpadMonitor/NumpadMonitor.resx b/NumpadMonitor/NumpadMonitor.resx new file mode 100755 index 0000000..29dcb1b --- /dev/null +++ b/NumpadMonitor/NumpadMonitor.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NumpadMonitor/Program.cs b/NumpadMonitor/Program.cs new file mode 100755 index 0000000..e1a1a75 --- /dev/null +++ b/NumpadMonitor/Program.cs @@ -0,0 +1,37 @@ +using System; +using System.Collections.Generic; +using System.Windows.Forms; + +namespace NumpadMonitor +{ + public static class Program + { + /// + /// The main entry point for the application. + /// + [STAThread] + private static void Main(string[] args) + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + string args0 = args.Length > 0 ? args[0] : ""; + NumpadMonitorForm monitor = Initiate(args0 == "config-keys"); + Application.Run(monitor); + } + + public static NumpadMonitorForm Initiate(bool configKeys = false, bool alternativeKeyset = false, bool formVisible = true) + { + List keyinfo = KeyCodeReaderWriter.Read(); + + if (configKeys || keyinfo == null) + { + KeyConfig keyConfig = new KeyConfig(alternativeKeyset); + keyConfig.ShowDialog(); + keyConfig.Dispose(); + keyinfo = KeyCodeReaderWriter.Read(); + } + NumpadMonitorForm monitor = new NumpadMonitorForm(keyinfo, alternativeKeyset, formVisible); + return monitor; + } + } +} \ No newline at end of file diff --git a/NumpadMonitor/Properties/AssemblyInfo.cs b/NumpadMonitor/Properties/AssemblyInfo.cs new file mode 100755 index 0000000..b5ae865 --- /dev/null +++ b/NumpadMonitor/Properties/AssemblyInfo.cs @@ -0,0 +1,35 @@ +using System.Reflection; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("Keyboard Calculator")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("Keyboard Calculator")] +[assembly: AssemblyCopyright("Copyright © 2020")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("d42162e9-9057-49e6-a6ae-660f108c721b")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/NumpadMonitor/Properties/Resources.Designer.cs b/NumpadMonitor/Properties/Resources.Designer.cs new file mode 100755 index 0000000..206fcf3 --- /dev/null +++ b/NumpadMonitor/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NumpadMonitor.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("NumpadMonitor.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/NumpadMonitor/Properties/Resources.resx b/NumpadMonitor/Properties/Resources.resx new file mode 100755 index 0000000..ffecec8 --- /dev/null +++ b/NumpadMonitor/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NumpadMonitor/Properties/Settings.Designer.cs b/NumpadMonitor/Properties/Settings.Designer.cs new file mode 100755 index 0000000..7b19432 --- /dev/null +++ b/NumpadMonitor/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace NumpadMonitor.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.5.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/NumpadMonitor/Properties/Settings.settings b/NumpadMonitor/Properties/Settings.settings new file mode 100755 index 0000000..abf36c5 --- /dev/null +++ b/NumpadMonitor/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/NumpadMonitor/packages.config b/NumpadMonitor/packages.config new file mode 100755 index 0000000..32637c2 --- /dev/null +++ b/NumpadMonitor/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file