예제 #1
0
        public static Uri ReadScopes(Collection <Uri> scopes, XmlReader reader)
        {
            Uri scopeMatchBy = null;

            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    if ((reader.NamespaceURI.Length == 0) &&
                        (reader.Name.Equals(ProtocolStrings.SchemaNames.MatchByAttribute)))
                    {
                        string scopeMatchByStr = reader.Value;
                        try
                        {
                            scopeMatchBy = new Uri(scopeMatchByStr, UriKind.RelativeOrAbsolute);
                        }
                        catch (FormatException fe)
                        {
                            throw FxTrace.Exception.AsError(new XmlException(SR2.DiscoveryXmlUriFormatError(scopeMatchByStr), fe));
                        }
                        break;
                    }
                }

                reader.MoveToElement();
            }

            if (reader.IsEmptyElement)
            {
                reader.Read();
            }
            else
            {
                reader.ReadStartElement();

                string listOfUrisAsString = reader.ReadString();
                if (!string.IsNullOrEmpty(listOfUrisAsString))
                {
                    SerializationUtility.ParseUriList(listOfUrisAsString, scopes, UriKind.Absolute);
                }

                reader.ReadEndElement();
            }

            return(scopeMatchBy);
        }
예제 #2
0
        public static void ReadListenUris(Collection <Uri> listenUris, XmlReader reader)
        {
            if (reader.IsEmptyElement)
            {
                reader.Read();
            }
            else
            {
                reader.ReadStartElement();

                string listOfUrisAsString = reader.ReadString();
                if (!string.IsNullOrEmpty(listOfUrisAsString))
                {
                    SerializationUtility.ParseUriList(listOfUrisAsString, listenUris, UriKind.RelativeOrAbsolute);
                }

                reader.ReadEndElement();
            }
        }