public void Add(Descriptor descriptor) { // Forward descriptor.CreateDescriptor(this); }
private void LoadEventData( out string name, out string description, Descriptor[] descriptors ) { // Descriptors we can have ShortEvent shortEvent = null; // Extended events List<ExtendedEvent> exEvents = new List<ExtendedEvent>(); // Check all descriptors foreach (Descriptor descr in descriptors) if (descr.IsValid) { // Check type if (null == shortEvent) { // Read shortEvent = descr as ShortEvent; // Done for now if (null != shortEvent) continue; } // Test ExtendedEvent exEvent = descr as ExtendedEvent; // Register if (null != exEvent) exEvents.Add( exEvent ); } // Reset all description = null; name = null; // Take the best we got if (exEvents.Count > 0) { // Text builder StringBuilder text = new StringBuilder(); // Process all foreach (ExtendedEvent exEvent in exEvents) { // Normal if (null == name) name = exEvent.Name; // Merge if (exEvent.Text != null) text.Append( exEvent.Text ); } // Use description = text.ToString(); } // Try short event if (null != shortEvent) { // Read if (null == name) name = shortEvent.Name; if (null == description) description = shortEvent.Text; // Check for additional information if (string.IsNullOrEmpty( name )) name = shortEvent.Text; else if (!string.IsNullOrEmpty( shortEvent.Text )) name += string.Format( " ({0})", shortEvent.Text ); } }