Exemplo n.º 1
0
        public MainForm()
        {
            string path = "/Test/SubTest/Sub/";
            var list = path.Split(new char[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            InitializeComponent();

            //Macro macro = new Macro(
            //    new Delay(2345)//,
            //    //new KeyDown(PInvoke.ScanCode.x)
            //    );

            Profile profile = new Profile
            {
                Name = "Test",
                Script = @"
function blah<T>(T t) {
    var a = t[[0]] >10;
    return ""a"" > ""b && ""c"" < ""d"";
    
}
",
                Macros = new List<Macro>
                {
                    new Macro
                    {
                        Name = "TestMacro",
                        Steps = new List<Step>
                        {
                            new Delay(12345),
                            new KeyCharDown('a'),
                            new KeyScanCodeTap(PInvoke.ScanCode.semicolon)
                        }
                    }
                },

                InputAssignments = new List<InputAssignment>
                {
                    new InputAssignment
                    {
                        MinJoystickAngle = 0,
                        MaxJoystickAngle = 90
                    }
                }
            };

            var ser = new XmlSerializer(typeof(Profile));
            var sb = new StringBuilder();
            using (var sr = new StringWriter(sb))
                ser.Serialize(sr, profile);
            System.Diagnostics.Debug.WriteLine(sb.ToString());
        }
Exemplo n.º 2
0
        public G13ProfileRunner(Profile profile)
        {
            if (profile == null)
                throw new ArgumentNullException("profile", "Profile cannot be null");

            this.profile = profile;

            SingleKeyEvents = true;

            keyEvents = new Queue<KeyEvent>();

            mouseHook = new MouseHook();
            keyboardHook = new KeyboardHook();

            mouseHook.MouseDown += new MouseEventHandler(mouseHook_MouseDown);
            mouseHook.MouseUp += new MouseEventHandler(mouseHook_MouseUp);

            keyboardHook.KeyDown += new KeyEventHandler(keyboardHook_KeyDown);
            keyboardHook.KeyUp += new KeyEventHandler(keyboardHook_KeyUp);

            threadDelegate = new ThreadStart(RunThread);

            macroRunner = new MacroRunner(profile);

            lcd.Notified += new NotificationEventHandler(Connection_Notified);

            SetupMacros();
        }