Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / WCF / Log / System / IO / Log / FileLogRecordHeader.cs / 1305376 / FileLogRecordHeader.cs
//------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System.IO; using System.Diagnostics; internal struct FileLogRecordHeader { [Flags] enum LowFlags : byte { RestartArea = 0x01 } internal const int Size = 20; internal const byte MAJORVER = 1; internal const byte MINORVER = 0; const int MajorVersionOffset = 0; const int MinorVersionOffset = 1; const int LowFlagsOffset = 2; const int HighFlagsOffset = 3; const int PreviousLsnOffsetHigh = 4; const int NextUndoLsnOffsetHigh = 12; byte[] bits; internal FileLogRecordHeader(byte[] bits) { if (bits == null) { this.bits = new Byte[Size]; this.bits[MajorVersionOffset] = MAJORVER; this.bits[MinorVersionOffset] = MINORVER; } else { if (bits.Length < Size) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.LogCorrupt()); } // if version not supported then ??? if (bits[MajorVersionOffset] != MAJORVER) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.IncompatibleVersion()); this.bits = bits; } } internal bool IsRestartArea { get { return (((LowFlags)bits[LowFlagsOffset] & LowFlags.RestartArea) != 0); } set { LowFlags flags = (LowFlags)bits[LowFlagsOffset]; if (value) flags |= LowFlags.RestartArea; else flags &= ~LowFlags.RestartArea; bits[LowFlagsOffset] = (byte)(flags); } } internal SequenceNumber PreviousLsn { get { return new SequenceNumber( BitConverter.ToUInt64(this.bits, PreviousLsnOffsetHigh)); } set { SequenceNumber.WriteUInt64(value.High, this.bits, PreviousLsnOffsetHigh); } } internal SequenceNumber NextUndoLsn { get { return new SequenceNumber(BitConverter.ToUInt64(this.bits, NextUndoLsnOffsetHigh)); } set { SequenceNumber.WriteUInt64(value.High, this.bits, NextUndoLsnOffsetHigh); } } internal byte[] Bits { get { return this.bits; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------- namespace System.IO.Log { using System.IO; using System.Diagnostics; internal struct FileLogRecordHeader { [Flags] enum LowFlags : byte { RestartArea = 0x01 } internal const int Size = 20; internal const byte MAJORVER = 1; internal const byte MINORVER = 0; const int MajorVersionOffset = 0; const int MinorVersionOffset = 1; const int LowFlagsOffset = 2; const int HighFlagsOffset = 3; const int PreviousLsnOffsetHigh = 4; const int NextUndoLsnOffsetHigh = 12; byte[] bits; internal FileLogRecordHeader(byte[] bits) { if (bits == null) { this.bits = new Byte[Size]; this.bits[MajorVersionOffset] = MAJORVER; this.bits[MinorVersionOffset] = MINORVER; } else { if (bits.Length < Size) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.LogCorrupt()); } // if version not supported then ??? if (bits[MajorVersionOffset] != MAJORVER) throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(Error.IncompatibleVersion()); this.bits = bits; } } internal bool IsRestartArea { get { return (((LowFlags)bits[LowFlagsOffset] & LowFlags.RestartArea) != 0); } set { LowFlags flags = (LowFlags)bits[LowFlagsOffset]; if (value) flags |= LowFlags.RestartArea; else flags &= ~LowFlags.RestartArea; bits[LowFlagsOffset] = (byte)(flags); } } internal SequenceNumber PreviousLsn { get { return new SequenceNumber( BitConverter.ToUInt64(this.bits, PreviousLsnOffsetHigh)); } set { SequenceNumber.WriteUInt64(value.High, this.bits, PreviousLsnOffsetHigh); } } internal SequenceNumber NextUndoLsn { get { return new SequenceNumber(BitConverter.ToUInt64(this.bits, NextUndoLsnOffsetHigh)); } set { SequenceNumber.WriteUInt64(value.High, this.bits, NextUndoLsnOffsetHigh); } } internal byte[] Bits { get { return this.bits; } } } } // 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
- NameNode.cs
- SimpleBitVector32.cs
- TreeViewImageIndexConverter.cs
- MultiPageTextView.cs
- StorageEntitySetMapping.cs
- GroupLabel.cs
- SortFieldComparer.cs
- sitestring.cs
- WebContext.cs
- MsmqIntegrationReceiveParameters.cs
- HistoryEventArgs.cs
- TypeListConverter.cs
- ReverseQueryOperator.cs
- Cell.cs
- FrameSecurityDescriptor.cs
- TemplateManager.cs
- ProfessionalColors.cs
- VectorAnimationBase.cs
- WindowsContainer.cs
- MenuItem.cs
- OleCmdHelper.cs
- LookupNode.cs
- TextServicesProperty.cs
- FieldBuilder.cs
- ListViewHitTestInfo.cs
- LicenseContext.cs
- SoapEnumAttribute.cs
- ExpressionNormalizer.cs
- ParsedAttributeCollection.cs
- DesignerDataTableBase.cs
- WebPartAuthorizationEventArgs.cs
- SystemWebCachingSectionGroup.cs
- GeometryHitTestResult.cs
- InfoCardSymmetricAlgorithm.cs
- MetadataAssemblyHelper.cs
- HtmlTableRow.cs
- ErrorFormatterPage.cs
- FormViewInsertEventArgs.cs
- BrowserCapabilitiesCompiler.cs
- XmlSchemaValidator.cs
- HasCopySemanticsAttribute.cs
- PageOutputColor.cs
- GlyphsSerializer.cs
- DerivedKeySecurityTokenStub.cs
- PerformanceCounterNameAttribute.cs
- sqlcontext.cs
- NullableDecimalSumAggregationOperator.cs
- ViewgenGatekeeper.cs
- SchemaTypeEmitter.cs
- MetadataCache.cs
- MulticastNotSupportedException.cs
- MaskedTextBox.cs
- ItemCollection.cs
- Application.cs
- SurrogateEncoder.cs
- TypeBuilder.cs
- HttpCookieCollection.cs
- IChannel.cs
- XmlNodeChangedEventManager.cs
- SuppressIldasmAttribute.cs
- CommandExpr.cs
- WindowsListBox.cs
- RequestBringIntoViewEventArgs.cs
- FlowPosition.cs
- CodeTypeReferenceCollection.cs
- ControlDesigner.cs
- FormViewUpdateEventArgs.cs
- BaseCodeDomTreeGenerator.cs
- StateMachineWorkflowInstance.cs
- Color.cs
- BufferedReceiveManager.cs
- X509Extension.cs
- StorageBasedPackageProperties.cs
- DispatcherFrame.cs
- Model3DCollection.cs
- InternalControlCollection.cs
- BoolExpr.cs
- NameScopePropertyAttribute.cs
- RangeValuePattern.cs
- CheckedListBox.cs
- ScriptHandlerFactory.cs
- HttpRequest.cs
- ValidatorCollection.cs
- CompositeActivityTypeDescriptor.cs
- IsolatedStorage.cs
- SqlDataSourceSelectingEventArgs.cs
- XmlIgnoreAttribute.cs
- InProcStateClientManager.cs
- InkCanvas.cs
- OracleString.cs
- KerberosTicketHashIdentifierClause.cs
- BaseParagraph.cs
- _HeaderInfoTable.cs
- XsltArgumentList.cs
- ByteAnimationBase.cs
- MDIWindowDialog.cs
- SoapDocumentMethodAttribute.cs
- ResourceLoader.cs
- TextWriterEngine.cs
- FilterElement.cs