Example #1
0
 private bool copyToDevice(string localPath, string remotePath, bool useActiveSync)
 {
     _Log.DebugFormat("Copying file to device: [{0}]->[{1}]", localPath, remotePath);
     if (useActiveSync && Rapi != null)
     {
         if (Rapi.DevicePresent && Rapi.Connected)
         {
             Rapi.CopyFileToDevice(localPath, remotePath, true);
             return(true);
         }
         else
         {
             return(false);//TODO Fehlermeldung/Logging
         }
     }
     else
     {
         if (System.IO.File.Exists(localPath))
         {
             try
             {
                 System.IO.File.Copy(localPath, remotePath, true);
                 return(true);
             }
             catch (IOException ex)
             {
                 _Log.ErrorFormat("Copying file to device failed:\n[{0}]\n[{1}]->[{2}]", ex, localPath.nullToEmpty(), remotePath.nullToEmpty());
                 return(false);
             }
         }
         else
         {
             _Log.ErrorFormat("Copying file to device failed: Source does not exist! [{0}]", localPath.nullToEmpty());
             return(false);
         }
     }
 }