示例#1
0
 private void AddFactory(ILogProvider provider)
 {
     AddOrReplaceEntry(
         RecentFactoriesSectionName,
         new XElement(EntryNodeName, RecentLogEntry.FactoryPartToString(provider.Factory)),
         (e1, e2) => e1.SafeValue() == e2.SafeValue(),
         DefaultRecentFactoriesListSizeLimit,
         updateExisting: false
         );
 }
示例#2
0
 IEnumerable <ILogProviderFactory> GetRecentFactories()
 {
     using (var sect = settingsEntry.OpenXMLSection(RecentFactoriesSectionName, Persistence.StorageSectionOpenFlag.ReadOnly))
     {
         return
             (from e in sect.Data.SafeElement(RootNodeName).SafeElements(EntryNodeName)
              let f = RecentLogEntry.ParseFactoryPart(logProviderFactoryRegistry, e.Value)
                      where f != null
                      select f);
     }
 }
示例#3
0
 IEnumerable <IRecentlyUsedEntity> IRecentlyUsedEntities.GetMRUList()
 {
     using (var sect = settingsEntry.OpenXMLSection(RecentLogsSectionName, Persistence.StorageSectionOpenFlag.ReadOnly))
     {
         foreach (var e in sect.Data.SafeElement(RootNodeName).SafeElements(EntryNodeName))
         {
             if (e.AttributeValue(TypeAttrName) == WorkspaceTypeAttrValue)
             {
                 yield return(new RecentWorkspaceEntry(
                                  e.Value,
                                  e.AttributeValue(NameAttrName),
                                  e.AttributeValue(AnnotationAttrName),
                                  e.DateTimeValue(DateAttrName)
                                  ));
             }
             else
             {
                 RecentLogEntry entry;
                 try
                 {
                     entry = new RecentLogEntry(logProviderFactoryRegistry,
                                                e.Value, e.AttributeValue(AnnotationAttrName), e.DateTimeValue(DateAttrName));
                 }
                 catch (RecentLogEntry.FormatNotRegistedException)
                 {
                     continue;
                 }
                 catch (InvalidConnectionParamsException)
                 {
                     continue;
                 }
                 catch (RecentLogEntry.SerializationException ex)
                 {
                     telemetry.ReportException(ex, "broken MRU entry");
                     continue;
                 }
                 yield return(entry);
             }
         }
     }
 }