コード例 #1
0
ファイル: MainForm.cs プロジェクト: HaKDMoDz/GNet
        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());
        }
コード例 #2
0
ファイル: G13ProfileRunner.cs プロジェクト: HaKDMoDz/GNet
        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();
        }