Ejemplo n.º 1
0
        public bool PasteCut(ADBFile myfile, string path)
        {
            //FileAndDirectoryCounter++;
            ExternalMethod.CounterEx++;
            bool rslt = false;

            if (myfile.GetTag() == 'd')
            {
                CreateDirectory(path, myfile.Name.FixForbidCharInTerminal());
                foreach (ADBFile onefile in myfile.GetSubFiles())
                {
                    PasteCut(onefile, path + "/" + myfile.Name.FixForbidCharInTerminal());
                }
                rslt = true;
            }
            else
            {
                if (resultCommand(string.Format(@"mv {0} {1}", myfile.FullName.FixForbidCharInTerminal(), path)).Count() == 0)
                {
                    rslt = true;
                }
                rslt = false;
            }
            return(rslt);
        }
Ejemplo n.º 2
0
 public bool BackupToSystem(ADBFile myfile, string BackupPath)
 {
     ExternalMethod.CounterEx++;
     if (myfile.GetTag() == 'd')
     {
         Directory.CreateDirectory(BackupPath + @"\" + myfile.Name.nickName().DecodingText());
         foreach (ADBFile onefile in myfile.GetSubFiles())
         {
             BackupToSystem(onefile, BackupPath + @"\" + myfile.Name.nickName().DecodingText());
         }
         return(true);
     }
     else
     {
         string fullnamebackup = BackupPath + @"\" + myfile.FullName.returnFile(CurrentDevice).Name.Replace(@"\", string.Empty).DecodingText();
         if (File.Exists(fullnamebackup))
         {
             return(true);
         }
         using (SyncService service = new SyncService(new AdbSocket(new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort)), CurrentDevice))
             using (Stream stream = System.IO.File.OpenWrite(fullnamebackup))
             {
                 try
                 {
                     service.Pull(myfile.FullName.Replace(@"\", string.Empty), stream, null, CancellationToken.None);
                     return(true);
                 }
                 catch (Exception)
                 {
                     return(false);
                 }
             }
     }
 }