Exemplo n.º 1
0
        public static Instruction Create(int keycode, int duration)
        {
            Scale(ref duration, Unit);
            if (duration < 0)
            {
                return(AsmEmpty.Create());
            }
            if (duration >= 1 << 8)
            {
                return(Failed.OutOfRange);
            }
            var ins = new AsmKey_Standard
            {
                KeyCode  = keycode,
                Duration = duration
            };

            return(ins);
        }
Exemplo n.º 2
0
        public static Instruction Create(int duration)
        {
            if (duration < 0)
            {
                return(AsmEmpty.Create());
            }
            var ins = AsmWait_HighPrecision.Create(duration);

            if (ins.Success)
            {
                return(ins);
            }
            ins = AsmWait_Standard.Create(duration);
            if (ins.Success)
            {
                return(ins);
            }
            return(AsmWait_Extended.Create(duration));
        }
Exemplo n.º 3
0
        public static Instruction Create(int keycode, int dindex, int duration)
        {
            Scale(ref duration, 50);
            if (duration < 0)
            {
                return(AsmEmpty.Create());
            }
            if (duration >= 1 << 7)
            {
                return(Failed.OutOfRange);
            }
            var ins = new AsmStick_Standard
            {
                KeyCode  = keycode,
                DIndex   = dindex,
                Duration = duration
            };

            return(ins);
        }