Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Diagnostics / Eventing / EventDescriptor.cs / 1305376 / EventDescriptor.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics.Eventing
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
[System.Runtime.CompilerServices.FriendAccessAllowed]
internal struct EventDescriptorInternal
{
# region private
[FieldOffset(0)]
private ushort m_id;
[FieldOffset(2)]
private byte m_version;
[FieldOffset(3)]
private byte m_channel;
[FieldOffset(4)]
private byte m_level;
[FieldOffset(5)]
private byte m_opcode;
[FieldOffset(6)]
private ushort m_task;
[FieldOffset(8)]
private long m_keywords;
#endregion
public EventDescriptorInternal(
int id,
byte version,
byte channel,
byte level,
byte opcode,
int task,
long keywords
)
{
if (id < 0)
{
throw new ArgumentOutOfRangeException("id", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedNonNegNum));
}
if (id > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException("id", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedValidId, 1, ushort.MaxValue));
}
m_id = (ushort)id;
m_version = version;
m_channel = channel;
m_level = level;
m_opcode = opcode;
m_keywords = keywords;
if (task < 0)
{
throw new ArgumentOutOfRangeException("task", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedNonNegNum));
}
if (task > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException("task", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedValidId, 1, ushort.MaxValue));
}
m_task = (ushort)task;
}
public int EventId {
get {
return m_id;
}
}
public byte Version
{
get
{
return m_version;
}
}
public byte Channel
{
get
{
return m_channel;
}
}
public byte Level
{
get
{
return m_level;
}
}
public byte Opcode
{
get
{
return m_opcode;
}
}
public int Task
{
get
{
return m_task;
}
}
public long Keywords
{
get
{
return m_keywords;
}
}
public override bool Equals(object obj)
{
if (!(obj is EventDescriptorInternal))
return false;
return Equals((EventDescriptorInternal) obj);
}
public override int GetHashCode()
{
return m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^ (int)m_keywords;
}
public bool Equals(EventDescriptorInternal 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;
}
public static bool operator ==(EventDescriptorInternal event1, EventDescriptorInternal event2)
{
return event1.Equals(event2);
}
public static bool operator !=(EventDescriptorInternal event1, EventDescriptorInternal event2)
{
return !event1.Equals(event2);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// [....]
//-----------------------------------------------------------------------------
using System;
using System.Runtime.InteropServices;
namespace System.Diagnostics.Eventing
{
[StructLayout(LayoutKind.Explicit, Size = 16)]
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
[System.Runtime.CompilerServices.FriendAccessAllowed]
internal struct EventDescriptorInternal
{
# region private
[FieldOffset(0)]
private ushort m_id;
[FieldOffset(2)]
private byte m_version;
[FieldOffset(3)]
private byte m_channel;
[FieldOffset(4)]
private byte m_level;
[FieldOffset(5)]
private byte m_opcode;
[FieldOffset(6)]
private ushort m_task;
[FieldOffset(8)]
private long m_keywords;
#endregion
public EventDescriptorInternal(
int id,
byte version,
byte channel,
byte level,
byte opcode,
int task,
long keywords
)
{
if (id < 0)
{
throw new ArgumentOutOfRangeException("id", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedNonNegNum));
}
if (id > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException("id", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedValidId, 1, ushort.MaxValue));
}
m_id = (ushort)id;
m_version = version;
m_channel = channel;
m_level = level;
m_opcode = opcode;
m_keywords = keywords;
if (task < 0)
{
throw new ArgumentOutOfRangeException("task", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedNonNegNum));
}
if (task > ushort.MaxValue)
{
throw new ArgumentOutOfRangeException("task", SRETW.GetString(SRETW.ArgumentOutOfRange_NeedValidId, 1, ushort.MaxValue));
}
m_task = (ushort)task;
}
public int EventId {
get {
return m_id;
}
}
public byte Version
{
get
{
return m_version;
}
}
public byte Channel
{
get
{
return m_channel;
}
}
public byte Level
{
get
{
return m_level;
}
}
public byte Opcode
{
get
{
return m_opcode;
}
}
public int Task
{
get
{
return m_task;
}
}
public long Keywords
{
get
{
return m_keywords;
}
}
public override bool Equals(object obj)
{
if (!(obj is EventDescriptorInternal))
return false;
return Equals((EventDescriptorInternal) obj);
}
public override int GetHashCode()
{
return m_id ^ m_version ^ m_channel ^ m_level ^ m_opcode ^ m_task ^ (int)m_keywords;
}
public bool Equals(EventDescriptorInternal 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;
}
public static bool operator ==(EventDescriptorInternal event1, EventDescriptorInternal event2)
{
return event1.Equals(event2);
}
public static bool operator !=(EventDescriptorInternal event1, EventDescriptorInternal event2)
{
return !event1.Equals(event2);
}
}
}
// 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
- HwndMouseInputProvider.cs
- CompilerWrapper.cs
- XmlAnyElementAttribute.cs
- TextHidden.cs
- MergeLocalizationDirectives.cs
- DataKeyPropertyAttribute.cs
- SemaphoreSlim.cs
- WebBrowserProgressChangedEventHandler.cs
- AsnEncodedData.cs
- XsdDateTime.cs
- DependencyPropertyChangedEventArgs.cs
- DBConnection.cs
- OpenTypeLayoutCache.cs
- CheckBoxList.cs
- IsolatedStorageFileStream.cs
- TreeViewBindingsEditorForm.cs
- ContextActivityUtils.cs
- ToolStripContentPanelRenderEventArgs.cs
- FontSource.cs
- SecurityElement.cs
- InputMethodStateChangeEventArgs.cs
- TextRangeEditTables.cs
- XmlSchemaSimpleContent.cs
- HostAdapter.cs
- NativeRightsManagementAPIsStructures.cs
- DataGridState.cs
- Int32CollectionConverter.cs
- DataGridViewCellStyle.cs
- QueryResponse.cs
- CompositeFontInfo.cs
- GatewayDefinition.cs
- CreateUserWizard.cs
- ClientSession.cs
- WinEventQueueItem.cs
- StringConcat.cs
- CTreeGenerator.cs
- UIPropertyMetadata.cs
- SupportingTokenChannel.cs
- WebPartsPersonalizationAuthorization.cs
- C14NUtil.cs
- ArcSegment.cs
- XamlTypeMapper.cs
- ExpressionReplacer.cs
- ItemMap.cs
- ColumnWidthChangingEvent.cs
- XPathDescendantIterator.cs
- WebPartDisplayModeCancelEventArgs.cs
- PersonalizationStateInfoCollection.cs
- FastPropertyAccessor.cs
- StyleHelper.cs
- ColumnResizeAdorner.cs
- CellConstant.cs
- KnownTypesProvider.cs
- Image.cs
- IgnoreDeviceFilterElement.cs
- XmlValueConverter.cs
- LoadRetryStrategyFactory.cs
- XmlSchemaAppInfo.cs
- CatalogUtil.cs
- WebSysDefaultValueAttribute.cs
- _ShellExpression.cs
- HashMembershipCondition.cs
- WrappedKeySecurityToken.cs
- MeasurementDCInfo.cs
- ListControl.cs
- HandlerFactoryWrapper.cs
- TagMapInfo.cs
- XmlElementAttributes.cs
- FlowNode.cs
- errorpatternmatcher.cs
- UrlMappingsModule.cs
- hwndwrapper.cs
- Site.cs
- BindingCompleteEventArgs.cs
- RoleService.cs
- CryptoConfig.cs
- ActivityExecutionContextCollection.cs
- RelOps.cs
- Icon.cs
- BitmapEffectGroup.cs
- WebRequest.cs
- RoleGroupCollection.cs
- TabControl.cs
- brushes.cs
- WebBrowserNavigatingEventHandler.cs
- MobileContainerDesigner.cs
- RadioButtonFlatAdapter.cs
- EventListener.cs
- HtmlEncodedRawTextWriter.cs
- PersonalizableTypeEntry.cs
- WebService.cs
- FileSystemInfo.cs
- AuthorizationPolicyTypeElement.cs
- PropertySourceInfo.cs
- CapabilitiesSection.cs
- XomlDesignerLoader.cs
- ContourSegment.cs
- TextParagraphView.cs
- AppliedDeviceFiltersDialog.cs
- MatrixTransform.cs