Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventOpcode.cs / 1305376 / EventOpcode.cs
// ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventOpcode ** ** Purpose: ** This public class describes the metadata for a specific Opcode ** defined by a Provider. An instance of this class is obtained from ** a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.Eventing.Reader { [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Opcode", Justification = "[....]: Shipped public in 3.5, breaking change to fix now.")] public sealed class EventOpcode { private int value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //call from EventMetadata internal EventOpcode(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //call from ProviderMetadata internal EventOpcode(string name, int value, string displayName) { this.value = value; this.name = name; this.displayName = displayName; this.dataReady = true; this.syncObject = new object(); } internal void PrepareData() { lock (syncObject) { if (dataReady == true) return; // get the data IEnumerableresult = pmReference.Opcodes; //set the names and display names to null this.name = null; this.displayName = null; this.dataReady = true; foreach (EventOpcode op in result) { if (op.Value == this.value) { this.name = op.Name; this.displayName = op.DisplayName; this.dataReady = true; break; } } } }//End Prepare Data public string Name { get { PrepareData(); return this.name; } } public int Value { get { return this.value; } } public string DisplayName { get { PrepareData(); return this.displayName; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // ==++== // // Copyright (c) Microsoft Corporation. All rights reserved. // // ==--== /*============================================================ ** ** Class: EventOpcode ** ** Purpose: ** This public class describes the metadata for a specific Opcode ** defined by a Provider. An instance of this class is obtained from ** a ProviderMetadata object. ** ============================================================*/ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; namespace System.Diagnostics.Eventing.Reader { [System.Security.Permissions.HostProtection(MayLeakOnAbort = true)] [SuppressMessage("Microsoft.Naming", "CA1702:CompoundWordsShouldBeCasedCorrectly", MessageId = "Opcode", Justification = "[....]: Shipped public in 3.5, breaking change to fix now.")] public sealed class EventOpcode { private int value; private string name; private string displayName; private bool dataReady; ProviderMetadata pmReference; object syncObject; //call from EventMetadata internal EventOpcode(int value, ProviderMetadata pmReference) { this.value = value; this.pmReference = pmReference; this.syncObject = new object(); } //call from ProviderMetadata internal EventOpcode(string name, int value, string displayName) { this.value = value; this.name = name; this.displayName = displayName; this.dataReady = true; this.syncObject = new object(); } internal void PrepareData() { lock (syncObject) { if (dataReady == true) return; // get the data IEnumerable result = pmReference.Opcodes; //set the names and display names to null this.name = null; this.displayName = null; this.dataReady = true; foreach (EventOpcode op in result) { if (op.Value == this.value) { this.name = op.Name; this.displayName = op.DisplayName; this.dataReady = true; break; } } } }//End Prepare Data public string Name { get { PrepareData(); return this.name; } } public int Value { get { return this.value; } } public string DisplayName { get { PrepareData(); return this.displayName; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- CalendarDataBindingHandler.cs
- NavigationWindowAutomationPeer.cs
- EventLogException.cs
- FileDialogPermission.cs
- WeakReadOnlyCollection.cs
- ProjectedSlot.cs
- SrgsSemanticInterpretationTag.cs
- TextCompositionManager.cs
- ReplacementText.cs
- GenericEnumerator.cs
- WindowShowOrOpenTracker.cs
- rsa.cs
- MenuItem.cs
- Floater.cs
- Literal.cs
- SafePEFileHandle.cs
- _LocalDataStore.cs
- DirectoryInfo.cs
- XamlClipboardData.cs
- TextAdaptor.cs
- DeploymentSection.cs
- IndentTextWriter.cs
- SslStream.cs
- CompositeActivityCodeGenerator.cs
- XPathNavigator.cs
- TrackingMemoryStream.cs
- GroupAggregateExpr.cs
- EmptyWorkItem.cs
- InProcStateClientManager.cs
- SeekableReadStream.cs
- StorageEntityTypeMapping.cs
- List.cs
- KerberosTicketHashIdentifierClause.cs
- securestring.cs
- UnsafeNativeMethods.cs
- RadialGradientBrush.cs
- ProcessHost.cs
- DoubleAverageAggregationOperator.cs
- TlsnegoTokenAuthenticator.cs
- ExceptionRoutedEventArgs.cs
- SecurityElement.cs
- DataExpression.cs
- DynamicILGenerator.cs
- ReversePositionQuery.cs
- TrimSurroundingWhitespaceAttribute.cs
- FieldToken.cs
- DataList.cs
- UnsafeNativeMethods.cs
- RectangleGeometry.cs
- BrushConverter.cs
- CompModHelpers.cs
- XmlObjectSerializerContext.cs
- ColorContext.cs
- OdbcFactory.cs
- GatewayIPAddressInformationCollection.cs
- OneWayBindingElementImporter.cs
- MachineKeyValidationConverter.cs
- cryptoapiTransform.cs
- RelatedView.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- OrthographicCamera.cs
- ImageCollectionCodeDomSerializer.cs
- Vector3DAnimation.cs
- EntityRecordInfo.cs
- FontUnitConverter.cs
- UIInitializationException.cs
- HasCopySemanticsAttribute.cs
- CodeIdentifiers.cs
- RightNameExpirationInfoPair.cs
- BinaryFormatter.cs
- followingsibling.cs
- XPathNavigatorKeyComparer.cs
- PointLight.cs
- RijndaelManaged.cs
- ThreadStaticAttribute.cs
- DateTimeFormatInfoScanner.cs
- TextRangeEditLists.cs
- HttpCacheVary.cs
- DataBoundControlAdapter.cs
- Walker.cs
- hresults.cs
- PropertySet.cs
- SettingsPropertyValue.cs
- AttachInfo.cs
- CompilerInfo.cs
- PersonalizablePropertyEntry.cs
- AsymmetricSignatureFormatter.cs
- WebServiceFaultDesigner.cs
- TraceHandler.cs
- HttpAsyncResult.cs
- RSAPKCS1SignatureDeformatter.cs
- DiscoveryRequestHandler.cs
- TextTreeRootTextBlock.cs
- EditBehavior.cs
- TrustManagerMoreInformation.cs
- ObjectMemberMapping.cs
- RoutedEventHandlerInfo.cs
- DrawItemEvent.cs
- UnionCodeGroup.cs
- Page.cs