示例#1
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "method")
            {
                UtilityMethods.CheckParsingException(reader);
            }

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                case "name":
                    Name = reader.Value;
                    break;

                case "needslogin":
                    NeedsLogin = reader.Value == "1";
                    break;

                case "needssigning":
                    NeedsSigning = reader.Value == "1";
                    break;

                case "requiredperms":
                    RequiredPermissions = (MethodPermission)int.Parse(reader.Value, System.Globalization.NumberFormatInfo.InvariantInfo);
                    break;

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

            reader.Read();

            while (reader.LocalName != "method")
            {
                switch (reader.LocalName)
                {
                case "description":
                    Description = reader.ReadElementContentAsString();
                    break;

                case "response":
                    Response = reader.ReadElementContentAsString();
                    break;

                case "explanation":
                    Explanation = reader.ReadElementContentAsString();
                    break;
                }
            }

            reader.ReadToFollowing("argument");

            while (reader.LocalName == "argument")
            {
                MethodArgument a = new MethodArgument();
                ((IFlickrParsable)a).Load(reader);
                Arguments.Add(a);
            }
            reader.ReadToFollowing("error");

            while (reader.LocalName == "error")
            {
                MethodError e = new MethodError();
                ((IFlickrParsable)e).Load(reader);
                Errors.Add(e);
            }
            reader.Read();

            reader.Skip();
        }
示例#2
0
文件: Method.cs 项目: rmck/FlickrNet
 void IFlickrParsable.Load(XmlReader reader)
 {
     if (!(reader.LocalName != "method"))
     ;
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "name":
     this.Name = reader.Value;
     continue;
       case "needslogin":
     this.NeedsLogin = reader.Value == "1";
     continue;
       case "needssigning":
     this.NeedsSigning = reader.Value == "1";
     continue;
       case "requiredperms":
     this.RequiredPermissions = (MethodPermission) int.Parse(reader.Value, (IFormatProvider) NumberFormatInfo.InvariantInfo);
     continue;
       default:
     continue;
     }
       }
       reader.Read();
       while (reader.LocalName != "method")
       {
     switch (reader.LocalName)
     {
       case "description":
     this.Description = reader.ReadElementContentAsString();
     continue;
       case "response":
     this.Response = reader.ReadElementContentAsString();
     continue;
       case "explanation":
     this.Explanation = reader.ReadElementContentAsString();
     continue;
       default:
     continue;
     }
       }
       reader.ReadToFollowing("argument");
       while (reader.LocalName == "argument")
       {
     MethodArgument methodArgument = new MethodArgument();
     methodArgument.Load(reader);
     this.Arguments.Add(methodArgument);
       }
       reader.ReadToFollowing("error");
       while (reader.LocalName == "error")
       {
     MethodError methodError = new MethodError();
     methodError.Load(reader);
     this.Errors.Add(methodError);
       }
       reader.Read();
       reader.Skip();
 }