Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / wpf / src / Framework / System / Windows / Markup / XamlSerializer.cs / 1 / XamlSerializer.cs
//----------------------------------------------------------------------------
//
// File: XamlSerializer.cs
//
// Description:
// XamlSerializer is used to persist an object instance to xaml markup
//
// Copyright (C) 2003 by Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Security.Permissions;
using MS.Utility;
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
///
/// XamlSerializer is used to persist an
/// object instance to xaml markup.
///
internal class XamlSerializer
{
#region Construction
///
/// Constructor for XamlSerializer
///
///
/// This constructor will be used under
/// the following three scenarios
/// 1. Convert .. XamlToBaml
/// 2. Convert .. XamlToObject
/// 3. Convert .. BamlToObject
///
public XamlSerializer()
{
}
#endregion Construction
#region OtherConversions
///
/// Convert from Xaml read by a token reader into baml being written
/// out by a record writer. The context gives mapping information.
///
#if !PBTCOMPILER
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif
internal virtual void ConvertXamlToBaml (
XamlReaderHelper tokenReader,
ParserContext context,
XamlNode xamlNode,
BamlRecordWriter bamlWriter)
{
throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
}
#if !PBTCOMPILER
///
/// Convert from Xaml read by a token reader into a live
/// object tree. The context gives mapping information.
///
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
internal virtual void ConvertXamlToObject (
XamlReaderHelper tokenReader,
ReadWriteStreamManager streamManager,
ParserContext context,
XamlNode xamlNode,
BamlRecordReader reader)
{
throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
}
///
/// Convert from Baml read by a baml reader into an object tree.
/// The context gives mapping information. Return the number of
/// baml records processed.
///
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
internal virtual void ConvertBamlToObject (
BamlRecordReader reader, // Current reader that is processing records
BamlRecord bamlRecord, // Record read in that triggered serializer
ParserContext context) // Context
{
throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
}
#endif
///
/// Convert a string into a compact binary representation and write it out
/// to the passed BinaryWriter.
///
public virtual bool ConvertStringToCustomBinary (
BinaryWriter writer, // Writer into the baml stream
string stringValue) // String to convert
{
throw new InvalidOperationException(SR.Get(SRID.InvalidCustomSerialize));
}
///
/// Convert a compact binary representation of a certain object into and instance
/// of that object. The reader must be left pointing immediately after the object
/// data in the underlying stream.
///
public virtual object ConvertCustomBinaryToObject(
BinaryReader reader)
{
throw new InvalidOperationException(SR.Get(SRID.InvalidCustomSerialize));
}
///
/// If the object created by this serializer is stored in a dictionary, this
/// method will extract the key used for this dictionary from the passed
/// collection of baml records. How the key is determined is up to the
/// individual serializer. By default, there is no key retrieved.
///
#if !PBTCOMPILER
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif
internal virtual object GetDictionaryKey(
BamlRecord bamlRecord,
ParserContext parserContext)
{
return null;
}
#endregion OtherConversions
#region Data
internal const string DefNamespacePrefix = "x"; // Used to emit Definitions namespace prefix
internal const string DefNamespace = "http://schemas.microsoft.com/winfx/2006/xaml"; // Used to emit Definitions namespace
internal const string ArrayTag = "Array"; // Used to emit the x:Array tag
internal const string ArrayTagTypeAttribute = "Type"; // Used to emit the x:Type attribute for Array
#endregion Data
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
// File: XamlSerializer.cs
//
// Description:
// XamlSerializer is used to persist an object instance to xaml markup
//
// Copyright (C) 2003 by Microsoft Corporation. All rights reserved.
//
//---------------------------------------------------------------------------
using System;
using System.Collections;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.ComponentModel.Design.Serialization;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Security.Permissions;
using MS.Utility;
#if PBTCOMPILER
namespace MS.Internal.Markup
#else
namespace System.Windows.Markup
#endif
{
///
/// XamlSerializer is used to persist an
/// object instance to xaml markup.
///
internal class XamlSerializer
{
#region Construction
///
/// Constructor for XamlSerializer
///
///
/// This constructor will be used under
/// the following three scenarios
/// 1. Convert .. XamlToBaml
/// 2. Convert .. XamlToObject
/// 3. Convert .. BamlToObject
///
public XamlSerializer()
{
}
#endregion Construction
#region OtherConversions
///
/// Convert from Xaml read by a token reader into baml being written
/// out by a record writer. The context gives mapping information.
///
#if !PBTCOMPILER
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif
internal virtual void ConvertXamlToBaml (
XamlReaderHelper tokenReader,
ParserContext context,
XamlNode xamlNode,
BamlRecordWriter bamlWriter)
{
throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
}
#if !PBTCOMPILER
///
/// Convert from Xaml read by a token reader into a live
/// object tree. The context gives mapping information.
///
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
internal virtual void ConvertXamlToObject (
XamlReaderHelper tokenReader,
ReadWriteStreamManager streamManager,
ParserContext context,
XamlNode xamlNode,
BamlRecordReader reader)
{
throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
}
///
/// Convert from Baml read by a baml reader into an object tree.
/// The context gives mapping information. Return the number of
/// baml records processed.
///
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
internal virtual void ConvertBamlToObject (
BamlRecordReader reader, // Current reader that is processing records
BamlRecord bamlRecord, // Record read in that triggered serializer
ParserContext context) // Context
{
throw new InvalidOperationException(SR.Get(SRID.InvalidDeSerialize));
}
#endif
///
/// Convert a string into a compact binary representation and write it out
/// to the passed BinaryWriter.
///
public virtual bool ConvertStringToCustomBinary (
BinaryWriter writer, // Writer into the baml stream
string stringValue) // String to convert
{
throw new InvalidOperationException(SR.Get(SRID.InvalidCustomSerialize));
}
///
/// Convert a compact binary representation of a certain object into and instance
/// of that object. The reader must be left pointing immediately after the object
/// data in the underlying stream.
///
public virtual object ConvertCustomBinaryToObject(
BinaryReader reader)
{
throw new InvalidOperationException(SR.Get(SRID.InvalidCustomSerialize));
}
///
/// If the object created by this serializer is stored in a dictionary, this
/// method will extract the key used for this dictionary from the passed
/// collection of baml records. How the key is determined is up to the
/// individual serializer. By default, there is no key retrieved.
///
#if !PBTCOMPILER
//CASRemoval:[StrongNameIdentityPermission(SecurityAction.InheritanceDemand, PublicKey = Microsoft.Internal.BuildInfo.WCP_PUBLIC_KEY_STRING)]
#endif
internal virtual object GetDictionaryKey(
BamlRecord bamlRecord,
ParserContext parserContext)
{
return null;
}
#endregion OtherConversions
#region Data
internal const string DefNamespacePrefix = "x"; // Used to emit Definitions namespace prefix
internal const string DefNamespace = "http://schemas.microsoft.com/winfx/2006/xaml"; // Used to emit Definitions namespace
internal const string ArrayTag = "Array"; // Used to emit the x:Array tag
internal const string ArrayTagTypeAttribute = "Type"; // Used to emit the x:Type attribute for Array
#endregion Data
}
}
// 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
- AssociationProvider.cs
- CodeSubDirectory.cs
- DeclaredTypeValidator.cs
- StateDesignerConnector.cs
- TextEncodedRawTextWriter.cs
- XmlBinaryWriter.cs
- PrivacyNoticeBindingElement.cs
- PropertyTabAttribute.cs
- HotCommands.cs
- _ShellExpression.cs
- CloudCollection.cs
- SeverityFilter.cs
- ContainerAction.cs
- SerializationBinder.cs
- SignatureToken.cs
- DoubleIndependentAnimationStorage.cs
- ComponentDispatcherThread.cs
- TouchEventArgs.cs
- sqlstateclientmanager.cs
- ArgumentException.cs
- XmlPreloadedResolver.cs
- WebPartConnectionsDisconnectVerb.cs
- ClientCultureInfo.cs
- XmlSignatureProperties.cs
- ExpandCollapsePattern.cs
- AttachedAnnotationChangedEventArgs.cs
- SystemSounds.cs
- ProviderException.cs
- AffineTransform3D.cs
- IPAddress.cs
- Journaling.cs
- UserCancellationException.cs
- GreenMethods.cs
- ItemsControl.cs
- StandardCommands.cs
- TraceListener.cs
- DataGridViewComboBoxColumnDesigner.cs
- ClientTargetCollection.cs
- DoWorkEventArgs.cs
- SqlPersonalizationProvider.cs
- RegexCompilationInfo.cs
- ProtocolViolationException.cs
- SmtpTransport.cs
- UrlAuthorizationModule.cs
- ParallelEnumerable.cs
- ManifestResourceInfo.cs
- XsdBuilder.cs
- CodeIterationStatement.cs
- DecoderExceptionFallback.cs
- PathFigureCollection.cs
- SessionStateItemCollection.cs
- querybuilder.cs
- PassportAuthentication.cs
- UniqueEventHelper.cs
- DocumentPageViewAutomationPeer.cs
- FormsAuthenticationTicket.cs
- ToolStripSettings.cs
- AdornerPresentationContext.cs
- EmptyEnumerable.cs
- DesignerVerb.cs
- SocketManager.cs
- SpecialNameAttribute.cs
- BindToObject.cs
- MarshalByRefObject.cs
- IconBitmapDecoder.cs
- DrawingGroup.cs
- DataGridColumnFloatingHeader.cs
- WorkflowElementDialog.cs
- SelectionListComponentEditor.cs
- RootDesignerSerializerAttribute.cs
- CommonGetThemePartSize.cs
- _NtlmClient.cs
- ObjectViewEntityCollectionData.cs
- AttributeData.cs
- IODescriptionAttribute.cs
- DataGridComponentEditor.cs
- Lease.cs
- Application.cs
- EventDescriptor.cs
- ConfigurationManagerHelper.cs
- BuildManagerHost.cs
- BaseEntityWrapper.cs
- HttpChannelHelpers.cs
- PartialCachingAttribute.cs
- DtdParser.cs
- XmlSchemaImport.cs
- DeviceContexts.cs
- SamlAuthorizationDecisionClaimResource.cs
- PrintControllerWithStatusDialog.cs
- UpdatePanelTriggerCollection.cs
- StringComparer.cs
- AmbientProperties.cs
- TextEditorCopyPaste.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- DurableTimerExtension.cs
- FocusManager.cs
- CheckBoxFlatAdapter.cs
- OdbcEnvironment.cs
- QueryContinueDragEvent.cs
- RichTextBoxContextMenu.cs