コード例 #1
0
 public static void deleteDeviceFile(string file)
 {
     using (RemoteDeviceManager r = new RemoteDeviceManager())
     {
         using (RemoteDevice device = r.Devices.FirstConnectedDevice)
         {
             string myDocs = device.GetFolderPath(SpecialFolder.MyDocuments);
             if (RemoteFile.Exists(device, myDocs + "\\" + file))
             {
                 RemoteFile.Delete(device, myDocs + "\\" + file);
             }
             else
             {
                 Console.ForegroundColor = ConsoleColor.Red;
                 Console.Error.WriteLine("El archivo " + file + " no existe");
                 Console.ResetColor();
             }
         }
     }
 }
コード例 #2
0
 public static void getFileFromDevice(string path, string file)
 {
     using (RemoteDeviceManager r = new RemoteDeviceManager())
     {
         using (RemoteDevice device = r.Devices.FirstConnectedDevice)
         {
             string myDocs     = device.GetFolderPath(SpecialFolder.MyDocuments);
             string deviceFile = myDocs + "\\" + file;
             string localFile  = path + "\\" + file;
             if (RemoteFile.Exists(device, deviceFile))
             {
                 RemoteFile.CopyFileFromDevice(device, deviceFile, localFile, true);
             }
             else
             {
                 Console.ForegroundColor = ConsoleColor.Red;
                 Console.Error.WriteLine("El archivo " + deviceFile + " no existe");
                 Console.ResetColor();
             }
         }
     }
 }