public TransitionEvent( EventDescriptor descriptor, params uint[] participants) { this.Descriptor = descriptor; this.Participants = participants; }
private static Guid WINDOWS_SQM_GLOBALSESSION = new Guid("95baba28-ed26-49c9-b74f-93b170e1b849"); // new Guid("{ 0x95baba28, 0xed26, 0x49c9, { 0xb7, 0x4f, 0x93, 0xb1, 0x70, 0xe1, 0xb8, 0x49 }}"); private static void FireWinSQMEvent(EventDescriptor eventDescriptor, Dictionary<int, int> dataToWrite) { Guid empty = Guid.Empty; if (WinSqmEventEnabled(ref eventDescriptor, ref empty)) { IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(WINDOWS_SQM_GLOBALSESSION)); IntPtr ptr2 = Marshal.AllocHGlobal(4); IntPtr ptr3 = Marshal.AllocHGlobal(4); try { Marshal.StructureToPtr(WINDOWS_SQM_GLOBALSESSION, ptr, true); foreach (int num in dataToWrite.Keys) { int structure = dataToWrite[num]; Marshal.StructureToPtr(num, ptr2, true); Marshal.StructureToPtr(structure, ptr3, true); FireWinSQMEvent(eventDescriptor, ptr, ptr2, ptr3); } } finally { Marshal.FreeHGlobal(ptr); Marshal.FreeHGlobal(ptr2); Marshal.FreeHGlobal(ptr3); } } }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, long value1) { byte* numPtr = stackalloc byte[(IntPtr) sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) ((IntPtr) &value1); dataPtr->Size = 8; return base.WriteEvent(ref eventDescriptor, 1, (IntPtr) numPtr); }
private static void FireWinSQMEvent(EventDescriptor eventDescriptor, IntPtr sessionHandle, IntPtr dataPointIDHandle, IntPtr dataValueHandle) { EventDataDescriptor descriptor = new EventDataDescriptor(sessionHandle, Marshal.SizeOf(WINDOWS_SQM_GLOBALSESSION)); EventDataDescriptor descriptor2 = new EventDataDescriptor(dataPointIDHandle, 4); EventDataDescriptor descriptor3 = new EventDataDescriptor(dataValueHandle, 4); EventDataDescriptor[] userData = new EventDataDescriptor[] { descriptor, descriptor2, descriptor3 }; WinSqmEventWrite(ref eventDescriptor, userData.Length, userData); }
/// <summary> /// Returns all populations that are valid for this signature /// </summary> private static IEnumerable<EventPopulation> GetApplicable( EventDescriptor evtDesc, IEnumerable<EventPopulation> candidates, IEnumerable<IHasState> allWorldObjs) { foreach (EventPopulation candidate in candidates) if (evtDesc.CheckRequirements(candidate.AsParams(), allWorldObjs) == true) yield return candidate; }
/// <summary> /// Given an enumeration of objects, assembles them into valid /// participant populations for this event. Requires that the event /// takes only SmartObject participants (or equivalent). /// </summary> public static IEnumerable<EventPopulation> GetValidPopulations( EventDescriptor evtDesc, IEnumerable<IHasState> objsToConsider, IEnumerable<IHasState> allWorldObjs) { BinHolder bins = BinIntoParameterSlots(evtDesc, objsToConsider); return GetApplicable( evtDesc, GetPopulations(evtDesc, bins), allWorldObjs); }
private static void SaveEvent(EventDescriptor eventDescriptor, SQLiteTransaction transaction) { const string commandText = "INSERT INTO Events VALUES(@aggregateId, @eventData, @version)"; using (var sqLiteCommand = new SQLiteCommand(commandText, transaction.Connection, transaction)) { sqLiteCommand.Parameters.Add(new SQLiteParameter("@aggregateId", eventDescriptor.AggregateId)); sqLiteCommand.Parameters.Add(new SQLiteParameter("@eventData", eventDescriptor.EventData)); sqLiteCommand.Parameters.Add(new SQLiteParameter("@version", eventDescriptor.Version)); sqLiteCommand.ExecuteNonQuery(); } }
public void Save(Guid aggregateId, Event @event) { List<EventDescriptor> list; db.TryGetValue(aggregateId, out list); if(list == null) { list = new List<EventDescriptor>(); db.Add(aggregateId, list); } var eventDescriptor = new EventDescriptor(@event.Id, @event, @event.Version); list.Add(eventDescriptor); }
private async void SaveEvent(Event @event, string streamName) { var eventDescriptor = new EventDescriptor(Guid.NewGuid(), @event.GetType().Name, @event); var serializedEvent = JsonConvert.SerializeObject(new EventDescriptor[] { eventDescriptor }); using (var client = new HttpClient()) { client.BaseAddress = new Uri("http://localhost:2113/streams/"); var response = await client.PostAsync(streamName, new StringContent(serializedEvent, Encoding.UTF8, "application/vnd.eventstore.events+json")); _logger.LogInformation(string.Format("Saving event {0} to stream resulted with {1}", eventDescriptor.EventType, response.StatusCode)); } }
public void ConstructorReadOnlyTests() { var descriptors = new EventDescriptor[] { new MockEventDescriptor("descriptor1") }; var collection = new EventDescriptorCollection(descriptors, true); Assert.Equal(descriptors, collection.Cast<EventDescriptor>()); // These methods are implemented as explicit properties so we need to ensure they are what we expect Assert.True(((IList)collection).IsReadOnly); Assert.True(((IList)collection).IsFixedSize); }
/// <summary> /// Takes a list of world SmartObjects and an EventDescriptor and creates /// one bin for each of the event's participant slot containing the /// objects that satisfy that slot's State (not Relation) requirements. /// Makes sure that any index in fixedSlots only considers the accompanied /// SmartObject. Does however not check state for those. /// </summary> private static BinHolder BinIntoParameterSlots( EventDescriptor evtDesc, IEnumerable<IHasState> objs, IDictionary<int, IHasState> fixedSlots = null) { StateName[][] stateReqs = evtDesc.StateRequirements; BinHolder bins = new BinHolder(stateReqs.Length); for (int i = 0; i < stateReqs.Length; i++) { if (fixedSlots != null && fixedSlots.ContainsKey(i) == true) bins.AddBin(new IHasState[] { fixedSlots[i] }); else bins.AddBin(Filter.ByState(objs, stateReqs[i])); } return bins; }
public IEnumerable Explore(WorldState initial, EventDescriptor[] evtDescs) { List<ExplorationNode> stateSpace = new List<ExplorationNode>(); this.status = ExplorationStatus.Exploring; foreach (var step in Step_Exploring(initial, evtDescs, stateSpace)) { exploredNodes = stateSpace.Count; if (exploredNodes > MAX_NODES) break; yield return null; } // TODO: Temporarily disabling expanding.. //this.status = Status.Expanding; //foreach (var step in Step_Expanding(stateSpace)) // yield return null; this.status = ExplorationStatus.PageRank; foreach (var step in Step_PageRanking(stateSpace, 0.85, 200, 5, 0.01)) yield return null; this.status = ExplorationStatus.InversePageRank; foreach (var step in Step_InversePageRanking(stateSpace, 0.85, 200, 5, 0.01)) yield return null; this.status = ExplorationStatus.Path; #if !GPU foreach (var step in Step_Pathing(stateSpace)) yield return null; #else Console.WriteLine("\nProcessing paths on GPU..."); Crunch.GPUGraphUtil.GPUPath(stateSpace); #endif //this.status = ExplorationStatus.MinCut; //foreach (var step in Step_MinCut(stateSpace)) // yield return null; this.status = ExplorationStatus.Done; this.space = new ExplorationSpace(stateSpace); yield break; }
private void SaveEventsInternal(IEnumerable<DomainEvent> events, ITapeStream stream, int version) { var array = events.ToArray(); foreach (var @event in array) { @event.Version = ++version; byte[] bytes; using (var buffer = new MemoryStream()) { var descriptor = new EventDescriptor(@event); serializer.Serialize(descriptor, buffer); bytes = buffer.ToArray(); } stream.TryAppend(bytes, TapeAppendCondition.None); } sender.SendBatch(array); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, string value1, string value2) { bool flag = true; value1 = value1 ?? string.Empty; value2 = value2 ?? string.Empty; fixed (char* str = ((char*) value1)) { char* chPtr = str; fixed (char* str2 = ((char*) value2)) { char* chPtr2 = str2; byte* numPtr = stackalloc byte[(IntPtr) (sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData) * 2)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) chPtr; dataPtr->Size = (uint) ((value1.Length + 1) * 2); dataPtr[1].DataPointer = (ulong) chPtr2; dataPtr[1].Size = (uint) ((value2.Length + 1) * 2); flag = base.WriteEvent(ref eventDescriptor, 2, (IntPtr) numPtr); } } return flag; }
private static void FireWinSQMEvent(EventDescriptor eventDescriptor, int dataPointID, int dataPointValue) { Guid empty = Guid.Empty; if (WinSqmEventEnabled(ref eventDescriptor, ref empty)) { IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf(WINDOWS_SQM_GLOBALSESSION)); IntPtr ptr2 = Marshal.AllocHGlobal(4); IntPtr ptr3 = Marshal.AllocHGlobal(4); try { Marshal.StructureToPtr(WINDOWS_SQM_GLOBALSESSION, ptr, true); Marshal.StructureToPtr(dataPointID, ptr2, true); Marshal.StructureToPtr(dataPointValue, ptr3, true); FireWinSQMEvent(eventDescriptor, ptr, ptr2, ptr3); } finally { Marshal.FreeHGlobal(ptr); Marshal.FreeHGlobal(ptr2); Marshal.FreeHGlobal(ptr3); } } }
public bool Equals(EventDescriptor other) { if ((m_id != other.m_id) || (m_version != other.m_version) || (m_channel != other.m_channel) || (m_level != other.m_level) || (m_opcode != other.m_opcode) || (m_task != other.m_task) || (m_keywords != other.m_keywords)) { return false; } return true; }
internal unsafe bool WriteEventRaw( ref EventDescriptor eventDescriptor, Guid* activityID, Guid* relatedActivityID, int dataCount, IntPtr data) { int status; status = UnsafeNativeMethods.ManifestEtw.EventWriteTransferWrapper( m_regHandle, ref eventDescriptor, activityID, relatedActivityID, dataCount, (EventData*)data); if (status != 0) { SetLastError(status); return false; } return true; }
internal override bool NotifyValueGivenParent(object obj, int type) { if (obj is ICustomTypeDescriptor) { obj = ((ICustomTypeDescriptor)obj).GetPropertyOwner(propertyInfo); } switch (type) { case NOTIFY_RESET: object[] objects = (object[])obj; if (objects != null && objects.Length > 0) { IDesignerHost host = DesignerHost; DesignerTransaction trans = null; if (host != null) { trans = host.CreateTransaction(string.Format(SR.PropertyGridResetValue, PropertyName)); } try { bool needChangeNotify = !(objects[0] is IComponent) || ((IComponent)objects[0]).Site == null; if (needChangeNotify) { if (!OnComponentChanging()) { if (trans != null) { trans.Cancel(); trans = null; } return(false); } } mergedPd.ResetValue(obj); if (needChangeNotify) { OnComponentChanged(); } NotifyParentChange(this); } finally { if (trans != null) { trans.Commit(); } } } return(false); case NOTIFY_DBL_CLICK: case NOTIFY_RETURN: Debug.Assert(propertyInfo is MergePropertyDescriptor, "Did not get a MergePropertyDescriptor!!!"); Debug.Assert(obj is object[], "Did not get an array of objects!!"); if (propertyInfo is MergePropertyDescriptor mpd) { object[] objs = (object[])obj; if (eventBindings == null) { eventBindings = (IEventBindingService)GetService(typeof(IEventBindingService)); } if (eventBindings != null) { EventDescriptor descriptor = eventBindings.GetEvent(mpd[0]); if (descriptor != null) { return(ViewEvent(obj, null, descriptor, true)); } } return(false); } else { return(base.NotifyValueGivenParent(obj, type)); } } return(base.NotifyValueGivenParent(obj, type)); }
protected override string CreateUniqueMethodName(IComponent component, EventDescriptor e) { string componentName = GetComponentName(component); return(GetEventHandlerName(componentName, e.DisplayName)); }
private object SetPropertyValue(object obj, object objVal, bool reset, string undoText) { DesignerTransaction trans = null; try { object oldValue = GetPropertyValueCore(obj); if (objVal != null && objVal.Equals(oldValue)) { return(objVal); } ClearCachedValues(); IDesignerHost host = DesignerHost; if (host != null) { string text = (undoText ?? string.Format(SR.PropertyGridSetValue, propertyInfo.Name)); trans = host.CreateTransaction(text); } // Usually IComponent things are sited and this notification will be // fired automatically by the PropertyDescriptor. However, for non-IComponent sub objects // or sub objects that are non-sited sub components, we need to manuall fire // the notification. // bool needChangeNotify = !(obj is IComponent) || ((IComponent)obj).Site == null; if (needChangeNotify) { try { if (ComponentChangeService != null) { ComponentChangeService.OnComponentChanging(obj, propertyInfo); } } catch (CheckoutException coEx) { if (coEx == CheckoutException.Canceled) { return(oldValue); } throw coEx; } } bool wasExpanded = InternalExpanded; int childCount = -1; if (wasExpanded) { childCount = ChildCount; } RefreshPropertiesAttribute refreshAttr = (RefreshPropertiesAttribute)propertyInfo.Attributes[typeof(RefreshPropertiesAttribute)]; bool needsRefresh = wasExpanded || (refreshAttr != null && !refreshAttr.RefreshProperties.Equals(RefreshProperties.None)); if (needsRefresh) { DisposeChildren(); } // Determine if this is an event being created, and if so, navigate to the event code // EventDescriptor eventDesc = null; // This is possibly an event. Check it out. // if (obj != null && objVal is string) { if (eventBindings == null) { eventBindings = (IEventBindingService)GetService(typeof(IEventBindingService)); } if (eventBindings != null) { eventDesc = eventBindings.GetEvent(propertyInfo); } // For a merged set of propertius, the event binding service won't // find an event. So, we ask type descriptor directly. // if (eventDesc == null) { // If we have a merged property descriptor, pull out one of // the elements. // object eventObj = obj; if (propertyInfo is MergePropertyDescriptor && obj is Array) { Array objArray = obj as Array; if (objArray.Length > 0) { eventObj = objArray.GetValue(0); } } eventDesc = TypeDescriptor.GetEvents(eventObj)[propertyInfo.Name]; } } bool setSuccessful = false; try { if (reset) { propertyInfo.ResetValue(obj); } else if (eventDesc != null) { ViewEvent(obj, (string)objVal, eventDesc, false); } else { // Not an event SetPropertyValueCore(obj, objVal, true); } setSuccessful = true; // Now notify the change service that the change was successful. // if (needChangeNotify && ComponentChangeService != null) { ComponentChangeService.OnComponentChanged(obj, propertyInfo, null, objVal); } NotifyParentChange(this); } finally { // see if we need to refresh the property browser // 1) if this property has the refreshpropertiesattribute, or // 2) it's got expanded sub properties // if (needsRefresh && GridEntryHost != null) { RecreateChildren(childCount); if (setSuccessful) { GridEntryHost.Refresh(refreshAttr != null && refreshAttr.Equals(RefreshPropertiesAttribute.All)); } } } } catch (CheckoutException checkoutEx) { if (trans != null) { trans.Cancel(); trans = null; } if (checkoutEx == CheckoutException.Canceled) { return(null); } throw; } catch { if (trans != null) { trans.Cancel(); trans = null; } throw; } finally { if (trans != null) { trans.Commit(); } } return(obj); }
public MockPropertyDescriptor GetLoadEventPropertyDescriptor() { EventDescriptor loadEventDescriptor = GetLoadEventDescriptor(); return(base.ComponentCreator.GetEventProperty(loadEventDescriptor) as MockPropertyDescriptor); }
protected override ICollection GetCompatibleMethods(EventDescriptor e) { return(new PropertyDescriptorCollection(null)); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, string value1, long value2, string value3, string value4) { bool flag = true; value1 = value1 ?? string.Empty; value3 = value3 ?? string.Empty; value4 = value4 ?? string.Empty; fixed (char* str = ((char*) value1)) { char* chPtr = str; fixed (char* str2 = ((char*) value3)) { char* chPtr2 = str2; fixed (char* str3 = ((char*) value4)) { char* chPtr3 = str3; byte* numPtr = stackalloc byte[(IntPtr) (sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData) * 4)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) chPtr; dataPtr->Size = (uint) ((value1.Length + 1) * 2); dataPtr[1].DataPointer = (ulong) ((IntPtr) &value2); dataPtr[1].Size = 8; dataPtr[2].DataPointer = (ulong) chPtr2; dataPtr[2].Size = (uint) ((value3.Length + 1) * 2); dataPtr[3].DataPointer = (ulong) chPtr3; dataPtr[3].Size = (uint) ((value4.Length + 1) * 2); flag = base.WriteEvent(ref eventDescriptor, 4, (IntPtr) numPtr); } } } str3 = null; return flag; }
public XamlEventPropertyInfo(EventDescriptor eventDescriptor) { this._eventDescriptor = eventDescriptor; }
public EventDescriptorXamlMember(EventDescriptor evt, XamlType declaringType) : base(evt.CheckNotNull("evt"), declaringType) { }
public virtual EventDescriptor GetDefaultEvent() { EventDescriptor ed = TypeDescriptor.GetDefaultEvent(this, true); return(ed); }
public EventDescriptor GetDefaultEvent() { return(defaultEvent ?? (defaultEvent = TypeDescriptor.GetDefaultEvent(ModelType))); }
// sohuld look around in form class for compatiable methodes protected override ICollection GetCompatibleMethods(EventDescriptor e) { return(this.formDesigner.GetCompatibleMethods(e)); }
protected override ICollection GetCompatibleMethods(EventDescriptor e) { return(new ArrayList()); }
protected override string CreateUniqueMethodName(IComponent component, EventDescriptor e) { return(string.Empty); }
internal override bool NotifyValueGivenParent(object obj, int type) { if (obj is ICustomTypeDescriptor) { obj = ((ICustomTypeDescriptor)obj).GetPropertyOwner(propertyInfo); } switch (type) { case NOTIFY_RESET: SetPropertyValue(obj, null, true, string.Format(SR.PropertyGridResetValue, PropertyName)); if (pvUIItems != null) { for (int i = 0; i < pvUIItems.Length; i++) { pvUIItems[i].Reset(); } } pvUIItems = null; return(false); case NOTIFY_CAN_RESET: try { return(propertyInfo.CanResetValue(obj) || (pvUIItems != null && pvUIItems.Length > 0)); } catch { if (exceptionConverter == null) { // clear the flags Flags = 0; exceptionConverter = new ExceptionConverter(); exceptionEditor = new ExceptionEditor(); } return(false); } case NOTIFY_SHOULD_PERSIST: try { return(propertyInfo.ShouldSerializeValue(obj)); } catch { if (exceptionConverter == null) { // clear the flags Flags = 0; exceptionConverter = new ExceptionConverter(); exceptionEditor = new ExceptionEditor(); } return(false); } case NOTIFY_DBL_CLICK: case NOTIFY_RETURN: if (eventBindings == null) { eventBindings = (IEventBindingService)GetService(typeof(IEventBindingService)); } if (eventBindings != null) { EventDescriptor descriptor = eventBindings.GetEvent(propertyInfo); if (descriptor != null) { return(ViewEvent(obj, null, null, true)); } } break; } return(false); }
public MockPropertyDescriptor GetButtonKeyDownEventPropertyDescriptor() { EventDescriptor eventDescriptor = GetButtonKeyDownEventDescriptor(); return(base.ComponentCreator.GetEventProperty(eventDescriptor) as MockPropertyDescriptor); }
protected bool ViewEvent(object obj, string newHandler, EventDescriptor eventdesc, bool alwaysNavigate) { object value = GetPropertyValueCore(obj); string handler = value as string; if (handler == null && value != null && TypeConverter != null && TypeConverter.CanConvertTo(typeof(string))) { handler = TypeConverter.ConvertToString(value); } if (newHandler == null && !string.IsNullOrEmpty(handler)) { newHandler = handler; } else if (handler == newHandler && !string.IsNullOrEmpty(newHandler)) { return(true); } IComponent component = obj as IComponent; if (component == null && propertyInfo is MergePropertyDescriptor) { // It's possible that multiple objects are selected, and we're trying to create an event for each of them // if (obj is Array objArray && objArray.Length > 0) { component = objArray.GetValue(0) as IComponent; } } if (component == null) { return(false); } if (propertyInfo.IsReadOnly) { return(false); } if (eventdesc == null) { if (eventBindings == null) { eventBindings = (IEventBindingService)GetService(typeof(IEventBindingService)); } if (eventBindings != null) { eventdesc = eventBindings.GetEvent(propertyInfo); } } IDesignerHost host = DesignerHost; DesignerTransaction trans = null; try { // This check can cause exceptions if the event has unreferenced dependencies, which we want to cath. // This must be done before the transaction is started or the commit/cancel will also throw. if (eventdesc.EventType == null) { return(false); } if (host != null) { string compName = component.Site != null ? component.Site.Name : component.GetType().Name; trans = DesignerHost.CreateTransaction(string.Format(SR.WindowsFormsSetEvent, compName + "." + PropertyName)); } if (eventBindings == null) { ISite site = component.Site; if (site != null) { eventBindings = (IEventBindingService)site.GetService(typeof(IEventBindingService)); } } if (newHandler == null && eventBindings != null) { newHandler = eventBindings.CreateUniqueMethodName(component, eventdesc); } if (newHandler != null) { // now walk through all the matching methods to see if this one exists. // if it doesn't we'll wanna show code. // if (eventBindings != null) { bool methodExists = false; foreach (string methodName in eventBindings.GetCompatibleMethods(eventdesc)) { if (newHandler == methodName) { methodExists = true; break; } } if (!methodExists) { alwaysNavigate = true; } } try { propertyInfo.SetValue(obj, newHandler); } catch (InvalidOperationException ex) { if (trans != null) { trans.Cancel(); trans = null; } if (GridEntryHost != null && GridEntryHost is PropertyGridView) { PropertyGridView pgv = GridEntryHost as PropertyGridView; pgv.ShowInvalidMessage(newHandler, obj, ex); } return(false); } } if (alwaysNavigate && eventBindings != null) { targetBindingService = eventBindings; targetComponent = component; targetEventdesc = eventdesc; Application.Idle += new EventHandler(PropertyDescriptorGridEntry.ShowCodeIdle); } } catch { if (trans != null) { trans.Cancel(); trans = null; } throw; } finally { if (trans != null) { trans.Commit(); } } return(true); }
EventDescriptor ICustomTypeDescriptor.GetDefaultEvent() { EventDescriptor ed = TypeDescriptor.GetDefaultEvent(this, true); return(ed); }
public ICollection GetCompatibleMethods(EventDescriptor edesc) { throw new NotImplementedException(); }
/// <summary> /// Creates a method signature in the source code file for the default event on the component and navigates the user's cursor to that location in preparation to assign the default action. /// </summary> public virtual void DoDefaultAction() { IEventBindingService eps = (IEventBindingService)GetService(typeof(IEventBindingService)); //If the event binding service is not available, there is nothing much we can do, so just return. if (eps == null) { return; } ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService)); if (selectionService == null) { return; } ICollection components = selectionService.GetSelectedComponents(); EventDescriptor thisDefaultEvent = null; string thisHandler = null; IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); DesignerTransaction t = null; try { foreach (object comp in components) { if (!(comp is IComponent)) { continue; } EventDescriptor defaultEvent = TypeDescriptor.GetDefaultEvent(comp); PropertyDescriptor defaultPropEvent = null; string handler = null; bool eventChanged = false; if (defaultEvent != null) { defaultPropEvent = eps.GetEventProperty(defaultEvent); } // If we couldn't find a property for this event, or of the property is read only, then abort. if (defaultPropEvent == null || defaultPropEvent.IsReadOnly) { continue; } try { if (host != null && t == null) { t = host.CreateTransaction(string.Format(SR.ComponentDesignerAddEvent, defaultEvent.Name)); } } catch (CheckoutException cxe) { if (cxe == CheckoutException.Canceled) { return; } throw cxe; } // handler will be null if there is no explicit event hookup in the parsed init method handler = (string)defaultPropEvent.GetValue(comp); if (handler == null) { eventChanged = true; handler = eps.CreateUniqueMethodName((IComponent)comp, defaultEvent); } else { // ensure the handler is still there eventChanged = true; foreach (string compatibleMethod in eps.GetCompatibleMethods(defaultEvent)) { if (handler == compatibleMethod) { eventChanged = false; break; } } } // Save the new value... BEFORE navigating to it! //s_codemarkers.CodeMarker(CodeMarkerEvent.perfFXBindEventDesignToCode); if (eventChanged && defaultPropEvent != null) { defaultPropEvent.SetValue(comp, handler); } if (_component == comp) { thisDefaultEvent = defaultEvent; thisHandler = handler; } } } catch (InvalidOperationException) { if (t != null) { t.Cancel(); t = null; } } finally { if (t != null) { t.Commit(); } } // Now show the event code. if (thisHandler != null && thisDefaultEvent != null) { eps.ShowCode(_component, thisDefaultEvent); } }
/// <summary> /// Creates a new instance of EtwEventArgs class. /// </summary> /// <param name="descriptor">Event descriptor.</param> /// <param name="success">Indicate whether the event is successfully written.</param> /// <param name="payload">Event payload.</param> public EtwEventArgs(EventDescriptor descriptor, bool success, object[] payload) { this.Descriptor = descriptor; this.Payload = payload; this.Success = success; }
/// <summary> /// WriteEvent method to write parameters with event schema properties /// </summary> /// <param name="EventDescriptor"> /// Event Descriptor for this event. /// </param> public bool WriteEvent(ref EventDescriptor eventDescriptor, params object[] eventPayload) { return WriteTransferEvent(ref eventDescriptor, Guid.Empty, eventPayload); }
public bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, params object[] eventPayload) { uint status = 0; if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords)) { Guid activityId = GetActivityId(); unsafe { int argCount = 0; EventData* userDataPtr = null; if ((eventPayload != null) && (eventPayload.Length != 0)) { argCount = eventPayload.Length; if (argCount > s_etwMaxMumberArguments) { // //too many arguments to log // throw new ArgumentOutOfRangeException("eventPayload", SR.GetString(SR.ArgumentOutOfRange_MaxArgExceeded, s_etwMaxMumberArguments)); } uint totalEventSize = 0; int index; int stringIndex = 0; int[] stringPosition = new int[s_etwAPIMaxStringCount]; //used to keep the position of strings in the eventPayload parameter string[] dataString = new string[s_etwAPIMaxStringCount]; // string arrays from the eventPayload parameter EventData* userData = stackalloc EventData[argCount]; // allocation for the data descriptors userDataPtr = (EventData*)userData; byte* dataBuffer = stackalloc byte[s_basicTypeAllocationBufferSize * argCount]; // 16 byte for unboxing non-string argument byte* currentBuffer = dataBuffer; // // The loop below goes through all the arguments and fills in the data // descriptors. For strings save the location in the dataString array. // Caculates the total size of the event by adding the data descriptor // size value set in EncodeObjec method. // for (index = 0; index < eventPayload.Length; index++) { string isString; isString = EncodeObject(ref eventPayload[index], userDataPtr, currentBuffer); currentBuffer += s_basicTypeAllocationBufferSize; totalEventSize += userDataPtr->Size; userDataPtr++; if (isString != null) { if (stringIndex < s_etwAPIMaxStringCount) { dataString[stringIndex] = isString; stringPosition[stringIndex] = index; stringIndex++; } else { throw new ArgumentOutOfRangeException("eventPayload", SR.GetString(SR.ArgumentOutOfRange_MaxStringsExceeded, s_etwAPIMaxStringCount)); } } } if (totalEventSize > s_traceEventMaximumSize) { t_returnCode = WriteEventErrorCode.EventTooBig; return false; } fixed (char* v0 = dataString[0], v1 = dataString[1], v2 = dataString[2], v3 = dataString[3], v4 = dataString[4], v5 = dataString[5], v6 = dataString[6], v7 = dataString[7]) { userDataPtr = (EventData*)userData; if (dataString[0] != null) { userDataPtr[stringPosition[0]].DataPointer = (ulong)v0; } if (dataString[1] != null) { userDataPtr[stringPosition[1]].DataPointer = (ulong)v1; } if (dataString[2] != null) { userDataPtr[stringPosition[2]].DataPointer = (ulong)v2; } if (dataString[3] != null) { userDataPtr[stringPosition[3]].DataPointer = (ulong)v3; } if (dataString[4] != null) { userDataPtr[stringPosition[4]].DataPointer = (ulong)v4; } if (dataString[5] != null) { userDataPtr[stringPosition[5]].DataPointer = (ulong)v5; } if (dataString[6] != null) { userDataPtr[stringPosition[6]].DataPointer = (ulong)v6; } if (dataString[7] != null) { userDataPtr[stringPosition[7]].DataPointer = (ulong)v7; } } } if (relatedActivityId == Guid.Empty && s_preWin7) { // If relatedActivityId is Guid.Empty, this is not a real transfer: just call EventWrite(). // For pre-Win7 platforms we cannot set the activityId from CorrelationManager // because we cannot set relatedActivityId to null (Win7 bug 116784) status = UnsafeNativeMethods.EventWrite (m_regHandle, ref eventDescriptor, (uint)argCount, userDataPtr); } else { status = UnsafeNativeMethods.EventWriteTransfer (m_regHandle, ref eventDescriptor, (activityId == Guid.Empty) ? null : &activityId, (relatedActivityId == Guid.Empty && !s_preWin7)? null : &relatedActivityId, (uint)argCount, userDataPtr); } } } if (status != 0) { SetLastError((int)status); return false; } return true; }
public PseudoEventLibrary(EventDescriptor[] descs) { this.descLib = new Dictionary<string, EventDescriptor>(); foreach (EventDescriptor desc in descs) this.descLib.Add(desc.Name, desc); }
public EventDescriptorXamlMemberInvoker(EventDescriptorXamlMember xamlMember) : base(xamlMember) { Descriptor = xamlMember.Descriptor; }
protected override bool ShowCode(IComponent component, EventDescriptor e, string methodName) { throw new NotImplementedException(); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, int value1, int value2, int value3) { byte* numPtr = stackalloc byte[(IntPtr) (sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData) * 3)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) ((IntPtr) &value1); dataPtr->Size = 4; dataPtr[1].DataPointer = (ulong) ((IntPtr) &value2); dataPtr[1].Size = 4; dataPtr[2].DataPointer = (ulong) ((IntPtr) &value3); dataPtr[2].Size = 4; return base.WriteEvent(ref eventDescriptor, 3, (IntPtr) numPtr); }
protected internal override bool NotifyValueGivenParent(object @object, Notify type) { if (@object is ICustomTypeDescriptor descriptor) { @object = descriptor.GetPropertyOwner(_propertyInfo); } switch (type) { case Notify.Reset: object[] objects = (object[])@object; if (objects is not null && objects.Length > 0) { IDesignerHost host = DesignerHost; DesignerTransaction transaction = host?.CreateTransaction(string.Format(SR.PropertyGridResetValue, PropertyName)); try { bool needChangeNotify = objects[0] is not IComponent component || component.Site is null; if (needChangeNotify) { if (!OnComponentChanging()) { transaction?.Cancel(); transaction = null; return(false); } } _mergedDescriptor.ResetValue(@object); if (needChangeNotify) { OnComponentChanged(); } NotifyParentChange(this); } finally { transaction?.Commit(); } } return(false); case Notify.DoubleClick: case Notify.Return: Debug.Assert(_propertyInfo is MergePropertyDescriptor, "Did not get a MergePropertyDescriptor!!!"); Debug.Assert(@object is object[], "Did not get an array of objects!!"); if (_propertyInfo is MergePropertyDescriptor mpd) { _eventBindings ??= this.GetService <IEventBindingService>(); if (_eventBindings is not null) { EventDescriptor eventDescriptor = _eventBindings.GetEvent(mpd[0]); if (eventDescriptor is not null) { return(ViewEvent(@object, null, eventDescriptor, true)); } } return(false); } else { return(base.NotifyValueGivenParent(@object, type)); } } return(base.NotifyValueGivenParent(@object, type)); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, string value1, string value2, string value3, string value4, string value5, string value6, string value7) { bool flag = true; value1 = value1 ?? string.Empty; value2 = value2 ?? string.Empty; value3 = value3 ?? string.Empty; value4 = value4 ?? string.Empty; value5 = value5 ?? string.Empty; value6 = value6 ?? string.Empty; value7 = value7 ?? string.Empty; fixed (char* str = ((char*) value1)) { char* chPtr = str; fixed (char* str2 = ((char*) value2)) { char* chPtr2 = str2; fixed (char* str3 = ((char*) value3)) { char* chPtr3 = str3; fixed (char* str4 = ((char*) value4)) { char* chPtr4 = str4; fixed (char* str5 = ((char*) value5)) { char* chPtr5 = str5; fixed (char* str6 = ((char*) value6)) { char* chPtr6 = str6; fixed (char* str7 = ((char*) value7)) { char* chPtr7 = str7; byte* numPtr = stackalloc byte[(IntPtr) (sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData) * 7)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) chPtr; dataPtr->Size = (uint) ((value1.Length + 1) * 2); dataPtr[1].DataPointer = (ulong) chPtr2; dataPtr[1].Size = (uint) ((value2.Length + 1) * 2); dataPtr[2].DataPointer = (ulong) chPtr3; dataPtr[2].Size = (uint) ((value3.Length + 1) * 2); dataPtr[3].DataPointer = (ulong) chPtr4; dataPtr[3].Size = (uint) ((value4.Length + 1) * 2); dataPtr[4].DataPointer = (ulong) chPtr5; dataPtr[4].Size = (uint) ((value5.Length + 1) * 2); dataPtr[5].DataPointer = (ulong) chPtr6; dataPtr[5].Size = (uint) ((value6.Length + 1) * 2); dataPtr[6].DataPointer = (ulong) chPtr7; dataPtr[6].Size = (uint) ((value7.Length + 1) * 2); flag = base.WriteEvent(ref eventDescriptor, 7, (IntPtr) numPtr); } } } } } } } str3 = null; str4 = null; str5 = null; str6 = null; str7 = null; return flag; }
protected override ICollection GetCompatibleMethods(EventDescriptor eventDescriptor) { return(_codeProvider.GetCompatibleMethods(eventDescriptor.EventType.GetMethod("Invoke").GetParameters())); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, Guid value1, long value2, long value3, string value4, string value5, string value6, string value7, string value8, string value9) { bool flag = true; value4 = value4 ?? string.Empty; value5 = value5 ?? string.Empty; value6 = value6 ?? string.Empty; value7 = value7 ?? string.Empty; value8 = value8 ?? string.Empty; value9 = value9 ?? string.Empty; fixed (char* str = ((char*) value4)) { char* chPtr = str; fixed (char* str2 = ((char*) value5)) { char* chPtr2 = str2; fixed (char* str3 = ((char*) value6)) { char* chPtr3 = str3; fixed (char* str4 = ((char*) value7)) { char* chPtr4 = str4; fixed (char* str5 = ((char*) value8)) { char* chPtr5 = str5; fixed (char* str6 = ((char*) value9)) { char* chPtr6 = str6; byte* numPtr = stackalloc byte[(IntPtr) (sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData) * 9)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) ((IntPtr) &value1); dataPtr->Size = (uint) sizeof(Guid); dataPtr[1].DataPointer = (ulong) ((IntPtr) &value2); dataPtr[1].Size = 8; dataPtr[2].DataPointer = (ulong) ((IntPtr) &value3); dataPtr[2].Size = 8; dataPtr[3].DataPointer = (ulong) chPtr; dataPtr[3].Size = (uint) ((value4.Length + 1) * 2); dataPtr[4].DataPointer = (ulong) chPtr2; dataPtr[4].Size = (uint) ((value5.Length + 1) * 2); dataPtr[5].DataPointer = (ulong) chPtr3; dataPtr[5].Size = (uint) ((value6.Length + 1) * 2); dataPtr[6].DataPointer = (ulong) chPtr4; dataPtr[6].Size = (uint) ((value7.Length + 1) * 2); dataPtr[7].DataPointer = (ulong) chPtr5; dataPtr[7].Size = (uint) ((value8.Length + 1) * 2); dataPtr[8].DataPointer = (ulong) chPtr6; dataPtr[8].Size = (uint) ((value9.Length + 1) * 2); flag = base.WriteEvent(ref eventDescriptor, 9, (IntPtr) numPtr); } } } } } } str3 = null; str4 = null; str5 = null; str6 = null; return flag; }
protected override bool ShowCode(IComponent component, EventDescriptor e, string methodName) { return(this.ShowCode(0)); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, string value1, string value2, string value3, string value4, string value5, string value6, string value7, string value8, string value9, string value10, string value11, string value12) { bool flag = true; value1 = value1 ?? string.Empty; value2 = value2 ?? string.Empty; value3 = value3 ?? string.Empty; value4 = value4 ?? string.Empty; value5 = value5 ?? string.Empty; value6 = value6 ?? string.Empty; value7 = value7 ?? string.Empty; value8 = value8 ?? string.Empty; value9 = value9 ?? string.Empty; value10 = value10 ?? string.Empty; value11 = value11 ?? string.Empty; value12 = value12 ?? string.Empty; fixed (char* str = ((char*) value1)) { char* chPtr = str; fixed (char* str2 = ((char*) value2)) { char* chPtr2 = str2; fixed (char* str3 = ((char*) value3)) { char* chPtr3 = str3; fixed (char* str4 = ((char*) value4)) { char* chPtr4 = str4; fixed (char* str5 = ((char*) value5)) { char* chPtr5 = str5; fixed (char* str6 = ((char*) value6)) { char* chPtr6 = str6; fixed (char* str7 = ((char*) value7)) { char* chPtr7 = str7; fixed (char* str8 = ((char*) value8)) { char* chPtr8 = str8; fixed (char* str9 = ((char*) value9)) { char* chPtr9 = str9; fixed (char* str10 = ((char*) value10)) { char* chPtr10 = str10; fixed (char* str11 = ((char*) value11)) { char* chPtr11 = str11; fixed (char* str12 = ((char*) value12)) { char* chPtr12 = str12; byte* numPtr = stackalloc byte[(IntPtr) (sizeof(System.Runtime.Interop.UnsafeNativeMethods.EventData) * 12)]; System.Runtime.Interop.UnsafeNativeMethods.EventData* dataPtr = (System.Runtime.Interop.UnsafeNativeMethods.EventData*) numPtr; dataPtr->DataPointer = (ulong) chPtr; dataPtr->Size = (uint) ((value1.Length + 1) * 2); dataPtr[1].DataPointer = (ulong) chPtr2; dataPtr[1].Size = (uint) ((value2.Length + 1) * 2); dataPtr[2].DataPointer = (ulong) chPtr3; dataPtr[2].Size = (uint) ((value3.Length + 1) * 2); dataPtr[3].DataPointer = (ulong) chPtr4; dataPtr[3].Size = (uint) ((value4.Length + 1) * 2); dataPtr[4].DataPointer = (ulong) chPtr5; dataPtr[4].Size = (uint) ((value5.Length + 1) * 2); dataPtr[5].DataPointer = (ulong) chPtr6; dataPtr[5].Size = (uint) ((value6.Length + 1) * 2); dataPtr[6].DataPointer = (ulong) chPtr7; dataPtr[6].Size = (uint) ((value7.Length + 1) * 2); dataPtr[7].DataPointer = (ulong) chPtr8; dataPtr[7].Size = (uint) ((value8.Length + 1) * 2); dataPtr[8].DataPointer = (ulong) chPtr9; dataPtr[8].Size = (uint) ((value9.Length + 1) * 2); dataPtr[9].DataPointer = (ulong) chPtr10; dataPtr[9].Size = (uint) ((value10.Length + 1) * 2); dataPtr[10].DataPointer = (ulong) chPtr11; dataPtr[10].Size = (uint) ((value11.Length + 1) * 2); dataPtr[11].DataPointer = (ulong) chPtr12; dataPtr[11].Size = (uint) ((value12.Length + 1) * 2); flag = base.WriteEvent(ref eventDescriptor, 12, (IntPtr) numPtr); } } } } } } } } } } } } str3 = null; str4 = null; str5 = null; str6 = null; str7 = null; str8 = null; str9 = null; str10 = null; str11 = null; str12 = null; return flag; }
internal static extern int TdhAggregatePayloadFilters( int PayloadFilterCount, void *PayloadFilterPtrs, ref bool EventMatchAllFlags, ref EventDescriptor EventFilterDescriptor );
public bool WriteEvent(ref EventDescriptor eventDescriptor, string data) { uint status = 0; if (data == null) { throw new ArgumentNullException("dataString"); } if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords)) { if (data.Length > s_traceEventMaximumStringSize) { t_returnCode = WriteEventErrorCode.EventTooBig; return false; } EventData userData; userData.Size = (uint)((data.Length +1)* 2); userData.Reserved = 0; unsafe { fixed (char* pdata = data) { Guid activityId = GetActivityId(); userData.DataPointer = (ulong)pdata; if (s_preWin7) { status = UnsafeNativeMethods.EventWrite(m_regHandle, ref eventDescriptor, 1, &userData); } else { status = UnsafeNativeMethods.EventWriteTransfer(m_regHandle, ref eventDescriptor, (activityId == Guid.Empty) ? null : &activityId, null, 1, &userData); } } } } if (status != 0) { SetLastError((int)status); return false; } return true; }
internal XomlEventConverter(EventDescriptor evt) { this.evt = evt; }
protected bool WriteTransferEvent(ref EventDescriptor eventDescriptor, Guid relatedActivityId, int dataCount, IntPtr data) { uint status = 0; Guid activityId = GetActivityId(); unsafe { status = UnsafeNativeMethods.EventWriteTransfer( m_regHandle, ref eventDescriptor, (activityId == Guid.Empty) ? null : &activityId, &relatedActivityId, (uint)dataCount, (void*)data); } if (status != 0) { SetLastError((int)status); return false; } return true; }
public string CreateUniqueMethodName(IComponent component, EventDescriptor e) { return(e.DisplayName); }
internal unsafe protected bool WriteEvent(ref EventDescriptor eventDescriptor, Guid* activityID, Guid* childActivityID, int dataCount, IntPtr data) { if (childActivityID != null) { // activity transfers are supported only for events that specify the Send or Receive opcode Contract.Assert((EventOpcode)eventDescriptor.Opcode == EventOpcode.Send || (EventOpcode)eventDescriptor.Opcode == EventOpcode.Receive || (EventOpcode)eventDescriptor.Opcode == EventOpcode.Start || (EventOpcode)eventDescriptor.Opcode == EventOpcode.Stop); } int status = UnsafeNativeMethods.ManifestEtw.EventWriteTransferWrapper(m_regHandle, ref eventDescriptor, activityID, childActivityID, dataCount, (EventData*)data); if (status != 0) { SetLastError(status); return false; } return true; }
public ICollection GetCompatibleMethods(EventDescriptor e) { return(new ArrayList()); }
internal unsafe bool WriteEvent(ref EventDescriptor eventDescriptor, Guid* activityID, Guid* childActivityID, params object[] eventPayload) { int status = 0; if (IsEnabled(eventDescriptor.Level, eventDescriptor.Keywords)) { int argCount = 0; unsafe { argCount = eventPayload.Length; if (argCount > s_etwMaxNumberArguments) { s_returnCode = WriteEventErrorCode.TooManyArgs; return false; } uint totalEventSize = 0; int index; int refObjIndex = 0; List<int> refObjPosition = new List<int>(s_etwAPIMaxRefObjCount); List<object> dataRefObj = new List<object>(s_etwAPIMaxRefObjCount); EventData* userData = stackalloc EventData[2 * argCount]; EventData* userDataPtr = (EventData*)userData; byte* dataBuffer = stackalloc byte[s_basicTypeAllocationBufferSize * 2 * argCount]; // Assume 16 chars for non-string argument byte* currentBuffer = dataBuffer; // // The loop below goes through all the arguments and fills in the data // descriptors. For strings save the location in the dataString array. // Calculates the total size of the event by adding the data descriptor // size value set in EncodeObject method. // bool hasNonStringRefArgs = false; for (index = 0; index < eventPayload.Length; index++) { if (eventPayload[index] != null) { object supportedRefObj; supportedRefObj = EncodeObject(ref eventPayload[index], ref userDataPtr, ref currentBuffer, ref totalEventSize); if (supportedRefObj != null) { // EncodeObject advanced userDataPtr to the next empty slot int idx = (int)(userDataPtr - userData - 1); if (!(supportedRefObj is string)) { if (eventPayload.Length + idx + 1 - index > s_etwMaxNumberArguments) { s_returnCode = WriteEventErrorCode.TooManyArgs; return false; } hasNonStringRefArgs = true; } dataRefObj.Add(supportedRefObj); refObjPosition.Add(idx); refObjIndex++; } } else { s_returnCode = WriteEventErrorCode.NullInput; return false; } } // update argCount based on actual number of arguments written to 'userData' argCount = (int)(userDataPtr - userData); if (totalEventSize > s_traceEventMaximumSize) { s_returnCode = WriteEventErrorCode.EventTooBig; return false; } // the optimized path (using "fixed" instead of allocating pinned GCHandles if (!hasNonStringRefArgs && (refObjIndex < s_etwAPIMaxRefObjCount)) { // Fast path: at most 8 string arguments // ensure we have at least s_etwAPIMaxStringCount in dataString, so that // the "fixed" statement below works while (refObjIndex < s_etwAPIMaxRefObjCount) { dataRefObj.Add(null); ++refObjIndex; } // // now fix any string arguments and set the pointer on the data descriptor // fixed (char* v0 = (string)dataRefObj[0], v1 = (string)dataRefObj[1], v2 = (string)dataRefObj[2], v3 = (string)dataRefObj[3], v4 = (string)dataRefObj[4], v5 = (string)dataRefObj[5], v6 = (string)dataRefObj[6], v7 = (string)dataRefObj[7]) { userDataPtr = (EventData*)userData; if (dataRefObj[0] != null) { userDataPtr[refObjPosition[0]].Ptr = (ulong)v0; } if (dataRefObj[1] != null) { userDataPtr[refObjPosition[1]].Ptr = (ulong)v1; } if (dataRefObj[2] != null) { userDataPtr[refObjPosition[2]].Ptr = (ulong)v2; } if (dataRefObj[3] != null) { userDataPtr[refObjPosition[3]].Ptr = (ulong)v3; } if (dataRefObj[4] != null) { userDataPtr[refObjPosition[4]].Ptr = (ulong)v4; } if (dataRefObj[5] != null) { userDataPtr[refObjPosition[5]].Ptr = (ulong)v5; } if (dataRefObj[6] != null) { userDataPtr[refObjPosition[6]].Ptr = (ulong)v6; } if (dataRefObj[7] != null) { userDataPtr[refObjPosition[7]].Ptr = (ulong)v7; } status = UnsafeNativeMethods.ManifestEtw.EventWriteTransferWrapper(m_regHandle, ref eventDescriptor, activityID, childActivityID, argCount, userData); } } else { // Slow path: use pinned handles userDataPtr = (EventData*)userData; GCHandle[] rgGCHandle = new GCHandle[refObjIndex]; for (int i = 0; i < refObjIndex; ++i) { // below we still use "fixed" to avoid taking dependency on the offset of the first field // in the object (the way we would need to if we used GCHandle.AddrOfPinnedObject) rgGCHandle[i] = GCHandle.Alloc(dataRefObj[i], GCHandleType.Pinned); if (dataRefObj[i] is string) { fixed (char* p = (string)dataRefObj[i]) userDataPtr[refObjPosition[i]].Ptr = (ulong)p; } else { fixed (byte* p = (byte[])dataRefObj[i]) userDataPtr[refObjPosition[i]].Ptr = (ulong)p; } } status = UnsafeNativeMethods.ManifestEtw.EventWriteTransferWrapper(m_regHandle, ref eventDescriptor, activityID, childActivityID, argCount, userData); for (int i = 0; i < refObjIndex; ++i) { rgGCHandle[i].Free(); } } } } if (status != 0) { SetLastError((int)status); return false; } return true; }
public PropertyDescriptor GetEventProperty(EventDescriptor e) { return(new EventPropertyDescriptor(e, this, this.serviceProvider)); }
public static void UpdateEventDefinitions(EventDescriptor[] eventDescriptors) { FxTrace.eventDescriptors = eventDescriptors; UpdateEnabledEventsList(); }
public bool ShowCode(IComponent component, EventDescriptor e) { return(false); }