Progression
This commit is contained in:
parent
14877f4711
commit
b0bc2fead2
@ -9,6 +9,8 @@ namespace FakeeDeck.ButtonType
|
|||||||
{
|
{
|
||||||
internal class KeyboardMacro
|
internal class KeyboardMacro
|
||||||
{
|
{
|
||||||
|
//https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
|
||||||
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
|
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
|
||||||
public static extern void keybd_event(uint bVk, uint bScan, uint dwFlags, uint dwExtraInfo);
|
public static extern void keybd_event(uint bVk, uint bScan, uint dwFlags, uint dwExtraInfo);
|
||||||
|
|
||||||
|
@ -12,12 +12,17 @@ namespace FakeeDeck.ButtonType
|
|||||||
{
|
{
|
||||||
{ "play/pause", new uint[] { 0xB3}},
|
{ "play/pause", new uint[] { 0xB3}},
|
||||||
{ "mute", new uint[] { 0xAD }},
|
{ "mute", new uint[] { 0xAD }},
|
||||||
|
{ "next", new uint[] { 0xB0 }},
|
||||||
|
{ "previous", new uint[] { 0xB1 }},
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Dictionary<string, string> mediaIcons = new Dictionary<string, string>
|
public static Dictionary<string, string> mediaIcons = new Dictionary<string, string>
|
||||||
{
|
{
|
||||||
{ "play/pause", "fa-play"},
|
{ "play/pause", "fa-play"},
|
||||||
{ "mute", "fa-volume-xmark"},
|
{ "mute", "fa-volume-xmark"},
|
||||||
|
{ "next", "fa-forward"},
|
||||||
|
{ "previous", "fa-backward"},
|
||||||
};
|
};
|
||||||
|
|
||||||
public static string getButton(string Key)
|
public static string getButton(string Key)
|
||||||
|
@ -57,4 +57,22 @@ pages:
|
|||||||
function: MediaMacro
|
function: MediaMacro
|
||||||
parameters:
|
parameters:
|
||||||
- name: Key
|
- name: Key
|
||||||
value: "mute"
|
value: "mute"
|
||||||
|
|
||||||
|
- button: mute
|
||||||
|
function: MediaMacro
|
||||||
|
parameters:
|
||||||
|
- name: Key
|
||||||
|
value: "previous"
|
||||||
|
|
||||||
|
- button: mute
|
||||||
|
function: MediaMacro
|
||||||
|
parameters:
|
||||||
|
- name: Key
|
||||||
|
value: "play/pause"
|
||||||
|
|
||||||
|
- button: mute
|
||||||
|
function: MediaMacro
|
||||||
|
parameters:
|
||||||
|
- name: Key
|
||||||
|
value: "next"
|
@ -1,47 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FakeeDeck.ButtonType
|
|
||||||
{
|
|
||||||
internal class Button
|
|
||||||
{
|
|
||||||
public static string getButtonHTML(string icon, string image, string name, string action, Dictionary<string, string> parameters = null)
|
|
||||||
{
|
|
||||||
|
|
||||||
string body = "";
|
|
||||||
|
|
||||||
body += "<div class=\"m-2\">";
|
|
||||||
body += "<form style=\"margin-bottom: 0px;\" method=\"post\" action=\"" + action + "\">";
|
|
||||||
|
|
||||||
if (parameters is not null)
|
|
||||||
{
|
|
||||||
foreach (var parameter in parameters)
|
|
||||||
{
|
|
||||||
body += "<input type=\"hidden\" name=\"" + parameter.Key + "\" value=\"" + parameter.Value + "\">";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
body += "<button type=\"submit\" value=\"submit\" style=\"background-size: cover; " + (!string.IsNullOrEmpty(image) ? "background-image: url('" + image + "');" : "") + " width: 150px;height: 150px; background-color: aquamarine;\" >";
|
|
||||||
body += (!string.IsNullOrEmpty(icon) ? "<i class=\"fa-solid " + icon + "\"></i>" : name);
|
|
||||||
body += "</button>";
|
|
||||||
|
|
||||||
body += "</form>";
|
|
||||||
body += "</div>";
|
|
||||||
|
|
||||||
return body;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string getButton(string Key)
|
|
||||||
{
|
|
||||||
return getButtonHTML(null, "https://docs.itego.cz/uploads/images/system/2022-04/OdRTPJ4iTTInmhdP-jagq7dfjpi2lilfg-imageedit-2-6604933313.gif", "Test", "test/test");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool invokeAction(string Key)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,102 +0,0 @@
|
|||||||
using FakeeDeck.Class;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using static System.Net.WebRequestMethods;
|
|
||||||
|
|
||||||
namespace FakeeDeck.ButtonType
|
|
||||||
{
|
|
||||||
class HelldiversTwoMacro : Button
|
|
||||||
{
|
|
||||||
const uint Key_Up = 0x68;
|
|
||||||
const uint Key_Down = 0x62;
|
|
||||||
const uint Key_Left = 0x64;
|
|
||||||
const uint Key_Right = 0x66;
|
|
||||||
|
|
||||||
//https://helldivers.wiki.gg/wiki/Stratagems
|
|
||||||
//https://helldivers.fandom.com/wiki/Stratagems_(Helldivers_2)
|
|
||||||
|
|
||||||
public static Dictionary<string, uint[]> stratogems = new Dictionary<string, uint[]>
|
|
||||||
{
|
|
||||||
//Mission
|
|
||||||
{ "reinforce", new uint[] { 0x65, Key_Up, Key_Down, Key_Right, Key_Left, Key_Up}},
|
|
||||||
{ "resupply", new uint[] { 0x65, Key_Down, Key_Down, Key_Up, Key_Right }},
|
|
||||||
|
|
||||||
//Support Weapons
|
|
||||||
{ "anti-material", new uint[] { 0x65, Key_Down, Key_Left, Key_Right, Key_Up, Key_Down}},
|
|
||||||
{ "flamethrower", new uint[] { 0x65, Key_Down, Key_Left, Key_Up, Key_Down, Key_Up}},
|
|
||||||
{ "autocannon", new uint[] { 0x65, Key_Down, Key_Left, Key_Down, Key_Up, Key_Up, Key_Right}},
|
|
||||||
{ "grenade-launcher", new uint[] { 0x65, Key_Down, Key_Left, Key_Up, Key_Left, Key_Down}},
|
|
||||||
|
|
||||||
//Offensive: Orbital Strikes
|
|
||||||
{ "orbital-precision-strike", new uint[] { 0x65, Key_Right, Key_Right, Key_Up}},
|
|
||||||
|
|
||||||
//Defensive
|
|
||||||
{ "mortar-sentry", new uint[] { 0x65, Key_Down, Key_Up, Key_Right, Key_Down}},
|
|
||||||
{ "gatling-sentry", new uint[] { 0x65, Key_Down, Key_Up, Key_Right, Key_Left}},
|
|
||||||
|
|
||||||
|
|
||||||
//Supply: Backpacks
|
|
||||||
|
|
||||||
//Offensive: Eagle
|
|
||||||
{ "strafing-run", new uint[] { 0x65, Key_Up, Key_Right, Key_Right}},
|
|
||||||
{ "airstrike", new uint[] { 0x65, Key_Up, Key_Right, Key_Down, Key_Right}},
|
|
||||||
{ "cluster-bomb", new uint[] { 0x65, Key_Up, Key_Right, Key_Down, Key_Down, Key_Right}},
|
|
||||||
{ "napalm-airstrike", new uint[] { 0x65, Key_Up, Key_Right, Key_Down, Key_Up}},
|
|
||||||
{ "smoke-strike", new uint[] { 0x65, Key_Up, Key_Right, Key_Up, Key_Down}},
|
|
||||||
{ "rocket-pods", new uint[] { 0x65, Key_Up, Key_Right, Key_Up, Key_Left}},
|
|
||||||
{ "bomb", new uint[] { 0x65, Key_Up, Key_Right, Key_Up, Key_Right}},
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
public static Dictionary<string, string> stratogemsIcons = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "reinforce", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/5/5a/HD2_Reinforce.png"},
|
|
||||||
{ "resupply", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/7/72/HD2_Resupply.png"},
|
|
||||||
{ "anti-material", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/c/c3/APW-1_Anti-Materiel_Rifle_Icon.png"},
|
|
||||||
{ "flamethrower", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/c/cc/FLAM-40_Flamethrower_Icon.png"},
|
|
||||||
{ "autocannon", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/c/c6/AC-8_Autocannon_Icon.png"},
|
|
||||||
{ "grenade-launcher","https://static.wikia.nocookie.net/helldivers_gamepedia/images/6/66/GL-21_Grenade_Launcher_Icon.png"},
|
|
||||||
{ "orbital-precision-strike", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/4/47/Orbital_Precision_Strike_Icon.png"},
|
|
||||||
{ "mortar-sentry", "https://static.wikia.nocookie.net/helldivers_gamepedia/images/1/1d/A_M-12_Mortar_Sentry_Icon.png"},
|
|
||||||
{ "gatling-sentry","https://static.wikia.nocookie.net/helldivers_gamepedia/images/4/48/A_G-16_Gatling_Sentry_Icon.png"},
|
|
||||||
|
|
||||||
//Offensive: Eagle
|
|
||||||
{ "strafing-run","https://static.wikia.nocookie.net/helldivers_gamepedia/images/3/33/Eagle_Strafing_Run_Icon.png"},
|
|
||||||
{ "airstrike","https://static.wikia.nocookie.net/helldivers_gamepedia/images/7/7e/Eagle_Airstrike_Icon.png"},
|
|
||||||
{ "cluster-bomb","https://static.wikia.nocookie.net/helldivers_gamepedia/images/8/89/Eagle_Cluster_Bomb_Icon.png"},
|
|
||||||
{ "napalm-airstrike","https://static.wikia.nocookie.net/helldivers_gamepedia/images/d/d4/Eagle_Napalm_Airstrike_Icon.png"},
|
|
||||||
{ "smoke-strike","https://static.wikia.nocookie.net/helldivers_gamepedia/images/1/1a/Eagle_Smoke_Strike_Icon.png"},
|
|
||||||
{ "rocket-pods","https://static.wikia.nocookie.net/helldivers_gamepedia/images/e/e3/Eagle_110MM_Rocket_Pods_Icon.png"},
|
|
||||||
{ "bomb","https://static.wikia.nocookie.net/helldivers_gamepedia/images/5/5a/Eagle_500KG_Bomb_Icon.png"},
|
|
||||||
};
|
|
||||||
|
|
||||||
public static string getButton(string Key)
|
|
||||||
{
|
|
||||||
return getButtonHTML(null, stratogemsIcons[Key].ToString(), Key, "button\\HelldiversTwoMacro", new Dictionary<string, string>() { { "stratogem", Key } });
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool invokeAction(string stratogem)
|
|
||||||
{
|
|
||||||
foreach (var key in stratogems[stratogem])
|
|
||||||
{
|
|
||||||
KeyboardMacro.SendKey(key);
|
|
||||||
Console.WriteLine(key);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string FirstLetterToUpper(string str)
|
|
||||||
{
|
|
||||||
if (str == null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
if (str.Length > 1)
|
|
||||||
return char.ToUpper(str[0]) + str.Substring(1);
|
|
||||||
|
|
||||||
return str.ToUpper();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,24 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FakeeDeck.ButtonType
|
|
||||||
{
|
|
||||||
internal class KeyboardMacro
|
|
||||||
{
|
|
||||||
[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]
|
|
||||||
public static extern void keybd_event(uint bVk, uint bScan, uint dwFlags, uint dwExtraInfo);
|
|
||||||
|
|
||||||
public static void SendKey(uint Key)
|
|
||||||
{
|
|
||||||
System.Threading.Thread.Sleep(60);
|
|
||||||
keybd_event(Key, 0, 0, 0);
|
|
||||||
System.Threading.Thread.Sleep(60);
|
|
||||||
keybd_event(Key, 0, 2, 0);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,35 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FakeeDeck.ButtonType
|
|
||||||
{
|
|
||||||
internal class MediaMacro : Button
|
|
||||||
{
|
|
||||||
public static Dictionary<string, uint[]> mediaControls = new Dictionary<string, uint[]>
|
|
||||||
{
|
|
||||||
{ "play/pause", new uint[] { 0xB3}},
|
|
||||||
{ "mute", new uint[] { 0xAD }},
|
|
||||||
};
|
|
||||||
|
|
||||||
public static Dictionary<string, string> mediaIcons = new Dictionary<string, string>
|
|
||||||
{
|
|
||||||
{ "play/pause", "fa-play"},
|
|
||||||
{ "mute", "fa-volume-xmark"},
|
|
||||||
};
|
|
||||||
|
|
||||||
public static string getButton(string Key)
|
|
||||||
{
|
|
||||||
return getButtonHTML(mediaIcons[Key], null, Key, "button\\MediaMacro", new Dictionary<string, string>() { { "control_action", Key } });
|
|
||||||
}
|
|
||||||
|
|
||||||
public static bool invokeAction(string control_action)
|
|
||||||
{
|
|
||||||
KeyboardMacro.SendKey(mediaControls[control_action][0]);
|
|
||||||
Console.WriteLine(control_action);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FakeeDeck.Class
|
|
||||||
{
|
|
||||||
internal class AbstractionHelper
|
|
||||||
{
|
|
||||||
public static Type? resolvType(string className)
|
|
||||||
{
|
|
||||||
string cleanClass = "FakeeDeck.ButtonType." + className.Trim('/');
|
|
||||||
|
|
||||||
Type? buttonClass = Type.GetType(cleanClass, true);
|
|
||||||
|
|
||||||
if (buttonClass is null)
|
|
||||||
return null;
|
|
||||||
|
|
||||||
return buttonClass;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string getButtonVisual(JsonElement button)
|
|
||||||
{
|
|
||||||
string calssName = button.GetProperty("function").ToString();
|
|
||||||
MethodInfo? renderMethod = AbstractionHelper.resolvType(calssName).GetMethod("getButton");
|
|
||||||
ParameterInfo[] pars = renderMethod.GetParameters();
|
|
||||||
List<object> parameters = new List<object>();
|
|
||||||
|
|
||||||
foreach (ParameterInfo p in pars)
|
|
||||||
{
|
|
||||||
JsonElement parameter = button.GetProperty("parameters").EnumerateArray().SingleOrDefault(item => item.GetProperty("name").ToString() == p.Name);
|
|
||||||
parameters.Insert(p.Position, parameter.GetProperty("value").ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
return renderMethod.Invoke(null, [.. parameters]).ToString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,33 +0,0 @@
|
|||||||
using AutoUpdaterDotNET;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Http.Json;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FakeeDeck.Class
|
|
||||||
{
|
|
||||||
internal class AutoUpdateHelper
|
|
||||||
{
|
|
||||||
public AutoUpdateHelper() {
|
|
||||||
AutoUpdater.ParseUpdateInfoEvent += AutoUpdaterOnParseUpdateInfoEvent;
|
|
||||||
AutoUpdater.Synchronous = true;
|
|
||||||
AutoUpdater.ShowRemindLaterButton = false;
|
|
||||||
AutoUpdater.Start("https://github.com/GamerClassN7/FakeDeck/releases/latest/download/meta.xml");
|
|
||||||
}
|
|
||||||
private void AutoUpdaterOnParseUpdateInfoEvent(ParseUpdateInfoEventArgs args)
|
|
||||||
{
|
|
||||||
JsonElement json = JsonDocument.Parse(args.RemoteData).RootElement;
|
|
||||||
args.UpdateInfo = new UpdateInfoEventArgs
|
|
||||||
{
|
|
||||||
CurrentVersion = json.GetProperty("tag_name").ToString().TrimStart('v'),
|
|
||||||
DownloadURL = json.GetProperty("zipball_url").ToString(),
|
|
||||||
};
|
|
||||||
|
|
||||||
Debug.WriteLine(json.ToString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,49 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using YamlDotNet.Serialization.NamingConventions;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Reflection;
|
|
||||||
using FakeeDeck.ButtonType;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
|
|
||||||
namespace FakeeDeck.Class
|
|
||||||
{
|
|
||||||
internal class FakeDeck
|
|
||||||
{
|
|
||||||
public FakeDeck()
|
|
||||||
{
|
|
||||||
|
|
||||||
YamlHelper yaml = new YamlHelper();
|
|
||||||
HttpServer server = new HttpServer();
|
|
||||||
|
|
||||||
foreach (JsonElement item in yaml.getData().GetProperty("pages").EnumerateArray())
|
|
||||||
{
|
|
||||||
Debug.WriteLine("PAGE: " + item.GetProperty("page"));
|
|
||||||
foreach (JsonElement button in item.GetProperty("buttons").EnumerateArray())
|
|
||||||
{
|
|
||||||
server.pageData += AbstractionHelper.getButtonVisual(button);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*foreach (var stratogem in HelldiversTwoMacro.stratogems)
|
|
||||||
{
|
|
||||||
server.pageData += HelldiversTwoMacro.getButton(stratogem.Key);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach (var control in MediaMacro.mediaControls)
|
|
||||||
{
|
|
||||||
server.pageData += MediaMacro.getButton(control.Key);
|
|
||||||
}*/
|
|
||||||
|
|
||||||
server.serv();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,316 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Net;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System;
|
|
||||||
using System.IO;
|
|
||||||
using System.Text;
|
|
||||||
using System.Net;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using FakeeDeck.ButtonType;
|
|
||||||
using System.Web;
|
|
||||||
using static System.Net.WebRequestMethods;
|
|
||||||
using File = System.IO.File;
|
|
||||||
using System.Reflection.Metadata;
|
|
||||||
using System.Xml.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Collections;
|
|
||||||
|
|
||||||
namespace FakeeDeck.Class
|
|
||||||
{
|
|
||||||
internal class HttpServer
|
|
||||||
{
|
|
||||||
private static IDictionary<string, string> mimeTypes = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase) {
|
|
||||||
{".asf", "video/x-ms-asf"},
|
|
||||||
{".asx", "video/x-ms-asf"},
|
|
||||||
{".avi", "video/x-msvideo"},
|
|
||||||
{".bin", "application/octet-stream"},
|
|
||||||
{".cco", "application/x-cocoa"},
|
|
||||||
{".crt", "application/x-x509-ca-cert"},
|
|
||||||
{".css", "text/css"},
|
|
||||||
{".deb", "application/octet-stream"},
|
|
||||||
{".der", "application/x-x509-ca-cert"},
|
|
||||||
{".dll", "application/octet-stream"},
|
|
||||||
{".dmg", "application/octet-stream"},
|
|
||||||
{".ear", "application/java-archive"},
|
|
||||||
{".eot", "application/octet-stream"},
|
|
||||||
{".exe", "application/octet-stream"},
|
|
||||||
{".flv", "video/x-flv"},
|
|
||||||
{".gif", "image/gif"},
|
|
||||||
{".hqx", "application/mac-binhex40"},
|
|
||||||
{".htc", "text/x-component"},
|
|
||||||
{".htm", "text/html"},
|
|
||||||
{".html", "text/html"},
|
|
||||||
{".ico", "image/x-icon"},
|
|
||||||
{".img", "application/octet-stream"},
|
|
||||||
{".iso", "application/octet-stream"},
|
|
||||||
{".jar", "application/java-archive"},
|
|
||||||
{".jardiff", "application/x-java-archive-diff"},
|
|
||||||
{".jng", "image/x-jng"},
|
|
||||||
{".jnlp", "application/x-java-jnlp-file"},
|
|
||||||
{".jpeg", "image/jpeg"},
|
|
||||||
{".jpg", "image/jpeg"},
|
|
||||||
{".js", "application/x-javascript"},
|
|
||||||
{".mml", "text/mathml"},
|
|
||||||
{".mng", "video/x-mng"},
|
|
||||||
{".mov", "video/quicktime"},
|
|
||||||
{".mp3", "audio/mpeg"},
|
|
||||||
{".mpeg", "video/mpeg"},
|
|
||||||
{".mpg", "video/mpeg"},
|
|
||||||
{".msi", "application/octet-stream"},
|
|
||||||
{".msm", "application/octet-stream"},
|
|
||||||
{".msp", "application/octet-stream"},
|
|
||||||
{".pdb", "application/x-pilot"},
|
|
||||||
{".pdf", "application/pdf"},
|
|
||||||
{".pem", "application/x-x509-ca-cert"},
|
|
||||||
{".pl", "application/x-perl"},
|
|
||||||
{".pm", "application/x-perl"},
|
|
||||||
{".png", "image/png"},
|
|
||||||
{".prc", "application/x-pilot"},
|
|
||||||
{".ra", "audio/x-realaudio"},
|
|
||||||
{".rar", "application/x-rar-compressed"},
|
|
||||||
{".rpm", "application/x-redhat-package-manager"},
|
|
||||||
{".rss", "text/xml"},
|
|
||||||
{".run", "application/x-makeself"},
|
|
||||||
{".sea", "application/x-sea"},
|
|
||||||
{".shtml", "text/html"},
|
|
||||||
{".sit", "application/x-stuffit"},
|
|
||||||
{".swf", "application/x-shockwave-flash"},
|
|
||||||
{".tcl", "application/x-tcl"},
|
|
||||||
{".tk", "application/x-tcl"},
|
|
||||||
{".txt", "text/plain"},
|
|
||||||
{".war", "application/java-archive"},
|
|
||||||
{".wbmp", "image/vnd.wap.wbmp"},
|
|
||||||
{".wmv", "video/x-ms-wmv"},
|
|
||||||
{".xml", "text/xml"},
|
|
||||||
{".xpi", "application/x-xpinstall"},
|
|
||||||
{".zip", "application/zip"},
|
|
||||||
};
|
|
||||||
|
|
||||||
public static HttpListener listener;
|
|
||||||
public static string url = "http://*:8000/";
|
|
||||||
public static int pageViews = 0;
|
|
||||||
public static int requestCount = 0;
|
|
||||||
public static string pageHeader =
|
|
||||||
"<!DOCTYPE>" +
|
|
||||||
"<html>" +
|
|
||||||
" <head>" +
|
|
||||||
" <title>HttpListener Example</title>" +
|
|
||||||
" <link href=\"https://yarnpkg.com/en/package/normalize.css\" rel=\"stylesheet\">" +
|
|
||||||
" <link href=\"https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css\" rel=\"stylesheet\">" +
|
|
||||||
" <link href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.2/css/all.min.css\" rel=\"stylesheet\">" +
|
|
||||||
" </head>" +
|
|
||||||
" <body>" +
|
|
||||||
" <div class=\"d-flex flex-wrap\">" +
|
|
||||||
" <div class=\"m-2\">" +
|
|
||||||
" <p style=\"margin-bottom: 0px; width: 150px;height: 150px;background-color: aquamarine;\" >Page Views: {0}</p>" +
|
|
||||||
" </div>";
|
|
||||||
public static string pageFooter =
|
|
||||||
" <div class=\"m-2\">" +
|
|
||||||
" <button style=\"width: 150px;height: 150px;background-color: aquamarine;\" onclick=\"!document.fullscreenElement ? document.documentElement.requestFullscreen() : document.exitFullscreen();\">" +
|
|
||||||
" <i class=\"fa-solid fa-maximize\"></i>" +
|
|
||||||
" </button>" +
|
|
||||||
" </div>" +
|
|
||||||
" </div>" +
|
|
||||||
" <script src=\"StaticFiles/app.js\"></script>" +
|
|
||||||
" </body>" +
|
|
||||||
"</html>";
|
|
||||||
public string pageData = "";
|
|
||||||
private Dictionary<string, Dictionary<string, Action>> routes;
|
|
||||||
public async Task HandleIncomingConnections()
|
|
||||||
{
|
|
||||||
bool runServer = true;
|
|
||||||
|
|
||||||
// While a user hasn't visited the `shutdown` url, keep on handling requests
|
|
||||||
while (runServer)
|
|
||||||
{
|
|
||||||
// Will wait here until we hear from a connection
|
|
||||||
HttpListenerContext ctx = await listener.GetContextAsync();
|
|
||||||
|
|
||||||
// Peel out the requests and response objects
|
|
||||||
HttpListenerRequest req = ctx.Request;
|
|
||||||
HttpListenerResponse resp = ctx.Response;
|
|
||||||
|
|
||||||
// Print out some info about the request
|
|
||||||
Console.WriteLine("Request #: {0}", ++requestCount);
|
|
||||||
Console.WriteLine(req.Url.ToString());
|
|
||||||
Console.WriteLine(req.HttpMethod);
|
|
||||||
Console.WriteLine(req.UserHostName);
|
|
||||||
Console.WriteLine(req.UserAgent);
|
|
||||||
Console.WriteLine();
|
|
||||||
|
|
||||||
if (req.HttpMethod == "POST")
|
|
||||||
{
|
|
||||||
//Parse Port Parameters
|
|
||||||
Dictionary<string, string> postParams = parsePostRequestParameters(req);
|
|
||||||
// If `shutdown` url requested w/ POST, then shutdown the server after serving the page
|
|
||||||
if (req.Url.AbsolutePath == "/shutdown")
|
|
||||||
{
|
|
||||||
Console.WriteLine("Shutdown requested");
|
|
||||||
runServer = false;
|
|
||||||
}
|
|
||||||
else if (req.Url.AbsolutePath.StartsWith("/button"))
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
string module = req.Url.AbsolutePath.Replace("/button", "");
|
|
||||||
Console.WriteLine("Call module " + module);
|
|
||||||
callButtonAction(module, postParams);
|
|
||||||
resp.StatusCode = (int)HttpStatusCode.OK;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
byte[] errorData = Encoding.UTF8.GetBytes(ex.Message);
|
|
||||||
resp.ContentType = "text/html";
|
|
||||||
resp.ContentEncoding = Encoding.UTF8;
|
|
||||||
resp.ContentLength64 = errorData.LongLength;
|
|
||||||
resp.StatusCode = (int)HttpStatusCode.InternalServerError;
|
|
||||||
await resp.OutputStream.WriteAsync(errorData, 0, errorData.Length);
|
|
||||||
}
|
|
||||||
finally
|
|
||||||
{
|
|
||||||
resp.Close();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (req.HttpMethod == "GET")
|
|
||||||
{
|
|
||||||
if (req.Url.AbsolutePath.Contains("."))
|
|
||||||
{
|
|
||||||
await servFileResponseAsync(req, resp);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await servViewResponseAsync(req, resp);
|
|
||||||
}
|
|
||||||
resp.Close();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void serv()
|
|
||||||
{
|
|
||||||
// Create a Http server and start listening for incoming connections
|
|
||||||
listener = new HttpListener();
|
|
||||||
listener.Prefixes.Add(url);
|
|
||||||
listener.Start();
|
|
||||||
Console.WriteLine("Listening for connections on {0}", url);
|
|
||||||
|
|
||||||
// Handle requests
|
|
||||||
Task listenTask = HandleIncomingConnections();
|
|
||||||
listenTask.GetAwaiter().GetResult();
|
|
||||||
|
|
||||||
// Close the listener
|
|
||||||
listener.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void callButtonAction(string module, Dictionary<string, string> postParams)
|
|
||||||
{
|
|
||||||
string cleanClass = "FakeeDeck.ButtonType." + module.Trim('/');
|
|
||||||
|
|
||||||
Type? buttonClass = Type.GetType(cleanClass, true);
|
|
||||||
|
|
||||||
if (buttonClass is null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
MethodInfo? method = buttonClass.GetMethod("invokeAction");
|
|
||||||
|
|
||||||
if (method is null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
ParameterInfo[] pars = method.GetParameters();
|
|
||||||
List<object> parameters = new List<object>();
|
|
||||||
|
|
||||||
foreach (ParameterInfo p in pars)
|
|
||||||
{
|
|
||||||
if (p == null)
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (p.Name != null && postParams.ContainsKey(p.Name))
|
|
||||||
{
|
|
||||||
parameters.Insert(p.Position, postParams[p.Name]);
|
|
||||||
}
|
|
||||||
else if (p.IsOptional && p.DefaultValue != null)
|
|
||||||
{
|
|
||||||
parameters.Insert(p.Position, p.DefaultValue);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_ = method.Invoke(null, [.. parameters]).ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
private static async Task servFileResponseAsync(HttpListenerRequest req, HttpListenerResponse resp)
|
|
||||||
{
|
|
||||||
string filename = Path.Combine("./", req.Url.AbsolutePath.Substring(1));
|
|
||||||
if (!File.Exists(filename))
|
|
||||||
{
|
|
||||||
resp.StatusCode = (int)HttpStatusCode.NotFound;
|
|
||||||
resp.Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
Stream input = new FileStream(filename, FileMode.Open);
|
|
||||||
|
|
||||||
string mime;
|
|
||||||
resp.ContentType = mimeTypes.TryGetValue(Path.GetExtension(filename), out mime)
|
|
||||||
? mime
|
|
||||||
: "application/octet-stream";
|
|
||||||
resp.ContentLength64 = input.Length;
|
|
||||||
resp.AddHeader("Date", DateTime.Now.ToString("r"));
|
|
||||||
resp.AddHeader("Last-Modified", File.GetLastWriteTime(filename).ToString("r"));
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024 * 32];
|
|
||||||
int nbytes;
|
|
||||||
while ((nbytes = input.Read(buffer, 0, buffer.Length)) > 0)
|
|
||||||
resp.OutputStream.Write(buffer, 0, nbytes);
|
|
||||||
input.Close();
|
|
||||||
resp.OutputStream.Flush();
|
|
||||||
resp.StatusCode = (int)HttpStatusCode.OK;
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
byte[] errorData = Encoding.UTF8.GetBytes(ex.Message);
|
|
||||||
resp.ContentType = "text/html";
|
|
||||||
resp.ContentEncoding = Encoding.UTF8;
|
|
||||||
resp.ContentLength64 = errorData.LongLength;
|
|
||||||
resp.StatusCode = (int)HttpStatusCode.InternalServerError;
|
|
||||||
await resp.OutputStream.WriteAsync(errorData, 0, errorData.Length);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task servViewResponseAsync(HttpListenerRequest req, HttpListenerResponse resp)
|
|
||||||
{
|
|
||||||
string disableSubmit = false ? "disabled" : "";
|
|
||||||
byte[] data = Encoding.UTF8.GetBytes(string.Format(pageHeader + this.pageData + pageFooter, pageViews, disableSubmit));
|
|
||||||
resp.ContentType = "text/html";
|
|
||||||
resp.ContentEncoding = Encoding.UTF8;
|
|
||||||
resp.ContentLength64 = data.LongLength;
|
|
||||||
await resp.OutputStream.WriteAsync(data, 0, data.Length);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Dictionary<string, string> parsePostRequestParameters(HttpListenerRequest req)
|
|
||||||
{
|
|
||||||
Dictionary<string, string> postParams = new Dictionary<string, string>();
|
|
||||||
|
|
||||||
using (var reader = new StreamReader(req.InputStream, req.ContentEncoding))
|
|
||||||
{
|
|
||||||
string postData = reader.ReadToEnd();
|
|
||||||
var parsedData = HttpUtility.ParseQueryString(postData);
|
|
||||||
foreach (string key in parsedData)
|
|
||||||
{
|
|
||||||
postParams[key] = parsedData[key];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return postParams;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,201 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace FakeeDeck.Class
|
|
||||||
{
|
|
||||||
internal class KeyboardCode
|
|
||||||
{
|
|
||||||
public const uint LBUTTON = 0x01; // Left mouse button
|
|
||||||
public const uint RBUTTON = 0x02; // Right mouse button
|
|
||||||
public const uint CANCEL = 0x03; // Control-break processing
|
|
||||||
public const uint MBUTTON = 0x04; // Middle mouse button (three-button mouse)
|
|
||||||
public const uint XBUTTON1 = 0x05; // X1 mouse button
|
|
||||||
public const uint XBUTTON2 = 0x06; // X2 mouse button
|
|
||||||
public const uint BACK = 0x08; // BACKSPACE key
|
|
||||||
public const uint TAB = 0x09; // TAB key
|
|
||||||
public const uint CLEAR = 0x0C; // CLEAR key
|
|
||||||
public const uint RETURN = 0x0D; // ENTER key
|
|
||||||
public const uint SHIFT = 0x10; // SHIFT key
|
|
||||||
public const uint CONTROL = 0x11; // CTRL key
|
|
||||||
public const uint MENU = 0x12; // ALT key
|
|
||||||
public const uint PAUSE = 0x13; // PAUSE key
|
|
||||||
public const uint CAPITAL = 0x14; // CAPS LOCK key
|
|
||||||
public const uint KANA = 0x15; // IME Kana mode
|
|
||||||
public const uint HANGUL = 0x15; // IME Hangul mode
|
|
||||||
public const uint JUNJA = 0x17; // IME Junja mode
|
|
||||||
public const uint FINAL = 0x18; // IME final mode
|
|
||||||
public const uint HANJA = 0x19; // IME Hanja mode
|
|
||||||
public const uint KANJI = 0x19; // IME Kanji mode
|
|
||||||
public const uint ESCAPE = 0x1B; // ESC key
|
|
||||||
public const uint CONVERT = 0x1C; // IME convert
|
|
||||||
public const uint NONCONVERT = 0x1D; // IME nonconvert
|
|
||||||
public const uint ACCEPT = 0x1E; // IME accept
|
|
||||||
public const uint MODECHANGE = 0x1F; // IME mode change request
|
|
||||||
public const uint SPACE = 0x20; // SPACEBAR
|
|
||||||
public const uint PRIOR = 0x21; // PAGE UP key
|
|
||||||
public const uint NEXT = 0x22; // PAGE DOWN key
|
|
||||||
public const uint END = 0x23; // END key
|
|
||||||
public const uint HOME = 0x24; // HOME key
|
|
||||||
public const uint LEFT = 0x25; // LEFT ARROW key
|
|
||||||
public const uint UP = 0x26; // UP ARROW key
|
|
||||||
public const uint RIGHT = 0x27; // RIGHT ARROW key
|
|
||||||
public const uint DOWN = 0x28; // DOWN ARROW key
|
|
||||||
public const uint SELECT = 0x29; // SELECT key
|
|
||||||
public const uint PRINT = 0x2A; // PRINT key
|
|
||||||
public const uint EXECUTE = 0x2B; // EXECUTE key
|
|
||||||
public const uint SNAPSHOT = 0x2C; // PRINT SCREEN key
|
|
||||||
public const uint INSERT = 0x2D; // INS key
|
|
||||||
public const uint DELETE = 0x2E; // DEL key
|
|
||||||
public const uint HELP = 0x2F; // HELP key
|
|
||||||
public const uint N0 = 0x30; // '0' key
|
|
||||||
public const uint N1 = 0x31; // '1' key
|
|
||||||
public const uint N2 = 0x32; // '2' key
|
|
||||||
public const uint N3 = 0x33; // '3' key
|
|
||||||
public const uint N4 = 0x34; // '4' key
|
|
||||||
public const uint N5 = 0x35; // '5' key
|
|
||||||
public const uint N6 = 0x36; // '6' key
|
|
||||||
public const uint N7 = 0x37; // '7' key
|
|
||||||
public const uint N8 = 0x38; // '8' key
|
|
||||||
public const uint N9 = 0x39; // '9' key
|
|
||||||
public const uint A = 0x41; // 'A' key
|
|
||||||
public const uint B = 0x42; // 'B' key
|
|
||||||
public const uint C = 0x43; // 'C' key
|
|
||||||
public const uint D = 0x44; // 'D' key
|
|
||||||
public const uint E = 0x45; // 'E' key
|
|
||||||
public const uint F = 0x46; // 'F' key
|
|
||||||
public const uint G = 0x47; // 'G' key
|
|
||||||
public const uint H = 0x48; // 'H' key
|
|
||||||
public const uint I = 0x49; // 'I' key
|
|
||||||
public const uint J = 0x4A; // 'J' key
|
|
||||||
public const uint K = 0x4B; // 'K' key
|
|
||||||
public const uint L = 0x4C; // 'L' key
|
|
||||||
public const uint M = 0x4D; // 'M' key
|
|
||||||
public const uint N = 0x4E; // 'N' key
|
|
||||||
public const uint O = 0x4F; // 'O' key
|
|
||||||
public const uint P = 0x50; // 'P' key
|
|
||||||
public const uint Q = 0x51; // 'Q' key
|
|
||||||
public const uint R = 0x52; // 'R' key
|
|
||||||
public const uint S = 0x53; // 'S' key
|
|
||||||
public const uint T = 0x54; // 'T' key
|
|
||||||
public const uint U = 0x55; // 'U' key
|
|
||||||
public const uint V = 0x56; // 'V' key
|
|
||||||
public const uint W = 0x57; // 'W' key
|
|
||||||
public const uint X = 0x58; // 'X' key
|
|
||||||
public const uint Y = 0x59; // 'Y' key
|
|
||||||
public const uint Z = 0x5A; // 'Z' key
|
|
||||||
public const uint LWIN = 0x5B; // Left Windows key (Natural keyboard)
|
|
||||||
public const uint RWIN = 0x5C; // Right Windows key (Natural keyboard)
|
|
||||||
public const uint APPS = 0x5D; // Applications key (Natural keyboard)
|
|
||||||
public const uint SLEEP = 0x5F; // Computer Sleep key
|
|
||||||
public const uint NUMPAD0 = 0x60; // Numeric keypad '0' key
|
|
||||||
public const uint NUMPAD1 = 0x61; // Numeric keypad '1' key
|
|
||||||
public const uint NUMPAD2 = 0x62; // Numeric keypad '2' key
|
|
||||||
public const uint NUMPAD3 = 0x63; // Numeric keypad '3' key
|
|
||||||
public const uint NUMPAD4 = 0x64; // Numeric keypad '4' key
|
|
||||||
public const uint NUMPAD5 = 0x65; // Numeric keypad '5' key
|
|
||||||
public const uint NUMPAD6 = 0x66; // Numeric keypad '6' key
|
|
||||||
public const uint NUMPAD7 = 0x67; // Numeric keypad '7' key
|
|
||||||
public const uint NUMPAD8 = 0x68; // Numeric keypad '8' key
|
|
||||||
public const uint NUMPAD9 = 0x69; // Numeric keypad '9' key
|
|
||||||
public const uint MULTIPLY = 0x6A; // Multiply key
|
|
||||||
public const uint ADD = 0x6B; // Add key
|
|
||||||
public const uint SEPARATOR = 0x6C; // Separator key
|
|
||||||
public const uint SUBTRACT = 0x6D; // Subtract key
|
|
||||||
public const uint DECIMAL = 0x6E; // Decimal key
|
|
||||||
public const uint DIVIDE = 0x6F; // Divide key
|
|
||||||
public const uint F1 = 0x70; // F1 key
|
|
||||||
public const uint F2 = 0x71; // F2 key
|
|
||||||
public const uint F3 = 0x72; // F3 key
|
|
||||||
public const uint F4 = 0x73; // F4 key
|
|
||||||
public const uint F5 = 0x74; // F5 key
|
|
||||||
public const uint F6 = 0x75; // F6 key
|
|
||||||
public const uint F7 = 0x76; // F7 key
|
|
||||||
public const uint F8 = 0x77; // F8 key
|
|
||||||
public const uint F9 = 0x78; // F9 key
|
|
||||||
public const uint F10 = 0x79; // F10 key
|
|
||||||
public const uint F11 = 0x7A; // F11 key
|
|
||||||
public const uint F12 = 0x7B; // F12 key
|
|
||||||
public const uint F13 = 0x7C; // F13 key
|
|
||||||
public const uint F14 = 0x7D; // F14 key
|
|
||||||
public const uint F15 = 0x7E; // F15 key
|
|
||||||
public const uint F16 = 0x7F; // F16 key
|
|
||||||
public const uint F17 = 0x80; // F17 key
|
|
||||||
public const uint F18 = 0x81; // F18 key
|
|
||||||
public const uint F19 = 0x82; // F19 key
|
|
||||||
public const uint F20 = 0x83; // F20 key
|
|
||||||
public const uint F21 = 0x84; // F21 key
|
|
||||||
public const uint F22 = 0x85; // F22 key
|
|
||||||
public const uint F23 = 0x86; // F23 key
|
|
||||||
public const uint F24 = 0x87; // F24 key
|
|
||||||
public const uint NUMLOCK = 0x90; // NUM LOCK key
|
|
||||||
public const uint SCROLL = 0x91; // SCROLL LOCK key
|
|
||||||
public const uint LSHIFT = 0xA0; // Left SHIFT key
|
|
||||||
public const uint RSHIFT = 0xA1; // Right SHIFT key
|
|
||||||
public const uint LCONTROL = 0xA2; // Left CONTROL key
|
|
||||||
public const uint RCONTROL = 0xA3; // Right CONTROL key
|
|
||||||
public const uint LMENU = 0xA4; // Left MENU key
|
|
||||||
public const uint RMENU = 0xA5; // Right MENU key
|
|
||||||
public const uint BROWSER_BACK = 0xA6; // Browser Back key
|
|
||||||
public const uint BROWSER_FORWARD = 0xA7; // Browser Forward key
|
|
||||||
public const uint BROWSER_REFRESH = 0xA8; // Browser Refresh key
|
|
||||||
public const uint BROWSER_STOP = 0xA9; // Browser Stop key
|
|
||||||
public const uint BROWSER_SEARCH = 0xAA; // Browser Search key
|
|
||||||
public const uint BROWSER_FAVORITES = 0xAB; // Browser Favorites key
|
|
||||||
public const uint BROWSER_HOME = 0xAC; // Browser Start and Home key
|
|
||||||
public const uint VOLUME_MUTE = 0xAD; // Volume Mute key
|
|
||||||
public const uint VOLUME_DOWN = 0xAE; // Volume Down key
|
|
||||||
public const uint VOLUME_UP = 0xAF; // Volume Up key
|
|
||||||
public const uint MEDIA_NEXT_TRACK = 0xB0; // Next Track key
|
|
||||||
public const uint MEDIA_PREV_TRACK = 0xB1; // Previous Track key
|
|
||||||
public const uint MEDIA_STOP = 0xB2; // Stop Media key
|
|
||||||
public const uint MEDIA_PLAY_PAUSE = 0xB3; // Play/Pause Media key
|
|
||||||
public const uint LAUNCH_MAIL = 0xB4; // Start Mail key
|
|
||||||
public const uint LAUNCH_MEDIA_SELECT = 0xB5; // Select Media key
|
|
||||||
public const uint LAUNCH_APP1 = 0xB6; // Start Application 1 key
|
|
||||||
public const uint LAUNCH_APP2 = 0xB7; // Start Application 2 key
|
|
||||||
public const uint OEM_1 = 0xBA; // For the US standard keyboard, the ';:' key
|
|
||||||
public const uint OEM_PLUS = 0xBB; // For any country/region, the '+' key
|
|
||||||
public const uint OEM_COMMA = 0xBC; // For any country/region, the ',' key
|
|
||||||
public const uint OEM_MINUS = 0xBD; // For any country/region, the '-' key
|
|
||||||
public const uint OEM_PERIOD = 0xBE; // For any country/region, the '.' key
|
|
||||||
public const uint OEM_2 = 0xBF; // For the US standard keyboard, the '/?' key
|
|
||||||
public const uint OEM_3 = 0xC0; // For the US standard keyboard, the '`~' key
|
|
||||||
public const uint OEM_4 = 0xDB; // For the US standard keyboard, the '[{' key
|
|
||||||
public const uint OEM_5 = 0xDC; // For the US standard keyboard, the '\|' key
|
|
||||||
public const uint OEM_6 = 0xDD; // For the US standard keyboard, the ']}' key
|
|
||||||
public const uint OEM_7 = 0xDE; // For the US standard keyboard, the 'single-quote/double-quote' key
|
|
||||||
public const uint OEM_8 = 0xDF; // Used for miscellaneous characters; it can vary by keyboard.
|
|
||||||
public const uint OEM_AX = 0xE1; // OEM specific
|
|
||||||
public const uint OEM_102 = 0xE2; // The angle bracket key or the backslash key on the RT 102-key keyboard
|
|
||||||
public const uint ICO_HELP = 0xE3; // Help key on ICO
|
|
||||||
public const uint ICO_00 = 0xE4; // 00 key on ICO
|
|
||||||
public const uint PROCESSKEY = 0xE5; // IME PROCESS key
|
|
||||||
public const uint ICO_CLEAR = 0xE6; // Clear key on ICO
|
|
||||||
public const uint PACKET = 0xE7; // Used to pass Unicode characters as if they were keystrokes.
|
|
||||||
public const uint OEM_RESET = 0xE9; // OEM specific
|
|
||||||
public const uint OEM_JUMP = 0xEA; // OEM specific
|
|
||||||
public const uint OEM_PA1 = 0xEB; // OEM specific
|
|
||||||
public const uint OEM_PA2 = 0xEC; // OEM specific
|
|
||||||
public const uint OEM_PA3 = 0xED; // OEM specific
|
|
||||||
public const uint OEM_WSCTRL = 0xEE; // OEM specific
|
|
||||||
public const uint OEM_CUSEL = 0xEF; // OEM specific
|
|
||||||
public const uint OEM_ATTN = 0xF0; // OEM specific
|
|
||||||
public const uint OEM_FINISH = 0xF1; // OEM specific
|
|
||||||
public const uint OEM_COPY = 0xF2; // OEM specific
|
|
||||||
public const uint OEM_AUTO = 0xF3; // OEM specific
|
|
||||||
public const uint OEM_ENLW = 0xF4; // OEM specific
|
|
||||||
public const uint OEM_BACKTAB = 0xF5; // OEM specific
|
|
||||||
public const uint ATTN = 0xF6; // Attn key
|
|
||||||
public const uint CRSEL = 0xF7; // CrSel key
|
|
||||||
public const uint EXSEL = 0xF8; // ExSel key
|
|
||||||
public const uint EREOF = 0xF9; // Erase EOF key
|
|
||||||
public const uint PLAY = 0xFA; // Play key
|
|
||||||
public const uint ZOOM = 0xFB; // Zoom key
|
|
||||||
public const uint NONAME = 0xFC; // Reserved
|
|
||||||
public const uint PA1 = 0xFD; // PA1 key
|
|
||||||
public const uint OEM_CLEAR = 0xFE; // Clear key
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Text.Json;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using YamlDotNet.Serialization;
|
|
||||||
|
|
||||||
namespace FakeeDeck.Class
|
|
||||||
{
|
|
||||||
internal class YamlHelper
|
|
||||||
{
|
|
||||||
JsonDocument jsonObjecz;
|
|
||||||
public YamlHelper()
|
|
||||||
{
|
|
||||||
var r = new StreamReader("./configuration.yaml");
|
|
||||||
var deserializer = new Deserializer();
|
|
||||||
object yamlObject = deserializer.Deserialize(r);
|
|
||||||
string json = System.Text.Json.JsonSerializer.Serialize(yamlObject);
|
|
||||||
jsonObjecz = JsonDocument.Parse(json);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JsonElement getData()
|
|
||||||
{
|
|
||||||
return jsonObjecz.RootElement;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,28 +0,0 @@
|
|||||||
<Project Sdk="Microsoft.NET.Sdk">
|
|
||||||
|
|
||||||
<PropertyGroup>
|
|
||||||
<OutputType>Exe</OutputType>
|
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
|
||||||
<Nullable>enable</Nullable>
|
|
||||||
</PropertyGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="StaticFiles\" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<PackageReference Include="Autoupdater.NET.Official" Version="1.9.2" />
|
|
||||||
<PackageReference Include="YamlDotNet" Version="16.1.0" />
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
<ItemGroup>
|
|
||||||
<None Update="configuration.yaml">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
<None Update="StaticFiles\app.js">
|
|
||||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
|
||||||
</None>
|
|
||||||
</ItemGroup>
|
|
||||||
|
|
||||||
</Project>
|
|
@ -1,9 +0,0 @@
|
|||||||
using FakeeDeck;
|
|
||||||
using FakeeDeck.Class;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Text.Json;
|
|
||||||
using AutoUpdaterDotNET;
|
|
||||||
|
|
||||||
|
|
||||||
AutoUpdateHelper updater = new AutoUpdateHelper();
|
|
||||||
FakeDeck fakeDeck = new FakeDeck();
|
|
@ -1,38 +0,0 @@
|
|||||||
[].forEach.call(document.querySelectorAll('form'), function (form) {
|
|
||||||
form.addEventListener('submit', function (event) {
|
|
||||||
event.preventDefault();
|
|
||||||
const target = event.currentTarget;
|
|
||||||
|
|
||||||
console.log(target.method, target.action);
|
|
||||||
console.log(form.method, form.action);
|
|
||||||
console.log(form === target);
|
|
||||||
|
|
||||||
var formData = new FormData(form);
|
|
||||||
|
|
||||||
const xhttp = new XMLHttpRequest();
|
|
||||||
xhttp.onload = function () { }
|
|
||||||
xhttp.onreadystatechange = function () {
|
|
||||||
if (xhttp.readyState === 4) {
|
|
||||||
if (xhttp.status === 200) {
|
|
||||||
console.log('successful');
|
|
||||||
} else {
|
|
||||||
console.log('failed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
xhttp.open(target.method, target.action, true);
|
|
||||||
xhttp.send(urlencodeFormData(formData));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
function urlencodeFormData(fd){
|
|
||||||
var s = '';
|
|
||||||
function encode(s){ return encodeURIComponent(s).replace(/%20/g,'+'); }
|
|
||||||
for(var pair of fd.entries()){
|
|
||||||
if(typeof pair[1]=='string'){
|
|
||||||
s += (s?'&':'') + encode(pair[0])+'='+encode(pair[1]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
|
@ -1,60 +0,0 @@
|
|||||||
|
|
||||||
server:
|
|
||||||
port: 8000
|
|
||||||
|
|
||||||
pages:
|
|
||||||
- page: helldivers
|
|
||||||
buttons:
|
|
||||||
- button: reinforce
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: "reinforce"
|
|
||||||
|
|
||||||
- button: strafing-run
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: strafing-run
|
|
||||||
|
|
||||||
- button: airstrike
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: airstrike
|
|
||||||
|
|
||||||
- button: cluster-bomb
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: cluster-bomb
|
|
||||||
|
|
||||||
- button: napalm-airstrike
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: napalm-airstrike
|
|
||||||
|
|
||||||
- button: smoke-strike
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: smoke-strike
|
|
||||||
|
|
||||||
- button: rocket-pods
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: rocket-pods
|
|
||||||
|
|
||||||
- button: bomb
|
|
||||||
function: HelldiversTwoMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: bomb
|
|
||||||
|
|
||||||
- button: mute
|
|
||||||
function: MediaMacro
|
|
||||||
parameters:
|
|
||||||
- name: Key
|
|
||||||
value: "mute"
|
|
Loading…
Reference in New Issue
Block a user