本文整理汇总了C#中System.Xml.XmlDictionaryReaderQuotas类的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReaderQuotas类的具体用法?C# XmlDictionaryReaderQuotas怎么用?C# XmlDictionaryReaderQuotas使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
XmlDictionaryReaderQuotas类属于System.Xml命名空间,在下文中一共展示了XmlDictionaryReaderQuotas类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeFrom
internal void InitializeFrom(XmlDictionaryReaderQuotas readerQuotas)
{
if (readerQuotas == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("readerQuotas");
}
if (readerQuotas.MaxDepth != EncoderDefaults.MaxDepth)
{
SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxDepth, readerQuotas.MaxDepth);
}
if (readerQuotas.MaxStringContentLength != EncoderDefaults.MaxStringContentLength)
{
SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxStringContentLength, readerQuotas.MaxStringContentLength);
}
if (readerQuotas.MaxArrayLength != EncoderDefaults.MaxArrayLength)
{
SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxArrayLength, readerQuotas.MaxArrayLength);
}
if (readerQuotas.MaxBytesPerRead != EncoderDefaults.MaxBytesPerRead)
{
SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxBytesPerRead, readerQuotas.MaxBytesPerRead);
}
if (readerQuotas.MaxNameTableCharCount != EncoderDefaults.MaxNameTableCharCount)
{
SetPropertyValueIfNotDefaultValue(ConfigurationStrings.MaxNameTableCharCount, readerQuotas.MaxNameTableCharCount);
}
}
示例2: MoveToInitial
private void MoveToInitial(XmlDictionaryReaderQuotas quotas, XmlBinaryReaderSession session, OnXmlDictionaryReaderClose onClose)
{
MoveToInitial(quotas);
_maxBytesPerRead = quotas.MaxBytesPerRead;
_arrayState = ArrayState.None;
_isTextWithEndElement = false;
}
示例3: ApplyConfiguration
internal void ApplyConfiguration(XmlDictionaryReaderQuotas readerQuotas)
{
if (readerQuotas == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("readerQuotas");
}
if (this.MaxDepth != 0)
{
readerQuotas.MaxDepth = this.MaxDepth;
}
if (this.MaxStringContentLength != 0)
{
readerQuotas.MaxStringContentLength = this.MaxStringContentLength;
}
if (this.MaxArrayLength != 0)
{
readerQuotas.MaxArrayLength = this.MaxArrayLength;
}
if (this.MaxBytesPerRead != 0)
{
readerQuotas.MaxBytesPerRead = this.MaxBytesPerRead;
}
if (this.MaxNameTableCharCount != 0)
{
readerQuotas.MaxNameTableCharCount = this.MaxNameTableCharCount;
}
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:27,代码来源:XmlDictionaryReaderQuotasElement.cs
示例4: GetBufferedReadQuotas
internal static XmlDictionaryReaderQuotas GetBufferedReadQuotas(XmlDictionaryReaderQuotas encoderQuotas)
{
XmlDictionaryReaderQuotas bufferedReadQuotas = new XmlDictionaryReaderQuotas();
encoderQuotas.CopyTo(bufferedReadQuotas);
// now we have the quotas from the encoder, we need to update the values with the new quotas from the default read quotas.
if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxStringContentLength))
{
bufferedReadQuotas.MaxStringContentLength = EncoderDefaults.BufferedReadDefaultMaxStringContentLength;
}
if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxArrayLength))
{
bufferedReadQuotas.MaxArrayLength = EncoderDefaults.BufferedReadDefaultMaxArrayLength;
}
if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxBytesPerRead))
{
bufferedReadQuotas.MaxBytesPerRead = EncoderDefaults.BufferedReadDefaultMaxBytesPerRead;
}
if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxNameTableCharCount))
{
bufferedReadQuotas.MaxNameTableCharCount = EncoderDefaults.BufferedReadDefaultMaxNameTableCharCount;
}
if (IsDefaultQuota(bufferedReadQuotas, XmlDictionaryReaderQuotaTypes.MaxDepth))
{
bufferedReadQuotas.MaxDepth = EncoderDefaults.BufferedReadDefaultMaxDepth;
}
return bufferedReadQuotas;
}
示例5: SetReaderQuotas
public static void SetReaderQuotas(XmlDictionaryReaderQuotas readerQuotas)
{
readerQuotas.MaxStringContentLength = int.MaxValue;
readerQuotas.MaxArrayLength = int.MaxValue;
readerQuotas.MaxBytesPerRead = int.MaxValue;
readerQuotas.MaxDepth = int.MaxValue;
}
示例6: CreateSplicedReader
internal static XmlDictionaryReader CreateSplicedReader(byte[] decryptedBuffer, XmlAttributeHolder[] outerContext1, XmlAttributeHolder[] outerContext2, XmlAttributeHolder[] outerContext3, XmlDictionaryReaderQuotas quotas)
{
MemoryStream stream = new MemoryStream();
XmlDictionaryWriter writer = XmlDictionaryWriter.CreateTextWriter(stream);
writer.WriteStartElement("x");
WriteNamespaceDeclarations(outerContext1, writer);
writer.WriteStartElement("y");
WriteNamespaceDeclarations(outerContext2, writer);
writer.WriteStartElement("z");
WriteNamespaceDeclarations(outerContext3, writer);
writer.WriteString(" ");
writer.WriteEndElement();
writer.WriteEndElement();
writer.WriteEndElement();
writer.Flush();
XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(SpliceBuffers(decryptedBuffer, stream.GetBuffer(), (int) stream.Length, 3), quotas);
reader.ReadStartElement("x");
reader.ReadStartElement("y");
reader.ReadStartElement("z");
if (reader.NodeType != XmlNodeType.Element)
{
reader.MoveToContent();
}
return reader;
}
示例7: ApplyConfiguration
private void ApplyConfiguration(XmlDictionaryReaderQuotas readerQuotas)
{
if (readerQuotas == null)
throw new ArgumentNullException("readerQuotas");
if (this.ReaderQuotasElement.MaxDepth != 0)
{
readerQuotas.MaxDepth = this.ReaderQuotasElement.MaxDepth;
}
if (this.ReaderQuotasElement.MaxStringContentLength != 0)
{
readerQuotas.MaxStringContentLength = this.ReaderQuotasElement.MaxStringContentLength;
}
if (this.ReaderQuotasElement.MaxArrayLength != 0)
{
readerQuotas.MaxArrayLength = this.ReaderQuotasElement.MaxArrayLength;
}
if (this.ReaderQuotasElement.MaxBytesPerRead != 0)
{
readerQuotas.MaxBytesPerRead = this.ReaderQuotasElement.MaxBytesPerRead;
}
if (this.ReaderQuotasElement.MaxNameTableCharCount != 0)
{
readerQuotas.MaxNameTableCharCount = this.ReaderQuotasElement.MaxNameTableCharCount;
}
}
示例8: ApplyConfiguration
void ApplyConfiguration(XmlDictionaryReaderQuotas readerQuotas)
{
if (readerQuotas == null)
{
throw FxTrace.Exception.ArgumentNull("readerQuotas");
}
XmlDictionaryReaderQuotasElement oldQuotas = this.ReaderQuotas;
if (oldQuotas.MaxDepth != 0)
{
readerQuotas.MaxDepth = oldQuotas.MaxDepth;
}
if (oldQuotas.MaxStringContentLength != 0)
{
readerQuotas.MaxStringContentLength = oldQuotas.MaxStringContentLength;
}
if (oldQuotas.MaxArrayLength != 0)
{
readerQuotas.MaxArrayLength = oldQuotas.MaxArrayLength;
}
if (oldQuotas.MaxBytesPerRead != 0)
{
readerQuotas.MaxBytesPerRead = oldQuotas.MaxBytesPerRead;
}
if (oldQuotas.MaxNameTableCharCount != 0)
{
readerQuotas.MaxNameTableCharCount = oldQuotas.MaxNameTableCharCount;
}
}
示例9: PeerNodeConfig
public PeerNodeConfig(string meshId, ulong nodeId, PeerResolver resolver, PeerMessagePropagationFilter messagePropagationFilter, System.ServiceModel.Channels.MessageEncoder encoder, Uri listenUri, IPAddress listenIPAddress, int port, long maxReceivedMessageSize, int minNeighbors, int idealNeighbors, int maxNeighbors, int maxReferrals, int connectTimeout, int maintainerInterval, PeerSecurityManager securityManager, XmlDictionaryReaderQuotas readerQuotas, long maxBufferPool, int maxSendQueueSize, int maxReceiveQueueSize)
{
this.connectTimeout = connectTimeout;
this.listenIPAddress = listenIPAddress;
this.listenUri = listenUri;
this.maxReceivedMessageSize = maxReceivedMessageSize;
this.minNeighbors = minNeighbors;
this.idealNeighbors = idealNeighbors;
this.maxNeighbors = maxNeighbors;
this.maxReferrals = maxReferrals;
this.maxReferralCacheSize = 50;
this.maxResolveAddresses = 3;
this.meshId = meshId;
this.encoder = encoder;
this.messagePropagationFilter = messagePropagationFilter;
this.nodeId = nodeId;
this.port = port;
this.resolver = resolver;
this.maintainerInterval = maintainerInterval;
this.maintainerRetryInterval = new TimeSpan(0x5f5e100L);
this.maintainerTimeout = new TimeSpan(0x47868c00L);
this.unregisterTimeout = new TimeSpan(0x47868c00L);
this.securityManager = securityManager;
readerQuotas.CopyTo(this.readerQuotas);
this.maxBufferPoolSize = maxBufferPool;
this.maxIncomingConcurrentCalls = maxReceiveQueueSize;
this.maxSendQueueSize = maxSendQueueSize;
}
示例10: ValidateMessageBody
void ValidateMessageBody(ref System.ServiceModel.Channels.Message message, bool isRequest)
{
if (!message.IsFault)
{
XmlDictionaryReaderQuotas quotas = new XmlDictionaryReaderQuotas();
XmlReader bodyReader = message.GetReaderAtBodyContents().ReadSubtree();
XmlReaderSettings wrapperSettings = new XmlReaderSettings();
wrapperSettings.CloseInput = true;
wrapperSettings.Schemas = schemaSet;
wrapperSettings.ValidationFlags = XmlSchemaValidationFlags.None;
wrapperSettings.ValidationType = ValidationType.Schema;
wrapperSettings.ValidationEventHandler +=
new ValidationEventHandler(InspectionValidationHandler);
XmlReader wrappedReader = XmlReader.Create(bodyReader, wrapperSettings);
// pull body into a memory backed writer to validate
this.isRequest = isRequest;
MemoryStream memStream = new MemoryStream();
XmlDictionaryWriter xdw = XmlDictionaryWriter.CreateBinaryWriter(memStream);
xdw.WriteNode(wrappedReader, false);
xdw.Flush(); memStream.Position = 0;
XmlDictionaryReader xdr = XmlDictionaryReader.CreateBinaryReader(memStream, quotas);
// reconstruct the message with the validated body
Message replacedMessage = Message.CreateMessage(message.Version, null, xdr);
replacedMessage.Headers.CopyHeadersFrom(message.Headers);
replacedMessage.Properties.CopyProperties(message.Properties);
message = replacedMessage;
}
}
示例11: WebScriptMetadataMessageEncoder
public WebScriptMetadataMessageEncoder(XmlDictionaryReaderQuotas quotas)
{
this.readerQuotas = new XmlDictionaryReaderQuotas();
quotas.CopyTo(this.readerQuotas);
this.mediaType = this.contentType = applicationJavaScriptMediaType;
this.innerReadMessageEncoder = new TextMessageEncodingBindingElement(MessageVersion.None, Encoding.UTF8).CreateMessageEncoderFactory().Encoder;
}
示例12: WriteXml
public void WriteXml(XmlWriter xmlWriter)
{
if (wsdl != null)
{
using (MemoryStream ms = new MemoryStream())
{
wsdl.Write(ms);
XmlDictionaryReaderQuotas quota = new XmlDictionaryReaderQuotas();
quota.MaxDepth = 32;
quota.MaxStringContentLength = 8192;
quota.MaxArrayLength = 16384;
quota.MaxBytesPerRead = 4096;
quota.MaxNameTableCharCount = 16384;
ms.Seek(0, SeekOrigin.Begin);
XmlDictionaryReader reader = XmlDictionaryReader.CreateTextReader(ms, null, quota, null);
if ((reader.MoveToContent() == XmlNodeType.Element) && (reader.Name == "wsdl:definitions"))
{
xmlWriter.WriteNode(reader, false);
}
reader.Close();
}
}
}
示例13: SetInput
public void SetInput(Stream stream, Encoding[] encodings, string contentType, XmlDictionaryReaderQuotas quotas, int maxBufferSize, OnXmlDictionaryReaderClose onClose)
{
SetReadEncodings(encodings);
CheckContentType(contentType);
Initialize(stream, contentType, quotas, maxBufferSize);
this.onClose = onClose;
}
示例14: FileTransferServiceProxy
public FileTransferServiceProxy()
{
this.m_BasicHttpBinding = new BasicHttpBinding();
this.m_EndpointAddress = new EndpointAddress(EndpointAddressUrl);
this.m_BasicHttpBinding.Security.Mode = BasicHttpSecurityMode.TransportWithMessageCredential;
this.m_BasicHttpBinding.Security.Message.ClientCredentialType = BasicHttpMessageCredentialType.UserName;
this.m_BasicHttpBinding.MaxReceivedMessageSize = 2147483647;
XmlDictionaryReaderQuotas readerQuotas = new XmlDictionaryReaderQuotas();
readerQuotas.MaxArrayLength = 25 * 208000;
readerQuotas.MaxStringContentLength = 25 * 208000;
this.m_BasicHttpBinding.ReaderQuotas = readerQuotas;
this.m_ChannelFactory = new ChannelFactory<Contract.IFileTransferService>(this.m_BasicHttpBinding, this.m_EndpointAddress);
this.m_ChannelFactory.Credentials.UserName.UserName = YellowstonePathology.YpiConnect.Contract.Identity.GuestWebServiceAccount.UserName;
this.m_ChannelFactory.Credentials.UserName.Password = YellowstonePathology.YpiConnect.Contract.Identity.GuestWebServiceAccount.Password;
foreach (System.ServiceModel.Description.OperationDescription op in this.m_ChannelFactory.Endpoint.Contract.Operations)
{
var dataContractBehavior = op.Behaviors.Find<System.ServiceModel.Description.DataContractSerializerOperationBehavior>();
if (dataContractBehavior != null)
{
dataContractBehavior.MaxItemsInObjectGraph = int.MaxValue;
}
}
this.m_FileTransferServiceChannel = this.m_ChannelFactory.CreateChannel();
}
示例15: CreateJsonReader
public static XmlDictionaryReader CreateJsonReader(byte[] buffer, XmlDictionaryReaderQuotas quotas)
{
if (buffer == null)
throw new ArgumentNullException("buffer");
else
return JsonReaderWriterFactory.CreateJsonReader(buffer, 0, buffer.Length, (Encoding)null, quotas, (OnXmlDictionaryReaderClose)null);
}