예제 #1
0
 //}}}
 public MacroProc(Macro macro) // {{{
 {
     this.macro = macro;
 }
예제 #2
0
 // }}}
 public void macroReleased(Macro macro) // {{{
 {
     _macroSendInput(macro, true);
 }
예제 #3
0
        } //}}}

        private void deviceKeyDispatch(byte[] dx1_curr_data) // {{{
        {
            log("deviceKeyDispatch(dx1_curr_data)");

            // SORT
            Array.Sort(dx1_curr_data);
            Array.Reverse(dx1_curr_data);

            // PRESS-RELEASE (in any of the possible SIMULTANEOUSLY-PRESSED-KEYS)
            int prev_index = 0;
            int curr_index = 0;

            while ((curr_index < DATALEN) || (prev_index < DATALEN))
            {
                // NO MORE DATA {{{
                byte prev = (prev_index < DATALEN) ? dx1_prev_data[prev_index] : (byte)0;
                byte curr = (curr_index < DATALEN) ? dx1_curr_data[curr_index] : (byte)0;

                if ((prev == 0) && (curr == 0))
                {
                    break;
                }

                //}}}
                // NO CHANGE {{{
                if (prev == curr)
                {
                    ++prev_index;
                    ++curr_index;
                } //}}}
                // RELEASED {{{
                else if (prev > curr)
                {
                    ++prev_index;

                    // MACRO
                    if (profile.keyMapList[prev - 1].KeyType > 3)
                    {
                        specialKeyPlayer.KeyUp(profile.keyMapList[prev - 1]);
                    }
                    // SPECIAL
                    else
                    {
                        // ...use original Macro Player by Rob
                        Macro macro = mKeyMacroSequenceMapping[prev - 1];
                        if (macro != null && (macro.macroType & Macro.MACRO_TYPE.MULTI_KEY) != 0)
                        {
                            macroPlayer.macroReleased(macro);
                        }
                    }
                } //}}}
                // PRESSED {{{
                else
                {
                    // SPECIAL
                    if (profile.keyMapList[curr - 1].KeyType > 3)
                    {
                        specialKeyPlayer.KeyDown(profile.keyMapList[curr - 1]);
                    }
                    // MACRO
                    else
                    {
                        // ...use original Macro Player by Rob
                        Macro macro = mKeyMacroSequenceMapping[curr - 1];
                        if (macro != null)
                        {
                            if ((macro.macroType & Macro.MACRO_TYPE.MULTI_KEY) == 0)
                            {
                                macroTimer.Stop();

                                // current timing
                                System.DateTime time        = System.DateTime.Now;
                                TimeSpan        elapsedTime = time - initialTime;
                                UInt64          curTimeMS   = (UInt64)elapsedTime.TotalMilliseconds;

                                // new Macro instance to process events
                                MacroPlayer.MacroProc macroProc = new MacroPlayer.MacroProc(macro);
                                UInt64 nextMacroTickMS          = macroProc.start(curTimeMS);

                                // time-spanned sequence -- not instantaneous -> add to todo-list
                                if (nextMacroTickMS != MacroPlayer.MACRO_TIME_DONE)
                                {
                                    macroPlayer.Add(macroProc);
                                }

                                // process remaining events -- up to this point in time
                                nextMacroTickMS = macroPlayer.Tick(curTimeMS);

                                // start a timer for the next macro event
                                if (nextMacroTickMS != MacroPlayer.MACRO_TIME_DONE)
                                {
                                    macroTimer.AutoReset = false;
                                    macroTimer.Interval  = (UInt32)(nextMacroTickMS - curTimeMS);
                                    macroTimer.Start();
                                }
                            }
                            else
                            {
                                macroPlayer.macroPressed(macro);
                            }
                        }
                    }
                    ++curr_index;
                } //}}}
            }
            Array.Copy(dx1_curr_data, dx1_prev_data, DATALEN);
        }
예제 #4
0
        // }}}

        public void macroPressed(Macro macro) // {{{
        {
            _macroSendInput(macro, false);
        }
 public void Add(Macro macro)
 {
     mMacros.Add(macro);
 }