Beispiel #1
0
 public static int String(this ITestableNetworkStream netStream, string str)
 {
     MultiPressCommand[] mpc = MultiPress.CreateMultiPressCommands(str);
     foreach (MultiPressCommand m in mpc)
     {
         for (int i = 0; i < m.Times; i++)
         {
             netStream.Command(Convert.ToChar(48 + m.Digit));
             Thread.Sleep(MultiPressDelayForSameKey);
         }
         Thread.Sleep(MultiPressDelayForNextKey);
     }
     return(0);
 }
        public async static Task <int> CommandStringAsync(this NetworkStream netStream, string str)
        {
            MultiPressCommand[] mpc = MultiPress.CreateMultiPressCommands(str);
            if (Properties.Settings.Default.LogCommands)
            {
                Program.FormShow.Log(Form1.ParsedElementsWriter, Form1.StdOut, new XElement("CommandStringAsync", str));
            }
            foreach (MultiPressCommand m in mpc)
            {
                for (int i = 0; i < m.Times; i++)
                {
                    await netStream.CommandAsync(Convert.ToChar(48 + m.Digit));

                    Thread.Sleep(Noxon.MultiPressDelayForSameKey);
                }
                Thread.Sleep(Noxon.MultiPressDelayForNextKey);
            }
            return(0);
        }