XMap

C#, XML

This page is under development

# XMap A Windows XInput Manager for binding controller keys to custom macros. I created this because I couldn't find anything out there that fit what I wanted and was free. So I wrote my own! To those interested in helping please make a [pull request](https://github.com/lzinga/XMap/pulls), I am sure there is some improvements that could be made and I welcome them! If you can't contribute directly in programming but have a problem just open an [issue](https://github.com/lzinga/XMap/issues) and hopefully I or someone else can get to it! # XML Macro Config file XMap loads an xml file from the `\Configs\` folder, right now it only supports a predefined one but will probably make it support more later. Here is an example of a fully working config file that I created for myself. Past it, you will find a list of all actions/conditions currently available. ```xml ``` ### Conditions A Macro requires conditions, XMap will check these conditions on button presses to see if any of them match. If one matches it will execute the `Actions` (see the actions area below). The following XML conditions are all currently available and working (as far as I know). Each macro is checked based on the amount of conditions they have. So ones with the most are checked first, and the ones with the least are checked last. ```xml ``` ### Actions When the specified conditions are met using the aforementioned structure the actions will be executed. To also note, all actions will be executed in what ever application is currently the active window. ```xml ``` ### Creation of Actions and Conditions To create an action or condition all you have to do is create a new class and inherit the `BaseAction` or `BaseCondition` object. Here are two examples showing what an action and a condition look like - #### Action ```csharp [XmlType(TypeName = "Text")] public class TextAction : BaseAction { [XmlAttribute] public string Key { get; set; } public override void Execute() { this.input.Text(this.Key); } public override string ToString() { return $"Writing \"{this.Key}\"."; } } ``` #### Condition ```csharp [XmlType(TypeName = "Hold")] public class HoldCondition : BaseCondition { [XmlAttribute] public int Key { get; set; } public override bool Validate(XInputControllerState controller, WindowManager window) { if (controller.CurrentHoldTime.TotalSeconds >= this.Key && controller.HoldingButtons) { return true; } return false; } public override string ToString() { return $"{this.GetType().Name}: has it been held for {this.Key} seconds?"; } } ```