public RelatedTypesFilter(PublisherTypeDefinition types) { InitializeComponent(); listBox1.Items.Add(types.TypeName); listBox1.Items.AddRange(types.RelatedTypes.Cast <object>().ToArray()); listBox1.Sorted = true; }
public RelatedTypesFilter(PublisherTypeDefinition types) { InitializeComponent(); listBox1.Items.Add(types.TypeName); listBox1.Items.AddRange(types.RelatedTypes.Cast<object>().ToArray()); listBox1.Sorted = true; }
public LogPublisherInternal(LoggerInternal logger, Type type) { if ((object)type == null) throw new ArgumentNullException(nameof(type)); if (type == null) throw new ArgumentNullException(nameof(type)); if (logger == null) throw new ArgumentNullException(nameof(logger)); Type = type; Assembly = type.Assembly; TypeData = new PublisherTypeDefinition(type); m_logger = logger; SubscriptionFilterCollection = new MessageAttributeFilterCollection(); }
public PublisherTypeDefinition LoadPublisherTypeDefinition(Stream stream) { byte version = stream.ReadNextByte(); switch (version) { case 0: return new PublisherTypeDefinition(stream); case 1: { if (m_isSimple) throw new Exception("Cannot load without a LogMessageSaveHelper"); int id = stream.ReadInt32(); return m_publisherTypeDefinitionLoadLookup[id]; } case 2: { if (m_isSimple) throw new Exception("Cannot load without a LogMessageSaveHelper"); int id = stream.ReadInt32(); var details = new PublisherTypeDefinition(stream); m_publisherTypeDefinitionLoadLookup.Add(details); return details; } case 3: { if (m_isSimple) throw new Exception("Cannot load without a LogMessageSaveHelper"); var details = new PublisherTypeDefinition(stream); m_publisherTypeDefinitionLoadLookup.Add(details); return details; } default: throw new VersionNotFoundException(); } }
public void SavePublisherTypeDefinition(Stream stream, PublisherTypeDefinition publisherDetails) { if (publisherDetails == null) throw new ArgumentNullException(nameof(publisherDetails)); if (m_isSimple) { stream.Write((byte)0); publisherDetails.Save(stream); } else { int lookupId; if (m_publisherTypeDefinitionSaveLookup.TryGetValue(publisherDetails, out lookupId)) { stream.Write((byte)1); stream.Write(lookupId); } else { lookupId = m_publisherTypeDefinitionSaveLookup.Count; stream.Write((byte)3); publisherDetails.Save(stream); m_publisherTypeDefinitionSaveLookup.Add(publisherDetails, lookupId); } } }