Exemple #1
0
        /// <summary>
        /// Simulate typing text, keyboard input is delayed
        /// </summary>
        /// <param name="txt">text to type</param>
        /// <param name="token">break token</param>
        public static void SendText(string txt, BreakToken token)
        {
            //INPUT[] Inputs = createInputArray(txt);
            //foreach (var input in Inputs)
            //{
            //    if (token.shouldBreak)
            //        return;

            //    Thread.Sleep(50);
            //    Send(input);
            //}

            foreach (var c in txt)
            {
                if (token.shouldBreak)
                {
                    return;
                }
                if (keyMapAction.ContainsKey(c))
                {
                    keyMapAction[c]();
                }
                Thread.Sleep(40);
            }
        }
Exemple #2
0
        /// <summary>
        /// Simulate typing text asynchronously
        /// </summary>
        /// <param name="txt">text to type</param>
        /// <param name="token">break token</param>
        public async static void SendTextAsync(string txt, BreakToken token)
        {
            INPUT[] Inputs = createInputArray(txt);
            foreach (var input in Inputs)
            {
                if (token.shouldBreak)
                {
                    return;
                }

                await Task.Delay(30);

                Send(input);
            }
        }