Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / Log / System / IO / Log / LogArchiveSnapshot.cs / 1 / LogArchiveSnapshot.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.IO.Log { using System; using System.Collections.Generic; using System.Runtime.InteropServices; using System.Text; public sealed class LogArchiveSnapshot { SequenceNumber archiveTail; SequenceNumber baseSequenceNumber; SequenceNumber lastSequenceNumber; IEnumerableregions; const int MaxFileNameLength = 260; internal LogArchiveSnapshot(LogStore store, ulong lsnLow, ulong lsnHigh) { StringBuilder baseLogFileName = new StringBuilder(MaxFileNameLength); int actualLength; ulong baseLogFileOffset; ulong baseLogFileLength; ulong lsnBase; ulong lsnLast; ulong lsnArchiveTail; SafeArchiveContext archiveContext = null; try { while (!UnsafeNativeMethods.PrepareLogArchive( store.Handle, baseLogFileName, baseLogFileName.Capacity, ref lsnLow, ref lsnHigh, out actualLength, out baseLogFileOffset, out baseLogFileLength, out lsnBase, out lsnLast, out lsnArchiveTail, out archiveContext)) { baseLogFileName.EnsureCapacity(actualLength+1); } this.archiveTail = new SequenceNumber(lsnArchiveTail); this.baseSequenceNumber = new SequenceNumber(lsnBase); this.lastSequenceNumber = new SequenceNumber(lsnLast); List regions = new List (); byte[] readBuffer = new byte[checked((uint)baseLogFileLength)]; uint actualDataLength = 0; unsafe { fixed(byte *pbReadBuffer = readBuffer) { UnsafeNativeMethods.ReadLogArchiveMetadata( archiveContext, 0, readBuffer.Length, pbReadBuffer, out actualDataLength); } } byte[] baseFileData; if (actualDataLength == (uint)baseLogFileLength) { baseFileData = readBuffer; } else { baseFileData = new byte[actualDataLength]; Array.Copy(readBuffer, baseFileData, baseFileData.Length); } regions.Add(new FileRegion((long)baseLogFileLength, baseLogFileName.ToString(), (long)baseLogFileOffset, baseFileData)); CLFS_ARCHIVE_DESCRIPTOR descriptor = new CLFS_ARCHIVE_DESCRIPTOR(); while(true) { int returnedCount; if (!UnsafeNativeMethods.GetNextLogArchiveExtentSingle( archiveContext, ref descriptor, out returnedCount)) { break; } if (returnedCount < 1) break; long start = checked((long)descriptor.coffLow); long length = checked((long)(descriptor.coffHigh - descriptor.coffLow)); string fileName = descriptor.infoContainer.GetActualFileName(store.Handle); FileInfo containerInfo; containerInfo = new FileInfo(fileName); regions.Add(new FileRegion(containerInfo.Length, fileName, start, length)); } this.regions = regions.AsReadOnly(); } finally { if (archiveContext != null && !archiveContext.IsInvalid) { archiveContext.Close(); } } } public IEnumerable ArchiveRegions { get { return this.regions; } } public SequenceNumber ArchiveTail { get { return this.archiveTail; } } public SequenceNumber BaseSequenceNumber { get { return this.baseSequenceNumber; } } public SequenceNumber LastSequenceNumber { get { return this.lastSequenceNumber; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ModelPropertyDescriptor.cs
- MenuCommand.cs
- SqlUdtInfo.cs
- Utils.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- ProfileEventArgs.cs
- JsonFormatWriterGenerator.cs
- ChtmlCommandAdapter.cs
- FixUp.cs
- ToolboxDataAttribute.cs
- LineBreakRecord.cs
- XmlAttributes.cs
- _NestedSingleAsyncResult.cs
- IUnknownConstantAttribute.cs
- ToolStripItemTextRenderEventArgs.cs
- AsymmetricSignatureFormatter.cs
- ObjectDesignerDataSourceView.cs
- WebPartRestoreVerb.cs
- FontDifferentiator.cs
- Number.cs
- ContainerSelectorActiveEvent.cs
- BamlLocalizableResourceKey.cs
- nulltextcontainer.cs
- EventBuilder.cs
- TextModifier.cs
- ConnectionPoolManager.cs
- CustomErrorCollection.cs
- DataGridViewHeaderCell.cs
- SymmetricAlgorithm.cs
- TreeViewBindingsEditor.cs
- ListViewAutomationPeer.cs
- DispatcherObject.cs
- ManipulationInertiaStartingEventArgs.cs
- WSSecurityOneDotZeroSendSecurityHeader.cs
- SspiNegotiationTokenProviderState.cs
- MatrixTransform3D.cs
- ObjectViewQueryResultData.cs
- DefaultValueConverter.cs
- Internal.cs
- ResourceType.cs
- Menu.cs
- XmlDocument.cs
- OLEDB_Enum.cs
- XPathNodeIterator.cs
- HttpWriter.cs
- TransportOutputChannel.cs
- XamlStyleSerializer.cs
- WpfKnownType.cs
- BindingCompleteEventArgs.cs
- FacetDescriptionElement.cs
- ProtocolsConfigurationEntry.cs
- HttpCacheParams.cs
- ModuleConfigurationInfo.cs
- IssuanceLicense.cs
- AccessibleObject.cs
- GroupBox.cs
- DurableInstancingOptions.cs
- ErrorFormatter.cs
- ScriptingWebServicesSectionGroup.cs
- webclient.cs
- DelegatingConfigHost.cs
- InstanceDescriptor.cs
- ScopedKnownTypes.cs
- TypedTableBase.cs
- NCryptNative.cs
- X509PeerCertificateAuthenticationElement.cs
- JoinCqlBlock.cs
- StringExpressionSet.cs
- XmlArrayItemAttributes.cs
- CompoundFileDeflateTransform.cs
- ClientBuildManagerCallback.cs
- TrackingProfileDeserializationException.cs
- CodeCommentStatement.cs
- ProviderBase.cs
- PairComparer.cs
- PagesSection.cs
- DataViewSetting.cs
- EntitySqlQueryBuilder.cs
- WindowCollection.cs
- IItemProperties.cs
- RealizationContext.cs
- AddInDeploymentState.cs
- BindingWorker.cs
- ProtocolsSection.cs
- ListManagerBindingsCollection.cs
- VisualStateChangedEventArgs.cs
- DoubleCollection.cs
- DeferredTextReference.cs
- TableLayoutSettingsTypeConverter.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- GridViewPageEventArgs.cs
- ElementMarkupObject.cs
- Ray3DHitTestResult.cs
- PersonalizationProviderCollection.cs
- AssertFilter.cs
- ComponentGlyph.cs
- MD5.cs
- SelectionRangeConverter.cs
- _OSSOCK.cs
- XslCompiledTransform.cs