commit b488b73422dc9d905ca00b3a36d71ea93b63ab3a Author: Taskeren Date: Sat Apr 6 00:12:07 2024 +0800 Initial commit diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..7f914a3 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.cs] +indent_size = 4 +indent_style = tab diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..add57be --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +bin/ +obj/ +/packages/ +riderModule.iml +/_ReSharper.Caches/ \ No newline at end of file diff --git a/.idea/.idea.3074/.idea/.gitignore b/.idea/.idea.3074/.idea/.gitignore new file mode 100644 index 0000000..d7ac342 --- /dev/null +++ b/.idea/.idea.3074/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/contentModel.xml +/.idea.3074.iml +/modules.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/.idea.3074/.idea/encodings.xml b/.idea/.idea.3074/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/.idea/.idea.3074/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/.idea.3074/.idea/indexLayout.xml b/.idea/.idea.3074/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/.idea/.idea.3074/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/.idea.3074/.idea/vcs.xml b/.idea/.idea.3074/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/.idea.3074/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/3074.csproj b/3074.csproj new file mode 100644 index 0000000..a4f5311 --- /dev/null +++ b/3074.csproj @@ -0,0 +1,110 @@ + + + + + Debug + AnyCPU + {55FD1115-6694-4C85-B2BD-09D4ACB38E76} + WinExe + tsf_3074 + tsf_3074 + v4.7.2 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + 7.3 + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\NetLimiter.5.2.10\lib\net462\CoreLibNet.dll + + + packages\Microsoft.Extensions.Logging.Abstractions.5.0.0\lib\net461\Microsoft.Extensions.Logging.Abstractions.dll + + + + packages\NetLimiter.5.2.10\lib\net462\NetLimiter.dll + + + packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll + + + + + + + 4.0 + + + packages\NetLimiter.5.2.10\lib\net462\VirusTotalNet.dll + + + + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + + OverlayWindow.xaml + + + + Code + + + True + True + Resources.resx + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/3074.csproj.DotSettings.user b/3074.csproj.DotSettings.user new file mode 100644 index 0000000..5762e3e --- /dev/null +++ b/3074.csproj.DotSettings.user @@ -0,0 +1,2 @@ + + 55FD1115-6694-4C85-B2BD-09D4ACB38E76/d:Properties/f:Resources.resx \ No newline at end of file diff --git a/3074.sln b/3074.sln new file mode 100644 index 0000000..0c671bd --- /dev/null +++ b/3074.sln @@ -0,0 +1,16 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "3074", "3074.csproj", "{55FD1115-6694-4C85-B2BD-09D4ACB38E76}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {55FD1115-6694-4C85-B2BD-09D4ACB38E76}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {55FD1115-6694-4C85-B2BD-09D4ACB38E76}.Debug|Any CPU.Build.0 = Debug|Any CPU + {55FD1115-6694-4C85-B2BD-09D4ACB38E76}.Release|Any CPU.ActiveCfg = Release|Any CPU + {55FD1115-6694-4C85-B2BD-09D4ACB38E76}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/3074.sln.DotSettings.user b/3074.sln.DotSettings.user new file mode 100644 index 0000000..035b726 --- /dev/null +++ b/3074.sln.DotSettings.user @@ -0,0 +1,3 @@ + + True + True \ No newline at end of file diff --git a/App.config b/App.config new file mode 100644 index 0000000..92691b0 --- /dev/null +++ b/App.config @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..b710d19 --- /dev/null +++ b/App.xaml @@ -0,0 +1,10 @@ + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..69489c5 --- /dev/null +++ b/App.xaml.cs @@ -0,0 +1,45 @@ +using System; +using System.IO; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Threading; + +namespace _3074 +{ + /// + /// Interaction logic for App.xaml + /// + public partial class App + { + private void App_OnStartup(object sender, StartupEventArgs e) + { + SetCurrentProcessExplicitAppUserModelID("com.squirrel.Tsf"); + Tsf.FFullGame.ToString(); + var window = new OverlayWindow(); + window.Show(); + } + + private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) + { + // export the exception info + var date = DateTime.Now; + var fileName = $"tsf-crash_{date.Day}_{date.Month}_{date.Year}-{date.Hour}_{date.Minute}_{date.Second}.txt"; + using (var writer = new StreamWriter(fileName, true)) + { + writer.WriteLine("##########" + DateTime.Now + "##########"); + writer.WriteLine("An exception occurred when loading tsf."); + writer.WriteLine(e.Exception); + } + + Console.WriteLine(_3074.Properties.Resources.CrashTextOutputAt); + Console.WriteLine(fileName); + + Shutdown(); + e.Handled = true; + } + + [DllImport("shell32.dll", SetLastError = true)] + public static extern void SetCurrentProcessExplicitAppUserModelID( + [MarshalAs(UnmanagedType.LPWStr)] string appUserModelId); + } +} \ No newline at end of file diff --git a/Config.cs b/Config.cs new file mode 100644 index 0000000..d0622c4 --- /dev/null +++ b/Config.cs @@ -0,0 +1,36 @@ +using System; +using System.Collections.Generic; +using System.IO; +using Newtonsoft.Json; + +namespace _3074 +{ + public static class Config + { + public static ConfigData Instance => _instance ?? ReadConfig(); + private static ConfigData _instance; + + private static ConfigData ReadConfig(string path = "config.json") + { + if (File.Exists(path)) + { + return _instance = JsonConvert.DeserializeObject(File.ReadAllText(path)); + } + + var defaults = new ConfigData + { + Destiny2Path = "Your Destiny 2 application path" + }; + + File.WriteAllText(path, JsonConvert.SerializeObject(defaults)); + + throw new Exception("Config is not set"); + } + } + + public class ConfigData + { + public string Destiny2Path; + } + +} \ No newline at end of file diff --git a/HotkeyManager.cs b/HotkeyManager.cs new file mode 100644 index 0000000..9fc6fe4 --- /dev/null +++ b/HotkeyManager.cs @@ -0,0 +1,87 @@ +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Windows; +using System.Windows.Interop; + +namespace _3074 +{ + public partial class HotkeyManager + { + private readonly Window _window; + + public HotkeyManager(Window window) + { + _window = window; + } + + private HwndSource _source; + + private readonly Dictionary _listener = new Dictionary(); + + private const int HotkeyIdStart = 9000; + private int _hotkeyId = HotkeyIdStart; + + public void RegisterHotkey(uint fsModifiers, uint vk, OnEvent onEvent) + { + var thisId = _hotkeyId++; + RegisterHotKey(new WindowInteropHelper(_window).Handle, thisId, fsModifiers, vk); + _listener[thisId] = onEvent; + } + + private void UnregisterAllHotkeys() + { + var helper = new WindowInteropHelper(_window); + while (_hotkeyId >= HotkeyIdStart) + { + UnregisterHotKey(helper.Handle, _hotkeyId--); + } + } + + public void OnSourceInitialized() + { + _source = HwndSource.FromHwnd(new WindowInteropHelper(_window).Handle) ?? throw new Exception(); + _source.AddHook(HwndHook); + } + + public void OnClosed() + { + _source.RemoveHook(HwndHook); + _source = null; + UnregisterAllHotkeys(); + } + + private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) + { + if (msg != 0x0312) return IntPtr.Zero; + + var hotkeyId = wParam.ToInt32(); + if (OnHotKeyPressed(hotkeyId)) + { + handled = true; + } + return IntPtr.Zero; + } + + private bool OnHotKeyPressed(int hotkeyId) + { + var listener = _listener[hotkeyId]; + if (listener == null) return false; + listener.Invoke(); + return true; + } + + [DllImport("User32.dll")] + private static extern bool RegisterHotKey( + [In] IntPtr hWnd, + [In] int id, + [In] uint fsModifiers, + [In] uint vk); + + [DllImport("User32.dll")] + private static extern bool UnregisterHotKey( + [In] IntPtr hWnd, + [In] int id); + } + +} \ No newline at end of file diff --git a/OnEvent.cs b/OnEvent.cs new file mode 100644 index 0000000..d7735a1 --- /dev/null +++ b/OnEvent.cs @@ -0,0 +1,4 @@ +namespace _3074 +{ + public delegate void OnEvent(); +} \ No newline at end of file diff --git a/OverlayWindow.xaml b/OverlayWindow.xaml new file mode 100644 index 0000000..a243f22 --- /dev/null +++ b/OverlayWindow.xaml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OverlayWindow.xaml.cs b/OverlayWindow.xaml.cs new file mode 100644 index 0000000..44d887e --- /dev/null +++ b/OverlayWindow.xaml.cs @@ -0,0 +1,53 @@ +using System; +using System.ComponentModel; +using System.Windows; + +namespace _3074 +{ + public partial class OverlayWindow : Window + { + internal readonly HotkeyManager _hotkey; + + public OverlayWindow() + { + InitializeComponent(); + DataContext = new OverlayViewModel(); + _hotkey = new HotkeyManager(this); + } + + protected override void OnSourceInitialized(EventArgs e) + { + base.OnSourceInitialized(e); + TsfFilter.AllFilters.ForEach(f => f.RegisterHotkey(_hotkey)); + _hotkey.OnSourceInitialized(); + } + + protected override void OnClosed(EventArgs e) + { + _hotkey.OnClosed(); + base.OnClosed(e); + } + } + + public class OverlayViewModel : INotifyPropertyChanged + { + public event PropertyChangedEventHandler PropertyChanged; + + public string F3074 => Tsf.F3074.GetState(); + public string F3074UL => Tsf.F3074UL.GetState(); + public string F7500 => Tsf.F7500.GetState(); + public string F27K => Tsf.F27K.GetState(); + public string F30K => Tsf.F30K.GetState(); + public string FFullGame => Tsf.FFullGame.GetState(); + + public OverlayViewModel() + { + Tsf.F3074.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(F3074))); + Tsf.F3074UL.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(F3074UL))); + Tsf.F7500.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(F7500))); + Tsf.F27K.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(F27K))); + Tsf.F30K.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(F30K))); + Tsf.FFullGame.OnStateChanged += () => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(FFullGame))); + } + } +} \ No newline at end of file diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..2d732e8 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -0,0 +1,55 @@ +using System.Reflection; +using System.Resources; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; +using System.Windows; + +// 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("_3074")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("_3074")] +[assembly: AssemblyCopyright("Copyright © 2024")] +[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)] + +//In order to begin building localizable applications, set +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the to en-US. Then uncomment +//the NeutralResourceLanguage attribute below. Update the "en-US" in +//the line below to match the UICulture setting in the project file. + +//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] + + +[assembly: ThemeInfo( + ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located + //(used if a resource is not found in the page, + // or application resource dictionaries) + ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located + //(used if a resource is not found in the page, + // app, or any theme specific resource dictionaries) +)] + + +// 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/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..8c34e3a --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace _3074.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", "4.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("_3074.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; + } + } + + /// + /// Looks up a localized string similar to Tsf has crashed because of unhandled exceptions. Thrown exception log is output at:. + /// + internal static string CrashTextOutputAt { + get { + return ResourceManager.GetString("CrashTextOutputAt", resourceCulture); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..e1633c9 --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 + + + Tsf has crashed because of unhandled exceptions. Thrown exception log is output at: + + \ No newline at end of file diff --git a/Tsf.cs b/Tsf.cs new file mode 100644 index 0000000..30ccc6d --- /dev/null +++ b/Tsf.cs @@ -0,0 +1,149 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using NetLimiter.Service; + +namespace _3074 +{ + public static class Tsf + { + private const string Prefix = "tsf"; // thirty-seventy-four + + private static NLClient _client; + + private static NLClient GetClient() + { + if (_client != null) return _client; + _client = new NLClient(); + _client.Connect(); + return _client; + } + + private static string GetFilterNameFor(string portName, bool upload = false) + { + return upload ? $"{Prefix}_{portName}_ul" : $"{Prefix}_{portName}"; + } + + private static TsfFilter CreateFilter(string portName, ushort portStart, ushort portEnd, bool upload = false, + uint fs = 0, uint vk = 0) + { + var cli = GetClient(); + var name = GetFilterNameFor(portName); + var filter = cli.Filters.FirstOrDefault(f => f.Name == name) ?? + cli.AddFilter(new Filter(name) + { + Functions = { new FFRemotePortInRange(new PortRangeFilterValue(portStart, portEnd)) } + }); + return new TsfFilter(name, filter, cli, upload, 1, fs, vk); + } + + private static TsfFilter CreateFilterFullGame(uint fs, uint vk) + { + var cli = GetClient(); + var name = GetFilterNameFor("fg"); + var filter = cli.Filters.FirstOrDefault(f => f.Name == name) ?? + cli.AddFilter(new Filter(name) + { + Functions = { new FFPathEqual(Config.Instance.Destiny2Path) } + }); + return new TsfFilter(name, filter, cli, false, 811, fs, vk); + } + + public static readonly TsfFilter F3074; + public static readonly TsfFilter F3074UL; + public static readonly TsfFilter F7500; + public static readonly TsfFilter F27K; + public static readonly TsfFilter F30K; + public static readonly TsfFilter FFullGame; + + static Tsf() + { + F3074 = CreateFilter("3074", 3074, 3074, false, VirtualKey.ModCtrl, VirtualKey.VkG); + F3074UL = CreateFilter("3074", 3074, 3074, true, VirtualKey.ModCtrl, VirtualKey.VkH); + F7500 = CreateFilter("7500", 7500, 7509, false, VirtualKey.ModCtrl, VirtualKey.VkT); + F27K = CreateFilter("27k", 27015, 27200, false, VirtualKey.ModAlt, VirtualKey.VkN); + F30K = CreateFilter("30k", 30000, 30009, false, VirtualKey.ModAlt, VirtualKey.VkB); + FFullGame = CreateFilterFullGame(VirtualKey.ModCtrl, VirtualKey.VkJ); + } + } + + public class TsfFilter + { + private readonly string _name; + private readonly Filter _filter; + private readonly NLClient _client; + private readonly bool _upload; + private readonly uint _limitSize; // the limit rate, normally is 1, only FG is 800 or 811 + private readonly uint _fs; + private readonly uint _vk; + + private Rule _rule; + + public event OnEvent OnStateChanged = delegate { }; + + public static readonly List AllFilters = new List(); + + public TsfFilter(string name, Filter filter, NLClient client, bool upload, uint limitSize = 1, uint fs = 0, + uint vk = 0) + { + _name = name; + _filter = filter; + _client = client; + _upload = upload; + _limitSize = limitSize; + _fs = fs; + _vk = vk; + + GetLimitRule(); + + AllFilters.Add(this); + } + + public void RegisterHotkey(HotkeyManager manager) + { + if (_vk != 0) + { + Console.WriteLine($"Registering Hotkey for {_name}"); + manager.RegisterHotkey(_fs, _vk, () => + { + Toggle(); + var currState = GetLimitRule().IsEnabled ? "On" : "Off"; + Console.WriteLine($"Updated [{_name}] {currState}"); + }); + } + } + + private Rule GetLimitRule() + { + if (_rule != null) return _rule; + var dir = _upload ? RuleDir.Out : RuleDir.In; + _rule = _client.Rules.FirstOrDefault(r => r.FilterId == _filter.Id && r.Dir == dir) ?? + _client.AddRule(_filter.Id, new LimitRule(dir, _limitSize) { IsEnabled = false }); + return _rule; + } + + public void Toggle() + { + _rule.IsEnabled = !_rule.IsEnabled; + _rule = _client.UpdateRule(_rule).Rule; + OnStateChanged.Invoke(); + } + + public void Set(bool value) + { + _rule.IsEnabled = value; + _rule = _client.UpdateRule(_rule).Rule; + OnStateChanged.Invoke(); + } + + public bool IsEnabled() + { + return _rule?.IsEnabled ?? false; + } + + public string GetState() + { + return IsEnabled() ? "On" : "Off"; + } + } +} \ No newline at end of file diff --git a/VirtualKey.cs b/VirtualKey.cs new file mode 100644 index 0000000..dc64ea2 --- /dev/null +++ b/VirtualKey.cs @@ -0,0 +1,210 @@ +namespace _3074 +{ + public static class VirtualKey + { + public const uint ModNone = 0x0000; + public const uint ModAlt = 0x0001; + public const uint ModCtrl = 0x0002; + public const uint ModShift = 0x0004; + public const uint ModWin = 0x0008; + + // https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes + + public const uint VkLButton = 0x01; // Left mouse button + public const uint VkRButton = 0x02; // Right mouse button + public const uint VkCancel = 0x03; // Control-break processing + public const uint VkMButton = 0x04; // Middle mouse button + public const uint VkXButton1 = 0x05; // X1 mouse button + public const uint VkXButton2 = 0x06; // X2 mouse button + public const uint VkBack = 0x08; // BACKSPACE key + public const uint VkTab = 0x09; // TAB key + public const uint VkClear = 0x0C; // CLEAR key + public const uint VkReturn = 0x0D; // ENTER key + public const uint VkShift = 0x10; // SHIFT key + public const uint VkControl = 0x11; // CTRL key + public const uint VkMenu = 0x12; // ALT key + public const uint VkPause = 0x13; // PAUSE key + public const uint VkCapital = 0x14; // CAPS LOCK key + public const uint VkKana = 0x15; // IME Kana mode + public const uint VkHangul = 0x15; // IME Hangul mode + public const uint VkImeOn = 0x16; // IME On + public const uint VkJunja = 0x17; // IME Junja mode + public const uint VkFinal = 0x18; // IME final mode + public const uint VkHanja = 0x19; // IME Hanja mode + public const uint VkKanji = 0x19; // IME Kanji mode + public const uint VkImeOff = 0x1A; // IME Off + public const uint VkEscape = 0x1B; // ESC key + public const uint VkConvert = 0x1C; // IME convert + public const uint VkNonConvert = 0x1D; // IME nonconvert + public const uint VkAccept = 0x1E; // IME accept + public const uint VkModeChange = 0x1F; // IME mode change request + public const uint VkSpace = 0x20; // SPACEBAR + public const uint VkPrior = 0x21; // PAGE UP key + public const uint VkNext = 0x22; // PAGE DOWN key + public const uint VkEnd = 0x23; // END key + public const uint VkHome = 0x24; // HOME key + public const uint VkLeft = 0x25; // LEFT ARROW key + public const uint VkUp = 0x26; // UP ARROW key + public const uint VkRight = 0x27; // RIGHT ARROW key + public const uint VkDown = 0x28; // DOWN ARROW key + public const uint VkSelect = 0x29; // SELECT key + public const uint VkPrint = 0x2A; // PRINT key + public const uint VkExecute = 0x2B; // EXECUTE key + public const uint VkSnapshot = 0x2C; // PRINT SCREEN key + public const uint VkInsert = 0x2D; // INS key + public const uint VkDelete = 0x2E; // DEL key + public const uint VkHelp = 0x2F; // HELP key + public const uint Vk0 = 0x30; + public const uint Vk1 = 0x31; + public const uint Vk2 = 0x32; + public const uint Vk3 = 0x33; + public const uint Vk4 = 0x34; + public const uint Vk5 = 0x35; + public const uint Vk6 = 0x36; + public const uint Vk7 = 0x37; + public const uint Vk8 = 0x38; + public const uint Vk9 = 0x39; + public const uint VkA = 0x41; + public const uint VkB = 0x42; + public const uint VkC = 0x43; + public const uint VkD = 0x44; + public const uint VkE = 0x45; + public const uint VkF = 0x46; + public const uint VkG = 0x47; + public const uint VkH = 0x48; + public const uint VkI = 0x49; + public const uint VkJ = 0x4A; + public const uint VkK = 0x4B; + public const uint VkL = 0x4C; + public const uint VkM = 0x4D; + public const uint VkN = 0x4E; + public const uint VkO = 0x4F; + public const uint VkP = 0x50; + public const uint VkQ = 0x51; + public const uint VkR = 0x52; + public const uint VkS = 0x53; + public const uint VkT = 0x54; + public const uint VkU = 0x55; + public const uint VkV = 0x56; + public const uint VkW = 0x57; + public const uint VkX = 0x58; + public const uint VkY = 0x59; + public const uint VkZ = 0x5A; + public const uint VkLWin = 0x5B; // Left Windows key + public const uint VkRWin = 0x5C; // Right Windows key + public const uint VkApps = 0x5D; // Applications key + public const uint VkSleep = 0x5F; // Computer Sleep key + public const uint VkNumpad0 = 0x60; // Numeric keypad 0 key + public const uint VkNumpad1 = 0x61; // Numeric keypad 1 key + public const uint VkNumpad2 = 0x62; // Numeric keypad 2 key + public const uint VkNumpad3 = 0x63; // Numeric keypad 3 key + public const uint VkNumpad4 = 0x64; // Numeric keypad 4 key + public const uint VkNumpad5 = 0x65; // Numeric keypad 5 key + public const uint VkNumpad6 = 0x66; // Numeric keypad 6 key + public const uint VkNumpad7 = 0x67; // Numeric keypad 7 key + public const uint VkNumpad8 = 0x68; // Numeric keypad 8 key + public const uint VkNumpad9 = 0x69; // Numeric keypad 9 key + public const uint VkMultiply = 0x6A; // Multiply key + public const uint VkAdd = 0x6B; // Add key + public const uint VkSeparator = 0x6C; // Separator key + public const uint VkSubtract = 0x6D; // Subtract key + public const uint VkDecimal = 0x6E; // Decimal key + public const uint VkDivide = 0x6F; // Divide key + public const uint VkF1 = 0x70; // F1 key + public const uint VkF2 = 0x71; // F2 key + public const uint VkF3 = 0x72; // F3 key + public const uint VkF4 = 0x73; // F4 key + public const uint VkF5 = 0x74; // F5 key + public const uint VkF6 = 0x75; // F6 key + public const uint VkF7 = 0x76; // F7 key + public const uint VkF8 = 0x77; // F8 key + public const uint VkF9 = 0x78; // F9 key + public const uint VkF10 = 0x79; // F10 key + public const uint VkF11 = 0x7A; // F11 key + public const uint VkF12 = 0x7B; // F12 key + public const uint VkF13 = 0x7C; // F13 key + public const uint VkF14 = 0x7D; // F14 key + public const uint VkF15 = 0x7E; // F15 key + public const uint VkF16 = 0x7F; // F16 key + public const uint VkF17 = 0x80; // F17 key + public const uint VkF18 = 0x81; // F18 key + public const uint VkF19 = 0x82; // F19 key + public const uint VkF20 = 0x83; // F20 key + public const uint VkF21 = 0x84; // F21 key + public const uint VkF22 = 0x85; // F22 key + public const uint VkF23 = 0x86; // F23 key + public const uint VkF24 = 0x87; // F24 key + public const uint VkNumlock = 0x90; // NUM LOCK key + public const uint VkScroll = 0x91; // SCROLL LOCK key + public const uint VkLShift = 0xA0; // Left SHIFT key + public const uint VkRShift = 0xA1; // Right SHIFT key + public const uint VkLControl = 0xA2; // Left CONTROL key + public const uint VkRControl = 0xA3; // Right CONTROL key + public const uint VkLMenu = 0xA4; // Left ALT key + public const uint VkRMenu = 0xA5; // Right ALT key + public const uint VkBrowserBack = 0xA6; // Browser Back key + public const uint VkBrowserForward = 0xA7; // Browser Forward key + public const uint VkBrowserRefresh = 0xA8; // Browser Refresh key + public const uint VkBrowserStop = 0xA9; // Browser Stop key + public const uint VkBrowserSearch = 0xAA; // Browser Search key + public const uint VkBrowserFavorites = 0xAB; // Browser Favorites key + public const uint VkBrowserHome = 0xAC; // Browser Start and Home key + public const uint VkVolumeMute = 0xAD; // Volume Mute key + public const uint VkVolumeDown = 0xAE; // Volume Down key + public const uint VkVolumeUp = 0xAF; // Volume Up key + public const uint VkMediaNextTrack = 0xB0; // Next Track key + public const uint VkMediaPrevTrack = 0xB1; // Previous Track key + public const uint VkMediaStop = 0xB2; // Stop Media key + public const uint VkMediaPlayPause = 0xB3; // Play/Pause Media key + public const uint VkLaunchMail = 0xB4; // Start Mail key + public const uint VkLaunchMediaSelect = 0xB5; // Select Media key + public const uint VkLaunchApp1 = 0xB6; // Start Application 1 key + public const uint VkLaunchApp2 = 0xB7; // Start Application 2 key + + public const uint + VkOem1 = 0xBA; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ;: key + + public const uint VkOemPlus = 0xBB; // For any country/region, the + key + public const uint VkOemComma = 0xBC; // For any country/region, the , key + public const uint VkOemMinus = 0xBD; // For any country/region, the - key + public const uint VkOemPeriod = 0xBE; // For any country/region, the . key + + public const uint + VkOem2 = 0xBF; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the /? key + + public const uint + VkOem3 = 0xC0; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the `~ key + + public const uint + VkOem4 = 0xDB; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the [{ key + + public const uint + VkOem5 = 0xDC; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the \\| key + + public const uint + VkOem6 = 0xDD; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the ]} key + + public const uint + VkOem7 = 0xDE; // Used for miscellaneous characters; it can vary by keyboard. For the US standard keyboard, the '" key + + public const uint VkOem8 = 0xDF; // Used for miscellaneous characters; it can vary by keyboard. + + public const uint + VkOem102 = 0xE2; // The <> keys on the US standard keyboard, or the \\| key on the non-US 102-key keyboard + + public const uint VkProcessKey = 0xE5; // IME PROCESS key + + public const uint + VkPacket = 0xE7; // Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT, SendInput, WM_KEYDOWN, and WM_KEYUP + + public const uint VkAttn = 0xF6; // Attn key + public const uint VkCrSel = 0xF7; // CrSel key + public const uint VkExSel = 0xF8; // ExSel key + public const uint VkErEof = 0xF9; // Erase EOF key + public const uint VkPlay = 0xFA; // Play key + public const uint VkZoom = 0xFB; // Zoom key + public const uint VkNoname = 0xFC; // Reserved + public const uint VkPa1 = 0xFD; // PA1 key + public const uint VkOemClear = 0xFE; // Clear key + } +} \ No newline at end of file diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..2468456 --- /dev/null +++ b/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file