QueueCommand() public method

public QueueCommand ( StageDelegate pre, String cmd, StageDelegate post ) : void
pre StageDelegate
cmd String
post StageDelegate
return void
Example #1
0
        void ClonePackage(String source, String branch, String package)
        {
            try
            {
                String fullpath = Path.Combine(GlobalRegistry.Instance.Path, package);

                if (Directory.Exists(fullpath))
                {
                    MessageBox.Show(String.Format("Unable to install package {0}, directory already exists.", package), "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    m_ProgressForm = new ProgressDialog();
                    m_ProgressForm.WriteLine("Installing package {0}", package);

                    String wd = Directory.GetCurrentDirectory();
                    Directory.SetCurrentDirectory(GlobalRegistry.Instance.Path);
                    m_ProgressForm.QueueCommand(String.Format("git clone \"{0}.git\" \"{1}\"", source, fullpath));
                    m_ProgressForm.QueueCommand
                    (
                        delegate() { Directory.SetCurrentDirectory(fullpath); },
                        String.Format("git checkout \"{0}\"", branch),
                        delegate() { Directory.SetCurrentDirectory(wd); }
                    );
                    m_ProgressForm.ShowDialog();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error installing package:\n" + exc.Message, "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #2
0
        void UpdatePackage(String package)
        {
            try
            {
                String fullpath = Path.Combine(GlobalRegistry.Instance.Path, package);

                if (!Directory.Exists(fullpath))
                {
                    MessageBox.Show(String.Format("Unable to update package {0}, directory does not exist.", package), "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    m_ProgressForm = new ProgressDialog();
                    m_ProgressForm.WriteLine("Updating package {0}", package);

                    String wd = Directory.GetCurrentDirectory();
                    Directory.SetCurrentDirectory(fullpath);
                    m_ProgressForm.QueueCommand("git reset --hard");
                    m_ProgressForm.QueueCommand("git pull");
                    m_ProgressForm.ShowDialog();
                    Directory.SetCurrentDirectory(wd);

                    m_ProgressForm.WriteLine("Done updating package {0}.", package);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error updating package:\n" + exc.Message, "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #3
0
        void UpdatePackage(String package)
        {
            try
            {
                String fullpath = Path.Combine(GlobalRegistry.Instance.Path, package);

                if (!Directory.Exists(fullpath))
                {
                    MessageBox.Show(String.Format("Unable to update package {0}, directory does not exist.", package), "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    m_ProgressForm = new ProgressDialog();
                    m_ProgressForm.WriteLine("Updating package {0}", package);

                    String wd = Directory.GetCurrentDirectory();
                    Directory.SetCurrentDirectory(fullpath);
                    m_ProgressForm.QueueCommand("git reset --hard");
                    m_ProgressForm.QueueCommand("git pull");
                    m_ProgressForm.ShowDialog();
                    Directory.SetCurrentDirectory(wd);

                    m_ProgressForm.WriteLine("Done updating package {0}.", package);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error updating package:\n" + exc.Message, "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        void ClonePackage(String source, String branch, String package)
        {
            try
            {
                String fullpath = Path.Combine(GlobalRegistry.Instance.Path, package);

                if (Directory.Exists(fullpath))
                {
                    MessageBox.Show(String.Format("Unable to install package {0}, directory already exists.", package), "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else
                {
                    m_ProgressForm = new ProgressDialog();
                    m_ProgressForm.WriteLine("Installing package {0}", package);

                    String wd = Directory.GetCurrentDirectory();
                    Directory.SetCurrentDirectory(GlobalRegistry.Instance.Path);
                    m_ProgressForm.QueueCommand(String.Format("git clone \"{0}.git\" \"{1}\"", source, fullpath));
                    m_ProgressForm.QueueCommand
                    (
                        delegate() { Directory.SetCurrentDirectory(fullpath); },
                        String.Format("git checkout \"{0}\"", branch),
                        delegate() { Directory.SetCurrentDirectory(wd); }
                    );
                    m_ProgressForm.ShowDialog();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error installing package:\n" + exc.Message, "Package Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }