Exemple #1
0
 void ILogSource.StoreBookmarks()
 {
     if (loadingLogSourceInfoFromStorageEntry)
     {
         return;
     }
     using (var section = logSourceSpecificStorageEntry.OpenXMLSection("bookmarks", Persistence.StorageSectionOpenFlag.ReadWrite | Persistence.StorageSectionOpenFlag.ClearOnOpen))
     {
         section.Data.Add(
             new XElement("bookmarks",
                          bookmarks.Items.Where(b => b.Thread != null && b.Thread.LogSource == this).Select(b =>
         {
             var attrs = new List <XAttribute>()
             {
                 new XAttribute("time", b.Time),
                 new XAttribute("position", b.Position.ToString()),
                 new XAttribute("thread-id", b.Thread.ID),
                 new XAttribute("display-name", XmlUtils.RemoveInvalidXMLChars(b.DisplayName)),
                 new XAttribute("line-index", b.LineIndex),
             };
             return(new XElement("bookmark", attrs));
         }).ToArray()
                          ));
     }
 }
        private static HashSet <string> LoadTags(Persistence.IStorageEntry entry, string sectionName)
        {
            HashSet <string> loadedTags = null;

            using (var section = entry.OpenXMLSection(sectionName, Persistence.StorageSectionOpenFlag.ReadOnly))
            {
                var tagsElt = section.Data.SafeElement(Constants.StateRootEltName).SafeElement(Constants.TagsEltName);
                if (tagsElt != null)
                {
                    loadedTags = new HashSet <string>();
                    foreach (var tagElt in tagsElt.SafeElements(Constants.TagEltName))
                    {
                        if (!string.IsNullOrEmpty(tagElt.Value))
                        {
                            loadedTags.Add(tagElt.Value);
                        }
                    }
                }
            }
            return(loadedTags);
        }