コード例 #1
0
        /// <summary>
        ///
        /// </summary>
        protected internal virtual void LinkDataReaded()
        {
            var knowKeys = new List <XmlQualifiedName>();

            foreach (var extAttribute in AttributeExtensions)
            {
                if ("count".Equals(extAttribute.Key.Name, StringComparison.Ordinal) &&
                    OpdsNamespaces.Threading.Value.Equals(extAttribute.Key.Namespace, StringComparison.Ordinal))
                {
                    int count;
                    if (Int32.TryParse(extAttribute.Value, out count))
                    {
                        Count = count;
                    }
                }
                else if ("activeFacet".Equals(extAttribute.Key.Name, StringComparison.Ordinal) &&
                         OpdsNamespaces.Opds.Value.Equals(extAttribute.Key.Namespace, StringComparison.Ordinal))
                {
                    bool active;
                    if (Boolean.TryParse(extAttribute.Value, out active))
                    {
                        if (!active)
                        {
                            throw new XmlException("opds:activeFacet SOULD not has a value of 'false', just don't provide opds:activeFacet.");
                        }

                        ActiveFacet = true;
                    }
                }
                else if ("facetGroup".Equals(extAttribute.Key.Name, StringComparison.Ordinal) &&
                         OpdsNamespaces.Opds.Value.Equals(extAttribute.Key.Namespace, StringComparison.Ordinal))
                {
                    if (String.IsNullOrEmpty(extAttribute.Value))
                    {
                        throw new XmlException("opds:facetGroup SHOULD not be empty");
                    }

                    FacetGroup = extAttribute.Value;
                }
                else
                {
                    continue;
                }

                knowKeys.Add(extAttribute.Key);
            }

            // Remove parsed attributes.
            foreach (var key in knowKeys)
            {
                AttributeExtensions.Remove(key);
            }
        }