Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / WCF / infocard / Service / managed / Microsoft / InfoCards / IssuerInformation.cs / 1 / IssuerInformation.cs
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace Microsoft.InfoCards
{
using System;
using System.Xml;
using System.Collections.Generic;
using System.Collections;
using System.Xml.Serialization;
using System.Xml.Schema;
using System.IO;
using System.Text;
using Microsoft.InfoCards.Diagnostics;
using IDT = Microsoft.InfoCards.Diagnostics.InfoCardTrace;
internal class IssuerInformationEntry
{
string entryName;
string entryValue;
public string Name
{
get { return entryName; }
}
public string Value
{
get { return entryValue; }
}
public IssuerInformationEntry( string name, string value )
{
entryName = name;
entryValue = value;
}
}
//
// Summary
// Additional information about a managed card issuer
//
internal class IssuerInformation
{
List m_informationEntries;
public IssuerInformation()
{
m_informationEntries = new List();
}
//
// Summary
// Serialize the IssuerInformation object
//
// Parameter
// writer - binary stream conforming to the serialization format supported by this class.
//
public void Serialize( System.IO.Stream stream )
{
//
// Setup a BinaryWriter to serialize the bytes of each member to the provided stream
//
System.IO.BinaryWriter writer = new BinaryWriter( stream, Encoding.Unicode );
writer.Write( m_informationEntries.Count );
if( m_informationEntries.Count > 0 )
{
foreach( IssuerInformationEntry entry in m_informationEntries )
{
Utility.SerializeString( writer, entry.Name );
Utility.SerializeString( writer, entry.Value );
}
}
}
//
// Summary
// Read the IssuerInformation object
//
// Parameter
// reader - xml stream reader conforming to the serialization format supported by this class.
//
public void ReadIssuerInformation( XmlReader reader )
{
if( !reader.IsStartElement( XmlNames.WSIdentity07.IssuerInformation, XmlNames.WSIdentity07.Namespace ) )
{
throw IDT.ThrowHelperError( new XmlException( SR.GetString( SR.UnexpectedElement ) ) );
}
while( reader.Read() )
{
if( XmlNames.WSIdentity07.IssuerInformationEntry == reader.LocalName
&& XmlNames.WSIdentity07.Namespace == reader.NamespaceURI )
{
ReadIssuerInformationEntry( reader );
}
if( XmlNames.WSIdentity07.IssuerInformation == reader.LocalName
&& XmlNames.WSIdentity07.Namespace == reader.NamespaceURI
&& XmlNodeType.EndElement == reader.NodeType )
{
return;
}
}
}
//
// Summary
// Read the IssuerInformationEntry object
//
// Parameter
// reader - xml stream reader conforming to the serialization format supported by this class.
//
public void ReadIssuerInformationEntry( XmlReader reader )
{
if( !reader.IsStartElement( XmlNames.WSIdentity07.IssuerInformationEntry, XmlNames.WSIdentity07.Namespace ) )
{
throw IDT.ThrowHelperError( new XmlException( SR.GetString( SR.UnexpectedElement ) ) );
}
string name = string.Empty;
string value = string.Empty;
while( reader.Read() )
{
if( XmlNames.WSIdentity07.IssuerInformationEntry == reader.LocalName
&& XmlNames.WSIdentity07.Namespace == reader.NamespaceURI
&& XmlNodeType.EndElement == reader.NodeType )
{
m_informationEntries.Add( new IssuerInformationEntry( name, value ) );
return;
}
if( XmlNames.WSIdentity07.EntryName == reader.LocalName
&& XmlNames.WSIdentity07.Namespace == reader.NamespaceURI )
{
name = reader.ReadString();
if( string.IsNullOrEmpty( name ) )
{
throw IDT.ThrowHelperError( new InvalidCardException() );
}
}
if( XmlNames.WSIdentity07.EntryValue == reader.LocalName
&& XmlNames.WSIdentity07.Namespace == reader.NamespaceURI )
{
value = reader.ReadString();
}
}
}
}
}
// 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
- SyndicationSerializer.cs
- TableLayoutStyle.cs
- SetIterators.cs
- XXXInfos.cs
- XslException.cs
- EnumConverter.cs
- DataPointer.cs
- Unit.cs
- XmlKeywords.cs
- ApplicationException.cs
- DrawingContext.cs
- AutoGeneratedFieldProperties.cs
- WhereaboutsReader.cs
- PersonalizationProvider.cs
- RemotingClientProxy.cs
- CacheChildrenQuery.cs
- IndexingContentUnit.cs
- ShadowGlyph.cs
- SQLRoleProvider.cs
- PrePrepareMethodAttribute.cs
- Internal.cs
- SpinLock.cs
- FixedDocumentSequencePaginator.cs
- DbConnectionPoolCounters.cs
- XmlUtil.cs
- PropertyOrder.cs
- Pair.cs
- designeractionlistschangedeventargs.cs
- BindingElementCollection.cs
- AssemblyAssociatedContentFileAttribute.cs
- SpellerHighlightLayer.cs
- WebPartVerb.cs
- ResourceDescriptionAttribute.cs
- TempEnvironment.cs
- Label.cs
- ListViewHitTestInfo.cs
- Brush.cs
- SettingsPropertyValue.cs
- EnumerableValidator.cs
- TreeNodeEventArgs.cs
- ChineseLunisolarCalendar.cs
- WebPart.cs
- CoordinationService.cs
- UserNameSecurityTokenAuthenticator.cs
- StandardRuntimeEnumValidator.cs
- HttpFileCollection.cs
- HtmlInputCheckBox.cs
- HMAC.cs
- Rect.cs
- SystemUnicastIPAddressInformation.cs
- MultiPageTextView.cs
- Helpers.cs
- Animatable.cs
- Boolean.cs
- RemoteWebConfigurationHostStream.cs
- HtmlEmptyTagControlBuilder.cs
- ExpressionVisitor.cs
- ProxyElement.cs
- X509Utils.cs
- CodeEventReferenceExpression.cs
- DbConnectionPoolIdentity.cs
- CannotUnloadAppDomainException.cs
- UserControlCodeDomTreeGenerator.cs
- _SslStream.cs
- UnsafeNativeMethodsPenimc.cs
- HwndStylusInputProvider.cs
- BindingParameterCollection.cs
- XPathArrayIterator.cs
- TemplateControl.cs
- MarkupCompilePass1.cs
- AutomationEventArgs.cs
- ScriptIgnoreAttribute.cs
- WindowsGraphicsCacheManager.cs
- WebServiceHandler.cs
- LoginCancelEventArgs.cs
- Validator.cs
- QfeChecker.cs
- HitTestParameters3D.cs
- X509UI.cs
- DetectRunnableInstancesTask.cs
- TreeViewImageGenerator.cs
- TreeNodeStyle.cs
- NotificationContext.cs
- SimpleTextLine.cs
- GZipUtils.cs
- LinqDataSourceDisposeEventArgs.cs
- KeySpline.cs
- AttributeEmitter.cs
- OrderByQueryOptionExpression.cs
- LinearKeyFrames.cs
- MailDefinition.cs
- SafeThemeHandle.cs
- CqlParserHelpers.cs
- DataShape.cs
- InheritanceContextChangedEventManager.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- AlgoModule.cs
- NamespaceCollection.cs
- BitmapDecoder.cs
- Adorner.cs