Esempio n. 1
0
 private void CloneRepoFRM_Load(object sender, EventArgs e)
 {
     RepoPathTB.Text            = dir;
     RepoPathTB.SelectionStart  = RepoPathTB.SelectionStart;
     RepoPathTB.SelectionLength = 0;
     DestinationPathTB.Text     = Properties.Settings.Default.CloneLocalSourcePath;
     CloneRepoBT.Focus();
 }
Esempio n. 2
0
        private void CloneRepoBT_Click(object sender, EventArgs e)
        {
            progressBar1.Show();

            if (string.IsNullOrEmpty(DestinationPathTB.Text) || string.IsNullOrWhiteSpace(DestinationPathTB.Text))
            {
                MessageBox.Show("Not a valid destination!.", "Invalid Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            else
            {
                if (RepoHelpers.Is_Git_Repo(RepoPathTB.Text))
                {
                    bool ClonerResult = false;

                    if (RepoHelpers.Clone_Repo(DestinationPathTB.Text, true))
                    {
                        ClonerResult = false;

                        DirectoryInfo cloneInfo = new DirectoryInfo(RepoPathTB.Text);
                        DirectoryInfo localInfo = new DirectoryInfo(Properties.Settings.Default.CloneLocalSourcePath);

                        AutoClosingMessageBox.Show(cloneInfo.Name + " successfully cloned to " + localInfo.Name, "Clone Successful", 1500);
                    }

                    else
                    {
                        ClonerResult = true;
                    }

                    retry = ClonerResult;
                }

                else
                {
                    MessageBox.Show("Not a valid repository!", "Invalid Path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }

            progressBar1.Hide();

            if (retry)
            {
                retry = false;

                DialogResult res = MessageBox.Show("Error cloning repository, retry?", "Error Cloning", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error);

                if (res == DialogResult.Retry)
                {
                    CloneRepoBT.PerformClick();
                }
            }

            Close();
        }