Beispiel #1
0
            public static void Get_Stores()
            {
                if (Parsed_Raw != null)
                {
                    ManagerData.Stores = new Dictionary <string, StoreCell>();
                    StoreCell currStore = null;

                    try
                    {
                        foreach (XML.Store Parsed_Store in Parsed_Raw.Stores)
                        {
                            currStore        = new StoreCell(Parsed_Store.Location);
                            currStore._Path  = Parsed_Store.Location;
                            currStore._Repos = Get_Repos(Parsed_Store.Repos);

                            DirectoryInfo currStoreInfo = new DirectoryInfo(Parsed_Store.Location);
                            ManagerData.Stores.Add(currStoreInfo.Name, currStore);
                        }

                        foreach (StoreCell store in ManagerData.Stores.Values)
                        {
                            foreach (RepoCell repo in store._Repos.Values)
                            {
                                repo.Path = store._Path + @"\" + repo.Name;
                            }
                        }
                    }

                    catch (Exception ex)
                    {
                        ManagerData.Stores = null;
                    }
                }
            }
Beispiel #2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="roots">Background worker used to report progress.</param>
        /// <returns></returns>
        public static bool Initialize_Roots(BackgroundWorker roots)
        {
            try
            {
                string dir = Properties.Settings.Default.RepoBaseDir;

                DirectoryInfo temp = new DirectoryInfo(dir);

                foreach (string root in Directory.GetDirectories(dir))
                {
                    DirectoryInfo rootInfo = new DirectoryInfo(root);
                    StoreCell     rootCell = new StoreCell(rootInfo.FullName);

                    ManagerData.Stores.Add(rootInfo.Name, rootCell);
                }

                return(true);
            }

            catch (Exception ex)
            {
                ManagerData.Stores.Clear();
                Exception_Message = ex.Message;
                return(false);
            }
        }
Beispiel #3
0
        /*
         *   ________________________________________________________________________________
         *   # Method:              #
         *   #                                                                              #
         *   # Usage:               #
         *   #                                                                              #
         *   # Parameters:          #
         *   #                                                                              #
         *   # Returns:             #
         *   #                                                                              #
         *   # Last Date Modified:  #
         *   #                                                                              #
         *   # Last Modified By:    #
         *   #                                                                              #
         *   ________________________________________________________________________________
         */

        public static string Stores_To_String()
        {
            string message = string.Empty;

            if (ManagerData.Stores != null)
            {
                foreach (KeyValuePair <string, StoreCell> kvp in ManagerData.Stores)
                {
                    message += kvp.Key + Environment.NewLine + Environment.NewLine;

                    StoreCell Store = kvp.Value;

                    foreach (KeyValuePair <string, RepoCell> repokvp in Store._Repos)
                    {
                        message += repokvp.Key + Environment.NewLine;
                        message += RepoCell.Status.ToString(repokvp.Value.Current_Status) + Environment.NewLine;
                        message += repokvp.Value.Last_Commit.ToString() + Environment.NewLine;
                        message += repokvp.Value.Last_Commit_Message + Environment.NewLine + Environment.NewLine;

                        foreach (KeyValuePair <string, string> notekvp in repokvp.Value.Notes)
                        {
                            message += notekvp.Key + Environment.NewLine;
                            message += notekvp.Value + Environment.NewLine + Environment.NewLine;
                        }

                        message += Environment.NewLine;

                        foreach (KeyValuePair <string, List <EntryCell> > logkvp in repokvp.Value.Logs)
                        {
                            message += logkvp.Key + Environment.NewLine;

                            foreach (EntryCell entry in logkvp.Value)
                            {
                                message += entry.ID + Environment.NewLine;
                                message += entry.Date + Environment.NewLine;
                                message += entry.Author + Environment.NewLine;
                                message += entry.Message + Environment.NewLine + Environment.NewLine;
                            }
                        }

                        message += Environment.NewLine;
                    }

                    message += Environment.NewLine;
                }

                message += Environment.NewLine + Environment.NewLine;

                return(message);
            }

            else
            {
                return(string.Empty);
            }
        }
Beispiel #4
0
 public static bool Append_New_Store(StoreCell newStore)
 {
     // Convert store cell to store node
     // Append store node to the XmlDocument.DocumentElement children
     return(true);
 }
Beispiel #5
0
            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);
                    }
                }
            }
        private void SaveSettingsBT_Click(object sender, EventArgs e)
        {
            bool changed = false;

            SaveMessageLB.Text = string.Empty;

            if (!string.IsNullOrEmpty(CloneDestinationTB.Text) && !string.IsNullOrWhiteSpace(CloneDestinationTB.Text))
            {
                if (CloneDestinationTB.Text != Properties.Settings.Default.CloneLocalSourcePath)
                {
                    Properties.Settings.Default.CloneLocalSourcePath = CloneDestinationTB.Text;
                    changed = true;
                }
            }

            if (Store_List_Changed())
            {
                changed = true;
                MainViewFRM.Settings_Changed = true;

                // Add new items
                foreach (ListViewItem lvi in StoreLocationLV.Items)
                {
                    if (!ManagerData.Stores.Keys.Contains(lvi.Name))
                    {
                        StoreCell temp = null;
                        temp        = new StoreCell(lvi.SubItems[1].Name);
                        temp._Repos = Get_Repos(new DirectoryInfo(lvi.SubItems[1].Name));

                        if (temp != null)
                        {
                            DirectoryInfo tempInfo = new DirectoryInfo(temp._Path);
                            ManagerData.Stores.Add(tempInfo.Name, temp);
                        }
                    }
                }

                List <string> DeletedKeys = new List <string>();

                foreach (string key in ManagerData.Stores.Keys)
                {
                    if (StoreLocationLV.Items.Count > 0)
                    {
                        bool removeKey = true;

                        foreach (ListViewItem lvi in StoreLocationLV.Items)
                        {
                            if (lvi.Name == key)
                            {
                                removeKey = false;
                            }
                        }

                        if (removeKey)
                        {
                            DeletedKeys.Add(key);
                        }
                    }
                }

                if (StoreLocationLV.Items.Count == 0 && ManagerData.Stores.Count != 0)
                {
                    ManagerData.Stores.Clear();
                }

                else
                {
                    foreach (string key in DeletedKeys)
                    {
                        ManagerData.Stores.Remove(key);
                    }
                }
            }

            // Singular Parse
            int selected = 0;

            if (DynamicParseRB.Checked)
            {
                // Dynamic Parse
                selected = 1;
            }

            if (selected != Properties.Settings.Default.LogParseMethod)
            {
                Properties.Settings.Default.LogParseMethod = selected;
                changed = true;
            }

            // Auto Check For Changes
            Int32 changeRate = Convert.ToInt32(AutoChangeRateTB.Text);

            if (Properties.Settings.Default.AutoChangeRate == -1 && changeRate > 0)
            {
                changed = true;
                Properties.Settings.Default.AutoChangeRate = changeRate;
            }

            else if (Properties.Settings.Default.AutoChangeRate != -1 && Properties.Settings.Default.AutoChangeRate != changeRate)
            {
                changed = true;
                Properties.Settings.Default.AutoChangeRate = changeRate;
            }

            else if (changeRate <= 0)
            {
                Properties.Settings.Default.AutoChangeRate = -1;
            }

            if (changed)
            {
                changed = false;

                Configuration.Helpers.Serialize_Condensed_All(Properties.Settings.Default.ConfigPath);
                Properties.Settings.Default.Save();
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.Reload();
                SaveMessageLB.Text = "Settings successfully saved.";
            }
        }