private void ConnectDevice()
 {
     Client.Connect(ip.Text);
     ip.Enabled         = false;
     ConnectAdb.Enabled = false;
     Remember.Enabled   = false;
     if (ip.Text != null && !string.IsNullOrWhiteSpace(ip.Text) && Client.Devices()[0].Split(':').First() == ip.Text)
     {
         ConnectionStatus.Text      = "Connected";
         ConnectionStatus.ForeColor = Color.LimeGreen;
         Thread.Sleep(1000);
         Connected = true;
         this.Close();
     }
     else
     {
         ConnectAdb.Enabled = true;
         ip.Enabled         = true;
         Remember.Enabled   = true;
         Connected          = false;
     }
     ConnectionPanel.Visible = true;
 }
예제 #2
0
        static void Main(string[] args)
        {
            ADBClient client = new ADBClient()
            {
                AdbPath    = Path.Combine(Environment.CurrentDirectory, "lib", "adb.exe"),
                AdbTimeout = 1000
            };

            client.StartServer();
            Console.WriteLine("Server up and running!");

            client.Devices().ForEach(x => Console.WriteLine(x));

            Directory.GetFiles("D:\\Google Drive\\Pessoal\\Imagens\\Wallpapers\\Casual Overwatch\\").ToList().ForEach(fileName =>
            {
                client.Push(fileName, "/storage/emulated/0/Pictures/Overwatch/");
            });

            client.KillServer();
            Console.WriteLine("Server' dead and gone!");

            //AdbCmdVersion client = new AdbCmdVersion()
            //{
            //    adbPath = Path.Combine(Environment.CurrentDirectory, "lib", "adb.exe")
            //};

            //client.SendCommandExposed(AdbCmdVersion.commands.StartServer, null);
            //Console.WriteLine("Server up and running!");

            //client.Devices().ForEach(device => Console.WriteLine(device));


            //Directory.GetFiles("D:\\Google Drive\\Pessoal\\Imagens\\Wallpapers\\Casual Overwatch\\").ToList().ForEach(fileName =>
            //{
            //    client.SendCommandExposed(
            //    AdbCmdVersion.commands.Push,
            //    new List<string>()
            //    {
            //        fileName,
            //        "/storage/emulated/0/Pictures/Overwatch/"
            //    });
            //});

            //client.SendCommandExposed(AdbCmdVersion.commands.KillServer, null);
            //Console.WriteLine("Server' dead and gone!");

            //client.Reboot(AdbCmdVersion.bootState.System);

            //AdbPowershellVersion client = new AdbPowershellVersion()
            //{
            //    adbPath = Path.Combine(Environment.CurrentDirectory, "lib", "adb.exe")
            //};

            //client.SendCommand(AdbPowershellVersion.commands.StartServer, null);
            //Console.WriteLine("Server up and running!");

            //Console.WriteLine(client.SendCommand(AdbPowershellVersion.commands.ListDevices, null));

            //Directory.GetFiles("D:\\Google Drive\\Pessoal\\Imagens\\Wallpapers\\Casual Overwatch\\").ToList().ForEach(fileName =>
            //{
            //    client.SendCommand(
            //    AdbPowershellVersion.commands.Push,
            //    new List<string>()
            //    {
            //        fileName,
            //        "/storage/emulated/0/Pictures/Overwatch/"
            //    });
            //    Console.WriteLine($"Sent {fileName} to device!");
            //});

            //client.SendCommand(AdbPowershellVersion.commands.KillServer, null);
            //Console.WriteLine("Server' dead and gone!");

            Console.ReadLine();
        }