Пример #1
0
        /// <summary>
        /// Fill and return an ArtItem depending on the current ArtType. Read the xml to complete informations of the ArtItem. 
        /// </summary>
        /// <returns>a fully operationnal ArtItem</returns>
        private ArtItem FillArtItem()
        {
            String downloadStartTimestamp = null,
                name = null,
                description = null,
                category = null,
                author = null,
                license = null,
                thumbnail = null,
                smallThumbnail = null,
                url = null,
                resolution = null;

            ArtItem item = null;

            _xmlRd.Read (); // move to the first node - Depth = 1

            //  fill variables with data from the xml
            while (
                !_xmlRd.EOF
                && !(_xmlRd.Name == "theme" || _xmlRd.Name == "background")
                || _xmlRd.NodeType != XmlNodeType.EndElement
            )
            {
                _xmlRd.Read ();
                while (_xmlRd.NodeType == XmlNodeType.Whitespace)
                    _xmlRd.Read ();

                if ((_xmlRd.Name == "theme" || _xmlRd.Name == "background") && _xmlRd.NodeType == XmlNodeType.Element)
                    downloadStartTimestamp = _xmlRd.GetAttribute ("download_start_timestamp");
                else if (_xmlRd.Name == "name")
                    name =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "description")
                    description =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "category")
                    category =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "author")
                    author =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "license")
                    license =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "thumbnail")
                    thumbnail =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "small_thumbnail")
                    smallThumbnail = _xmlRd.ReadString ();
                else if (_xmlRd.Name == "url")
                    url =_xmlRd.ReadString ();
                else if (_xmlRd.Name == "resolution")
                    resolution = _xmlRd.ReadString ();
            }

            switch (_curArtType)
            {
                case ArtType.BackgroundAll :
                    Console.WriteLine ("Create BackgroundAll");
                    item = new ArtBackground (ArtType.BackgroundAll, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                    break;
                case ArtType.BackgroundAbstract :
                    Console.WriteLine ("Create BackgroundAbstract");
                    item = new ArtBackground (ArtType.BackgroundAbstract, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                    break;
                case ArtType.BackgroundGnome :
                    Console.WriteLine ("Create BackgroundGnome");
                    item = new ArtBackground (ArtType.BackgroundGnome, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                    break;
                case ArtType.BackgroundNature :
                    Console.WriteLine ("Create BackgroundNature");
                    item = new ArtBackground (ArtType.BackgroundNature, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                    break;
                case ArtType.BackgroundOther :
                    Console.WriteLine ("Create BackgroundOther");
                    item = new ArtBackground (ArtType.BackgroundOther, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                    break;
                case ArtType.ThemesGDM :
                    Console.WriteLine ("Create ThemesGDM");
                    item = new ArtLoginManager (downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                    break;
                case ArtType.ThemesSplashs :
                    Console.WriteLine ("Create ThemesSplash");
                    item = new ArtSplashScreen (downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                    break;
                case ArtType.ThemesGTKEngines :
                    Console.WriteLine ("Create ThemesGTKEngine");
                    item = new ArtGtkEngine (downloadStartTimestamp, "", name, description, author, url, thumbnail);
                    break;
                case ArtType.ThemesIcons :
                    Console.WriteLine ("Create ThemesIcon");
                    item = new ArtIcon (downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                    break;
                case ArtType.ThemesApplications :
                    Console.WriteLine ("Create ThemeApplication");
                    item = new ArtGtkGnome (downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                    Console.WriteLine ("Thumbnail url :" + smallThumbnail);
                    break;
                case ArtType.ThemesWindowsBorders :
                    Console.WriteLine ("Create WindowsBorder");
                    item = new ArtDesktop (downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                    break;
                case ArtType.All :
                    break;
                default :
                    break;
            }

            return item;
        }
Пример #2
0
        /// <summary>
        /// Fill and return an ArtItem depending on the current ArtType. Read the xml to complete informations of the ArtItem.
        /// </summary>
        /// <returns>a fully operationnal ArtItem</returns>
        private ArtItem FillArtItem()
        {
            String downloadStartTimestamp = null,
                   name           = null,
                   description    = null,
                   category       = null,
                   author         = null,
                   license        = null,
                   thumbnail      = null,
                   smallThumbnail = null,
                   url            = null,
                   resolution     = null;

            ArtItem item = null;

            _xmlRd.Read();              // move to the first node - Depth = 1

            //  fill variables with data from the xml
            while (
                !_xmlRd.EOF &&
                !(_xmlRd.Name == "theme" || _xmlRd.Name == "background") ||
                _xmlRd.NodeType != XmlNodeType.EndElement
                )
            {
                _xmlRd.Read();
                while (_xmlRd.NodeType == XmlNodeType.Whitespace)
                {
                    _xmlRd.Read();
                }

                if ((_xmlRd.Name == "theme" || _xmlRd.Name == "background") && _xmlRd.NodeType == XmlNodeType.Element)
                {
                    downloadStartTimestamp = _xmlRd.GetAttribute("download_start_timestamp");
                }
                else if (_xmlRd.Name == "name")
                {
                    name = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "description")
                {
                    description = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "category")
                {
                    category = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "author")
                {
                    author = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "license")
                {
                    license = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "thumbnail")
                {
                    thumbnail = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "small_thumbnail")
                {
                    smallThumbnail = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "url")
                {
                    url = _xmlRd.ReadString();
                }
                else if (_xmlRd.Name == "resolution")
                {
                    resolution = _xmlRd.ReadString();
                }
            }

            switch (_curArtType)
            {
            case ArtType.BackgroundAll:
                Console.WriteLine("Create BackgroundAll");
                item = new ArtBackground(ArtType.BackgroundAll, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                break;

            case ArtType.BackgroundAbstract:
                Console.WriteLine("Create BackgroundAbstract");
                item = new ArtBackground(ArtType.BackgroundAbstract, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                break;

            case ArtType.BackgroundGnome:
                Console.WriteLine("Create BackgroundGnome");
                item = new ArtBackground(ArtType.BackgroundGnome, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                break;

            case ArtType.BackgroundNature:
                Console.WriteLine("Create BackgroundNature");
                item = new ArtBackground(ArtType.BackgroundNature, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                break;

            case ArtType.BackgroundOther:
                Console.WriteLine("Create BackgroundOther");
                item = new ArtBackground(ArtType.BackgroundOther, resolution, downloadStartTimestamp, "", name, description, author, url, thumbnail);
                break;

            case ArtType.ThemesGDM:
                Console.WriteLine("Create ThemesGDM");
                item = new ArtLoginManager(downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                break;

            case ArtType.ThemesSplashs:
                Console.WriteLine("Create ThemesSplash");
                item = new ArtSplashScreen(downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                break;

            case ArtType.ThemesGTKEngines:
                Console.WriteLine("Create ThemesGTKEngine");
                item = new ArtGtkEngine(downloadStartTimestamp, "", name, description, author, url, thumbnail);
                break;

            case ArtType.ThemesIcons:
                Console.WriteLine("Create ThemesIcon");
                item = new ArtIcon(downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                break;

            case ArtType.ThemesApplications:
                Console.WriteLine("Create ThemeApplication");
                item = new ArtGtkGnome(downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                Console.WriteLine("Thumbnail url :" + smallThumbnail);
                break;

            case ArtType.ThemesWindowsBorders:
                Console.WriteLine("Create WindowsBorder");
                item = new ArtDesktop(downloadStartTimestamp, "", name, description, author, url, thumbnail, smallThumbnail);
                break;

            case ArtType.All:
                break;

            default:
                break;
            }

            return(item);
        }