當前位置: 首頁>>代碼示例>>C#>>正文


C# Xml.XmlDictionaryReaderQuotas類代碼示例

本文整理匯總了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);
     } 
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:27,代碼來源:XmlDictionaryReaderQuotasElement.cs

示例2: MoveToInitial

 private void MoveToInitial(XmlDictionaryReaderQuotas quotas, XmlBinaryReaderSession session, OnXmlDictionaryReaderClose onClose)
 {
     MoveToInitial(quotas);
     _maxBytesPerRead = quotas.MaxBytesPerRead;
     _arrayState = ArrayState.None;
     _isTextWithEndElement = false;
 }
開發者ID:dotnet,項目名稱:corefx,代碼行數:7,代碼來源:XmlBinaryReader.cs

示例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;
        }
開發者ID:SoumikMukherjeeDOTNET,項目名稱:wcf,代碼行數:33,代碼來源:EncoderHelpers.cs

示例5: SetReaderQuotas

 public static void SetReaderQuotas(XmlDictionaryReaderQuotas readerQuotas)
 {
     readerQuotas.MaxStringContentLength = int.MaxValue;
     readerQuotas.MaxArrayLength = int.MaxValue;
     readerQuotas.MaxBytesPerRead = int.MaxValue;
     readerQuotas.MaxDepth = int.MaxValue;
 }
開發者ID:rbramwell,項目名稱:OrionSDK,代碼行數:7,代碼來源:ReaderQuotaHelper.cs

示例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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:25,代碼來源:ContextImportHelper.cs

示例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;
     }
 }
開發者ID:gtkrug,項目名稱:gfipm-ws-ms.net,代碼行數:26,代碼來源:CustomTextMessageEncodingBindingSection.cs

示例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;
            }
        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:30,代碼來源:ByteStreamMessageEncodingElement.cs

示例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;
 }
開發者ID:pritesh-mandowara-sp,項目名稱:DecompliedDotNetLibraries,代碼行數:28,代碼來源:PeerNodeConfig.cs

示例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;
            }
        }
開發者ID:spzenk,項目名稱:sfdocsamples,代碼行數:30,代碼來源:SchemaValidationMessageInspector.cs

示例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;
 }
開發者ID:nlh774,項目名稱:DotNetReferenceSource,代碼行數:7,代碼來源:WebScriptMetadataMessageEncoderFactory.cs

示例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();
                }
            }

        }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:31,代碼來源:ComPlusDiagnosticTraceSchemas.cs

示例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;
 }
開發者ID:iskiselev,項目名稱:JSIL.NetFramework,代碼行數:7,代碼來源:XmlMtomReader.cs

示例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();
        }
開發者ID:WilliamCopland,項目名稱:YPILIS,代碼行數:29,代碼來源:FileTransferServiceProxy.cs

示例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);
 }
開發者ID:yonglehou,項目名稱:SyncFrameworkToolkit,代碼行數:7,代碼來源:JsonReaderWriterFactory.cs


注:本文中的System.Xml.XmlDictionaryReaderQuotas類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。