示例#1
0
            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);
            }
示例#2
0
            public static void Serialize_Replace(string destination, Dictionary <string, StoreCell> ToAdd)
            {
                XML.Root tempRoot = new XML.Root();
                tempRoot.Stores = new List <XML.Store>();

                foreach (KeyValuePair <string, StoreCell> Store in ToAdd)
                {
                    XML.Store tempStore = new XML.Store();
                    tempStore.Location    = Store.Value._Path;
                    tempStore.Repos       = new XML.Repos();
                    tempStore.Repos.Items = new List <XML.Repo>();

                    foreach (KeyValuePair <string, RepoCell> Repo in Store.Value._Repos)
                    {
                        XML.Repo tempRepo = new XML.Repo();
                        tempRepo.Name        = Repo.Key;
                        tempRepo.Status      = RepoCell.Status.ToString(Repo.Value.Current_Status);
                        tempRepo.Notes       = new XML.Notes();
                        tempRepo.Notes.Items = new List <XML.Note>();

                        foreach (KeyValuePair <string, string> Note in Repo.Value.Notes)
                        {
                            XML.Note tempNote = new XML.Note();
                            tempNote.Title = Note.Key;
                            tempNote.Body  = Note.Value;

                            tempRepo.Notes.Items.Add(tempNote);
                        }

                        tempStore.Repos.Items.Add(tempRepo);
                    }

                    tempRoot.Stores.Add(tempStore);
                }

                XmlSerializer serializer = new XmlSerializer(typeof(XML.Root));
                StreamWriter  writer     = new StreamWriter(destination);

                serializer.Serialize(writer, tempRoot);
                writer.Close();
            }