public System.Drawing.Bitmap CaptureScreenshot(bool isRotate = false) { var watch = new Stopwatch(); watch.Start(); var bytes = AdbApi.CaptureScreenshot(AdbStream); //System.IO.File.WriteAllBytes(@"p:\temp\q1.png", bytes); var captureTime = watch.Elapsed; watch.Reset(); //Log.Information("Capture {captureTime}", captureTime); watch.Start(); var bitmap = LoadRawBitmap(bytes); //var bitmap = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(new System.IO.MemoryStream(bytes)); if (isRotate) { bitmap.RotateFlip(System.Drawing.RotateFlipType.Rotate270FlipNone); } var rotateTime = watch.Elapsed; Log.Information("Capture {captureTime}, {rotateTime}", captureTime, rotateTime); return(bitmap); }
public AdbClient(string device, int?adbPort = null) { this.Device = device; this.AdbPort = adbPort ?? AdbPort_Default; this.TcpClient = new TcpClient("127.0.0.1", AdbPort); this.AdbStream = this.TcpClient.GetStream(); AdbApi.RunCommand(AdbStream, $"host:transport:{Device}"); }
public void Back() { AdbApi.Back(AdbStream); }
public void Tap(int x, int y) { AdbApi.Tap(AdbStream, x, y); }
public string Shell(string command) { return(AdbApi.RunShellCommand(AdbStream, command)); }