示例#1
0
        //public static Folder LoadFromXML(XmlNode node)
        //{
        //    Folder temp = new Folder();

        //    temp.ParseXML(node);

        //    return temp;
        //}

        private void ParseXML(XmlNode node)
        {
            if (node.Attributes.GetNamedItem("Name") != null)
            {
                nameField = node.Attributes.GetNamedItem("Name").Value;
            }
            else
            {
                nameField = "";
            }
            if (node.Attributes.GetNamedItem("Url") != null)
            {
                urlField = node.Attributes.GetNamedItem("Url").Value;
            }

            if (node.Attributes.GetNamedItem("Thumbnail") != null)
            {
                thumbnailUrlField = node.Attributes.GetNamedItem("Thumbnail").Value;
            }

            // load Children

            foreach (XmlNode child in node.ChildNodes)
            {
                switch (child.Name)
                {
                case "Folder":
                    Folder temp = new Folder();
                    temp.Parent = this;
                    //if (Parent != null && IsProxy)
                    //{
                    //    temp.Parent = Parent.Parent;
                    //}
                    temp.ParseXML(child);
                    folders.Add(temp);
                    break;

                case "Place":
                    places.Add(Place.FromXml(child));
                    break;

                case "ImageSet":
                    Imagesets.Add(Imageset.FromXMLNode(child));
                    break;

                case "Tour":
                    Tours.Add(Tour.FromXml(child));
                    break;
                }
            }


            //bool Browseable { get; set; }
            //System.Collections.Generic.List<Folder> Folders { get; set; }
            //FolderGroup Group { get; set; }
            //System.Collections.Generic.List<Imageset> Imagesets { get; set; }
            //long MSRCommunityId { get; set; }
            //long MSRComponentId { get; set; }
            //string Name { get; set; }
            //long Permission { get; set; }
            //System.Collections.Generic.List<Place> Places { get; set; }
            //bool ReadOnly { get; set; }
            //string RefreshInterval { get; set; }
            //FolderRefreshType RefreshType { get; set; }
            //bool RefreshTypeSpecified { get; set; }
            //bool Searchable { get; set; }
            //string SubType { get; set; }
            //string ThumbnailUrl { get; set; }
            //System.Collections.Generic.List<Tour> Tours { get; set; }
            //FolderType Type { get; set; }
            //string Url { get; set; }
        }
示例#2
0
        internal static Tour FromXml(System.Xml.XmlNode child)
        {
            Tour temp = new Tour();
            if (child.Attributes.GetNamedItem("ID") != null)
            {
                temp.Id = child.Attributes.GetNamedItem("ID").Value;
            }
            if (child.Attributes.GetNamedItem("TourUrl") != null)
            {
                temp.tourUrl = child.Attributes.GetNamedItem("TourUrl").Value;
            }

            if (child.Attributes.GetNamedItem("Title") != null)
            {
               temp.Title = child.Attributes.GetNamedItem("Title").Value;
            }

            if (child.Attributes.GetNamedItem("Description") != null)
            {
               temp.Description = child.Attributes.GetNamedItem("Description").Value;
            }
            if (child.Attributes.GetNamedItem("Classification") != null)
            {
                switch (child.Attributes.GetNamedItem("Classification").Value)
                {

                    case "Star":
                        temp.Classification = Classification.Star;
                        break;
                    case "Supernova":
                        temp.Classification = Classification.Supernova;
                        break;
                    case "BlackHole":
                        temp.Classification = Classification.BlackHole;
                        break;
                    case "NeutronStar":
                        temp.Classification = Classification.NeutronStar;
                        break;
                    case "DoubleStar":
                        temp.Classification = Classification.DoubleStar;
                        break;
                    case "MultipleStars":
                        temp.Classification = Classification.MultipleStars;
                        break;
                    case "Asterism":
                        temp.Classification = Classification.Asterism;
                        break;
                    case "Constellation":
                        temp.Classification = Classification.Constellation;
                        break;
                    case "OpenCluster":
                        temp.Classification = Classification.OpenCluster;
                        break;
                    case "GlobularCluster":
                        temp.Classification = Classification.GlobularCluster;
                        break;
                    case "NebulousCluster":
                        temp.Classification = Classification.NebulousCluster;
                        break;
                    case "Nebula":
                        temp.Classification = Classification.Nebula;
                        break;
                    case "EmissionNebula":
                        temp.Classification = Classification.EmissionNebula;
                        break;
                    case "PlanetaryNebula":
                        temp.Classification = Classification.PlanetaryNebula;
                        break;
                    case "ReflectionNebula":
                        temp.Classification = Classification.ReflectionNebula;
                        break;
                    case "DarkNebula":
                        temp.Classification = Classification.DarkNebula;
                        break;
                    case "GiantMolecularCloud":
                        temp.Classification = Classification.GiantMolecularCloud;
                        break;
                    case "SupernovaRemnant":
                        temp.Classification = Classification.SupernovaRemnant;
                        break;
                    case "InterstellarDust":
                        temp.Classification = Classification.InterstellarDust;
                        break;
                    case "Quasar":
                        temp.Classification = Classification.Quasar;
                        break;
                    case "Galaxy":
                        temp.Classification = Classification.Galaxy;
                        break;
                    case "SpiralGalaxy":
                        temp.Classification = Classification.SpiralGalaxy;
                        break;
                    case "IrregularGalaxy":
                        temp.Classification = Classification.IrregularGalaxy;
                        break;
                    case "EllipticalGalaxy":
                        temp.Classification = Classification.EllipticalGalaxy;
                        break;
                    case "Knot":
                        temp.Classification = Classification.Knot;
                        break;
                    case "PlateDefect":
                        temp.Classification = Classification.PlateDefect;
                        break;
                    case "ClusterOfGalaxies":
                        temp.Classification = Classification.ClusterOfGalaxies;
                        break;
                    case "OtherNGC":
                        temp.Classification = Classification.OtherNGC;
                        break;
                    case "Unidentified":
                        temp.Classification = Classification.Unidentified;
                        break;
                    case "SolarSystem":
                        temp.Classification = Classification.SolarSystem;
                        break;
                    case "Unfiltered":
                        temp.Classification = Classification.Unfiltered;
                        break;
                    case "Stellar":
                        temp.Classification = Classification.Stellar;
                        break;
                    case "StellarGroupings":
                        temp.Classification = Classification.StellarGroupings;
                        break;
                    case "Nebulae":
                        temp.Classification = Classification.Nebulae;
                        break;
                    case "Galactic":
                        temp.Classification = Classification.Galactic;
                        break;
                    case "Other":
                        temp.Classification = Classification.Other;
                        break;

                    default:
                        break;
                }

            }
            if (child.Attributes.GetNamedItem("AuthorEmail") != null)
            {
               temp.AuthorEmail = child.Attributes.GetNamedItem("AuthorEmail").Value;
            }
            if (child.Attributes.GetNamedItem("Author") != null)
            {
               temp.Author = child.Attributes.GetNamedItem("Author").Value;
            }
            if (child.Attributes.GetNamedItem("AuthorURL") != null)
            {
               temp.AuthorURL = child.Attributes.GetNamedItem("AuthorURL").Value;
            }

            if (child.Attributes.GetNamedItem("AuthorImageUrl") != null)
            {
                temp.AuthorImageUrl = child.Attributes.GetNamedItem("AuthorImageUrl").Value;
            }

            if (child.Attributes.GetNamedItem("AverageRating") != null)
            {
               temp.AverageRating = double.Parse(child.Attributes.GetNamedItem("AverageRating").Value);
            }
            if (child.Attributes.GetNamedItem("LengthInSecs") != null)
            {
               temp.LengthInSecs = double.Parse(child.Attributes.GetNamedItem("LengthInSecs").Value);
            }
            if (child.Attributes.GetNamedItem("OrganizationUrl") != null)
            {
              temp.OrganizationUrl  = child.Attributes.GetNamedItem("OrganizationUrl").Value;
            }
            if (child.Attributes.GetNamedItem("OrganizationName") != null)
            {
               temp.OrganizationName = child.Attributes.GetNamedItem("OrganizationName").Value;
            }
            if (child.Attributes.GetNamedItem("RelatedTours") != null)
            {
               temp.RelatedTours = child.Attributes.GetNamedItem("RelatedTours").Value;
            }
            if (child.Attributes.GetNamedItem("Keywords") != null)
            {
               temp.Keywords = child.Attributes.GetNamedItem("Keywords").Value;
            }
            if (child.Attributes.GetNamedItem("ThumbnailUrl") != null)
            {
                temp.ThumbnailUrl = child.Attributes.GetNamedItem("ThumbnailUrl").Value;
            }

            return temp;
        }
示例#3
0
        internal static Tour FromXml(System.Xml.XmlNode child)
        {
            Tour temp = new Tour();

            if (child.Attributes.GetNamedItem("ID") != null)
            {
                temp.Id = child.Attributes.GetNamedItem("ID").Value;
            }
            if (child.Attributes.GetNamedItem("TourUrl") != null)
            {
                temp.tourUrl = child.Attributes.GetNamedItem("TourUrl").Value;
            }

            if (child.Attributes.GetNamedItem("Title") != null)
            {
                temp.Title = child.Attributes.GetNamedItem("Title").Value;
            }

            if (child.Attributes.GetNamedItem("Description") != null)
            {
                temp.Description = child.Attributes.GetNamedItem("Description").Value;
            }
            if (child.Attributes.GetNamedItem("Classification") != null)
            {
                switch (child.Attributes.GetNamedItem("Classification").Value)
                {
                case "Star":
                    temp.Classification = Classification.Star;
                    break;

                case "Supernova":
                    temp.Classification = Classification.Supernova;
                    break;

                case "BlackHole":
                    temp.Classification = Classification.BlackHole;
                    break;

                case "NeutronStar":
                    temp.Classification = Classification.NeutronStar;
                    break;

                case "DoubleStar":
                    temp.Classification = Classification.DoubleStar;
                    break;

                case "MultipleStars":
                    temp.Classification = Classification.MultipleStars;
                    break;

                case "Asterism":
                    temp.Classification = Classification.Asterism;
                    break;

                case "Constellation":
                    temp.Classification = Classification.Constellation;
                    break;

                case "OpenCluster":
                    temp.Classification = Classification.OpenCluster;
                    break;

                case "GlobularCluster":
                    temp.Classification = Classification.GlobularCluster;
                    break;

                case "NebulousCluster":
                    temp.Classification = Classification.NebulousCluster;
                    break;

                case "Nebula":
                    temp.Classification = Classification.Nebula;
                    break;

                case "EmissionNebula":
                    temp.Classification = Classification.EmissionNebula;
                    break;

                case "PlanetaryNebula":
                    temp.Classification = Classification.PlanetaryNebula;
                    break;

                case "ReflectionNebula":
                    temp.Classification = Classification.ReflectionNebula;
                    break;

                case "DarkNebula":
                    temp.Classification = Classification.DarkNebula;
                    break;

                case "GiantMolecularCloud":
                    temp.Classification = Classification.GiantMolecularCloud;
                    break;

                case "SupernovaRemnant":
                    temp.Classification = Classification.SupernovaRemnant;
                    break;

                case "InterstellarDust":
                    temp.Classification = Classification.InterstellarDust;
                    break;

                case "Quasar":
                    temp.Classification = Classification.Quasar;
                    break;

                case "Galaxy":
                    temp.Classification = Classification.Galaxy;
                    break;

                case "SpiralGalaxy":
                    temp.Classification = Classification.SpiralGalaxy;
                    break;

                case "IrregularGalaxy":
                    temp.Classification = Classification.IrregularGalaxy;
                    break;

                case "EllipticalGalaxy":
                    temp.Classification = Classification.EllipticalGalaxy;
                    break;

                case "Knot":
                    temp.Classification = Classification.Knot;
                    break;

                case "PlateDefect":
                    temp.Classification = Classification.PlateDefect;
                    break;

                case "ClusterOfGalaxies":
                    temp.Classification = Classification.ClusterOfGalaxies;
                    break;

                case "OtherNGC":
                    temp.Classification = Classification.OtherNGC;
                    break;

                case "Unidentified":
                    temp.Classification = Classification.Unidentified;
                    break;

                case "SolarSystem":
                    temp.Classification = Classification.SolarSystem;
                    break;

                case "Unfiltered":
                    temp.Classification = Classification.Unfiltered;
                    break;

                case "Stellar":
                    temp.Classification = Classification.Stellar;
                    break;

                case "StellarGroupings":
                    temp.Classification = Classification.StellarGroupings;
                    break;

                case "Nebulae":
                    temp.Classification = Classification.Nebulae;
                    break;

                case "Galactic":
                    temp.Classification = Classification.Galactic;
                    break;

                case "Other":
                    temp.Classification = Classification.Other;
                    break;

                default:
                    break;
                }
            }
            if (child.Attributes.GetNamedItem("AuthorEmail") != null)
            {
                temp.AuthorEmail = child.Attributes.GetNamedItem("AuthorEmail").Value;
            }
            if (child.Attributes.GetNamedItem("Author") != null)
            {
                temp.Author = child.Attributes.GetNamedItem("Author").Value;
            }
            if (child.Attributes.GetNamedItem("AuthorURL") != null)
            {
                temp.AuthorURL = child.Attributes.GetNamedItem("AuthorURL").Value;
            }

            if (child.Attributes.GetNamedItem("AuthorImageUrl") != null)
            {
                temp.AuthorImageUrl = child.Attributes.GetNamedItem("AuthorImageUrl").Value;
            }

            if (child.Attributes.GetNamedItem("AverageRating") != null)
            {
                temp.AverageRating = double.Parse(child.Attributes.GetNamedItem("AverageRating").Value);
            }
            if (child.Attributes.GetNamedItem("LengthInSecs") != null)
            {
                temp.LengthInSecs = double.Parse(child.Attributes.GetNamedItem("LengthInSecs").Value);
            }
            if (child.Attributes.GetNamedItem("OrganizationUrl") != null)
            {
                temp.OrganizationUrl = child.Attributes.GetNamedItem("OrganizationUrl").Value;
            }
            if (child.Attributes.GetNamedItem("OrganizationName") != null)
            {
                temp.OrganizationName = child.Attributes.GetNamedItem("OrganizationName").Value;
            }
            if (child.Attributes.GetNamedItem("RelatedTours") != null)
            {
                temp.RelatedTours = child.Attributes.GetNamedItem("RelatedTours").Value;
            }
            if (child.Attributes.GetNamedItem("Keywords") != null)
            {
                temp.Keywords = child.Attributes.GetNamedItem("Keywords").Value;
            }


            return(temp);
        }