Exemplo n.º 1
0
        private void Test(ServerConfig conf)
        {
            Session        session;
            SessionOptions opts;

            UpdateMessage("Configuring WinSCP Information...");

            try {
                opts = ConnectionUtils.GetSessionOptions(conf);
            } catch {
                UpdateMessage("Configuring WinSCP Information Failed!");
                DialogResult = DialogResult.Abort;
                //CloseForm();
                return;
            }

            UpdateMessage($"Connecting to {conf.Hostname} with username {conf.Username}");

            try {
                session = ConnectionUtils.GetSession(opts);
            } catch {
                UpdateMessage($"Connection to {conf.Hostname} failed!");
                DialogResult = DialogResult.Abort;
                //CloseForm();
                return;
            }

            try {
                RemoteDirectoryInfo directory = session.ListDirectory("/");
                if (directory.Files.Count > 0)
                {
                    UpdateMessage($"Connection to {conf.Hostname} succeeded!");
                    DialogResult = DialogResult.OK;
                    //CloseForm();
                    return;
                }
                else
                {
                    UpdateMessage($"Connection to {conf.Hostname} failed!");
                    DialogResult = DialogResult.Abort;
                    //CloseForm();
                    return;
                }
            } catch {
                UpdateMessage($"Failed to verify successful connection to {conf.Hostname} (check '/' read permissions)");
                DialogResult = DialogResult.Abort;
                //CloseForm();
                return;
            } finally {
                session.Close();
            }
        }
Exemplo n.º 2
0
        private void btnPushBackendPrivate_Click(object sender, EventArgs e)
        {
            Task.Factory.StartNew(new Action(() => {
                foreach (ServerConfig k in Program.config.Servers.Values)
                {
                    Log("Syncronizing local backend build to testing on " + k.Hostname + "\n");

                    Session session = ConnectionUtils.GetSession(ConnectionUtils.GetSessionOptions(k));

                    session.FileTransferred += FileTransferred;

                    session.SynchronizeDirectories(SynchronizationMode.Remote, Program.config.BackendSourceDirectory + "\\bin\\Release\\netcoreapp2.1\\ubuntu.18.04-x64\\publish\\", k.BackendTestingDirectory, false, false, SynchronizationCriteria.Size);

                    session.Close();

                    Log("Finished syncronizing local backend build to testing on " + k.Hostname + "\n");
                }
            }));
        }
Exemplo n.º 3
0
        private void btnPushPublicTest_Click(object sender, EventArgs e)
        {
            Task.Factory.StartNew(new Action(() => {
                foreach (ServerConfig k in Program.config.Servers.Values)
                {
                    Log("Syncronizing local guide build to public on " + k.Hostname + "\n");

                    Session session = ConnectionUtils.GetSession(ConnectionUtils.GetSessionOptions(k));

                    session.FileTransferred += FileTransferred;

                    session.SynchronizeDirectories(SynchronizationMode.Remote, Program.config.GuideSourceDirectory + "\\_build\\html\\", k.PublicTestingGuideDirectory, true, false, SynchronizationCriteria.Size);

                    session.Close();

                    Log("Finished syncronizing local guide build to public on " + k.Hostname + "\n");
                }
            }));
        }