void LoadBookmarks() { using (new ScopedGuard(() => loadingLogSourceInfoFromStorageEntry = true, () => loadingLogSourceInfoFromStorageEntry = false)) using (var section = logSourceSpecificStorageEntry.OpenXMLSection("bookmarks", Persistence.StorageSectionOpenFlag.ReadOnly)) { var root = section.Data.Element("bookmarks"); if (root == null) { return; } foreach (var elt in root.Elements("bookmark")) { var time = elt.Attribute("time"); var thread = elt.Attribute("thread-id"); var name = elt.Attribute("display-name"); var position = elt.Attribute("position"); var lineIndex = elt.Attribute("line-index"); if (time != null && thread != null && name != null && position != null) { bookmarks.ToggleBookmark(bookmarks.Factory.CreateBookmark( MessageTimestamp.ParseFromLoselessFormat(time.Value), logSourceThreads.GetThread(new StringSlice(thread.Value)), name.Value, long.Parse(position.Value), (lineIndex != null) ? int.Parse(lineIndex.Value) : 0 )); } } } }
/// <summary> /// Loads a range of messages from Logs Table. The range is specified by two partition keys. /// </summary> /// <param name="wadTable">Table to load messages from</param> /// <param name="threads">Threads container that will store loaded threads</param> /// <param name="beginPartitionKey">Begin of the range. Messages with PartitionKey GREATER THAN or EQUAL to <paramref name="beginPartitionKey"/> are included to the range</param> /// <param name="endPartitionKey">End of the range. Messages with PartitionKey LESS THAN <paramref name="endPartitionKey"/> are included to the range</param> /// <param name="entriesLimit">If specified limits the number of items to return</param> /// <returns>Sequence of messages sorted by EventTickCount</returns> public static IEnumerable <IMessage> LoadWADLogsTableMessagesRange( IAzureDiagnosticLogsTable wadTable, ILogSourceThreadsInternal threads, EntryPartition beginPartition, EntryPartition endPartition, int?entriesLimit) { foreach (var entryAndIndex in LoadEntriesRange(wadTable, beginPartition, endPartition, entriesLimit, CancellationToken.None)) { var entry = entryAndIndex.Entry as WADLogsTableEntry; if (entry == null) { continue; } yield return(new Message( new EntryPartition(entry.EventTickCount).MakeMessagePosition(entryAndIndex.IndexWithinPartition), new EntryPartition(entry.EventTickCount).MakeMessagePosition(entryAndIndex.IndexWithinPartition + 1), threads.GetThread(new StringSlice(string.Format("{0}-{1}", entry.Pid, entry.Tid))), new MessageTimestamp(new DateTime(entry.EventTickCount, DateTimeKind.Utc)), new StringSlice(entry.Message), SeverityFlag.Info )); } }
public IThread GetThread(StringSlice id) { return(fakeThread ?? threads.GetThread(id)); }