当前位置: 首页>>代码示例>>C#>>正文


C# XmlDictionaryReader.ReadElementContentAsTimeSpan方法代码示例

本文整理汇总了C#中System.Xml.XmlDictionaryReader.ReadElementContentAsTimeSpan方法的典型用法代码示例。如果您正苦于以下问题:C# XmlDictionaryReader.ReadElementContentAsTimeSpan方法的具体用法?C# XmlDictionaryReader.ReadElementContentAsTimeSpan怎么用?C# XmlDictionaryReader.ReadElementContentAsTimeSpan使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlDictionaryReader的用法示例。


在下文中一共展示了XmlDictionaryReader.ReadElementContentAsTimeSpan方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Create

 public static CreateSequenceResponseInfo Create(AddressingVersion addressingVersion, ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader)
 {
     CreateSequenceResponseInfo info = new CreateSequenceResponseInfo();
     WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
     XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
     reader.ReadStartElement(dictionary.CreateSequenceResponse, namespaceUri);
     reader.ReadStartElement(dictionary.Identifier, namespaceUri);
     info.Identifier = reader.ReadContentAsUniqueId();
     reader.ReadEndElement();
     if (reader.IsStartElement(dictionary.Expires, namespaceUri))
     {
         reader.ReadElementContentAsTimeSpan();
     }
     if ((reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11) && reader.IsStartElement(DXD.Wsrm11Dictionary.IncompleteSequenceBehavior, namespaceUri))
     {
         string str2 = reader.ReadElementContentAsString();
         if (((str2 != "DiscardEntireSequence") && (str2 != "DiscardFollowingFirstGap")) && (str2 != "NoDiscard"))
         {
             string message = System.ServiceModel.SR.GetString("CSResponseWithInvalidIncompleteSequenceBehavior");
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(message));
         }
     }
     if (reader.IsStartElement(dictionary.Accept, namespaceUri))
     {
         reader.ReadStartElement();
         info.AcceptAcksTo = EndpointAddress.ReadFrom(addressingVersion, reader, dictionary.AcksTo, namespaceUri);
         while (reader.IsStartElement())
         {
             reader.Skip();
         }
         reader.ReadEndElement();
     }
     while (reader.IsStartElement())
     {
         reader.Skip();
     }
     reader.ReadEndElement();
     return info;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:39,代码来源:CreateSequenceResponse.cs

示例2: Create

        public static CreateSequenceResponseInfo Create(AddressingVersion addressingVersion,
            ReliableMessagingVersion reliableMessagingVersion, XmlDictionaryReader reader)
        {
            if (reader == null)
            {
                Fx.Assert("Argument reader cannot be null.");
            }

            CreateSequenceResponseInfo createSequenceResponse = new CreateSequenceResponseInfo();
            WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary;
            XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion);

            reader.ReadStartElement(wsrmFeb2005Dictionary.CreateSequenceResponse, wsrmNs);

            reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs);
            createSequenceResponse.Identifier = reader.ReadContentAsUniqueId();
            reader.ReadEndElement();

            if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs))
            {
                reader.ReadElementContentAsTimeSpan();
            }

            if (reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11)
            {
                if (reader.IsStartElement(DXD.Wsrm11Dictionary.IncompleteSequenceBehavior, wsrmNs))
                {
                    string incompleteSequenceBehavior = reader.ReadElementContentAsString();

                    if ((incompleteSequenceBehavior != Wsrm11Strings.DiscardEntireSequence)
                        && (incompleteSequenceBehavior != Wsrm11Strings.DiscardFollowingFirstGap)
                        && (incompleteSequenceBehavior != Wsrm11Strings.NoDiscard))
                    {
                        string reason = SR.GetString(SR.CSResponseWithInvalidIncompleteSequenceBehavior);
                        throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new XmlException(reason));
                    }

                    // Otherwise ignore the value.
                }
            }

            if (reader.IsStartElement(wsrmFeb2005Dictionary.Accept, wsrmNs))
            {
                reader.ReadStartElement();
                createSequenceResponse.AcceptAcksTo = EndpointAddress.ReadFrom(addressingVersion, reader,
                    wsrmFeb2005Dictionary.AcksTo, wsrmNs);
                while (reader.IsStartElement())
                {
                    reader.Skip();
                }
                reader.ReadEndElement();
            }

            while (reader.IsStartElement())
            {
                reader.Skip();
            }

            reader.ReadEndElement();

            return createSequenceResponse;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:62,代码来源:CreateSequenceResponse.cs

示例3: Create

 public static CreateSequenceInfo Create(MessageVersion messageVersion, ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession, XmlDictionaryReader reader)
 {
     CreateSequenceInfo info2;
     try
     {
         CreateSequenceInfo info = new CreateSequenceInfo();
         WsrmFeb2005Dictionary dictionary = XD.WsrmFeb2005Dictionary;
         XmlDictionaryString namespaceUri = WsrmIndex.GetNamespace(reliableMessagingVersion);
         reader.ReadStartElement(dictionary.CreateSequence, namespaceUri);
         info.AcksTo = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, dictionary.AcksTo, namespaceUri);
         if (reader.IsStartElement(dictionary.Expires, namespaceUri))
         {
             info.Expires = new TimeSpan?(reader.ReadElementContentAsTimeSpan());
         }
         if (!reader.IsStartElement(dictionary.Offer, namespaceUri))
         {
             goto Label_01B7;
         }
         reader.ReadStartElement();
         reader.ReadStartElement(dictionary.Identifier, namespaceUri);
         info.OfferIdentifier = reader.ReadContentAsUniqueId();
         reader.ReadEndElement();
         bool flag = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;
         Wsrm11Dictionary dictionary2 = flag ? DXD.Wsrm11Dictionary : null;
         if (flag && (EndpointAddress.ReadFrom(messageVersion.Addressing, reader, dictionary2.Endpoint, namespaceUri).Uri != info.AcksTo.Uri))
         {
             string str2 = System.ServiceModel.SR.GetString("CSRefusedAcksToMustEqualEndpoint");
             Message message = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str2);
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message, str2, new ProtocolException(str2)));
         }
         if (reader.IsStartElement(dictionary.Expires, namespaceUri))
         {
             info.OfferExpires = new TimeSpan?(reader.ReadElementContentAsTimeSpan());
         }
         if (!flag || !reader.IsStartElement(dictionary2.IncompleteSequenceBehavior, namespaceUri))
         {
             goto Label_01A9;
         }
         string str3 = reader.ReadElementContentAsString();
         if ((!(str3 != "DiscardEntireSequence") || !(str3 != "DiscardFollowingFirstGap")) || !(str3 != "NoDiscard"))
         {
             goto Label_01A9;
         }
         string reason = System.ServiceModel.SR.GetString("CSRefusedInvalidIncompleteSequenceBehavior");
         Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason)));
     Label_01A3:
         reader.Skip();
     Label_01A9:
         if (reader.IsStartElement())
         {
             goto Label_01A3;
         }
         reader.ReadEndElement();
     Label_01B7:
         if (securitySession == null)
         {
             goto Label_0217;
         }
         bool flag2 = false;
         while (reader.IsStartElement())
         {
             if (securitySession.TryReadSessionTokenIdentifier(reader))
             {
                 flag2 = true;
                 break;
             }
             reader.Skip();
         }
         if (flag2)
         {
             goto Label_0217;
         }
         string str5 = System.ServiceModel.SR.GetString("CSRefusedRequiredSecurityElementMissing");
         Message message3 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str5);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message3, str5, new ProtocolException(str5)));
     Label_0211:
         reader.Skip();
     Label_0217:
         if (reader.IsStartElement())
         {
             goto Label_0211;
         }
         reader.ReadEndElement();
         if (reader.IsStartElement())
         {
             string str6 = System.ServiceModel.SR.GetString("CSRefusedUnexpectedElementAtEndOfCSMessage");
             Message message4 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str6);
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message4, str6, new ProtocolException(str6)));
         }
         info2 = info;
     }
     catch (XmlException exception)
     {
         string str7 = System.ServiceModel.SR.GetString("CouldNotParseWithAction", new object[] { WsrmIndex.GetCreateSequenceActionString(reliableMessagingVersion) });
         Message message5 = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, str7);
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(message5, str7, new ProtocolException(str7, exception)));
     }
     return info2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:100,代码来源:CreateSequence.cs

示例4: Create

        public static CreateSequenceInfo Create(MessageVersion messageVersion,
            ReliableMessagingVersion reliableMessagingVersion, ISecureConversationSession securitySession,
            XmlDictionaryReader reader)
        {
            if (reader == null)
            {
                Fx.Assert("Argument reader cannot be null.");
            }

            try
            {
                CreateSequenceInfo info = new CreateSequenceInfo();
                WsrmFeb2005Dictionary wsrmFeb2005Dictionary = XD.WsrmFeb2005Dictionary;
                XmlDictionaryString wsrmNs = WsrmIndex.GetNamespace(reliableMessagingVersion);
                reader.ReadStartElement(wsrmFeb2005Dictionary.CreateSequence, wsrmNs);

                info.AcksTo = EndpointAddress.ReadFrom(messageVersion.Addressing, reader, wsrmFeb2005Dictionary.AcksTo, wsrmNs);

                if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs))
                {
                    info.Expires = reader.ReadElementContentAsTimeSpan();
                }

                if (reader.IsStartElement(wsrmFeb2005Dictionary.Offer, wsrmNs))
                {
                    reader.ReadStartElement();

                    reader.ReadStartElement(wsrmFeb2005Dictionary.Identifier, wsrmNs);
                    info.OfferIdentifier = reader.ReadContentAsUniqueId();
                    reader.ReadEndElement();

                    bool wsrm11 = reliableMessagingVersion == ReliableMessagingVersion.WSReliableMessaging11;
                    Wsrm11Dictionary wsrm11Dictionary = wsrm11 ? DXD.Wsrm11Dictionary : null;

                    if (wsrm11)
                    {
                        EndpointAddress endpoint = EndpointAddress.ReadFrom(messageVersion.Addressing, reader,
                            wsrm11Dictionary.Endpoint, wsrmNs);

                        if (endpoint.Uri != info.AcksTo.Uri)
                        {
                            string reason = SR.GetString(SR.CSRefusedAcksToMustEqualEndpoint);
                            Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason);
                            throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(WsrmMessageInfo.CreateInternalFaultException(faultReply, reason, new ProtocolException(reason)));
                        }
                    }

                    if (reader.IsStartElement(wsrmFeb2005Dictionary.Expires, wsrmNs))
                    {
                        info.OfferExpires = reader.ReadElementContentAsTimeSpan();
                    }

                    if (wsrm11)
                    {
                        if (reader.IsStartElement(wsrm11Dictionary.IncompleteSequenceBehavior, wsrmNs))
                        {
                            string incompleteSequenceBehavior = reader.ReadElementContentAsString();

                            if ((incompleteSequenceBehavior != Wsrm11Strings.DiscardEntireSequence)
                                && (incompleteSequenceBehavior != Wsrm11Strings.DiscardFollowingFirstGap)
                                && (incompleteSequenceBehavior != Wsrm11Strings.NoDiscard))
                            {
                                string reason = SR.GetString(SR.CSRefusedInvalidIncompleteSequenceBehavior);
                                Message faultReply = WsrmUtilities.CreateCSRefusedProtocolFault(messageVersion, reliableMessagingVersion, reason);
                                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(
                                    WsrmMessageInfo.CreateInternalFaultException(faultReply, reason,
                                    new ProtocolException(reason)));
                            }

                            // Otherwise ignore the value.
                        }
                    }

                    while (reader.IsStartElement())
                    {
                        reader.Skip();
                    }

                    reader.ReadEndElement();
                }

                // Check for security only if we expect a soap security session.
                if (securitySession != null)
                {
                    bool hasValidToken = false;

                    // Since the security element is amongst the extensible elements (i.e. there is no 
                    // gaurantee of ordering or placement), a loop is required to attempt to parse the 
                    // security element.
                    while (reader.IsStartElement())
                    {
                        if (securitySession.TryReadSessionTokenIdentifier(reader))
                        {
                            hasValidToken = true;
                            break;
                        }

                        reader.Skip();
                    }

//.........这里部分代码省略.........
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:101,代码来源:CreateSequence.cs


注:本文中的System.Xml.XmlDictionaryReader.ReadElementContentAsTimeSpan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。