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
- OleDbParameterCollection.cs
- TextReader.cs
- Command.cs
- DialogResultConverter.cs
- HostedBindingBehavior.cs
- ErrorTableItemStyle.cs
- RelationalExpressions.cs
- CodeObject.cs
- DocumentReferenceCollection.cs
- BoundsDrawingContextWalker.cs
- ADRoleFactoryConfiguration.cs
- AccessDataSourceView.cs
- TraceEventCache.cs
- OperationValidationEventArgs.cs
- CodeDelegateInvokeExpression.cs
- CacheEntry.cs
- HealthMonitoringSection.cs
- BitmapData.cs
- TextEditorLists.cs
- ImageSourceTypeConverter.cs
- SqlDataSourceConfigureFilterForm.cs
- _ListenerAsyncResult.cs
- EncoderReplacementFallback.cs
- TabItem.cs
- StructuredType.cs
- OutputCacheSettingsSection.cs
- TypeValidationEventArgs.cs
- WebPartManager.cs
- ToolStripGrip.cs
- FontCacheLogic.cs
- RegexCapture.cs
- XsdDuration.cs
- TextAutomationPeer.cs
- Axis.cs
- OleServicesContext.cs
- ListSortDescription.cs
- ClientUtils.cs
- TransformerConfigurationWizardBase.cs
- WebPartDeleteVerb.cs
- PolyBezierSegment.cs
- XmlSchemaType.cs
- DataPagerFieldCollection.cs
- _ListenerAsyncResult.cs
- BaseTemplateBuildProvider.cs
- CatalogZoneBase.cs
- BookmarkEventArgs.cs
- ProfileModule.cs
- ContainerActivationHelper.cs
- OracleString.cs
- XPathCompiler.cs
- AppPool.cs
- EntityClientCacheEntry.cs
- SafeBitVector32.cs
- FixedSOMTableRow.cs
- TargetControlTypeAttribute.cs
- IndexedGlyphRun.cs
- SessionStateModule.cs
- Size3D.cs
- SchemaImporter.cs
- MethodRental.cs
- ResourceCategoryAttribute.cs
- Solver.cs
- ELinqQueryState.cs
- XPathNavigatorException.cs
- linebase.cs
- DataChangedEventManager.cs
- EmptyEnumerator.cs
- FilteredReadOnlyMetadataCollection.cs
- ScaleTransform3D.cs
- ListMarkerLine.cs
- ReferentialConstraint.cs
- IISUnsafeMethods.cs
- InternalBufferOverflowException.cs
- DataColumn.cs
- Opcode.cs
- QueryPageSettingsEventArgs.cs
- ContextConfiguration.cs
- ThreadPool.cs
- MarkupCompilePass2.cs
- X509IssuerSerialKeyIdentifierClause.cs
- DoubleAnimationUsingPath.cs
- PublisherIdentityPermission.cs
- InstanceLockQueryResult.cs
- NullableConverter.cs
- StaticExtensionConverter.cs
- UIElementParaClient.cs
- CompressedStack.cs
- PolygonHotSpot.cs
- RadioButtonBaseAdapter.cs
- KeyProperty.cs
- SQLInt16Storage.cs
- SystemInfo.cs
- dbdatarecord.cs
- BufferedGraphicsContext.cs
- PaperSource.cs
- _FtpControlStream.cs
- MobileUserControlDesigner.cs
- CodeTypeConstructor.cs
- EpmContentSerializer.cs
- DependencyProperty.cs