Example #1
0
        private void OnPullClick(object sender, EventArgs e)
        {
            Adb.Device device;
            DeviceItem item;

            if ((item = (DevicesBox.SelectedItem as DeviceItem)) != null && ((device = item.Value).IsOnline))
            {
                using (PullFile pull = new PullFile())
                {
                    if (pull.ShowDialog() == DialogResult.OK)
                    {
                        string local  = pull.GetLocalPath();
                        string remote = pull.GetRemotePath();
                        if (string.IsNullOrEmpty(local))
                        {
                            Console.WriteLine(Resources.OUTPUT_ENTER_LOCAL);
                        }
                        else if (!Directory.Exists(local))
                        {
                            Console.WriteLine(Resources.OUTPUT_NOT_EXISTS, local);
                        }
                        else
                        {
                            Console.WriteLine(new String('-', CONSOLE_DIVIDER));
                            Console.WriteLine(Resources.OUTPUT_PULLING, remote, local, device.Model, device.Serial);
                            RunInBackground((a, b) =>
                            {
                                Worker.ReportProgress(1);
                                b.Result = Adb.Pull(device.Serial, remote, local);
                                Worker.ReportProgress(100);
                            },
                                            (a, b) =>
                            {
                                if ((bool)b.Result)
                                {
                                    Console.WriteLine(Resources.OUTPUT_PULLING_FAILED, remote);
                                }
                                else
                                {
                                    Console.WriteLine(Resources.OUTPUT_PULLING_SUCCESS, remote);
                                }
                            });
                        }
                    }
                }
            }
            else
            {
                Console.WriteLine(Resources.OUTPUT_DEVICE_OFFLINE);
            }
        }
Example #2
0
 private void OnPullClick(object sender, EventArgs e)
 {
     Adb.Device device;
     DeviceItem item;
     if ((item = (DevicesBox.SelectedItem as DeviceItem)) != null && ((device = item.Value).IsOnline))
     {
         using (PullFile pull = new PullFile())
         {
             if (pull.ShowDialog() == DialogResult.OK)
             {
                 string local = pull.GetLocalPath();
                 string remote = pull.GetRemotePath();
                 if (string.IsNullOrEmpty(local))
                 {
                     Console.WriteLine(Resources.OUTPUT_ENTER_LOCAL);
                 }
                 else if (!Directory.Exists(local))
                 {
                     Console.WriteLine(Resources.OUTPUT_NOT_EXISTS, local);
                 }
                 else
                 {
                     Console.WriteLine(new String('-', CONSOLE_DIVIDER));
                     Console.WriteLine(Resources.OUTPUT_PULLING, remote, local, device.Model, device.Serial);
                     RunInBackground((a, b) =>
                     {
                         Worker.ReportProgress(1);
                         b.Result = Adb.Pull(device.Serial, remote, local);
                         Worker.ReportProgress(100);
                     },
                     (a, b) =>
                     {
                         if ((bool)b.Result)
                         {
                             Console.WriteLine(Resources.OUTPUT_PULLING_FAILED, remote);
                         }
                         else
                         {
                             Console.WriteLine(Resources.OUTPUT_PULLING_SUCCESS, remote);
                         }
                     });
                 }
             }
         }
     }
     else
     {
         Console.WriteLine(Resources.OUTPUT_DEVICE_OFFLINE);
     }
 }