ReadContentAsInt() public method

public ReadContentAsInt ( ) : int
return int
Beispiel #1
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "label":
     this.Label = reader.Value;
     continue;
       case "width":
     this.Width = reader.ReadContentAsInt();
     continue;
       case "height":
     this.Height = reader.ReadContentAsInt();
     continue;
       case "source":
     this.Source = reader.Value;
     continue;
       case "url":
     this.Url = reader.Value;
     continue;
       case "media":
     this.MediaType = reader.Value == "photo" ? MediaType.Photos : MediaType.Videos;
     continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
Beispiel #2
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     if (!(reader.LocalName != "subscription"))
     ;
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "topic":
     this.Topic = reader.Value;
     continue;
       case "callback":
     this.Callback = reader.Value;
     continue;
       case "pending":
     this.IsPending = reader.Value == "1";
     continue;
       case "date_create":
     this.DateCreated = UtilityMethods.UnixTimestampToDate(reader.Value);
     continue;
       case "lease_seconds":
     this.LeaseSeconds = reader.ReadContentAsInt();
     continue;
       case "expiry":
     this.Expiry = UtilityMethods.UnixTimestampToDate(reader.Value);
     continue;
       case "verify_attempts":
     this.VerifyAttempts = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
Beispiel #3
0
    public void ReadXml(System.Xml.XmlReader reader)
    {
        reader.MoveToAttribute("Width");
        Width = reader.ReadContentAsInt();
        reader.MoveToAttribute("Height");
        Height = reader.ReadContentAsInt();
        reader.MoveToElement();

        SetupWorld(Width, Height);

        while (reader.Read())
        {
            switch (reader.Name)
            {
            case "Tiles":
                ReadXML_Tiles(reader);
                break;

            case "StaticObjects":
                ReadXml_StaticObjects(reader);
                break;

            case "Characters":
                ReadXml_Characters(reader);
                break;
            }
        }
    }
Beispiel #4
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "ready":
     this.Ready = reader.Value == "1";
     continue;
       case "failed":
     this.Failed = reader.Value == "1";
     continue;
       case "pending":
     this.Pending = reader.Value == "1";
     continue;
       case "duration":
     this.Duration = !string.IsNullOrEmpty(reader.Value) ? reader.ReadContentAsInt() : -1;
     continue;
       case "width":
     this.Width = !string.IsNullOrEmpty(reader.Value) ? reader.ReadContentAsInt() : -1;
     continue;
       case "height":
     this.Height = !string.IsNullOrEmpty(reader.Value) ? reader.ReadContentAsInt() : -1;
     continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
Beispiel #5
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "usage":
     this.Usage = reader.ReadContentAsInt();
     continue;
       case "predicate":
     this.PredicateName = reader.Value;
     continue;
       case "namespace":
     this.NamespaceName = reader.Value;
     continue;
       case "first_added":
     this.DateFirstAdded = new DateTime?(UtilityMethods.UnixTimestampToDate(reader.Value));
     continue;
       case "last_added":
     this.DateLastUsed = new DateTime?(UtilityMethods.UnixTimestampToDate(reader.Value));
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       if (reader.NodeType == XmlNodeType.Text)
     this.ValueText = reader.ReadContentAsString();
       reader.Read();
 }
Beispiel #6
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "id":
     this.LicenseId = (LicenseType) reader.ReadContentAsInt();
     continue;
       case "name":
     this.LicenseName = reader.Value;
     continue;
       case "url":
     if (!string.IsNullOrEmpty(reader.Value))
     {
       this.LicenseUrl = reader.Value;
       continue;
     }
     else
       continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
Beispiel #7
0
 public static int readInt(XmlReader reader, string nodeName)
 {
     reader.ReadStartElement(nodeName);
     int i = reader.ReadContentAsInt();
     reader.ReadEndElement();
     return i;
 }
        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "usage":
                        Usage = reader.ReadContentAsInt();
                        break;
                    case "predicate":
                        PredicateName = reader.Value;
                        break;
                    case "namespace":
                        NamespaceName = reader.Value;
                        break;
                    case "first_added":
                        DateFirstAdded = UtilityMethods.UnixTimestampToDate(reader.Value);
                        break;
                    case "last_added":
                        DateLastUsed = UtilityMethods.UnixTimestampToDate(reader.Value);
                        break;
                }
            }

            reader.Read();

            if (reader.NodeType == XmlNodeType.Text)
                ValueText = reader.ReadContentAsString();

            reader.Read();
        }
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "place_type")
                UtilityMethods.CheckParsingException(reader);

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "place_type_id":
                    case "id":
                        Id = reader.ReadContentAsInt();
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();

            Name = reader.ReadContentAsString();

            reader.Skip();
        }
        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "usage":
                        Usage = reader.ReadContentAsInt();
                        break;
                    case "predicate":
                        PredicateName = reader.Value;
                        break;
                    case "namespace":
                        NamespaceName = reader.Value;
                        break;
                }
            }

            reader.Read();

            if (reader.NodeType == XmlNodeType.Text)
                PairName = reader.ReadContentAsString();

            reader.Read();
        }
Beispiel #11
0
 //public static string HostAddress
 //{
 //    get
 //    {
 //        foreach (IPAddress address in Dns.GetHostAddresses (Dns.GetHostName ())) {
 //            if (address.AddressFamily == AddressFamily.InterNetwork) {
 //                return address;
 //            }
 //        }
 //    }
 //}
 public static Version DeserializeSpecVersion(XmlReader reader)
 {
     try {
         // We assume the elements appear in this order
         reader.ReadToFollowing ("major");
         reader.Read ();
         var major = reader.ReadContentAsInt ();
         reader.ReadToFollowing ("minor");
         reader.Read ();
         var minor = reader.ReadContentAsInt ();
         return new Version (major, minor);
     } catch (Exception e) {
         throw new UpnpDeserializationException ("There was a problem deserializing a spec version.", e);
     } finally {
         reader.Close ();
     }
 }
Beispiel #12
0
        public static int ReadElementAsInt(this XmlReader xw, string localName)
        {
            xw.ReadStartElement(localName);
            var result = xw.ReadContentAsInt();

            xw.ReadEndElement();
            return(result);
        }
Beispiel #13
0
 public void FromXml(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
     {
         if (reader.Name == "Width")
             Width = reader.ReadContentAsInt();
         else if (reader.Name == "Height")
             Height = reader.ReadContentAsInt();
         else if (reader.Name == "Name")
             Name = reader.ReadContentAsString();
         else if (reader.Name == "PositionNaming")
         {
             var index = reader.ReadContentAsInt();
             if (index < PositionNamings.Defined.Length) PositionNaming = PositionNamings.Defined[index];
         }
     }
     reader.MoveToElement();
 }
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader == null) throw new ArgumentNullException("reader");

            if (!reader.ReadToFollowing("photos"))
                throw new ResponseXmlException("Unable to find \"photos\" element in response.");

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "maxdisplaypx":
                        MaximumDisplayPixels = reader.ReadContentAsInt();
                        break;
                    case "maxupload":
                        MaximumPhotoUpload = reader.ReadContentAsLong();
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            if (!reader.ReadToFollowing("videos"))
                throw new ResponseXmlException("Unable to find \"videos\" element in response.");

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "maxduration":
                        MaximumVideoDuration = reader.ReadContentAsInt();
                        break;
                    case "maxupload":
                        MaximumVideoUpload = reader.ReadContentAsLong();
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Skip();
        }
Beispiel #15
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "usage":
     this.Usage = reader.ReadContentAsInt();
     continue;
       case "predicates":
     this.Predicates = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       if (reader.NodeType == XmlNodeType.Text)
     this.NamespaceName = reader.ReadContentAsString();
       reader.Read();
 }
Beispiel #16
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "count":
     this.Count = reader.ReadContentAsInt();
     continue;
       case "mode":
     this.Mode = GroupThrottleInfo.ParseMode(reader.Value);
     continue;
       case "remaining":
     this.Remaining = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
 }
        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            if (reader.LocalName != "people")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "total":
                    Total = reader.ReadContentAsInt();
                    break;

                case "photo_width":
                    PhotoWidth = reader.ReadContentAsInt();
                    break;

                case "photo_height":
                    PhotoHeight = reader.ReadContentAsInt();
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();

            while (reader.LocalName == "person")
            {
                var item = new PhotoPerson();
                ((IFlickrParsable)item).Load(reader);
                Add(item);
            }

            reader.Skip();
        }
Beispiel #18
0
 public static Firewall load(XmlReader reader)
 {
     while (reader.Name != "firewall")
         reader.Read();
     var complexity = 0;
     string solution = null;
     var additionalTime = 0.0f;
     if (reader.MoveToAttribute("complexity"))
         complexity = reader.ReadContentAsInt();
     if (reader.MoveToAttribute("solution"))
         solution = reader.ReadContentAsString();
     if (reader.MoveToAttribute("additionalDelay"))
         additionalTime = reader.ReadContentAsFloat();
     return new Firewall(complexity, solution, additionalTime);
 }
Beispiel #19
0
 public static UserDetail loadUserDetail(XmlReader reader)
 {
     reader.MoveToAttribute("name");
     var user = reader.ReadContentAsString();
     reader.MoveToAttribute("pass");
     var password = reader.ReadContentAsString();
     reader.MoveToAttribute("type");
     var accountType = (byte) reader.ReadContentAsInt();
     reader.MoveToAttribute("known");
     var flag = reader.ReadContentAsString().ToLower().Equals("true");
     return new UserDetail(user, password, accountType)
     {
         known = flag
     };
 }
Beispiel #20
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "count":
     this.Count = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       this.TagName = reader.ReadContentAsString();
       reader.Read();
 }
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
     {
         switch (reader.LocalName)
         {
             case "nsid":
                 UserId = reader.Value;
                 break;
             case "geoperms":
                 GeoPermissions = (GeoPermissionType) reader.ReadContentAsInt();
                 break;
             case "importgeoexif":
                 ImportGeoExif = reader.Value == "1";
                 break;
         }
     }
 }
Beispiel #22
0
        public static StateCategory Parse(XmlReader reader)
        {
            StateCategory state = new StateCategory();

            while (reader.Read())
            {
                if (reader.Name == "availability")
                {
                    while (reader.Read() && reader.NodeType != XmlNodeType.Text) ;
                    state.Availability = reader.ReadContentAsInt();
                }

                if (reader.Name == "state" && reader.NodeType == XmlNodeType.EndElement)
                    break;
            }

            return state;
        }
Beispiel #23
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "score":
     this.Score = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       if (reader.NodeType == XmlNodeType.Text)
     this.Tag = reader.ReadContentAsString();
       reader.Read();
 }
Beispiel #24
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     this.Tags = new Collection<string>();
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "total":
     this.TotalTags = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       while (reader.LocalName == "tag")
     this.Tags.Add(reader.ReadElementContentAsString());
       reader.Read();
 }
Beispiel #25
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     if (!(reader.LocalName != "place_type"))
     ;
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "place_type_id":
       case "id":
     this.Id = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       this.Name = reader.ReadContentAsString();
       reader.Skip();
 }
        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "ready":
                        Ready = reader.Value == "1";
                        break;
                    case "failed":
                        Failed = reader.Value == "1";
                        break;
                    case "pending":
                        Pending = reader.Value == "1";
                        break;
                    case "duration":
                        if (String.IsNullOrEmpty(reader.Value))
                            Duration = -1;
                        else
                            Duration = reader.ReadContentAsInt();
                        break;
                    case "width":
                        if (String.IsNullOrEmpty(reader.Value))
                            Width = -1;
                        else
                            Width = reader.ReadContentAsInt();
                        break;
                    case "height":
                        if (String.IsNullOrEmpty(reader.Value))
                            Height = -1;
                        else
                            Height = reader.ReadContentAsInt();
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                }
            }

            reader.Read();
        }
        void IFlickrParsable.Load(XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "id":
                        TicketId = reader.Value;
                        break;
                    case "invalid":
                        InvalidTicketId = true;
                        break;
                    case "photoid":
                        PhotoId = reader.Value;
                        break;
                    case "complete":
                        CompleteStatus = reader.ReadContentAsInt();
                        break;
                }
            }

            reader.Skip();
        }
        void IFlickrParsable.Load(XmlReader reader)
        {
            Tags = new Collection<string>();

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "total":
                        TotalTags = reader.ReadContentAsInt();
                        break;
                }
            }

            reader.Read();

            while (reader.LocalName == "tag")
            {
                Tags.Add(reader.ReadElementContentAsString());
            }

            reader.Read();
        }
Beispiel #29
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "id":
     this.TicketId = reader.Value;
     continue;
       case "invalid":
     this.InvalidTicketId = true;
     continue;
       case "photoid":
     this.PhotoId = reader.Value;
     continue;
       case "complete":
     this.CompleteStatus = reader.ReadContentAsInt();
     continue;
       default:
     continue;
     }
       }
       reader.Skip();
 }
Beispiel #30
0
        public void ReadXml(XmlReader reader)
        {
            if (reader.HasAttributes)
            {
                while (reader.MoveToNextAttribute())
                {
                    switch (reader.Name)
                    {
                        case "LogGUID":
                            LogGUID = reader.ReadContentAsString();
                            break;
                        case "LogFileID":
                            LogFileID = reader.ReadContentAsString();
                            break;
                        case "LogTypeKey":
                            LogTypeKey = reader.ReadContentAsString();
                            break;
                        case "LogUserID":
                            LogUserID = reader.ReadContentAsInt();
                            break;
                        case "LogUserName":
                            LogUserName = reader.ReadContentAsString();
                            break;
                        case "LogPortalID":
                            LogPortalID = reader.ReadContentAsInt();
                            break;
                        case "LogPortalName":
                            LogPortalName = reader.ReadContentAsString();
                            break;
                        case "LogCreateDate":
                            LogCreateDate = DateTime.Parse(reader.ReadContentAsString());
                            break;
                        case "LogCreateDateNum":
                            LogCreateDateNum = reader.ReadContentAsLong();
                            break;
                        case "BypassBuffering":
                            BypassBuffering = bool.Parse(reader.ReadContentAsString());
                            break;
                        case "LogServerName":
                            LogServerName = reader.ReadContentAsString();
                            break;
                        case "LogConfigID":
                            LogConfigID = reader.ReadContentAsString();
                            break;
                    }
                }
            }
			
            //Check for LogProperties child node
            reader.Read();
            if (reader.NodeType == XmlNodeType.Element && reader.LocalName == "LogProperties")
            {
                reader.ReadStartElement("LogProperties");
                if (reader.ReadState != ReadState.EndOfFile && reader.NodeType != XmlNodeType.None && !String.IsNullOrEmpty(reader.LocalName))
                {
                    LogProperties.ReadXml(reader);
                }
            }
        }
Beispiel #31
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
     {
         switch (reader.LocalName)
         {
             case "count":
                 Count = reader.ReadContentAsInt();
                 break;
             case "mode":
                 Mode = ParseMode(reader.Value);
                 break;
             case "remaining":
                 Remaining = reader.ReadContentAsInt();
                 break;
         }
     }
     reader.Read();
 }
Beispiel #32
0
        private void LoadAttributes(System.Xml.XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "name":
                    Description = reader.Value;
                    break;

                case "place_id":
                    PlaceId = reader.Value;
                    break;

                case "place_url":
                    PlaceUrl = reader.Value;
                    break;

                case "place_type_id":
                    PlaceType = (PlaceType)reader.ReadContentAsInt();
                    break;

                case "place_type":
                    PlaceType = (PlaceType)Enum.Parse(typeof(PlaceType), reader.Value, true);
                    break;

                case "woeid":
                    WoeId = reader.Value;
                    break;

                case "woe_name":
                    WoeName = reader.Value;
                    break;

                case "latitude":
                    Latitude = reader.ReadContentAsDouble();
                    break;

                case "longitude":
                    Longitude = reader.ReadContentAsDouble();
                    break;

                case "accuracy":
                    Accuracy = (GeoAccuracy)reader.ReadContentAsInt();
                    break;

                case "context":
                    Context = (GeoContext)reader.ReadContentAsInt();
                    break;

                case "timezone":
                    TimeZone = reader.Value;
                    break;

                case "has_shapedata":
                    HasShapeData = reader.Value == "1";
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();
        }
 public override int ReadContentAsInt()
 {
     CheckAsync();
     return(_coreReader.ReadContentAsInt());
 }
Beispiel #34
0
        /// <summary>
        /// Serializes the XML to an instance.
        /// </summary>
        /// <param name="reader"></param>
        void IFlickrParsable.Load(System.Xml.XmlReader reader)
        {
            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "name":
                    Description = reader.Value;
                    break;

                case "place_id":
                    PlaceId = reader.Value;
                    break;

                case "place_url":
                    PlaceUrl = reader.Value;
                    break;

                case "place_type_id":
                    PlaceType = (PlaceType)reader.ReadContentAsInt();
                    break;

                case "place_type":
                    PlaceType = (PlaceType)Enum.Parse(typeof(PlaceType), reader.Value, true);
                    break;

                case "woeid":
                    WoeId = reader.Value;
                    break;

                case "woe_name":
                    WoeName = reader.Value;
                    break;

                case "latitude":
                    Latitude = reader.ReadContentAsDouble();
                    break;

                case "longitude":
                    Longitude = reader.ReadContentAsDouble();
                    break;

                case "timezone":
                    TimeZone = reader.Value;
                    break;

                case "photo_count":
                    PhotoCount = reader.ReadContentAsInt();
                    break;

                default:
                    UtilityMethods.CheckParsingException(reader);
                    break;
                }
            }

            reader.Read();

            while (reader.NodeType != XmlNodeType.EndElement)
            {
                if (reader.NodeType == XmlNodeType.Text)
                {
                    Description = reader.ReadContentAsString();
                }
                else
                {
                    switch (reader.LocalName)
                    {
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;
                    }
                }
            }

            reader.Read();
        }
Beispiel #35
0
 private void ParseSets(XmlReader reader)
 {
     while (reader.MoveToNextAttribute())
     {
         switch (reader.LocalName)
         {
             case "created":
                 if (!String.IsNullOrEmpty(reader.Value))
                     SetsCreated = reader.ReadContentAsInt();
                 break;
             case "remaining":
                 if (!String.IsNullOrEmpty(reader.Value) && reader.Value != "lots")
                     SetsRemaining = reader.ReadContentAsInt();
                 break;
             default:
                 UtilityMethods.CheckParsingException(reader);
                 break;
         }
     }
     reader.Read();
 }
Beispiel #36
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     if (reader == null)
     throw new ArgumentNullException("reader");
       if (reader.LocalName != "suggestion")
     return;
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "id":
     this.SuggestionId = reader.Value;
     continue;
       case "photo_id":
     this.PhotoId = reader.Value;
     continue;
       case "date_suggested":
     this.DateSuggested = UtilityMethods.UnixTimestampToDate(reader.Value);
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       while (reader.LocalName != "suggestion" && reader.NodeType != XmlNodeType.EndElement)
       {
     switch (reader.LocalName)
     {
       case "suggested_by":
     this.SuggestedByUserId = reader.GetAttribute("nsid");
     this.SuggestedByUserName = reader.GetAttribute("username");
     reader.Skip();
     continue;
       case "note":
     this.Note = reader.ReadElementContentAsString();
     continue;
       case "location":
     while (reader.MoveToNextAttribute())
     {
       switch (reader.LocalName)
       {
         case "woeid":
           this.WoeId = reader.Value;
           continue;
         case "latitude":
           this.Latitude = reader.ReadContentAsDouble();
           continue;
         case "longitude":
           this.Longitude = reader.ReadContentAsDouble();
           continue;
         case "accuracy":
           this.Accuracy = (GeoAccuracy) reader.ReadContentAsInt();
           continue;
         default:
           continue;
       }
     }
     reader.Skip();
     continue;
       default:
     continue;
     }
       }
 }
Beispiel #37
0
        private CategoryDirectory ReadResult(System.Xml.XmlReader reader, bool securityTrimmingEnabled)
        {
            CategoryDirectory result = null;

            if (reader.NodeType == System.Xml.XmlNodeType.Element)
            {
                if (reader.LocalName == "category" && reader.NamespaceURI == ns)
                {
                    if (DeterminVisible(reader) && DeterminSecure(securityTrimmingEnabled, reader))
                    {
                        result = new CategoryDirectory();
                        if (reader.MoveToAttribute("name"))
                        {
                            result.Name = reader.Value;
                        }

                        if (reader.MoveToAttribute("title"))
                        {
                            result.Title = reader.Value;
                        }

                        reader.MoveToElement();
                    }
                }
                else if (reader.LocalName == "item" && reader.NamespaceURI == ns)
                {
                    if (DeterminVisible(reader) && DeterminSecure(securityTrimmingEnabled, reader))
                    {
                        result = new CategoryLink();
                        if (reader.MoveToAttribute("name"))
                        {
                            result.Name = reader.Value;
                        }
                        if (reader.MoveToAttribute("title"))
                        {
                            result.Title = reader.Value;
                        }
                        if (reader.MoveToAttribute("group"))
                        {
                            ((CategoryLink)result).Group = reader.ReadContentAsInt();
                        }
                        if (reader.MoveToAttribute("href"))
                        {
                            ((CategoryLink)result).Url = reader.Value;
                        }
                        if (reader.MoveToAttribute("role"))
                        {
                            ((CategoryLink)result).Role = reader.Value;
                        }
                        if (reader.MoveToAttribute("feature"))
                        {
                            ((CategoryLink)result).Feature = reader.Value;
                        }
                    }
                }
                else if (reader.LocalName == "group" && reader.NamespaceURI == ns)
                {
                    if (DeterminVisible(reader) && DeterminSecure(securityTrimmingEnabled, reader))
                    {
                        result = new CategoryGroup();
                        if (reader.MoveToAttribute("name"))
                        {
                            result.Name = reader.Value;
                        }
                        if (reader.MoveToAttribute("title"))
                        {
                            result.Title = reader.Value;
                        }
                        reader.MoveToElement();
                        ArrayList list = new ArrayList();

                        ReadSubItems(reader, list, securityTrimmingEnabled);
                        ((CategoryGroup)result).Categories = (CategoryDirectory[])list.ToArray(typeof(CategoryDirectory));
                    }
                    else
                    {
                        var level = reader.Depth;
                        while (reader.Read() && reader.Depth > level)
                        {
                            reader.Skip(); //跳过其任何子节点
                        }
                    }
                }
            }

            reader.MoveToElement();

            return(result);
        }