Пример #1
0
        public FileTransfer(PscpOptions options, FileTransferRequest request)
        {
            this.Options = options;
            this.Request = request;

            this.Id = Interlocked.Increment(ref idSeed);
        }
Пример #2
0
        public PscpBrowserPanel(SessionData session, PscpOptions options, string localStartingDir) : this()
        {
            this.Name = session.SessionName;
            this.TabText = session.SessionName;

             //set the remote path
            String remotePath = "";            
            if (String.IsNullOrEmpty(session.RemotePath)){                
                remotePath = options.PscpHomePrefix + session.Username;
            }else{                
                remotePath = session.RemotePath;
            }

            //set the local path
            String localPath = "";
            if (String.IsNullOrEmpty(localStartingDir)){
                localPath = String.IsNullOrEmpty(session.LocalPath) ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : session.LocalPath;
            }else{
                localPath = localStartingDir;
            }
 		 

            this.fileTransferPresenter = new FileTransferPresenter(options);
            this.localBrowserPresenter = new BrowserPresenter(
                "Local", new LocalBrowserModel(), session, fileTransferPresenter);
            this.remoteBrowserPresenter = new BrowserPresenter(
                "Remote", new RemoteBrowserModel(options), session, fileTransferPresenter);

            this.browserViewLocal.Initialize(this.localBrowserPresenter, new BrowserFileInfo(new DirectoryInfo(localPath)));
            this.browserViewRemote.Initialize(this.remoteBrowserPresenter, RemoteBrowserModel.NewDirectory(remotePath));
            this.fileTransferView.Initialize(this.fileTransferPresenter);
        }
Пример #3
0
        public FileTransfer(PscpOptions options, FileTransferRequest request)
        {
            this.Options = options;
            this.Request = request;

            this.Id = Interlocked.Increment(ref idSeed);
        }
Пример #4
0
        public PscpBrowserPanel(SessionData session, PscpOptions options, string localStartingDir) : this()
        {
            this.Name    = session.SessionName;
            this.TabText = session.SessionName;

            this.fileTransferPresenter = new FileTransferPresenter(options);
            this.localBrowserPresenter = new BrowserPresenter(
                "Local", new LocalBrowserModel(), session, fileTransferPresenter);
            this.remoteBrowserPresenter = new BrowserPresenter(
                "Remote", new RemoteBrowserModel(options), session, fileTransferPresenter);

            this.browserViewLocal.Initialize(this.localBrowserPresenter, new BrowserFileInfo(new DirectoryInfo(localStartingDir)));
            this.browserViewRemote.Initialize(this.remoteBrowserPresenter, RemoteBrowserModel.NewDirectory(options.PscpHomePrefix + session.Username));
            this.fileTransferView.Initialize(this.fileTransferPresenter);
        }
Пример #5
0
        public PscpBrowserPanel(SessionData session, PscpOptions options, string localStartingDir) : this()
        {
            this.Name = session.SessionName;
            this.TabText = session.SessionName;

            this.fileTransferPresenter = new FileTransferPresenter(options);
            this.localBrowserPresenter = new BrowserPresenter(
                "Local", new LocalBrowserModel(), session, fileTransferPresenter);
            this.remoteBrowserPresenter = new BrowserPresenter(
                "Remote", new RemoteBrowserModel(options), session, fileTransferPresenter);

            this.browserViewLocal.Initialize(this.localBrowserPresenter, new BrowserFileInfo(new DirectoryInfo(localStartingDir)));
            this.browserViewRemote.Initialize(this.remoteBrowserPresenter, RemoteBrowserModel.NewDirectory("/"));
            this.fileTransferView.Initialize(this.fileTransferPresenter);
        }
Пример #6
0
        public PscpBrowserPanel(SessionData session, PscpOptions options, string localStartingDir) : this()
        {
            Name    = session.SessionName;
            TabText = session.SessionName;

            //set the remote path
            String remotePath;

            if (String.IsNullOrEmpty(session.RemotePath))
            {
                remotePath = options.PscpHomePrefix + session.Username;
            }
            else
            {
                remotePath = session.RemotePath;
            }

            //set the local path
            String localPath;

            if (String.IsNullOrEmpty(localStartingDir))
            {
                localPath = String.IsNullOrEmpty(session.LocalPath) ? Environment.GetFolderPath(Environment.SpecialFolder.Desktop) : session.LocalPath;
            }
            else
            {
                localPath = localStartingDir;
            }


            var fileTransferPresenter = new FileTransferPresenter(options);
            IBrowserPresenter localBrowserPresenter = new BrowserPresenter(
                "Local", new LocalBrowserModel(), session, fileTransferPresenter);
            IBrowserPresenter remoteBrowserPresenter = new BrowserPresenter(
                "Remote", new RemoteBrowserModel(options), session, fileTransferPresenter);

            browserViewLocal.Initialize(localBrowserPresenter, new BrowserFileInfo(new DirectoryInfo(localPath)));
            browserViewRemote.Initialize(remoteBrowserPresenter, RemoteBrowserModel.NewDirectory(remotePath));
            fileTransferView.Initialize(fileTransferPresenter);
        }
Пример #7
0
 public RemoteBrowserModel(PscpOptions options)
 {
     this.Options = options;
 }
Пример #8
0
 public PscpBrowserPanel(SessionData session, PscpOptions options) :
     this(session, options, Environment.GetFolderPath(Environment.SpecialFolder.Desktop))
 {
 }
Пример #9
0
        /* Network
         * 10.1 ‘The server's host key is not cached in the registry’
         * 10.2 ‘WARNING - POTENTIAL SECURITY BREACH!’
         * 10.3 ‘Out of space for port forwardings’
         * 10.4 ‘The first cipher supported by the server is ... below the configured warning threshold’
         * 10.5 ‘Server sent disconnect message type 2 (protocol error): "Too many authentication failures for root"’
         * 10.6 ‘Out of memory’
         * 10.7 ‘Internal error’, ‘Internal fault’, ‘Assertion failed’
         * 10.8 ‘Unable to use this private key file’, ‘Couldn't load private key’, ‘Key is of wrong type’
         * 10.9 ‘Server refused our public key’ or ‘Key refused’
         * 10.10 ‘Access denied’, ‘Authentication refused’
         * 10.11 ‘Incorrect CRC received on packet’ or ‘Incorrect MAC received on packet’
         * 10.12 ‘Incoming packet was garbled on decryption’
         * 10.13 ‘PuTTY X11 proxy: various errors’
         * 10.14 ‘Network error: Software caused connection abort’
         * 10.15 ‘Network error: Connection reset by peer’
         * 10.16 ‘Network error: Connection refused’
         * 10.17 ‘Network error: Connection timed out’ error: Connection timed out
         */

        #endregion


        public PscpClient(PscpOptions options, SessionData session)
        {
            this.Options = options;
            this.Session = session;
        }
Пример #10
0
 public FileTransferPresenter(PscpOptions options)
 {
     this.Options = options;
     this.ViewModel = new FileTransferViewModel();
 }
Пример #11
0
        /* Network
         * 10.1 ‘The server's host key is not cached in the registry’
         * 10.2 ‘WARNING - POTENTIAL SECURITY BREACH!’
         * 10.3 ‘Out of space for port forwardings’
         * 10.4 ‘The first cipher supported by the server is ... below the configured warning threshold’
         * 10.5 ‘Server sent disconnect message type 2 (protocol error): "Too many authentication failures for root"’
         * 10.6 ‘Out of memory’
         * 10.7 ‘Internal error’, ‘Internal fault’, ‘Assertion failed’
         * 10.8 ‘Unable to use this private key file’, ‘Couldn't load private key’, ‘Key is of wrong type’
         * 10.9 ‘Server refused our public key’ or ‘Key refused’
         * 10.10 ‘Access denied’, ‘Authentication refused’
         * 10.11 ‘Incorrect CRC received on packet’ or ‘Incorrect MAC received on packet’
         * 10.12 ‘Incoming packet was garbled on decryption’
         * 10.13 ‘PuTTY X11 proxy: various errors’
         * 10.14 ‘Network error: Software caused connection abort’
         * 10.15 ‘Network error: Connection reset by peer’
         * 10.16 ‘Network error: Connection refused’
         * 10.17 ‘Network error: Connection timed out’ error: Connection timed out
         */

        #endregion


        public PscpClient(PscpOptions options, SessionData session)
        {
            Options = options;
            Session = session;
        }
Пример #12
0
        public void LocalToRemote()
        {
            SessionData session = new SessionData
            {
                Username = ScpConfig.UserName,
                Password = ScpConfig.Password,
                Host = ScpConfig.KnownHost,
                Port = 22
            };

            List<BrowserFileInfo> sourceFiles = new List<BrowserFileInfo> 
            {
                //new BrowserFileInfo(new FileInfo(Path.GetTempFileName()))
                new BrowserFileInfo(new FileInfo(ScpConfig.PscpLocation))
            };
            BrowserFileInfo target = new BrowserFileInfo
            { 
                Path = string.Format("/home/{0}/", session.Username), 
                Source = SourceType.Remote
            };

            PscpOptions options = new PscpOptions { PscpLocation = ScpConfig.PscpLocation, TimeoutMs = 5000 };
            PscpClient client = new PscpClient(options, session);
            PscpResult res = client.CopyFiles(
                sourceFiles, 
                target, 
                (complete, cancelAll, status) => 
                {
                    Log.InfoFormat(
                        "complete={0}, cancelAll={1}, fileName={2}, pctComplete={3}", 
                        complete, cancelAll, status.Filename, status.PercentComplete);
                });

            Log.InfoFormat("Result: {0}", res);

            /*
            ListDirectoryResult res = client.ListDirectory(new BrowserFileInfo { Path = "." });

            Assert.AreEqual(ResultStatusCode.Success, res.StatusCode);
            Assert.Greater(res.Files.Count, 0);
            foreach (BrowserFileInfo file in res.Files)
            {
                Log.Info(file);
            }

            Log.InfoFormat("Result: {0}", res);*/
        }
Пример #13
0
 public RemoteBrowserModel(PscpOptions options)
 {
     this.Options = options;
 }
Пример #14
0
 public FileTransferPresenter(PscpOptions options)
 {
     this.Options   = options;
     this.ViewModel = new FileTransferViewModel();
 }
Пример #15
0
 public PscpBrowserPanel(SessionData session, PscpOptions options) :
    // default value of localStartingDir moved to localPath in PscpBrowserPanel(SessionData session, PscpOptions options, string localStartingDir)            
    this(session, options, "")
 { }
Пример #16
0
 public PscpClient(PscpOptions options, SessionData session)
 {
     this.Options = options;
     this.Session = session;
 }
Пример #17
0
 public PscpBrowserPanel(SessionData session, PscpOptions options) :
     // default value of localStartingDir moved to localPath in PscpBrowserPanel(SessionData session, PscpOptions options, string localStartingDir)
     this(session, options, "")
 {
 }
Пример #18
0
 public PscpBrowserPanel(SessionData session, PscpOptions options) :
     this(session, options, Environment.GetFolderPath(Environment.SpecialFolder.Desktop))
 { }