diff --git a/GICServer/Controllers/KeyController.cs b/GICServer/Controllers/KeyController.cs deleted file mode 100644 index 21d030e..0000000 --- a/GICServer/Controllers/KeyController.cs +++ /dev/null @@ -1,52 +0,0 @@ -using GICServer.Models; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Web.Http; - -namespace GICServer.Controllers -{ - class KeyController : ApiController - { - private KeyMaster km = new KeyMaster(); - - // GET api/values - public IEnumerable Get() - { - Command test = new Command(); - test.Key = 'd'; - SendCommand(test); - return new string[] { "value1", "value2" }; - } - - //// GET api/values/5 - //public string Get(int id) - //{ - // return "value"; - //} - - // POST api/values - public void Post([FromBody]Command value) - { - SendCommand(value); - } - - //// PUT api/values/5 - //public void Put(int id, [FromBody]string value) - //{ - //} - - //// DELETE api/values/5 - //public void Delete(int id) - //{ - //} - - private void SendCommand(Command value) - { - km.SendCommand(value); - } - } -} diff --git a/GICServer/GICServer.csproj b/GICServer/GICServer.csproj deleted file mode 100644 index ab62ea0..0000000 --- a/GICServer/GICServer.csproj +++ /dev/null @@ -1,87 +0,0 @@ - - - - - Debug - AnyCPU - {600C7419-E56E-4313-A529-E8FB6E192CE1} - Library - Properties - GICServer - GICServer - v4.6.1 - 512 - - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - ..\packages\Microsoft.Owin.4.0.0\lib\net451\Microsoft.Owin.dll - - - ..\packages\Microsoft.Owin.Host.HttpListener.4.0.0\lib\net451\Microsoft.Owin.Host.HttpListener.dll - - - ..\packages\Microsoft.Owin.Hosting.4.0.0\lib\net451\Microsoft.Owin.Hosting.dll - - - ..\packages\Newtonsoft.Json.12.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\Owin.1.0\lib\net40\Owin.dll - - - - - - ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll - - - ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll - - - ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.7\lib\net45\System.Web.Http.Owin.dll - - - - - - - - - - - - - - - - - - - - - - - - {fe61ad51-a5bc-4133-8657-ae21d1b98afe} - Keyboard - - - - \ No newline at end of file diff --git a/GICServer/GICValues.cs b/GICServer/GICValues.cs deleted file mode 100644 index b6e658e..0000000 --- a/GICServer/GICValues.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GICServer -{ - class GICValues - { - private static readonly Lazy instance = new Lazy(() => new GICValues()); - public static GICValues Instance { get { return instance.Value; } } - - private string address = "localhost"; - private int port = 8093; - private string password = "123456"; - private string application = "notepad.exe"; - - - private GICValues() - { - } - - public string Address - { - get - { - return address; - } - set - { - address = value; - } - } - - public int Port - { - get - { - return port; - } - set - { - if (value > 1023 && value < 655535) - port = value; - } - } - - public string Password - { - get - { - return password; - } - set - { - if (value.Length > 6 && value.Length < 100) - password = value; - } - } - public string Application - { - get - { - return application; - } - set - { - if (value.Length > 0) - application = value; - } - } - - } -} diff --git a/GICServer/GateKeeper.cs b/GICServer/GateKeeper.cs deleted file mode 100644 index 1ffcff4..0000000 --- a/GICServer/GateKeeper.cs +++ /dev/null @@ -1,77 +0,0 @@ -using Microsoft.Owin.Hosting; -using System; -using System.Net.Http; - -namespace GICServer -{ - public class GateKeeper - { - private IDisposable app; - - public string Address - { - get - { - return GICValues.Instance.Address; - } - set - { - GICValues.Instance.Address = value; - } - } - - public int Port - { - get - { - return GICValues.Instance.Port; - } - set - { - GICValues.Instance.Port = value; - } - } - - public string Password - { - get - { - return GICValues.Instance.Password; - } - set - { - GICValues.Instance.Password = value; - } - } - public string Application - { - get - { - return GICValues.Instance.Application; - } - set - { - GICValues.Instance .Application = value; - } - } - - public void Start() - { - string baseAddress = "http://" + Address + ":" + Port + "/"; - - // Start our OWIN hosting - //app = WebApp.Start(url: baseAddress); - //using (app) - using (WebApp.Start(url: baseAddress)) - { - // Create the HttpCient - HttpClient client = new HttpClient(); - } - } - - public void Stop() - { - app.Dispose(); - } - } -} diff --git a/GICServer/KeyMaster.cs b/GICServer/KeyMaster.cs deleted file mode 100644 index dd017ed..0000000 --- a/GICServer/KeyMaster.cs +++ /dev/null @@ -1,39 +0,0 @@ -using GICServer.Models; -using Keyboard; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GICServer -{ - class KeyMaster - { - public void SendCommand(Command command) - { - var p = new Process { StartInfo = { FileName = GICValues.Instance.Application } }; - - p.Start(); - - try - { - //List keys = "hello world".Select(c => new Key(c)).ToList(); - //var procId = p.Id; - ////Console.WriteLine("ID: " + procId); - ////Console.WriteLine("Sending background keypresses to write \"hello world\""); - //p.WaitForInputIdle(); - //foreach (var key in keys) - //{ - // key.PressForeground(p.MainWindowHandle); - //} - Key key = new Key(command.Key); - key.PressBackground(p.MainWindowHandle); - } - catch (InvalidOperationException) - { - } - } - } -} diff --git a/GICServer/Models/Command.cs b/GICServer/Models/Command.cs deleted file mode 100644 index 320b0e2..0000000 --- a/GICServer/Models/Command.cs +++ /dev/null @@ -1,14 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; - -namespace GICServer.Models -{ - class Command - { - public char Key { get; set; } - public string[] Modifier { get; set; } - } -} diff --git a/GICServer/Properties/AssemblyInfo.cs b/GICServer/Properties/AssemblyInfo.cs deleted file mode 100644 index ca05433..0000000 --- a/GICServer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -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("GICServer")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("GICServer")] -[assembly: AssemblyCopyright("Copyright © 2019")] -[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("600c7419-e56e-4313-a529-e8fb6e192ce1")] - -// 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")] diff --git a/GICServer/Startup.cs b/GICServer/Startup.cs deleted file mode 100644 index 0929c92..0000000 --- a/GICServer/Startup.cs +++ /dev/null @@ -1,22 +0,0 @@ -using Owin; -using System.Web.Http; - -namespace GICServer -{ - class Startup - { - // Configures the Web API. This class is a parameter in the WerbApp.Start method in the main class. - public void Configuration(IAppBuilder appBuilder) - { - // Configure Web API for self-host. - HttpConfiguration config = new HttpConfiguration(); - config.Routes.MapHttpRoute( - name: "GicAPi", - routeTemplate: "api/{controller}/{id}", - defaults: new { id = RouteParameter.Optional } - ); - - appBuilder.UseWebApi(config); - } - } -} diff --git a/GICServer/app.config b/GICServer/app.config deleted file mode 100644 index ecb7b13..0000000 --- a/GICServer/app.config +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/GICServer/packages.config b/GICServer/packages.config deleted file mode 100644 index 1ae4879..0000000 --- a/GICServer/packages.config +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/GameInputCommandSystem/GameInputCommandSystem.csproj b/GameInputCommandSystem/GameInputCommandSystem.csproj index 03fa72b..5d6650c 100644 --- a/GameInputCommandSystem/GameInputCommandSystem.csproj +++ b/GameInputCommandSystem/GameInputCommandSystem.csproj @@ -13,6 +13,23 @@ {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 4 true + false + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + true + 0 + 1.0.0.%2a + false + true + true AnyCPU @@ -53,6 +70,27 @@ MinimumRecommendedRules.ruleset true + + EF661A61AB2405EB0CE7621DCBAC48215BF8E838 + + + GameInputCommandSystem_TemporaryKey.pfx + + + false + + + true + + + app.manifest + + + LocalIntranet + + + app.ico + C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.Assembly.dll @@ -109,6 +147,10 @@ MSBuild:Compile Designer + + Designer + MSBuild:Compile + MSBuild:Compile Designer @@ -124,6 +166,10 @@ + + + About.xaml + MainWindow.xaml Code @@ -147,6 +193,8 @@ ResXFileCodeGenerator Resources.Designer.cs + + SettingsSingleFileGenerator @@ -159,10 +207,23 @@ + Always + + + False + Microsoft .NET Framework 4.6.1 %28x86 and x64%29 + true + + + False + .NET Framework 3.5 SP1 + false + + \ No newline at end of file diff --git a/GameInputCommandSystem/GateKeeper.cs b/GameInputCommandSystem/GateKeeper.cs index 5b53ec7..b1fceba 100644 --- a/GameInputCommandSystem/GateKeeper.cs +++ b/GameInputCommandSystem/GateKeeper.cs @@ -1,7 +1,9 @@ using Microsoft.Owin.Hosting; using System; using System.Diagnostics; +using System.Net; using System.Net.Http; +using System.Net.Sockets; /** Copyright [2019] [Terence Doerksen] @@ -74,18 +76,25 @@ public string Application public bool Start() { - //GICValues.Instance.ActiveProcess = FindProcess(); + CheckFirewall(Port); + string baseAddress = "http://" + "*" + ":" + Port + "/"; - //if (GICValues.Instance.ActiveProcess != null) + // Start our OWIN hosting + app = WebApp.Start(url: baseAddress); + client = new HttpClient(); + return true; + } + + private void CheckFirewall(int port) + { + foreach (IPAddress address in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { - string baseAddress = "http://" + "*" + ":" + Port + "/"; + IPEndPoint ipLocalEndPoint = new IPEndPoint(address, Port); - // Start our OWIN hosting - app = WebApp.Start(url: baseAddress); - client = new HttpClient(); - return true; + TcpListener t = new TcpListener(ipLocalEndPoint); + t.Start(); + t.Stop(); } - //return false; } private Process FindProcess() diff --git a/GameInputCommandSystem/KeyMaster.cs b/GameInputCommandSystem/KeyMaster.cs index 732e3be..a9dd152 100644 --- a/GameInputCommandSystem/KeyMaster.cs +++ b/GameInputCommandSystem/KeyMaster.cs @@ -30,18 +30,19 @@ public bool SendCommand(Command command) //if any modifiers, send them first foreach (string modifier in command.Modifier) { - AutoItX.Send("{" + modifier + " down}"); + AutoItX.Send("{" + modifier + "DOWN}"); } //now send the key itself - AutoItX.Send("{" + command.Key + " down}"); + AutoItX.Send("{" + command.Key + " down}"); //keep everything pressed for 10ms - AutoItX.Sleep(10); // - AutoItX.Send("{" + command.Key + " up}"); //release the LEFT key + AutoItX.Sleep(10); + AutoItX.Send("{" + command.Key + " up}"); //if any modifiers, unset them last foreach (string modifier in command.Modifier) { - AutoItX.Send("{" + modifier + " up}"); + AutoItX.Send("{" + modifier + "UP}"); } + } return true; } diff --git a/GameInputCommandSystem/Properties/AssemblyInfo.cs b/GameInputCommandSystem/Properties/AssemblyInfo.cs index 0a135a3..68b3106 100644 --- a/GameInputCommandSystem/Properties/AssemblyInfo.cs +++ b/GameInputCommandSystem/Properties/AssemblyInfo.cs @@ -10,7 +10,7 @@ [assembly: AssemblyTitle("GameInputCommandSystem")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] +[assembly: AssemblyCompany("Coffee Shop Studio")] [assembly: AssemblyProduct("GameInputCommandSystem")] [assembly: AssemblyCopyright("Copyright © 2019")] [assembly: AssemblyTrademark("")] diff --git a/GameInputCommandSystem/Views/About.xaml b/GameInputCommandSystem/Views/About.xaml new file mode 100644 index 0000000..cce01da --- /dev/null +++ b/GameInputCommandSystem/Views/About.xaml @@ -0,0 +1,43 @@ + + + + + + + + + + + + +