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
- SignatureToken.cs
- TextServicesCompartmentContext.cs
- DataControlPagerLinkButton.cs
- SqlCacheDependency.cs
- SqlErrorCollection.cs
- TypeHelpers.cs
- sqlinternaltransaction.cs
- SingleQueryOperator.cs
- CodeSnippetExpression.cs
- EventSourceCreationData.cs
- DataViewManager.cs
- XmlAtomicValue.cs
- BinaryNode.cs
- ConfigurationSectionGroupCollection.cs
- _FtpDataStream.cs
- DeploymentSection.cs
- TickBar.cs
- ToolStripPanelRow.cs
- RemotingException.cs
- _SslStream.cs
- ZipIOCentralDirectoryFileHeader.cs
- WmpBitmapEncoder.cs
- XmlCountingReader.cs
- FileDialogCustomPlace.cs
- SuppressMergeCheckAttribute.cs
- TableRowCollection.cs
- UnsafeNativeMethods.cs
- AutomationElement.cs
- DecimalAnimationBase.cs
- NavigationWindowAutomationPeer.cs
- AssemblyAttributes.cs
- InfoCardAsymmetricCrypto.cs
- RemoteTokenFactory.cs
- CodeMethodInvokeExpression.cs
- Canvas.cs
- UrlMappingsSection.cs
- TextEncodedRawTextWriter.cs
- DesignerProperties.cs
- CollectionsUtil.cs
- AvTraceFormat.cs
- HostProtectionException.cs
- XmlParser.cs
- Lookup.cs
- OleDbTransaction.cs
- PropertyRef.cs
- SoapSchemaExporter.cs
- ISFClipboardData.cs
- MissingMemberException.cs
- CorrelationTokenInvalidatedHandler.cs
- HandlerElement.cs
- OutputCacheSettingsSection.cs
- KeyValuePair.cs
- Stopwatch.cs
- UndoEngine.cs
- WebPartDeleteVerb.cs
- regiisutil.cs
- DataGridViewCellParsingEventArgs.cs
- BitmapFrameDecode.cs
- panel.cs
- CutCopyPasteHelper.cs
- WinInet.cs
- HttpCachePolicyWrapper.cs
- TextRunTypographyProperties.cs
- SystemEvents.cs
- UnsafeNativeMethods.cs
- InstanceDescriptor.cs
- Form.cs
- ProviderCommandInfoUtils.cs
- Pen.cs
- FacetChecker.cs
- WebSysDefaultValueAttribute.cs
- X509SecurityTokenProvider.cs
- VBCodeProvider.cs
- EventHandlers.cs
- TableDetailsCollection.cs
- UserControl.cs
- IImplicitResourceProvider.cs
- CultureInfoConverter.cs
- ButtonAutomationPeer.cs
- ValidationHelper.cs
- CqlIdentifiers.cs
- LineGeometry.cs
- ButtonColumn.cs
- CopyOfAction.cs
- ServiceHostFactory.cs
- TriggerAction.cs
- EnumConverter.cs
- ToolBarDesigner.cs
- shaperfactory.cs
- InputQueue.cs
- IdentityReference.cs
- CipherData.cs
- ConnectionProviderAttribute.cs
- MILUtilities.cs
- WorkflowApplicationEventArgs.cs
- ScrollBarRenderer.cs
- WebResponse.cs
- FrugalMap.cs
- TableLayout.cs
- MimePart.cs