상속: IFlickrParsable
예제 #1
0
        public FakeCollectionCollection()
        {
            fake_collection = new CollectionCollection();

            // ------------- Highest level -----------
            FlickrNet.Collection colA = new Collection();
            colA.Title = "Collection A";
            colA.CollectionId = "A";

            FlickrNet.Collection colB = new Collection();
            colB.Title = "Collection B";
            colB.CollectionId = "B";

            fake_collection.Add(colA);
            fake_collection.Add(colB);

            // ------------ Second level --------------
            FlickrNet.Collection colAA = new Collection();
            colAA.Title = "Collection A.A";
            colAA.CollectionId = "A.A";

            FlickrNet.Collection colAB = new Collection();
            colAB.Title = "Collection A.B";
            colAB.CollectionId = "A.B";

            colA.Collections.Add(colAA);
            colA.Collections.Add(colAB);

            // ------------ Photo sets ---------------
            CollectionSet ps1 = new CollectionSet();
            ps1.SetId = "ps1";
            ps1.Title = "PhotoSet 1";

            CollectionSet ps2 = new CollectionSet();
            ps2.SetId = "ps2";
            ps2.Title = "PhotoSet 2";

            colAA.Sets.Add(ps1);
            colB.Sets.Add(ps2);
        }
예제 #2
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "collection")
            {
                UtilityMethods.CheckParsingException(reader);
            }

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

                case "title":
                    Title = reader.Value;
                    break;

                case "description":
                    Description = reader.Value;
                    break;

                case "iconlarge":
                    IconLarge = reader.Value;
                    break;

                case "iconsmall":
                    IconSmall = reader.Value;
                    break;

                case "url":
                    Url = reader.Value;
                    break;

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

            reader.MoveToElement();

            // If this is an empty collection then skip to next item, which wont be a child, but may be a sibling.
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }

            reader.Read();

            while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set"))
            {
                if (reader.LocalName == "collection")
                {
                    var c = new Collection();
                    ((IFlickrParsable)c).Load(reader);
                    _subcollections.Add(c);
                }
                else
                {
                    var s = new CollectionSet();
                    ((IFlickrParsable)s).Load(reader);
                    _subsets.Add(s);
                }
            }

            // Skip to next element (if any)
            reader.Skip();
        }
예제 #3
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "collection")
            {
                UtilityMethods.CheckParsingException(reader);
            }

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

                case "title":
                    Title = reader.Value;
                    break;

                case "description":
                    Description = reader.Value;
                    break;

                case "iconlarge":
                    IconLarge = reader.Value;
                    break;

                case "iconsmall":
                    IconSmall = reader.Value;
                    break;

                case "url":
                    Url = reader.Value;
                    break;

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

            reader.Read();

            while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set"))
            {
                if (reader.LocalName == "collection")
                {
                    Collection c = new Collection();
                    ((IFlickrParsable)c).Load(reader);
                    subcollections.Add(c);
                }
                else
                {
                    CollectionSet s = new CollectionSet();
                    ((IFlickrParsable)s).Load(reader);
                    subsets.Add(s);
                }
            }

            // Skip to next element (if any)
            reader.Skip();
        }
예제 #4
0
 void IFlickrParsable.Load(XmlReader reader)
 {
     if (!(reader.LocalName != "collection"))
     ;
       while (reader.MoveToNextAttribute())
       {
     switch (reader.LocalName)
     {
       case "id":
     this.CollectionId = reader.Value;
     continue;
       case "title":
     this.Title = reader.Value;
     continue;
       case "description":
     this.Description = reader.Value;
     continue;
       case "iconlarge":
     this.IconLarge = reader.Value;
     continue;
       case "iconsmall":
     this.IconSmall = reader.Value;
     continue;
       case "url":
     this.Url = reader.Value;
     continue;
       default:
     continue;
     }
       }
       reader.MoveToElement();
       if (reader.IsEmptyElement)
       {
     reader.Skip();
       }
       else
       {
     reader.Read();
     while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set"))
     {
       if (reader.LocalName == "collection")
       {
     Collection collection = new Collection();
     collection.Load(reader);
     this.subcollections.Add(collection);
       }
       else
       {
     CollectionSet collectionSet = new CollectionSet();
     collectionSet.Load(reader);
     this.subsets.Add(collectionSet);
       }
     }
     reader.Skip();
       }
 }
예제 #5
0
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "collection")
                UtilityMethods.CheckParsingException(reader);

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "id":
                        CollectionId = reader.Value;
                        break;
                    case "title":
                        Title = reader.Value;
                        break;
                    case "description":
                        Description = reader.Value;
                        break;
                    case "iconlarge":
                        IconLarge = reader.Value;
                        break;
                    case "iconsmall":
                        IconSmall = reader.Value;
                        break;
                    case "url":
                        Url = reader.Value;
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;

                }
            }

            reader.MoveToElement();

            // If this is an empty collection then skip to next item, which wont be a child, but may be a sibling.
            if (reader.IsEmptyElement)
            {
                reader.Skip();
                return;
            }

            reader.Read();

            while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set"))
            {
                if (reader.LocalName == "collection")
                {
                    var c = new Collection();
                    ((IFlickrParsable)c).Load(reader);
                    _subcollections.Add(c);

                }
                else
                {
                    var s = new CollectionSet();
                    ((IFlickrParsable)s).Load(reader);
                    _subsets.Add(s);
                }
            }

            // Skip to next element (if any)
            reader.Skip();
        }
예제 #6
0
파일: Collection.cs 프로젝트: liquidboy/X
        void IFlickrParsable.Load(XmlReader reader)
        {
            if (reader.LocalName != "collection")
                UtilityMethods.CheckParsingException(reader);

            while (reader.MoveToNextAttribute())
            {
                switch (reader.LocalName)
                {
                    case "id":
                        CollectionId = reader.Value;
                        break;
                    case "title":
                        Title = reader.Value;
                        break;
                    case "description":
                        Description = reader.Value;
                        break;
                    case "iconlarge":
                        IconLarge = reader.Value;
                        break;
                    case "iconsmall":
                        IconSmall = reader.Value;
                        break;
                    case "url":
                        Url = reader.Value;
                        break;
                    default:
                        UtilityMethods.CheckParsingException(reader);
                        break;

                }
            }

            reader.Read();

            while (reader.NodeType == XmlNodeType.Element && (reader.LocalName == "collection" || reader.LocalName == "set"))
            {
                if (reader.LocalName == "collection")
                {
                    Collection c = new Collection();
                    ((IFlickrParsable)c).Load(reader);
                    subcollections.Add(c);

                }
                else
                {
                    CollectionSet s = new CollectionSet();
                    ((IFlickrParsable)s).Load(reader);
                    subsets.Add(s);
                }
            }

            // Skip to next element (if any)
            reader.Skip();

        }