// public static void drag(string sn, string devicename, int x1, int y1, int x2, int y2, int step = 10)
// {
// try
// {
// bool exitflag = false;
// Process pp = new Process();
// pp.StartInfo = new ProcessStartInfo();
// pp.StartInfo.FileName = "adb.exe";
// pp.StartInfo.Arguments = " -s " + sn + " shell ";
// pp.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
// pp.StartInfo.CreateNoWindow = true;
// pp.StartInfo.WorkingDirectory = Application.StartupPath;
// pp.StartInfo.UseShellExecute = false;
// pp.StartInfo.RedirectStandardInput = true;
// pp.StartInfo.RedirectStandardOutput = true;
// pp.StartInfo.RedirectStandardError = true;
// DataReceivedEventHandler dataReceivedEventHandler = new DataReceivedEventHandler((sender, e) =>
// {
// if (null == e.Data) return;
// });
// pp.ErrorDataReceived += dataReceivedEventHandler;
// pp.OutputDataReceived += dataReceivedEventHandler;
// pp.EnableRaisingEvents = true;
// pp.Exited += new EventHandler((sender, e) =>
// {
// exitflag = true;
// });
// pp.Start();
// pp.BeginOutputReadLine();
// pp.BeginErrorReadLine();
// int rc = 30;
// do
// {
// Thread.Sleep(500);
// if (30 == rc)
// {
// string tips = "";
// int dir = 0;
// List<int> lstX = new List<int>();
// if (x2 > x1) // 向右
// {
// dir = 1;
// for (int x = x1; x < x2; x += Math.Abs(x2 - x1) / step)
// {
// lstX.Add(x);
// }
// lstX.Add(x2);
// }
// else if (x2 < x1) // 向左
// {
// dir = 2;
// for (int x = x2; x > x1; x -= Math.Abs(x2 - x1) / step)
// {
// lstX.Add(x);
// }
// lstX.Add(x1);
// }
// else
// {
// lstX.Add(x1);
// }
// List<int> lstY = new List<int>();
// if (y2 > y1) // 向下
// {
// dir = 3;
// for (int y = y1; y < y2; y += Math.Abs(y2 - y1) / step)
// {
// lstY.Add(y);
// }
// lstY.Add(y2);
// }
// else if (y2 < y1) // 向上
// {
// dir = 4;
// for (int y = y2; y > y1; y -= Math.Abs(y2 - y1) / step)
// {
// lstY.Add(y);
// }
// lstY.Add(y1);
// }
// else
// {
// lstY.Add(y1);
// }
// if (1 == dir || 2 == dir) // 左 右 x发生变化 y发生波动
// {
// for (int i = 0; i < lstX.Count; ++i)
// {
// tips += @" sendevent {inputname} 3 53 {x}
// sendevent {inputname} 3 54 {y}
// sendevent {inputname} 0 0 0
//".Replace("{inputname}", devicename)
// .Replace("{x}", lstX[i].ToString())
// .Replace("{y}", lstY[new Random(DateTime.Now.Second).Next(0, lstY.Count)].ToString());
// }
// }
// if (3 == dir || 4 == dir) // 上 下 y发生变化 x发生波动
// {
// for (int i = 0; i < lstY.Count; ++i)
// {
// tips += @" sendevent {inputname} 3 53 {x}
// sendevent {inputname} 3 54 {y}
// sendevent {inputname} 0 0 0
//".Replace("{inputname}", devicename)
// .Replace("{x}", lstX[new Random(DateTime.Now.Second).Next(0, lstX.Count)].ToString())
// .Replace("{y}", lstY[i].ToString());
// }
// }
// string tip = @" sendevent {inputname} 3 57 0
// sendevent {inputname} 3 53 {x1}
// sendevent {inputname} 3 54 {y1}
// sendevent {inputname} 0 0 0
// sendevent {inputname} 1 330 1
// sendevent {inputname} 3 53 {x1}
// sendevent {inputname} 3 54 {y1}
// sendevent {inputname} 0 0 0
//{tips}sendevent {inputname} 3 57 4294967295
// sendevent {inputname} 1 330 0
// sendevent {inputname} 0 0 0
//exit
//".Replace("{inputname}", devicename).Replace("{x1}", x1.ToString()).Replace("{y1}", y1.ToString()).Replace("{x2}", x2.ToString()).Replace("{y2}", y2.ToString()).Replace("{tips}", tips);
// pp.StandardInput.Write(tip);
// }
// }
// while (!exitflag && --rc > 0 && !pp.WaitForExit(500));
// }
// catch (Exception err)
// {
// Program.LogWarn(err, "drag");
// }
// }