public static Dictionary <string, RepoCell> Get_Repos(XML.Repos ReposObj) { Dictionary <string, RepoCell> RepoDict = new Dictionary <string, RepoCell>(); try { foreach (XML.Repo Parsed_Repo in ReposObj.Items) { RepoCell currRepo = Get_Repo(Parsed_Repo); currRepo.Logs = new Dictionary <string, List <EntryCell> >(); if (currRepo != null) { RepoDict.Add(Parsed_Repo.Name, currRepo); } } } catch (Exception ex) { RepoDict = null; } return(RepoDict); }
public void Refresh_Store_Dictionary() { foreach (RepoCell cell in Refresh_Repo_Deletions) { ManagerData.Selected_Store._Repos.Remove(cell.Name); } foreach (string path in Refresh_Repo_Additions) { DirectoryInfo temp = new DirectoryInfo(path); RepoCell newCell = new RepoCell() { Name = temp.Name, Path = temp.FullName, Current_Status = RepoCell.Status.Type.NONE, Notes = new Dictionary <string, string>(), Last_Commit = DateTime.MinValue, Last_Commit_Message = string.Empty, Logs = new Dictionary <string, List <EntryCell> >() }; ManagerData.Selected_Store._Repos.Add(temp.Name, newCell); } Configuration.Helpers.Serialize_Condensed_All(Properties.Settings.Default.ConfigPath); var selectedItem = StoreLocationCB.SelectedItem; Refresh_Elements(false); StoreLocationCB.SelectedItem = selectedItem; }
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); }
public static bool Append_New_Repo(RepoCell newRepo) { // Convert repo cell to repo node // Get the node of the currently selected store // Append the repo node to the store node's children return(true); }
public static RepoCell Get_Repo(XML.Repo RepoObj) { RepoCell currRepo = null; try { currRepo = new RepoCell(); currRepo.Name = RepoObj.Name; currRepo.Current_Status = RepoCell.Status.ToType(RepoObj.Status); currRepo.Notes = Get_Notes(RepoObj.Notes); } catch (Exception ex) { } return(currRepo); }
public static string Add_Repos(Dictionary <string, List <string> > additions) { string response = string.Empty; foreach (KeyValuePair <string, List <string> > kvp in additions) { DirectoryInfo storeInfo = new DirectoryInfo(kvp.Key); foreach (string path in kvp.Value) { if (Is_Git_Repo(path)) { DirectoryInfo repoInfo = new DirectoryInfo(path); RepoCell newRepo = new RepoCell() { Name = repoInfo.Name, Path = repoInfo.FullName, Current_Status = RepoCell.Status.Type.NONE, Logs_Parsed = false, Last_Commit = DateTime.MinValue, Last_Commit_Message = string.Empty, Logs = new Dictionary <string, List <EntryCell> >(), Notes = new Dictionary <string, string>() }; try { if (!ManagerData.Stores[storeInfo.Name]._Repos.ContainsKey(repoInfo.Name)) { ManagerData.Stores[storeInfo.Name]._Repos.Add(repoInfo.Name, newRepo); } } catch (Exception ex) { response += ex.Message + Environment.NewLine + Environment.NewLine; } } } } return(response); }
public static void Copy_Selected_Repo() { if (Selected_Repo != null) { Selected_Repo_Copy = new RepoCell(); Selected_Repo_Copy.Name = Selected_Repo.Name; Selected_Repo_Copy.Path = Selected_Repo.Path; Selected_Repo_Copy.Current_Status = Selected_Repo.Current_Status; Selected_Repo_Copy.Last_Commit = Selected_Repo.Last_Commit; Selected_Repo_Copy.Last_Commit_Message = Selected_Repo.Last_Commit_Message; Selected_Repo_Copy.Notes = Selected_Repo.Notes; Selected_Repo_Copy.Logs = Selected_Repo.Logs; } else { Selected_Repo_Copy = null; } }
public static void Deserialize_Condensed(string file, CircularProgressBar.CircularProgressBar cpb = null) { // Load the document XmlDocument Config = new XmlDocument(); Config.Load(file); if (ManagerData.Stores != null) { ManagerData.Stores.Clear(); } else { ManagerData.Stores = new Dictionary <string, StoreCell>(); } string currStoreLocation = string.Empty; string currRepoName = string.Empty; RepoCell.Status.Type currRepoStatus = RepoCell.Status.Type.NONE; string currNoteTitle = string.Empty; string currNoteMessage = string.Empty; StoreCell newStore = null; RepoCell newRepo = null; // Under the root the layers will be Stores => Repos => Notes foreach (XmlNode storeNode in Config.DocumentElement.ChildNodes) { foreach (XmlAttribute storeAttr in storeNode.Attributes) { switch (File.String_ToATTRIBUTE_T(storeAttr.Name)) { case File.ATTRIBUTE_T.LOCATION: currStoreLocation = storeAttr.Value; break; } } newStore = new StoreCell(currStoreLocation) { _Repos = new Dictionary <string, RepoCell>() }; foreach (XmlNode repoNode in storeNode.ChildNodes) { foreach (XmlAttribute repoAttr in repoNode.Attributes) { switch (File.String_ToATTRIBUTE_T(repoAttr.Name)) { case File.ATTRIBUTE_T.NAME: currRepoName = repoAttr.Value; break; case File.ATTRIBUTE_T.STATUS: currRepoStatus = RepoCell.Status.ToType(repoAttr.Value); break; } } newRepo = new RepoCell() { Name = currRepoName, Current_Status = currRepoStatus, Path = currStoreLocation + @"\" + currRepoName, Notes = new Dictionary <string, string>() }; foreach (XmlNode noteNode in repoNode.ChildNodes) { foreach (XmlAttribute noteAttr in noteNode.Attributes) { switch (File.String_ToATTRIBUTE_T(noteAttr.Name)) { case File.ATTRIBUTE_T.TITLE: currNoteTitle = noteAttr.Value; break; } } currNoteMessage = noteNode.InnerText; newRepo.Notes.Add(currNoteTitle, currNoteMessage); currNoteMessage = string.Empty; currNoteTitle = string.Empty; } newRepo.Logs_Parsed = false; newStore._Repos.Add(currRepoName, newRepo); currRepoStatus = RepoCell.Status.Type.NONE; } if (currStoreLocation != "") { DirectoryInfo dirInfo = new DirectoryInfo(currStoreLocation); ManagerData.Stores.Add(dirInfo.Name, newStore); } } }
/* * ________________________________________________________________________________ * # Method: # * # # * # Usage: # * # # * # Parameters: # * # # * # Returns: # * # # * # Last Date Modified: # * # # * # Last Modified By: # * # # * ________________________________________________________________________________ */ public static List <EntryCell> Parse_Logs(string Full_Log, RepoCell currRepo = null) { // Get a list of matches that match the log format // There will probably be two sets, one for the ID and one for the message // Each should align with the other in seperate lists i.e. index 0 in the id list aligns with index 0 in the message list string currID = ""; string currAuthor = ""; string currDate = ""; string currMessage = ""; Regex rgx = new Regex(Properties.Resources.REGEX_LOG_PATTERN, RegexOptions.IgnoreCase | RegexOptions.Multiline); List <EntryCell> Entries = new List <EntryCell>(); var matches = rgx.Matches(Full_Log); bool first = true; foreach (Match commit in matches) { currID = commit.Groups[1].Value; currAuthor = commit.Groups[2].Value; currDate = commit.Groups[3].Value; currMessage = commit.Groups[4].Value; EntryCell entry = new EntryCell { ID = currID, Author = currAuthor, Message = currMessage }; DateTime temp = DateTime.MinValue; currDate = currDate.Trim(); temp = DateTime.ParseExact(currDate, "ddd MMM d HH:mm:ss yyyy zz00", null); entry.Date = temp; Entries.Add(entry); string shortID = currID.Substring(0, 8); if (first) { first = false; if (currRepo.Last_Commit == DateTime.MinValue && currRepo.Last_Commit != null || Properties.Settings.Default.LogParseMethod == 1) { currRepo.Last_Commit = entry.Date; } if (currRepo.Last_Commit_Message == string.Empty || currRepo.Last_Commit_Message == null || Properties.Settings.Default.LogParseMethod == 1) { currRepo.Last_Commit_Message = entry.Message; } } if (currRepo != null) { if (currRepo.Logs != null) { if (currRepo.Logs.Keys.Contains(currID.Substring(0, 8))) { currRepo.Logs[shortID].Add(entry); } else { currRepo.Logs.Add(shortID, new List <EntryCell>()); currRepo.Logs[shortID].Add(entry); } } else { currRepo.Logs = new Dictionary <string, List <EntryCell> >(); currRepo.Logs.Add(shortID, new List <EntryCell>()); currRepo.Logs[shortID].Add(entry); } } } return(Entries); }