private Dictionary <string, RepoCell> Get_Repos(DirectoryInfo pathInfo) { Dictionary <string, RepoCell> Repos = new Dictionary <string, RepoCell>(); foreach (string dir in Directory.GetDirectories(pathInfo.FullName)) { DirectoryInfo dirInfo = new DirectoryInfo(dir); if (dirInfo.Exists) { if (RepoHelpers.Is_Git_Repo(dir)) { RepoCell tempRepo = new RepoCell() { Name = dirInfo.Name, Path = dirInfo.FullName, Current_Status = RepoCell.Status.Type.NEW, Last_Commit = DateTime.MinValue, Last_Commit_Message = "", Notes = new Dictionary <string, string>(), Logs = new Dictionary <string, List <EntryCell> >() }; Repos.Add(dirInfo.Name, tempRepo); } } } return(Repos); }
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(); }
public static int Get_Store_Count() { List <string> temp = Directory.GetDirectories(ManagerData.Selected_Store._Path).ToList(); int count = temp.Count; foreach (string path in temp) { if (!RepoHelpers.Is_Git_Repo(path)) { count--; } } return(count); }
public void Get_Store_Additions() { List <string> temp = Directory.GetDirectories(ManagerData.Selected_Store._Path).ToList(); if (Refresh_Repo_Additions != null) { Refresh_Repo_Additions.Clear(); } else { Refresh_Repo_Additions = new List <string>(); } foreach (string path in temp) { bool contains = false; foreach (RepoCell cell in ManagerData.Selected_Store._Repos.Values) { if (path == cell.Path) { contains = true; break; } } if (!contains) { // Addition if (RepoHelpers.Is_Git_Repo(path)) { Refresh_Repo_Additions.Add(path); } } } }