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
- ArithmeticException.cs
- __Filters.cs
- _BasicClient.cs
- InvokePattern.cs
- METAHEADER.cs
- PointUtil.cs
- Executor.cs
- XmlCharCheckingReader.cs
- XmlWhitespace.cs
- LocalizationComments.cs
- WebPartDescription.cs
- FullTextBreakpoint.cs
- SelectedCellsCollection.cs
- EnumerableRowCollection.cs
- CompositeScriptReference.cs
- CodeMethodInvokeExpression.cs
- JoinCqlBlock.cs
- WebPartEventArgs.cs
- MulticastDelegate.cs
- HttpResponseBase.cs
- FixedSOMLineRanges.cs
- precedingsibling.cs
- Region.cs
- WebServiceErrorEvent.cs
- VirtualDirectoryMapping.cs
- FixedMaxHeap.cs
- RealizationDrawingContextWalker.cs
- TreeViewItemAutomationPeer.cs
- BrowserPolicyValidator.cs
- BrushMappingModeValidation.cs
- MobileControlsSection.cs
- Panel.cs
- FormView.cs
- EntitySqlQueryBuilder.cs
- EntityViewGenerationAttribute.cs
- XmlCharacterData.cs
- httpserverutility.cs
- ValueTypeFixupInfo.cs
- MetaModel.cs
- ElementAction.cs
- NetMsmqBindingElement.cs
- EnumerableValidator.cs
- GridViewUpdateEventArgs.cs
- ClosableStream.cs
- Utilities.cs
- VideoDrawing.cs
- PrintDialogException.cs
- EntityFunctions.cs
- ComboBoxItem.cs
- ListChunk.cs
- DbDataSourceEnumerator.cs
- ExclusiveHandle.cs
- JsonReader.cs
- XamlTemplateSerializer.cs
- ManifestResourceInfo.cs
- SchemaNames.cs
- HtmlTableCellCollection.cs
- Serializer.cs
- ConnectionPoint.cs
- MachineKeyConverter.cs
- CriticalHandle.cs
- TypeAccessException.cs
- HtmlElement.cs
- PathTooLongException.cs
- MdiWindowListItemConverter.cs
- GenericsInstances.cs
- MaterialCollection.cs
- RuntimeConfigLKG.cs
- GetLastErrorDetailsRequest.cs
- PartBasedPackageProperties.cs
- IncrementalReadDecoders.cs
- CssClassPropertyAttribute.cs
- CompilerTypeWithParams.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- FileDialogCustomPlace.cs
- KeyPullup.cs
- HttpCookie.cs
- TrackingProfile.cs
- util.cs
- Membership.cs
- DbConnectionPoolGroupProviderInfo.cs
- XmlArrayItemAttributes.cs
- SqlProcedureAttribute.cs
- PropertyRecord.cs
- MobileCategoryAttribute.cs
- DoubleAnimationUsingPath.cs
- AppSettingsSection.cs
- XmlSerializerFactory.cs
- DataBoundControl.cs
- PerformanceCountersElement.cs
- ResourcesBuildProvider.cs
- StreamInfo.cs
- ItemsPanelTemplate.cs
- KeyGestureConverter.cs
- UriScheme.cs
- ProviderException.cs
- RawMouseInputReport.cs
- Guid.cs
- MaterializeFromAtom.cs
- EdmToObjectNamespaceMap.cs