/// <summary> /// Pulls file(s) or folder(s). </summary> /// <param name="entries"> the remote item(s) to pull </param> /// <param name="localPath"> The local destination. If the entries count is > 1 or /// if the unique entry is a folder, this should be a folder. </param> /// <param name="monitor"> The progress monitor. Cannot be null. </param> /// <exception cref="SyncException"> </exception> /// <exception cref="IOException"> </exception> /// <exception cref="TimeoutException"> /// </exception> /// <seealso cref= FileListingService.FileEntry </seealso> /// <seealso cref= #getNullProgressMonitor() </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void pull(com.android.ddmlib.FileListingService.FileEntry[] entries, String localPath, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException public void pull(FileListingService.FileEntry[] entries, string localPath, ISyncProgressMonitor monitor) { // first we check the destination is a directory and exists if (!Directory.Exists(localPath)) { throw new SyncException(SyncException.SyncError.NO_DIR_TARGET); } if (File.Exists(localPath)) { throw new SyncException(SyncException.SyncError.TARGET_IS_FILE); } // get a FileListingService object FileListingService fls = new FileListingService(mDevice); // compute the number of file to move int total = getTotalRemoteFileSize(entries, fls); // start the monitor monitor.start(total); doPull(entries, localPath, fls, monitor); monitor.stop(); }
/// <summary> /// Pulls a single file. </summary> /// <param name="remote"> the remote file </param> /// <param name="localFilename"> The local destination. </param> /// <param name="monitor"> The progress monitor. Cannot be null. /// </param> /// <exception cref="IOException"> in case of an IO exception. </exception> /// <exception cref="TimeoutException"> in case of a timeout reading responses from the device. </exception> /// <exception cref="SyncException"> in case of a sync exception. /// </exception> /// <seealso cref= FileListingService.FileEntry </seealso> /// <seealso cref= #getNullProgressMonitor() </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void pullFile(com.android.ddmlib.FileListingService.FileEntry remote, String localFilename, ISyncProgressMonitor monitor) throws java.io.IOException, SyncException, TimeoutException public void pullFile(FileListingService.FileEntry remote, string localFilename, ISyncProgressMonitor monitor) { int total = remote.sizeValue; monitor.start(total); doPullFile(remote.fullPath, localFilename, monitor); monitor.stop(); }
/// <summary> /// Push several files. </summary> /// <param name="local"> An array of loca files to push </param> /// <param name="remote"> the remote <seealso cref="FileListingService.FileEntry"/> representing a directory. </param> /// <param name="monitor"> The progress monitor. Cannot be null. </param> /// <exception cref="SyncException"> if file could not be pushed </exception> /// <exception cref="IOException"> in case of I/O error on the connection. </exception> /// <exception cref="TimeoutException"> in case of a timeout reading responses from the device. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void push(String[] local, com.android.ddmlib.FileListingService.FileEntry remote, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException public void push(string[] local, FileListingService.FileEntry remote, ISyncProgressMonitor monitor) { if (remote.directory == false) { throw new SyncException(SyncException.SyncError.REMOTE_IS_FILE); } // get the total count of the bytes to transfer int total = getTotalLocalFileSize(local); monitor.start(total); doPush(local, remote.fullPath, monitor); monitor.stop(); }
/// <summary> /// Push a single file. </summary> /// <param name="local"> the local filepath. </param> /// <param name="remote"> The remote filepath. </param> /// <param name="monitor"> The progress monitor. Cannot be null. /// </param> /// <exception cref="SyncException"> if file could not be pushed </exception> /// <exception cref="IOException"> in case of I/O error on the connection. </exception> /// <exception cref="TimeoutException"> in case of a timeout reading responses from the device. </exception> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void pushFile(String local, String remote, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException public void pushFile(string local, string remote, ISyncProgressMonitor monitor) { if (!File.Exists(local)) { throw new SyncException(SyncException.SyncError.NO_LOCAL_FILE); } if (Directory.Exists(local)) { throw new SyncException(SyncException.SyncError.LOCAL_IS_DIRECTORY); } monitor.start((int)new FileInfo(local).Length); doPushFile(local, remote, monitor); monitor.stop(); }
/// <summary> /// Pulls a single file. /// <p/>Because this method just deals with a String for the remote file instead of a /// <seealso cref="FileListingService.FileEntry"/>, the size of the file being pulled is unknown and the /// <seealso cref="ISyncProgressMonitor"/> will not properly show the progress </summary> /// <param name="remoteFilepath"> the full path to the remote file </param> /// <param name="localFilename"> The local destination. </param> /// <param name="monitor"> The progress monitor. Cannot be null. /// </param> /// <exception cref="IOException"> in case of an IO exception. </exception> /// <exception cref="TimeoutException"> in case of a timeout reading responses from the device. </exception> /// <exception cref="SyncException"> in case of a sync exception. /// </exception> /// <seealso cref= #getNullProgressMonitor() </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void pullFile(String remoteFilepath, String localFilename, ISyncProgressMonitor monitor) throws TimeoutException, java.io.IOException, SyncException public void pullFile(string remoteFilepath, string localFilename, ISyncProgressMonitor monitor) { int?mode = readMode(remoteFilepath); if (mode == null) { // attempts to download anyway } else if (mode == 0) { throw new SyncException(SyncException.SyncError.NO_REMOTE_OBJECT); } monitor.start(0); //TODO: use the {@link FileListingService} to get the file size. doPullFile(remoteFilepath, localFilename, monitor); monitor.stop(); }
/// <summary> /// Pulls a single file. /// <p/>Because this method just deals with a String for the remote file instead of a /// <seealso cref="FileListingService.FileEntry"/>, the size of the file being pulled is unknown and the /// <seealso cref="ISyncProgressMonitor"/> will not properly show the progress </summary> /// <param name="remoteFilepath"> the full path to the remote file </param> /// <param name="localFilename"> The local destination. </param> /// <param name="monitor"> The progress monitor. Cannot be null. /// </param> /// <exception cref="IOException"> in case of an IO exception. </exception> /// <exception cref="TimeoutException"> in case of a timeout reading responses from the device. </exception> /// <exception cref="SyncException"> in case of a sync exception. /// </exception> /// <seealso cref= #getNullProgressMonitor() </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public void pullFile(String remoteFilepath, String localFilename, ISyncProgressMonitor monitor) throws TimeoutException, java.io.IOException, SyncException public void pullFile(string remoteFilepath, string localFilename, ISyncProgressMonitor monitor) { int? mode = readMode(remoteFilepath); if (mode == null) { // attempts to download anyway } else if (mode == 0) { throw new SyncException(SyncException.SyncError.NO_REMOTE_OBJECT); } monitor.start(0); //TODO: use the {@link FileListingService} to get the file size. doPullFile(remoteFilepath, localFilename, monitor); monitor.stop(); }