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);
        }
        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);
        }
        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);
        }
        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);
        }
Exemple #5
0
 /// <summary>Transfer a file between two locations</summary>
 /// <param name="fileTransferReqeust">The request data containing files to transfer</param>
 public void TransferFiles(FileTransferRequest fileTransferReqeust)
 {
     FileTransferPresenter.TransferFiles(fileTransferReqeust);
 }
Exemple #6
0
 /// <summary>Verify a file can be transfered</summary>
 /// <param name="source">The Source file</param>
 /// <param name="target">The Destination file</param>
 /// <returns>true if the file can be transfered</returns>
 public bool CanTransferFile(BrowserFileInfo source, BrowserFileInfo target)
 {
     return(FileTransferPresenter.CanTransferFile(source, target));
 }
        public void RunCombinedView()
        {
            Form form = new Form();

            SessionData session = new SessionData
            {
                SessionId = "Test/SessionId",
                SessionName = "Test SessionName",
                Username = ScpConfig.UserName,
                Password = ScpConfig.Password, 
                Host = ScpConfig.KnownHost, 
                Port = 22
            };

            FileTransferPresenter fileTransferPresenter = new FileTransferPresenter(ScpConfig.DefaultOptions);

            FileTransferView fileTransferView = new FileTransferView(fileTransferPresenter) { Dock = DockStyle.Bottom };
            BrowserView localBrowserView = new BrowserView(
                new BrowserPresenter("Local", new LocalBrowserModel(), session, fileTransferPresenter), 
                new BrowserFileInfo(new DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.Desktop))));
            localBrowserView.Dock = DockStyle.Fill;
            
            BrowserView remoteBrowserView = new BrowserView(
                new BrowserPresenter("Remote", new RemoteBrowserModel(ScpConfig.DefaultOptions), session, fileTransferPresenter),
                RemoteBrowserModel.NewDirectory("/home/" + ScpConfig.UserName));
            remoteBrowserView.Dock = DockStyle.Fill;

            SplitContainer browserPanel = new SplitContainer() 
            { 
                Dock = DockStyle.Fill, 
                SplitterDistance = 75, 
            };
            browserPanel.Panel1.Controls.Add(localBrowserView);
            browserPanel.Panel2.Controls.Add(remoteBrowserView);

            form.Controls.Add(browserPanel);
            form.Controls.Add(fileTransferView);
            form.Size = new Size(1024, 768);
            form.Show();
        }