Example #1
0
        /// <summary>
        /// Push multiple files </summary>
        /// <param name="fileArray"> </param>
        /// <param name="remotePath"> </param>
        /// <param name="monitor">
        /// </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: private void doPush(java.io.File[] fileArray, String remotePath, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
        private void doPush(IEnumerable <string> fileArray, string remotePath, ISyncProgressMonitor monitor)
        {
            foreach (var f in fileArray)
            {
                // check if we're canceled
                if (monitor.canceled == true)
                {
                    throw new SyncException(SyncException.SyncError.CANCELED);
                }
                if (Directory.Exists(f))
                {
                    // append the name of the directory to the remote path
                    var    name = Path.GetFileName(f);
                    string dest = remotePath + "/" + name; // $NON-NLS-1S
                    monitor.startSubTask(dest);
                    doPush(Directory.GetFileSystemEntries(f), dest, monitor);

                    monitor.advance(1);
                }
                else if (File.Exists(f))
                {
                    // append the name of the file to the remote path
                    var    name       = Path.GetFileName(f);
                    string remoteFile = remotePath + "/" + name; // $NON-NLS-1S
                    monitor.startSubTask(remoteFile);
                    doPushFile(f, remoteFile, monitor);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Pulls multiple files/folders recursively. </summary>
        /// <param name="entries"> The list of entry to pull </param>
        /// <param name="localPath"> the localpath to a directory </param>
        /// <param name="fileListingService"> a FileListingService object to browse through remote directories. </param>
        /// <param name="monitor"> the progress monitor. Must be started already.
        /// </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: private void doPull(com.android.ddmlib.FileListingService.FileEntry[] entries, String localPath, FileListingService fileListingService, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
        private void doPull(FileListingService.FileEntry[] entries, string localPath, FileListingService fileListingService, ISyncProgressMonitor monitor)
        {
            foreach (FileListingService.FileEntry e in entries)
            {
                // check if we're cancelled
                if (monitor.canceled == true)
                {
                    throw new SyncException(SyncException.SyncError.CANCELED);
                }

                // get type (we only pull directory and files for now)
                int type = e.type;
                if (type == FileListingService.TYPE_DIRECTORY)
                {
                    monitor.startSubTask(e.fullPath);
                    var dest = Path.Combine(localPath, e.name);

                    // make the directory
                    Directory.CreateDirectory(dest);

                    // then recursively call the content. Since we did a ls command
                    // to get the number of files, we can use the cache
                    FileListingService.FileEntry[] children = fileListingService.getChildren(e, true, null);
                    doPull(children, dest, fileListingService, monitor);
                    monitor.advance(1);
                }
                else if (type == FileListingService.TYPE_FILE)
                {
                    monitor.startSubTask(e.fullPath);
                    string dest = Path.Combine(localPath, e.name);
                    doPullFile(e.fullPath, dest, monitor);
                }
            }
        }
Example #3
0
        /// <summary>
        /// Push multiple files </summary>
        /// <param name="fileArray"> </param>
        /// <param name="remotePath"> </param>
        /// <param name="monitor">
        /// </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: private void doPush(java.io.File[] fileArray, String remotePath, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
        private void doPush(IEnumerable<string> fileArray, string remotePath, ISyncProgressMonitor monitor)
        {
            foreach (var f in fileArray)
            {
                // check if we're canceled
                if (monitor.canceled == true)
                {
                    throw new SyncException(SyncException.SyncError.CANCELED);
                }
                if (Directory.Exists(f))
                {
                    // append the name of the directory to the remote path
                    var name = Path.GetFileName(f);
                    string dest = remotePath + "/" + name; // $NON-NLS-1S
                    monitor.startSubTask(dest);
                    doPush(Directory.GetFileSystemEntries(f), dest, monitor);

                    monitor.advance(1);
                }
                else if (File.Exists(f))
                {
                    // append the name of the file to the remote path
                    var name = Path.GetFileName(f);
                    string remoteFile = remotePath + "/" + name; // $NON-NLS-1S
                    monitor.startSubTask(remoteFile);
                    doPushFile(f, remoteFile, monitor);
                }
            }
        }
Example #4
0
        /// <summary>
        /// Pulls multiple files/folders recursively. </summary>
        /// <param name="entries"> The list of entry to pull </param>
        /// <param name="localPath"> the localpath to a directory </param>
        /// <param name="fileListingService"> a FileListingService object to browse through remote directories. </param>
        /// <param name="monitor"> the progress monitor. Must be started already.
        /// </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: private void doPull(com.android.ddmlib.FileListingService.FileEntry[] entries, String localPath, FileListingService fileListingService, ISyncProgressMonitor monitor) throws SyncException, java.io.IOException, TimeoutException
        private void doPull(FileListingService.FileEntry[] entries, string localPath, FileListingService fileListingService, ISyncProgressMonitor monitor)
        {
            foreach (FileListingService.FileEntry e in entries)
            {
                // check if we're cancelled
                if (monitor.canceled == true)
                {
                    throw new SyncException(SyncException.SyncError.CANCELED);
                }

                // get type (we only pull directory and files for now)
                int type = e.type;
                if (type == FileListingService.TYPE_DIRECTORY)
                {
                    monitor.startSubTask(e.fullPath);
                    var dest = Path.Combine(localPath, e.name);

                    // make the directory
                    Directory.CreateDirectory(dest);

                    // then recursively call the content. Since we did a ls command
                    // to get the number of files, we can use the cache
                    FileListingService.FileEntry[] children = fileListingService.getChildren(e, true, null);
                    doPull(children, dest, fileListingService, monitor);
                    monitor.advance(1);
                }
                else if (type == FileListingService.TYPE_FILE)
                {
                    monitor.startSubTask(e.fullPath);
                    string dest = Path.Combine(localPath, e.name);
                    doPullFile(e.fullPath, dest, monitor);
                }
            }
        }