Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Core / System / Diagnostics / Eventing / Reader / EventLogInformation.cs / 1305376 / EventLogInformation.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
/*============================================================
**
** Class: EventLogInformation
**
** Purpose:
** The objects of this class allow access to the run-time
** properties of logs and external log files. An instance of this
** class is obtained from EventLogSession.
**
============================================================*/
using System;
using System.Runtime.InteropServices;
using Microsoft.Win32;
namespace System.Diagnostics.Eventing.Reader {
///
/// Describes the run-time properties of logs and external log files. An instance
/// of this class is obtained from EventLogSession.
///
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
public sealed class EventLogInformation {
DateTime? creationTime;
DateTime? lastAccessTime;
DateTime? lastWriteTime;
long? fileSize;
int? fileAttributes;
long? recordCount;
long? oldestRecordNumber;
bool? isLogFull;
[System.Security.SecuritySafeCritical]
internal EventLogInformation(EventLogSession session, string channelName, PathType pathType) {
EventLogPermissionHolder.GetEventLogPermission().Demand();
EventLogHandle logHandle = NativeWrapper.EvtOpenLog(session.Handle, channelName, pathType);
using (logHandle) {
creationTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogCreationTime);
lastAccessTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogLastAccessTime);
lastWriteTime = (DateTime?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogLastWriteTime);
fileSize = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogFileSize));
fileAttributes = (int?)((uint?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogAttributes));
recordCount = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogNumberOfLogRecords));
oldestRecordNumber = (long?)((ulong?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogOldestRecordNumber));
isLogFull = (bool?)NativeWrapper.EvtGetLogInfo(logHandle, UnsafeNativeMethods.EvtLogPropertyId.EvtLogFull);
}
}
public DateTime? CreationTime { get { return creationTime; } }
public DateTime? LastAccessTime { get { return lastAccessTime; } }
public DateTime? LastWriteTime { get { return lastWriteTime; } }
public long? FileSize { get { return fileSize; } }
public int? Attributes { get { return fileAttributes; } }
public long? RecordCount { get { return recordCount; } }
public long? OldestRecordNumber { get { return oldestRecordNumber; } }
public bool? IsLogFull { get { return isLogFull; } }
}
}
// 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
- TableProvider.cs
- HttpRequest.cs
- TypographyProperties.cs
- Compilation.cs
- BamlBinaryReader.cs
- CodeMemberMethod.cs
- AppDomainUnloadedException.cs
- TemplateBindingExtensionConverter.cs
- EncoderNLS.cs
- Propagator.ExtentPlaceholderCreator.cs
- DiscardableAttribute.cs
- TraceContext.cs
- EntityDataSourceEntityTypeFilterConverter.cs
- BlobPersonalizationState.cs
- DataGridViewColumnCollectionDialog.cs
- PartialCachingAttribute.cs
- WebPartConnectionsCloseVerb.cs
- DataServiceRequestException.cs
- LockCookie.cs
- PaintValueEventArgs.cs
- XamlWrappingReader.cs
- CasesDictionary.cs
- TimersDescriptionAttribute.cs
- RemoteHelper.cs
- CheckBoxField.cs
- ResourceDictionary.cs
- CallbackHandler.cs
- webclient.cs
- DataListItemEventArgs.cs
- SqlDesignerDataSourceView.cs
- URLBuilder.cs
- MappingException.cs
- QuinticEase.cs
- ArrangedElementCollection.cs
- LabelLiteral.cs
- Events.cs
- MultiSelectRootGridEntry.cs
- EventLogStatus.cs
- SyndicationDeserializer.cs
- SingleAnimationBase.cs
- BindValidator.cs
- XsltArgumentList.cs
- InstanceNameConverter.cs
- ProfileSettingsCollection.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- DispatcherBuilder.cs
- DecimalAverageAggregationOperator.cs
- ListViewItemEventArgs.cs
- DataSourceIDConverter.cs
- PointUtil.cs
- StructuredTypeEmitter.cs
- CapacityStreamGeometryContext.cs
- PlanCompiler.cs
- RolePrincipal.cs
- NativeRecognizer.cs
- MSAANativeProvider.cs
- AccessorTable.cs
- CreatingCookieEventArgs.cs
- CodeDOMProvider.cs
- RepeaterItemCollection.cs
- ApplicationId.cs
- HMACSHA384.cs
- TextDecorationCollectionConverter.cs
- DataGridColumnsPage.cs
- FixedSOMTable.cs
- TypeBuilder.cs
- Util.cs
- EncodingInfo.cs
- RecognizedAudio.cs
- UpdatePanel.cs
- ProvidersHelper.cs
- NCryptSafeHandles.cs
- SQLMoney.cs
- CheckoutException.cs
- DataObjectCopyingEventArgs.cs
- Cursors.cs
- QueryGeneratorBase.cs
- Utilities.cs
- RootProfilePropertySettingsCollection.cs
- AppDomainProtocolHandler.cs
- HttpSysSettings.cs
- ArgumentOutOfRangeException.cs
- OneOfScalarConst.cs
- PtsCache.cs
- PenThreadPool.cs
- BoolExpressionVisitors.cs
- RijndaelManagedTransform.cs
- DependencyPropertyChangedEventArgs.cs
- UnsafeNativeMethods.cs
- String.cs
- _UriSyntax.cs
- RegexWorker.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- TrackingServices.cs
- ConfigXmlCDataSection.cs
- List.cs
- MarkupExtensionParser.cs
- ProfileService.cs
- GenericsNotImplementedException.cs
- Help.cs