├── .gitattributes ├── .gitignore ├── GameInputCommandSystem.sln ├── GameInputCommandSystem ├── App.config ├── App.xaml ├── App.xaml.cs ├── App_Start │ └── SwaggerConfig.cs ├── AutoItX3.dll ├── Controllers │ ├── KeyController.cs │ ├── ToggleController.cs │ └── VersionController.cs ├── GICValues.cs ├── GameInputCommandSystem.csproj ├── GateKeeper.cs ├── GlobalSuppressions.cs ├── KeyMaster.cs ├── Models │ └── Command.cs ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── Startup.cs ├── Views │ ├── About.xaml │ ├── About.xaml.cs │ ├── MainWindow.xaml │ └── MainWindow.xaml.cs ├── app.ico ├── app.manifest ├── license-autoit.txt ├── packages.config └── utils │ └── CryptoHelper.cs ├── LICENSE ├── README.md └── _config.yml /.gitattributes: -------------------------------------------------------------------------------- 1 | ############################################################################### 2 | # Set default behavior to automatically normalize line endings. 3 | ############################################################################### 4 | * text=auto 5 | 6 | ############################################################################### 7 | # Set default behavior for command prompt diff. 8 | # 9 | # This is need for earlier builds of msysgit that does not have it on by 10 | # default for csharp files. 11 | # Note: This is only used by command line 12 | ############################################################################### 13 | #*.cs diff=csharp 14 | 15 | ############################################################################### 16 | # Set the merge driver for project and solution files 17 | # 18 | # Merging from the command prompt will add diff markers to the files if there 19 | # are conflicts (Merging from VS is not affected by the settings below, in VS 20 | # the diff markers are never inserted). Diff markers may cause the following 21 | # file extensions to fail to load in VS. An alternative would be to treat 22 | # these files as binary and thus will always conflict and require user 23 | # intervention with every merge. To do so, just uncomment the entries below 24 | ############################################################################### 25 | #*.sln merge=binary 26 | #*.csproj merge=binary 27 | #*.vbproj merge=binary 28 | #*.vcxproj merge=binary 29 | #*.vcproj merge=binary 30 | #*.dbproj merge=binary 31 | #*.fsproj merge=binary 32 | #*.lsproj merge=binary 33 | #*.wixproj merge=binary 34 | #*.modelproj merge=binary 35 | #*.sqlproj merge=binary 36 | #*.wwaproj merge=binary 37 | 38 | ############################################################################### 39 | # behavior for image files 40 | # 41 | # image files are treated as binary by default. 42 | ############################################################################### 43 | #*.jpg binary 44 | #*.png binary 45 | #*.gif binary 46 | 47 | ############################################################################### 48 | # diff behavior for common document formats 49 | # 50 | # Convert binary document formats to text before diffing them. This feature 51 | # is only available from the command line. Turn it on by uncommenting the 52 | # entries below. 53 | ############################################################################### 54 | #*.doc diff=astextplain 55 | #*.DOC diff=astextplain 56 | #*.docx diff=astextplain 57 | #*.DOCX diff=astextplain 58 | #*.dot diff=astextplain 59 | #*.DOT diff=astextplain 60 | #*.pdf diff=astextplain 61 | #*.PDF diff=astextplain 62 | #*.rtf diff=astextplain 63 | #*.RTF diff=astextplain 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | [Ll]og/ 24 | 25 | # Visual Studio 2015 cache/options directory 26 | .vs/ 27 | # Uncomment if you have tasks that create the project's static files in wwwroot 28 | #wwwroot/ 29 | 30 | # MSTest test Results 31 | [Tt]est[Rr]esult*/ 32 | [Bb]uild[Ll]og.* 33 | 34 | # NUNIT 35 | *.VisualState.xml 36 | TestResult.xml 37 | 38 | # Build Results of an ATL Project 39 | [Dd]ebugPS/ 40 | [Rr]eleasePS/ 41 | dlldata.c 42 | 43 | # DNX 44 | project.lock.json 45 | project.fragment.lock.json 46 | artifacts/ 47 | 48 | *_i.c 49 | *_p.c 50 | *_i.h 51 | *.ilk 52 | *.meta 53 | *.obj 54 | *.pch 55 | *.pdb 56 | *.pgc 57 | *.pgd 58 | *.rsp 59 | *.sbr 60 | *.tlb 61 | *.tli 62 | *.tlh 63 | *.tmp 64 | *.tmp_proj 65 | *.log 66 | *.vspscc 67 | *.vssscc 68 | .builds 69 | *.pidb 70 | *.svclog 71 | *.scc 72 | 73 | # Chutzpah Test files 74 | _Chutzpah* 75 | 76 | # Visual C++ cache files 77 | ipch/ 78 | *.aps 79 | *.ncb 80 | *.opendb 81 | *.opensdf 82 | *.sdf 83 | *.cachefile 84 | *.VC.db 85 | *.VC.VC.opendb 86 | 87 | # Visual Studio profiler 88 | *.psess 89 | *.vsp 90 | *.vspx 91 | *.sap 92 | 93 | # TFS 2012 Local Workspace 94 | $tf/ 95 | 96 | # Guidance Automation Toolkit 97 | *.gpState 98 | 99 | # ReSharper is a .NET coding add-in 100 | _ReSharper*/ 101 | *.[Rr]e[Ss]harper 102 | *.DotSettings.user 103 | 104 | # JustCode is a .NET coding add-in 105 | .JustCode 106 | 107 | # TeamCity is a build add-in 108 | _TeamCity* 109 | 110 | # DotCover is a Code Coverage Tool 111 | *.dotCover 112 | 113 | # NCrunch 114 | _NCrunch_* 115 | .*crunch*.local.xml 116 | nCrunchTemp_* 117 | 118 | # MightyMoose 119 | *.mm.* 120 | AutoTest.Net/ 121 | 122 | # Web workbench (sass) 123 | .sass-cache/ 124 | 125 | # Installshield output folder 126 | [Ee]xpress/ 127 | 128 | # DocProject is a documentation generator add-in 129 | DocProject/buildhelp/ 130 | DocProject/Help/*.HxT 131 | DocProject/Help/*.HxC 132 | DocProject/Help/*.hhc 133 | DocProject/Help/*.hhk 134 | DocProject/Help/*.hhp 135 | DocProject/Help/Html2 136 | DocProject/Help/html 137 | 138 | # Click-Once directory 139 | publish/ 140 | 141 | # Publish Web Output 142 | *.[Pp]ublish.xml 143 | *.azurePubxml 144 | # TODO: Comment the next line if you want to checkin your web deploy settings 145 | # but database connection strings (with potential passwords) will be unencrypted 146 | #*.pubxml 147 | *.publishproj 148 | 149 | # Microsoft Azure Web App publish settings. Comment the next line if you want to 150 | # checkin your Azure Web App publish settings, but sensitive information contained 151 | # in these scripts will be unencrypted 152 | PublishScripts/ 153 | 154 | # NuGet Packages 155 | *.nupkg 156 | # The packages folder can be ignored because of Package Restore 157 | **/packages/* 158 | # except build/, which is used as an MSBuild target. 159 | !**/packages/build/ 160 | # Uncomment if necessary however generally it will be regenerated when needed 161 | #!**/packages/repositories.config 162 | # NuGet v3's project.json files produces more ignoreable files 163 | *.nuget.props 164 | *.nuget.targets 165 | 166 | # Microsoft Azure Build Output 167 | csx/ 168 | *.build.csdef 169 | 170 | # Microsoft Azure Emulator 171 | ecf/ 172 | rcf/ 173 | 174 | # Windows Store app package directories and files 175 | AppPackages/ 176 | BundleArtifacts/ 177 | Package.StoreAssociation.xml 178 | _pkginfo.txt 179 | 180 | # Visual Studio cache files 181 | # files ending in .cache can be ignored 182 | *.[Cc]ache 183 | # but keep track of directories ending in .cache 184 | !*.[Cc]ache/ 185 | 186 | # Others 187 | ClientBin/ 188 | ~$* 189 | *~ 190 | *.dbmdl 191 | *.dbproj.schemaview 192 | *.jfm 193 | *.pfx 194 | *.publishsettings 195 | node_modules/ 196 | orleans.codegen.cs 197 | 198 | # Since there are multiple workflows, uncomment next line to ignore bower_components 199 | # (https://github.com/github/gitignore/pull/1529#issuecomment-104372622) 200 | #bower_components/ 201 | 202 | # RIA/Silverlight projects 203 | Generated_Code/ 204 | 205 | # Backup & report files from converting an old project file 206 | # to a newer Visual Studio version. Backup files are not needed, 207 | # because we have git ;-) 208 | _UpgradeReport_Files/ 209 | Backup*/ 210 | UpgradeLog*.XML 211 | UpgradeLog*.htm 212 | 213 | # SQL Server files 214 | *.mdf 215 | *.ldf 216 | 217 | # Business Intelligence projects 218 | *.rdl.data 219 | *.bim.layout 220 | *.bim_*.settings 221 | 222 | # Microsoft Fakes 223 | FakesAssemblies/ 224 | 225 | # GhostDoc plugin setting file 226 | *.GhostDoc.xml 227 | 228 | # Node.js Tools for Visual Studio 229 | .ntvs_analysis.dat 230 | 231 | # Visual Studio 6 build log 232 | *.plg 233 | 234 | # Visual Studio 6 workspace options file 235 | *.opt 236 | 237 | # Visual Studio LightSwitch build output 238 | **/*.HTMLClient/GeneratedArtifacts 239 | **/*.DesktopClient/GeneratedArtifacts 240 | **/*.DesktopClient/ModelManifest.xml 241 | **/*.Server/GeneratedArtifacts 242 | **/*.Server/ModelManifest.xml 243 | _Pvt_Extensions 244 | 245 | # Paket dependency manager 246 | .paket/paket.exe 247 | paket-files/ 248 | 249 | # FAKE - F# Make 250 | .fake/ 251 | 252 | # JetBrains Rider 253 | .idea/ 254 | *.sln.iml 255 | 256 | # CodeRush 257 | .cr/ 258 | 259 | # Python Tools for Visual Studio (PTVS) 260 | __pycache__/ 261 | *.pyc -------------------------------------------------------------------------------- /GameInputCommandSystem.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 15 4 | VisualStudioVersion = 15.0.27130.2003 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GameInputCommandSystem", "GameInputCommandSystem\GameInputCommandSystem.csproj", "{C6CA4891-645A-4E86-900E-2ED2AD425855}" 7 | EndProject 8 | Global 9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 10 | Debug|Any CPU = Debug|Any CPU 11 | Debug|x64 = Debug|x64 12 | Release|Any CPU = Release|Any CPU 13 | Release|x64 = Release|x64 14 | EndGlobalSection 15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 16 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 17 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Debug|Any CPU.Build.0 = Debug|Any CPU 18 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Debug|x64.ActiveCfg = Debug|x64 19 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Debug|x64.Build.0 = Debug|x64 20 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Release|x64.ActiveCfg = Release|x64 23 | {C6CA4891-645A-4E86-900E-2ED2AD425855}.Release|x64.Build.0 = Release|x64 24 | EndGlobalSection 25 | GlobalSection(SolutionProperties) = preSolution 26 | HideSolutionNode = FALSE 27 | EndGlobalSection 28 | GlobalSection(ExtensibilityGlobals) = postSolution 29 | SolutionGuid = {7370A55F-7AC0-4AD9-B331-2031CD724E5F} 30 | EndGlobalSection 31 | EndGlobal 32 | -------------------------------------------------------------------------------- /GameInputCommandSystem/App.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 |
6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 0 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /GameInputCommandSystem/App.xaml: -------------------------------------------------------------------------------- 1 |  6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /GameInputCommandSystem/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace GameInputCommandSystem 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /GameInputCommandSystem/App_Start/SwaggerConfig.cs: -------------------------------------------------------------------------------- 1 | using System.Web.Http; 2 | using WebActivatorEx; 3 | using GameInputCommandSystem; 4 | using Swashbuckle.Application; 5 | 6 | [assembly: PreApplicationStartMethod(typeof(SwaggerConfig), "Register")] 7 | 8 | namespace GameInputCommandSystem 9 | { 10 | public class SwaggerConfig 11 | { 12 | public static void Register() 13 | { 14 | var thisAssembly = typeof(SwaggerConfig).Assembly; 15 | 16 | GlobalConfiguration.Configuration 17 | .EnableSwagger(c => 18 | { 19 | // By default, the service root url is inferred from the request used to access the docs. 20 | // However, there may be situations (e.g. proxy and load-balanced environments) where this does not 21 | // resolve correctly. You can workaround this by providing your own code to determine the root URL. 22 | // 23 | //c.RootUrl(req => GetRootUrlFromAppConfig()); 24 | 25 | // If schemes are not explicitly provided in a Swagger 2.0 document, then the scheme used to access 26 | // the docs is taken as the default. If your API supports multiple schemes and you want to be explicit 27 | // about them, you can use the "Schemes" option as shown below. 28 | // 29 | //c.Schemes(new[] { "http", "https" }); 30 | 31 | // Use "SingleApiVersion" to describe a single version API. Swagger 2.0 includes an "Info" object to 32 | // hold additional metadata for an API. Version and title are required but you can also provide 33 | // additional fields by chaining methods off SingleApiVersion. 34 | // 35 | c.SingleApiVersion("v1", "GameInputCommandSystem"); 36 | 37 | // If you want the output Swagger docs to be indented properly, enable the "PrettyPrint" option. 38 | // 39 | //c.PrettyPrint(); 40 | 41 | // If your API has multiple versions, use "MultipleApiVersions" instead of "SingleApiVersion". 42 | // In this case, you must provide a lambda that tells Swashbuckle which actions should be 43 | // included in the docs for a given API version. Like "SingleApiVersion", each call to "Version" 44 | // returns an "Info" builder so you can provide additional metadata per API version. 45 | // 46 | //c.MultipleApiVersions( 47 | // (apiDesc, targetApiVersion) => ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), 48 | // (vc) => 49 | // { 50 | // vc.Version("v2", "Swashbuckle Dummy API V2"); 51 | // vc.Version("v1", "Swashbuckle Dummy API V1"); 52 | // }); 53 | 54 | // You can use "BasicAuth", "ApiKey" or "OAuth2" options to describe security schemes for the API. 55 | // See https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md for more details. 56 | // NOTE: These only define the schemes and need to be coupled with a corresponding "security" property 57 | // at the document or operation level to indicate which schemes are required for an operation. To do this, 58 | // you'll need to implement a custom IDocumentFilter and/or IOperationFilter to set these properties 59 | // according to your specific authorization implementation 60 | // 61 | //c.BasicAuth("basic") 62 | // .Description("Basic HTTP Authentication"); 63 | // 64 | // NOTE: You must also configure 'EnableApiKeySupport' below in the SwaggerUI section 65 | //c.ApiKey("apiKey") 66 | // .Description("API Key Authentication") 67 | // .Name("apiKey") 68 | // .In("header"); 69 | // 70 | //c.OAuth2("oauth2") 71 | // .Description("OAuth2 Implicit Grant") 72 | // .Flow("implicit") 73 | // .AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog") 74 | // //.TokenUrl("https://tempuri.org/token") 75 | // .Scopes(scopes => 76 | // { 77 | // scopes.Add("read", "Read access to protected resources"); 78 | // scopes.Add("write", "Write access to protected resources"); 79 | // }); 80 | 81 | // Set this flag to omit descriptions for any actions decorated with the Obsolete attribute 82 | //c.IgnoreObsoleteActions(); 83 | 84 | // Each operation be assigned one or more tags which are then used by consumers for various reasons. 85 | // For example, the swagger-ui groups operations according to the first tag of each operation. 86 | // By default, this will be controller name but you can use the "GroupActionsBy" option to 87 | // override with any value. 88 | // 89 | //c.GroupActionsBy(apiDesc => apiDesc.HttpMethod.ToString()); 90 | 91 | // You can also specify a custom sort order for groups (as defined by "GroupActionsBy") to dictate 92 | // the order in which operations are listed. For example, if the default grouping is in place 93 | // (controller name) and you specify a descending alphabetic sort order, then actions from a 94 | // ProductsController will be listed before those from a CustomersController. This is typically 95 | // used to customize the order of groupings in the swagger-ui. 96 | // 97 | //c.OrderActionGroupsBy(new DescendingAlphabeticComparer()); 98 | 99 | // If you annotate Controllers and API Types with 100 | // Xml comments (http://msdn.microsoft.com/en-us/library/b2s063f7(v=vs.110).aspx), you can incorporate 101 | // those comments into the generated docs and UI. You can enable this by providing the path to one or 102 | // more Xml comment files. 103 | // 104 | //c.IncludeXmlComments(GetXmlCommentsPath()); 105 | 106 | // Swashbuckle makes a best attempt at generating Swagger compliant JSON schemas for the various types 107 | // exposed in your API. However, there may be occasions when more control of the output is needed. 108 | // This is supported through the "MapType" and "SchemaFilter" options: 109 | // 110 | // Use the "MapType" option to override the Schema generation for a specific type. 111 | // It should be noted that the resulting Schema will be placed "inline" for any applicable Operations. 112 | // While Swagger 2.0 supports inline definitions for "all" Schema types, the swagger-ui tool does not. 113 | // It expects "complex" Schemas to be defined separately and referenced. For this reason, you should only 114 | // use the "MapType" option when the resulting Schema is a primitive or array type. If you need to alter a 115 | // complex Schema, use a Schema filter. 116 | // 117 | //c.MapType(() => new Schema { type = "integer", format = "int32" }); 118 | 119 | // If you want to post-modify "complex" Schemas once they've been generated, across the board or for a 120 | // specific type, you can wire up one or more Schema filters. 121 | // 122 | //c.SchemaFilter(); 123 | 124 | // In a Swagger 2.0 document, complex types are typically declared globally and referenced by unique 125 | // Schema Id. By default, Swashbuckle does NOT use the full type name in Schema Ids. In most cases, this 126 | // works well because it prevents the "implementation detail" of type namespaces from leaking into your 127 | // Swagger docs and UI. However, if you have multiple types in your API with the same class name, you'll 128 | // need to opt out of this behavior to avoid Schema Id conflicts. 129 | // 130 | //c.UseFullTypeNameInSchemaIds(); 131 | 132 | // Alternatively, you can provide your own custom strategy for inferring SchemaId's for 133 | // describing "complex" types in your API. 134 | // 135 | //c.SchemaId(t => t.FullName.Contains('`') ? t.FullName.Substring(0, t.FullName.IndexOf('`')) : t.FullName); 136 | 137 | // Set this flag to omit schema property descriptions for any type properties decorated with the 138 | // Obsolete attribute 139 | //c.IgnoreObsoleteProperties(); 140 | 141 | // In accordance with the built in JsonSerializer, Swashbuckle will, by default, describe enums as integers. 142 | // You can change the serializer behavior by configuring the StringToEnumConverter globally or for a given 143 | // enum type. Swashbuckle will honor this change out-of-the-box. However, if you use a different 144 | // approach to serialize enums as strings, you can also force Swashbuckle to describe them as strings. 145 | // 146 | //c.DescribeAllEnumsAsStrings(); 147 | 148 | // Similar to Schema filters, Swashbuckle also supports Operation and Document filters: 149 | // 150 | // Post-modify Operation descriptions once they've been generated by wiring up one or more 151 | // Operation filters. 152 | // 153 | //c.OperationFilter(); 154 | // 155 | // If you've defined an OAuth2 flow as described above, you could use a custom filter 156 | // to inspect some attribute on each action and infer which (if any) OAuth2 scopes are required 157 | // to execute the operation 158 | // 159 | //c.OperationFilter(); 160 | 161 | // Post-modify the entire Swagger document by wiring up one or more Document filters. 162 | // This gives full control to modify the final SwaggerDocument. You should have a good understanding of 163 | // the Swagger 2.0 spec. - https://github.com/swagger-api/swagger-spec/blob/master/versions/2.0.md 164 | // before using this option. 165 | // 166 | //c.DocumentFilter(); 167 | 168 | // In contrast to WebApi, Swagger 2.0 does not include the query string component when mapping a URL 169 | // to an action. As a result, Swashbuckle will raise an exception if it encounters multiple actions 170 | // with the same path (sans query string) and HTTP method. You can workaround this by providing a 171 | // custom strategy to pick a winner or merge the descriptions for the purposes of the Swagger docs 172 | // 173 | //c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First()); 174 | 175 | // Wrap the default SwaggerGenerator with additional behavior (e.g. caching) or provide an 176 | // alternative implementation for ISwaggerProvider with the CustomProvider option. 177 | // 178 | //c.CustomProvider((defaultProvider) => new CachingSwaggerProvider(defaultProvider)); 179 | }) 180 | .EnableSwaggerUi(c => 181 | { 182 | // Use the "DocumentTitle" option to change the Document title. 183 | // Very helpful when you have multiple Swagger pages open, to tell them apart. 184 | // 185 | //c.DocumentTitle("My Swagger UI"); 186 | 187 | // Use the "InjectStylesheet" option to enrich the UI with one or more additional CSS stylesheets. 188 | // The file must be included in your project as an "Embedded Resource", and then the resource's 189 | // "Logical Name" is passed to the method as shown below. 190 | // 191 | //c.InjectStylesheet(containingAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testStyles1.css"); 192 | 193 | // Use the "InjectJavaScript" option to invoke one or more custom JavaScripts after the swagger-ui 194 | // has loaded. The file must be included in your project as an "Embedded Resource", and then the resource's 195 | // "Logical Name" is passed to the method as shown above. 196 | // 197 | //c.InjectJavaScript(thisAssembly, "Swashbuckle.Dummy.SwaggerExtensions.testScript1.js"); 198 | 199 | // The swagger-ui renders boolean data types as a dropdown. By default, it provides "true" and "false" 200 | // strings as the possible choices. You can use this option to change these to something else, 201 | // for example 0 and 1. 202 | // 203 | //c.BooleanValues(new[] { "0", "1" }); 204 | 205 | // By default, swagger-ui will validate specs against swagger.io's online validator and display the result 206 | // in a badge at the bottom of the page. Use these options to set a different validator URL or to disable the 207 | // feature entirely. 208 | //c.SetValidatorUrl("http://localhost/validator"); 209 | //c.DisableValidator(); 210 | 211 | // Use this option to control how the Operation listing is displayed. 212 | // It can be set to "None" (default), "List" (shows operations for each resource), 213 | // or "Full" (fully expanded: shows operations and their details). 214 | // 215 | //c.DocExpansion(DocExpansion.List); 216 | 217 | // Specify which HTTP operations will have the 'Try it out!' option. An empty paramter list disables 218 | // it for all operations. 219 | // 220 | //c.SupportedSubmitMethods("GET", "HEAD"); 221 | 222 | // Use the CustomAsset option to provide your own version of assets used in the swagger-ui. 223 | // It's typically used to instruct Swashbuckle to return your version instead of the default 224 | // when a request is made for "index.html". As with all custom content, the file must be included 225 | // in your project as an "Embedded Resource", and then the resource's "Logical Name" is passed to 226 | // the method as shown below. 227 | // 228 | //c.CustomAsset("index", containingAssembly, "YourWebApiProject.SwaggerExtensions.index.html"); 229 | 230 | // If your API has multiple versions and you've applied the MultipleApiVersions setting 231 | // as described above, you can also enable a select box in the swagger-ui, that displays 232 | // a discovery URL for each version. This provides a convenient way for users to browse documentation 233 | // for different API versions. 234 | // 235 | //c.EnableDiscoveryUrlSelector(); 236 | 237 | // If your API supports the OAuth2 Implicit flow, and you've described it correctly, according to 238 | // the Swagger 2.0 specification, you can enable UI support as shown below. 239 | // 240 | //c.EnableOAuth2Support( 241 | // clientId: "test-client-id", 242 | // clientSecret: null, 243 | // realm: "test-realm", 244 | // appName: "Swagger UI" 245 | // //additionalQueryStringParams: new Dictionary() { { "foo", "bar" } } 246 | //); 247 | 248 | // If your API supports ApiKey, you can override the default values. 249 | // "apiKeyIn" can either be "query" or "header" 250 | // 251 | //c.EnableApiKeySupport("apiKey", "header"); 252 | }); 253 | } 254 | } 255 | } 256 | -------------------------------------------------------------------------------- /GameInputCommandSystem/AutoItX3.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Terence-D/GameInputCommandServer/5b8d8f556b600ea0858da890342568e5947468d1/GameInputCommandSystem/AutoItX3.dll -------------------------------------------------------------------------------- /GameInputCommandSystem/Controllers/KeyController.cs: -------------------------------------------------------------------------------- 1 | using GameInputCommandSystem.Models; 2 | using System.Web.Http; 3 | 4 | /** 5 | Copyright [2019] [Terence Doerksen] 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | namespace GameInputCommandSystem.Controllers 20 | { 21 | /** 22 | * Used for commands related to a standard key up/down event 23 | * */ 24 | [Authorize] 25 | public class KeyController : ApiController 26 | { 27 | /** 28 | * Client will send in a specific key command along with modifiers and the event type - key down or key up 29 | * */ 30 | public void Post([FromBody]Command value) 31 | { 32 | KeyMaster.SendCommand(value, false); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Controllers/ToggleController.cs: -------------------------------------------------------------------------------- 1 | using GameInputCommandSystem.Models; 2 | using System.Web.Http; 3 | 4 | /** 5 | Copyright [2019] [Terence Doerksen] 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | namespace GameInputCommandSystem.Controllers 20 | { 21 | /** 22 | * Used for quick toggle commands 23 | * */ 24 | [Authorize] 25 | public class ToggleController : ApiController 26 | { 27 | /** 28 | * Client will send in a specific key command along with modifiers and the event type. 29 | * The server will process both the key down and up commands. 30 | * */ 31 | public void Post([FromBody]Command value) 32 | { 33 | KeyMaster.SendCommand(value, true); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Controllers/VersionController.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Net.Http; 5 | using System.Text; 6 | using System.Threading.Tasks; 7 | using System.Web.Http; 8 | using System.Reflection; 9 | using System.Diagnostics; 10 | using System.Net; 11 | 12 | /** 13 | Copyright [2019] [Terence Doerksen] 14 | 15 | Licensed under the Apache License, Version 2.0 (the "License"); 16 | you may not use this file except in compliance with the License. 17 | You may obtain a copy of the License at 18 | 19 | http://www.apache.org/licenses/LICENSE-2.0 20 | 21 | Unless required by applicable law or agreed to in writing, software 22 | distributed under the License is distributed on an "AS IS" BASIS, 23 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | See the License for the specific language governing permissions and 25 | limitations under the License. 26 | */ 27 | namespace GameInputCommandSystem.Controllers 28 | { 29 | /** 30 | * Used to validate the version of the server is what the client expects 31 | * */ 32 | public class VersionController : ApiController 33 | { 34 | private const string API_VERSION = "1.3.0.0"; 35 | /** 36 | * Returns current API version of this server 37 | * */ 38 | public HttpResponseMessage Get() 39 | { 40 | Assembly assembly = Assembly.GetExecutingAssembly(); 41 | //FileVersionInfo fileVersionInfo = FileVersionInfo.GetVersionInfo(assembly.Location); 42 | string version = API_VERSION;// fileVersionInfo.ProductVersion; 43 | 44 | return Request.CreateResponse(HttpStatusCode.OK, version, Configuration.Formatters.JsonFormatter); 45 | } 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /GameInputCommandSystem/GICValues.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics; 3 | 4 | /** 5 | Copyright [2019] [Terence Doerksen] 6 | 7 | Licensed under the Apache License, Version 2.0 (the "License"); 8 | you may not use this file except in compliance with the License. 9 | You may obtain a copy of the License at 10 | 11 | http://www.apache.org/licenses/LICENSE-2.0 12 | 13 | Unless required by applicable law or agreed to in writing, software 14 | distributed under the License is distributed on an "AS IS" BASIS, 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | See the License for the specific language governing permissions and 17 | limitations under the License. 18 | */ 19 | namespace GameInputCommandSystem 20 | { 21 | class GICValues 22 | { 23 | private static readonly Lazy instance = new Lazy(() => new GICValues()); 24 | public static GICValues Instance { get { return instance.Value; } } 25 | 26 | private string address = "localhost"; 27 | private int port = 8093; 28 | private string password = "123456"; 29 | private string application = "notepad.exe"; 30 | 31 | 32 | private GICValues() 33 | { 34 | } 35 | 36 | public Process ActiveProcess { get; set; } 37 | 38 | public string Address 39 | { 40 | get 41 | { 42 | return address; 43 | } 44 | set 45 | { 46 | address = value; 47 | } 48 | } 49 | 50 | public int Port 51 | { 52 | get 53 | { 54 | return port; 55 | } 56 | set 57 | { 58 | if (value > 1023 && value < 655535) 59 | port = value; 60 | } 61 | } 62 | 63 | public string Password 64 | { 65 | get 66 | { 67 | return password; 68 | } 69 | set 70 | { 71 | if (value.Length > 6 && value.Length < 100) 72 | password = value; 73 | } 74 | } 75 | public string Application 76 | { 77 | get 78 | { 79 | return application; 80 | } 81 | set 82 | { 83 | if (value.Length > 0) 84 | application = value; 85 | } 86 | } 87 | 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /GameInputCommandSystem/GameInputCommandSystem.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {C6CA4891-645A-4E86-900E-2ED2AD425855} 8 | WinExe 9 | GameInputCommandSystem 10 | GameInputCommandSystem 11 | v4.7.2 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | true 16 | false 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | true 28 | 0 29 | 1.5.0.%2a 30 | false 31 | true 32 | true 33 | 34 | 35 | 36 | AnyCPU 37 | true 38 | full 39 | false 40 | bin\Debug\ 41 | DEBUG;TRACE 42 | prompt 43 | 4 44 | 45 | 46 | AnyCPU 47 | pdbonly 48 | true 49 | bin\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | bin\Release\GameInputCommandSystem.xml 54 | 55 | 56 | true 57 | bin\x64\Debug\ 58 | DEBUG;TRACE 59 | full 60 | x64 61 | prompt 62 | MinimumRecommendedRules.ruleset 63 | true 64 | 65 | 66 | bin\x64\Release\ 67 | TRACE 68 | true 69 | pdbonly 70 | x64 71 | prompt 72 | MinimumRecommendedRules.ruleset 73 | true 74 | 75 | 76 | EF661A61AB2405EB0CE7621DCBAC48215BF8E838 77 | 78 | 79 | GameInputCommandSystem_TemporaryKey.pfx 80 | 81 | 82 | false 83 | 84 | 85 | true 86 | 87 | 88 | app.manifest 89 | 90 | 91 | LocalIntranet 92 | 93 | 94 | app.ico 95 | 96 | 97 | 98 | False 99 | C:\Program Files (x86)\AutoIt3\AutoItX\AutoItX3.Assembly.dll 100 | 101 | 102 | ..\packages\Microsoft.Owin.4.1.1\lib\net45\Microsoft.Owin.dll 103 | 104 | 105 | ..\packages\Microsoft.Owin.Host.HttpListener.4.1.1\lib\net45\Microsoft.Owin.Host.HttpListener.dll 106 | 107 | 108 | ..\packages\Microsoft.Owin.Hosting.4.1.1\lib\net45\Microsoft.Owin.Hosting.dll 109 | 110 | 111 | ..\packages\Microsoft.Owin.Security.4.1.1\lib\net45\Microsoft.Owin.Security.dll 112 | 113 | 114 | ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll 115 | 116 | 117 | ..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll 118 | 119 | 120 | ..\packages\Owin.1.0\lib\net40\Owin.dll 121 | 122 | 123 | ..\packages\Swashbuckle.Core.5.6.0\lib\net40\Swashbuckle.Core.dll 124 | 125 | 126 | 127 | 128 | 129 | ..\packages\Microsoft.AspNet.WebApi.Client.5.2.7\lib\net45\System.Net.Http.Formatting.dll 130 | 131 | 132 | 133 | ..\packages\Microsoft.AspNet.WebApi.Core.5.2.7\lib\net45\System.Web.Http.dll 134 | 135 | 136 | ..\packages\Microsoft.AspNet.WebApi.Owin.5.2.7\lib\net45\System.Web.Http.Owin.dll 137 | 138 | 139 | ..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.7\lib\net45\System.Web.Http.WebHost.dll 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 4.0 150 | 151 | 152 | ..\packages\Thinktecture.IdentityModel.Owin.BasicAuthentication.1.0.1\lib\net45\Thinktecture.IdentityModel.Owin.BasicAuthentication.dll 153 | 154 | 155 | ..\packages\WebActivatorEx.2.2.0\lib\net40\WebActivatorEx.dll 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | MSBuild:Compile 164 | Designer 165 | 166 | 167 | Designer 168 | MSBuild:Compile 169 | 170 | 171 | MSBuild:Compile 172 | Designer 173 | 174 | 175 | App.xaml 176 | Code 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | About.xaml 191 | 192 | 193 | MainWindow.xaml 194 | Code 195 | 196 | 197 | 198 | 199 | Code 200 | 201 | 202 | True 203 | True 204 | Resources.resx 205 | 206 | 207 | True 208 | Settings.settings 209 | True 210 | 211 | 212 | ResXFileCodeGenerator 213 | Resources.Designer.cs 214 | 215 | 216 | 217 | 218 | 219 | SettingsSingleFileGenerator 220 | Settings.Designer.cs 221 | 222 | 223 | 224 | 225 | Designer 226 | 227 | 228 | 229 | 230 | 231 | Always 232 | 233 | 234 | 235 | 236 | 237 | False 238 | Microsoft .NET Framework 4.6.1 %28x86 and x64%29 239 | true 240 | 241 | 242 | False 243 | .NET Framework 3.5 SP1 244 | false 245 | 246 | 247 | 248 | 249 | {F8937E53-D444-4E71-9275-35B64210CC3B} 250 | 1 251 | 0 252 | 0 253 | tlbimp 254 | False 255 | True 256 | 257 | 258 | 259 | -------------------------------------------------------------------------------- /GameInputCommandSystem/GateKeeper.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.Owin.Hosting; 2 | using System; 3 | using System.Diagnostics; 4 | using System.Net; 5 | using System.Net.Http; 6 | using System.Net.Sockets; 7 | 8 | /** 9 | Copyright [2019] [Terence Doerksen] 10 | 11 | Licensed under the Apache License, Version 2.0 (the "License"); 12 | you may not use this file except in compliance with the License. 13 | You may obtain a copy of the License at 14 | 15 | http://www.apache.org/licenses/LICENSE-2.0 16 | 17 | Unless required by applicable law or agreed to in writing, software 18 | distributed under the License is distributed on an "AS IS" BASIS, 19 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 20 | See the License for the specific language governing permissions and 21 | limitations under the License. 22 | */ 23 | namespace GameInputCommandSystem 24 | { 25 | public class GateKeeper 26 | { 27 | private IDisposable app; 28 | private HttpClient client; 29 | 30 | public string Address 31 | { 32 | get 33 | { 34 | return GICValues.Instance.Address; 35 | } 36 | set 37 | { 38 | GICValues.Instance.Address = value; 39 | } 40 | } 41 | 42 | public int Port 43 | { 44 | get 45 | { 46 | return GICValues.Instance.Port; 47 | } 48 | set 49 | { 50 | GICValues.Instance.Port = value; 51 | } 52 | } 53 | 54 | public string Password 55 | { 56 | get 57 | { 58 | return GICValues.Instance.Password; 59 | } 60 | set 61 | { 62 | GICValues.Instance.Password = value; 63 | } 64 | } 65 | public string Application 66 | { 67 | get 68 | { 69 | return GICValues.Instance.Application; 70 | } 71 | set 72 | { 73 | GICValues.Instance .Application = value; 74 | } 75 | } 76 | 77 | public bool Start() 78 | { 79 | CheckFirewall(Port); 80 | string baseAddress = "http://" + "*" + ":" + Port + "/"; 81 | 82 | // Start our OWIN hosting 83 | app = WebApp.Start(url: baseAddress); 84 | client = new HttpClient(); 85 | return true; 86 | } 87 | 88 | private void CheckFirewall(int port) 89 | { 90 | foreach (IPAddress address in Dns.GetHostEntry(Dns.GetHostName()).AddressList) 91 | { 92 | IPEndPoint ipLocalEndPoint = new IPEndPoint(address, Port); 93 | 94 | TcpListener t = new TcpListener(ipLocalEndPoint); 95 | t.Start(); 96 | t.Stop(); 97 | } 98 | } 99 | 100 | private Process FindProcess() 101 | { 102 | Process[] procs = Process.GetProcesses(); 103 | 104 | foreach (Process proc in procs) 105 | { 106 | if (proc.MainWindowTitle == GICValues.Instance.Application) 107 | return proc; 108 | } 109 | 110 | return null; 111 | } 112 | 113 | public void Stop() 114 | { 115 | app.Dispose(); 116 | client.Dispose(); 117 | } 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /GameInputCommandSystem/GlobalSuppressions.cs: -------------------------------------------------------------------------------- 1 |  2 | // This file is used by Code Analysis to maintain SuppressMessage 3 | // attributes that are applied to this project. 4 | // Project-level suppressions either have no target or are given 5 | // a specific target and scoped to a namespace, type, member, etc. 6 | 7 | [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "", Scope = "member", Target = "~M:GameInputCommandSystem.MainWindow.btnStart_Click(System.Object,System.Windows.RoutedEventArgs)")] -------------------------------------------------------------------------------- /GameInputCommandSystem/KeyMaster.cs: -------------------------------------------------------------------------------- 1 | using AutoIt; 2 | using GameInputCommandSystem.Models; 3 | using System; 4 | using System.Windows; 5 | 6 | /** 7 | Copyright [2019] [Terence Doerksen] 8 | 9 | Licensed under the Apache License, Version 2.0 (the "License"); 10 | you may not use this file except in compliance with the License. 11 | You may obtain a copy of the License at 12 | 13 | http://www.apache.org/licenses/LICENSE-2.0 14 | 15 | Unless required by applicable law or agreed to in writing, software 16 | distributed under the License is distributed on an "AS IS" BASIS, 17 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 18 | See the License for the specific language governing permissions and 19 | limitations under the License. 20 | */ 21 | namespace GameInputCommandSystem 22 | { 23 | public static class KeyMaster 24 | { 25 | static volatile object locker = new Object(); 26 | 27 | public static bool SendCommand(Command command, bool quickCommand) 28 | { 29 | lock (locker) 30 | { 31 | //long sec = DateTime.Now.Second; 32 | //Console.WriteLine("starting command for " + command.Key + " " + sec); 33 | int rv = 0; 34 | try 35 | { 36 | rv = AutoItX.WinWaitActive(GICValues.Instance.Application); 37 | } 38 | catch (Exception e) 39 | { 40 | //MessageBox.Show(e.Message); 41 | return false; 42 | } 43 | if (rv == 0) 44 | { 45 | return false; 46 | } 47 | else 48 | { 49 | if (command.activatorType == Command.KEY_DOWN) 50 | { 51 | //if any modifiers, send them first 52 | foreach (string modifier in command.Modifier) 53 | { 54 | AutoItX.Send("{" + modifier + "DOWN}"); 55 | } 56 | //now send the key itself 57 | AutoItX.Send("{" + command.Key + " down}"); 58 | if (quickCommand) 59 | { 60 | //keep everything pressed for 10ms 61 | System.Threading.Thread.Sleep(10); 62 | AutoItX.Send("{" + command.Key + " up}"); 63 | //if any modifiers, unset them last 64 | foreach (string modifier in command.Modifier) 65 | { 66 | AutoItX.Send("{" + modifier + "UP}"); 67 | } 68 | } 69 | } 70 | else if (command.activatorType == Command.KEY_UP && !quickCommand ) 71 | { 72 | AutoItX.Send("{" + command.Key + " up}"); 73 | //if any modifiers, unset them last 74 | foreach (string modifier in command.Modifier) 75 | { 76 | AutoItX.Send("{" + modifier + "UP}"); 77 | } 78 | } 79 | //Console.WriteLine("ending command for " + command.Key + " " + sec); 80 | } 81 | return true; 82 | } 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Models/Command.cs: -------------------------------------------------------------------------------- 1 | /** 2 | Copyright [2019] [Terence Doerksen] 3 | 4 | Licensed under the Apache License, Version 2.0 (the "License"); 5 | you may not use this file except in compliance with the License. 6 | You may obtain a copy of the License at 7 | 8 | http://www.apache.org/licenses/LICENSE-2.0 9 | 10 | Unless required by applicable law or agreed to in writing, software 11 | distributed under the License is distributed on an "AS IS" BASIS, 12 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | See the License for the specific language governing permissions and 14 | limitations under the License. 15 | */ 16 | namespace GameInputCommandSystem.Models 17 | { 18 | public class Command 19 | { 20 | public const int KEY_DOWN = 0; 21 | public const int KEY_UP = 1; 22 | 23 | public string Key { get; set; } 24 | public string[] Modifier { get; set; } 25 | public int activatorType {get;set;} 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("GameInputCommandSystem")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("Coffee Shop Studio")] 14 | [assembly: AssemblyProduct("GameInputCommandSystem")] 15 | [assembly: AssemblyCopyright("Copyright © 2019")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("2.0.0.0")] 55 | [assembly: AssemblyFileVersion("2.0.0.0")] 56 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GameInputCommandSystem.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("GameInputCommandSystem.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace GameInputCommandSystem.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | 26 | [global::System.Configuration.UserScopedSettingAttribute()] 27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 28 | [global::System.Configuration.DefaultSettingValueAttribute("")] 29 | public string target { 30 | get { 31 | return ((string)(this["target"])); 32 | } 33 | set { 34 | this["target"] = value; 35 | } 36 | } 37 | 38 | [global::System.Configuration.UserScopedSettingAttribute()] 39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 40 | [global::System.Configuration.DefaultSettingValueAttribute("0")] 41 | public int port { 42 | get { 43 | return ((int)(this["port"])); 44 | } 45 | set { 46 | this["port"] = value; 47 | } 48 | } 49 | 50 | [global::System.Configuration.UserScopedSettingAttribute()] 51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 52 | [global::System.Configuration.DefaultSettingValueAttribute("")] 53 | public string password { 54 | get { 55 | return ((string)(this["password"])); 56 | } 57 | set { 58 | this["password"] = value; 59 | } 60 | } 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Startup.cs: -------------------------------------------------------------------------------- 1 | using Newtonsoft.Json; 2 | using Newtonsoft.Json.Serialization; 3 | using Owin; 4 | using Swashbuckle.Application; 5 | using System.Collections.Generic; 6 | using System.Net.Http.Formatting; 7 | using System.Net.Http.Headers; 8 | using System.Security.Claims; 9 | using System.Threading.Tasks; 10 | using System.Web.Http; 11 | using Thinktecture.IdentityModel.Owin; 12 | 13 | /** 14 | Copyright [2019] [Terence Doerksen] 15 | 16 | Licensed under the Apache License, Version 2.0 (the "License"); 17 | you may not use this file except in compliance with the License. 18 | You may obtain a copy of the License at 19 | 20 | http://www.apache.org/licenses/LICENSE-2.0 21 | 22 | Unless required by applicable law or agreed to in writing, software 23 | distributed under the License is distributed on an "AS IS" BASIS, 24 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 25 | See the License for the specific language governing permissions and 26 | limitations under the License. 27 | */ 28 | namespace GameInputCommandSystem 29 | { 30 | class Startup 31 | { 32 | // Configures the Web API. This class is a parameter in the WerbApp.Start method in the main class. 33 | public void Configuration(IAppBuilder appBuilder) 34 | { 35 | // Configure Web API for self-host. 36 | HttpConfiguration config = new HttpConfiguration(); 37 | config.Routes.MapHttpRoute( 38 | name: "DefaultApi", 39 | routeTemplate: "api/{controller}/{id}", 40 | defaults: new { id = RouteParameter.Optional } 41 | ); 42 | appBuilder.UseBasicAuthentication(new BasicAuthenticationOptions("SecureApi", 43 | async (username, password) => await Authenticate(username, password))); 44 | 45 | //Tell swagger to generate documentation based on the XML doc file output from msbuild 46 | config.EnableSwagger(c => 47 | { 48 | c.IncludeXmlComments("GameInputCommandSystem.xml"); 49 | c.SingleApiVersion("1.0", "Owin Swashbuckle Demo"); 50 | }).EnableSwaggerUi(); 51 | 52 | appBuilder.UseWebApi(config); 53 | } 54 | private async Task> Authenticate(string username, string password) 55 | { 56 | // authenticate user 57 | if (username == "gic" && password == Properties.Settings.Default.password) 58 | { 59 | return new List { 60 | new Claim("name", username) 61 | }; 62 | } 63 | 64 | return null; 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /GameInputCommandSystem/Views/About.xaml: -------------------------------------------------------------------------------- 1 |  9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |