Example #1
0
        private bool copyFromDevice(string localPath, string remotePath, bool useActiveSync)
        {
            _Log.DebugFormat("Copying file from device:[{1}]->[{0}]", localPath, remotePath);


            if (useActiveSync && Rapi != null)
            {
                if (Rapi.DevicePresent && Rapi.Connected)
                {
                    Rapi.CopyFileFromDevice(localPath, remotePath, true);
                    return(true);
                }
                else
                {
                    return(false);//TODO Fehlermeldung/Logging
                }
            }
            else
            {
                if (System.IO.File.Exists(remotePath))
                {
                    try
                    {
                        System.IO.File.Copy(remotePath, localPath, true);
                        return(true);
                    }
                    catch (IOException ex)
                    {
                        _Log.ErrorFormat("Copy Failure: [{0}]", ex.Message != null ? ex.Message : "");
                        return(false);
                    }
                }
                else
                {
                    _Log.ErrorFormat("Copy Failure: Path Not Found [{0}]", remotePath.nullToEmpty());
                    return(false);
                }
            }
        }