Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / TrustUi / MS / Internal / documents / Application / FileDocument.cs / 1 / FileDocument.cs
//------------------------------------------------------------------------------
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Extends StreamDocument with CriticalFileTokens for use by FileController
// FilePresentation and DocumentStream.
//
//
// History:
// 08/28/2005: [....]: Initial implementation.
//-----------------------------------------------------------------------------
using System;
using System.IO;
using System.Security;
namespace MS.Internal.Documents.Application
{
///
/// Extends StreamDocument with CriticalFileTokens for use by FileController
/// FilePresentation and DocumentStream.
///
internal class FileDocument : StreamDocument
{
#region Constructors
//-------------------------------------------------------------------------
// Constructors
//-------------------------------------------------------------------------
#if DRT
///
/// Constructs a FileDocument allowing for a dependency. Null can be used
/// if there are none.
///
/// The Document this object depends on.
internal FileDocument(Document dependency)
: base(dependency) { }
#endif
///
/// Will construct a FileDocument with no dependency.
///
/// The file token to use for this document.
///
/// Critical:
/// - accesses _sourceFile, _desinationToken
/// TreatAsSafe:
/// - safe by defination for _sourcefile
///
[SecurityCritical, SecurityTreatAsSafe]
public FileDocument(CriticalFileToken fileToken)
: base(null)
{
_sourceToken = fileToken;
}
///
/// Will construct a FileDocument with no dependency.
///
/// The existing stream to use for this document.
///
///
/// Critical:
/// - we are setting the target stream to read from
/// NotSafe:
/// - we do not know the source of the stream
///
[SecurityCritical]
public FileDocument(Stream existing)
: base(null)
{
SourceProxy = DocumentStream.Open(existing);
}
#endregion Constructors
#region Internal Properties
//--------------------------------------------------------------------------
// Internal Properties
//-------------------------------------------------------------------------
///
/// Returns the file token to use for saving this document.
///
///
/// Critical:
/// - get & sets the _destinationToken
///
internal CriticalFileToken DestinationToken
{
[SecurityCritical]
get { return _destinationToken; }
[SecurityCritical]
set { _destinationToken = value; }
}
///
/// Returns the file token to use for opening this document.
///
///
/// Critical:
/// - gets the _fileToken
///
internal CriticalFileToken SourceToken
{
[SecurityCritical]
get { return _sourceToken; }
}
///
/// When true the source and destination should be swapped on SaveCommit.
///
///
internal bool SwapDestination
{
get { return _swapFile; }
set { _swapFile = value; }
}
#endregion Internal Properties
#region Private Fields
//--------------------------------------------------------------------------
// Private Fields
//--------------------------------------------------------------------------
///
/// The comparee document we will save to.
///
///
/// Critical:
/// - we do not want to leak the token
///
[SecurityCritical]
private CriticalFileToken _destinationToken;
///
/// The source document we represent.
///
///
/// Critical:
/// - we do not want to leak the token
/// - it is only safe to set once for the object
///
[SecurityCritical]
private CriticalFileToken _sourceToken;
private bool _swapFile;
#endregion Private Fields
}
}
// 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
- StrokeNode.cs
- DataGridViewCellEventArgs.cs
- CalendarDay.cs
- XamlTypeMapper.cs
- ContentPropertyAttribute.cs
- RestHandlerFactory.cs
- COM2FontConverter.cs
- TransformGroup.cs
- TypeConverterHelper.cs
- HostAdapter.cs
- SQLString.cs
- BindingExpressionBase.cs
- RecommendedAsConfigurableAttribute.cs
- Vector3DIndependentAnimationStorage.cs
- ValidationEventArgs.cs
- Section.cs
- ByteAnimationUsingKeyFrames.cs
- HtmlForm.cs
- NamespaceDecl.cs
- WindowsBrush.cs
- TableRowCollection.cs
- TreeNodeStyleCollection.cs
- VoiceObjectToken.cs
- SQLInt16Storage.cs
- XmlSchemaAll.cs
- RSAPKCS1SignatureDeformatter.cs
- PerformanceCounterManager.cs
- MSAANativeProvider.cs
- XmlSchemaProviderAttribute.cs
- LoadWorkflowByInstanceKeyCommand.cs
- TextEncodedRawTextWriter.cs
- ResourceDisplayNameAttribute.cs
- TCPClient.cs
- BitmapEncoder.cs
- ScrollableControl.cs
- ApplicationSecurityManager.cs
- SystemResourceKey.cs
- PlatformCulture.cs
- NumberEdit.cs
- GradientStop.cs
- IsolatedStorage.cs
- JavaScriptSerializer.cs
- WizardPanel.cs
- SelectedGridItemChangedEvent.cs
- TableCell.cs
- FamilyMapCollection.cs
- Int16.cs
- ThicknessAnimation.cs
- ColorDialog.cs
- DynamicMethod.cs
- XmlFormatWriterGenerator.cs
- RSAPKCS1SignatureFormatter.cs
- DescendantBaseQuery.cs
- VirtualDirectoryMapping.cs
- AuthenticatingEventArgs.cs
- ClockController.cs
- PrtCap_Reader.cs
- ApplicationInterop.cs
- HttpModuleActionCollection.cs
- CodeDomConfigurationHandler.cs
- WinInetCache.cs
- VerificationAttribute.cs
- COSERVERINFO.cs
- BezierSegment.cs
- Classification.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- DbConnectionPool.cs
- TextDecorationCollection.cs
- SrgsText.cs
- GenericTypeParameterConverter.cs
- BindingsCollection.cs
- UInt16Converter.cs
- SmiRecordBuffer.cs
- XmlSchemaSequence.cs
- DataConnectionHelper.cs
- MobileCapabilities.cs
- MobileControlPersister.cs
- QilBinary.cs
- SafeCertificateStore.cs
- DesignerEventService.cs
- SmiTypedGetterSetter.cs
- JsonXmlDataContract.cs
- LoginCancelEventArgs.cs
- ObjectToken.cs
- StorageInfo.cs
- WorkerRequest.cs
- PathFigureCollection.cs
- SqlUtils.cs
- XmlSignatureProperties.cs
- DataObject.cs
- CodeDomConfigurationHandler.cs
- FixedBufferAttribute.cs
- ExpressionWriter.cs
- CngKeyCreationParameters.cs
- SrgsGrammarCompiler.cs
- DeliveryStrategy.cs
- templategroup.cs
- WebPartConnectionsCancelEventArgs.cs
- EntryPointNotFoundException.cs
- ActivationServices.cs