ImageGlass.Theme.Theme.LoadTheme C# (CSharp) Méthode

LoadTheme() public méthode

Read theme data from theme configuration file (Version 1.5+). Return TRUE if sucessful, FALSE if the theme format is older version
public LoadTheme ( string file ) : bool
file string
Résultat bool
        public bool LoadTheme(string file)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(file);

            XmlElement root = doc.DocumentElement;
            XmlElement nType = null;
            XmlElement n = null;

            try
            {
                //Load theme version 1.5+ as default
                nType = (XmlElement)root.SelectNodes("Theme")[0]; //<Theme>
                n = (XmlElement)nType.SelectNodes("Info")[0];//<Info>
            }
            catch
            {
                LoadThemeOldVersion(file);
                return false;
            }

            try { name = n.GetAttribute("name"); }
            catch { };
            try { version = n.GetAttribute("version"); }
            catch { };
            try { author = n.GetAttribute("author"); }
            catch { };
            try { email = n.GetAttribute("email"); }
            catch { };
            try { website = n.GetAttribute("website"); }
            catch { };
            try { description = n.GetAttribute("description"); }
            catch { };
            try { type = n.GetAttribute("type"); }
            catch { };
            try { compatibility = n.GetAttribute("compatibility"); }
            catch { };
            try { preview = n.GetAttribute("preview"); }
            catch { };

            n = (XmlElement)nType.SelectNodes("main")[0]; //<main>
            try { topbar = n.GetAttribute("topbar"); }
            catch { };
            try { topbartransparent = int.Parse(n.GetAttribute("topbartransparent")); }
            catch { };
            try { backcolor = Color.FromArgb(int.Parse(n.GetAttribute("backcolor"))); }
            catch { };
            try { bottomBarColor = Color.FromArgb(int.Parse(n.GetAttribute("bottombarcolor"))); }
            catch { };
            try { statuscolor = Color.FromArgb(int.Parse(n.GetAttribute("statuscolor"))); }
            catch { };

            n = (XmlElement)nType.SelectNodes("toolbar_icon")[0]; //<toolbar_icon>
            try { back = n.GetAttribute("back"); }
            catch { };
            try { next = n.GetAttribute("next"); }
            catch { };
            try { leftrotate = n.GetAttribute("leftrotate"); }
            catch { };
            try { rightrotate = n.GetAttribute("rightrotate"); }
            catch { };
            try { zoomin = n.GetAttribute("zoomin"); }
            catch { };
            try { zoomout = n.GetAttribute("zoomout"); }
            catch { };
            try { scaletofit = n.GetAttribute("scaletofit"); }
            catch { };
            try { zoomlock = n.GetAttribute("zoomlock"); }
            catch { };
            try { scaletowidth = n.GetAttribute("scaletowidth"); }
            catch { };
            try { scaletoheight = n.GetAttribute("scaletoheight"); }
            catch { };
            try { autosizewindow = n.GetAttribute("autosizewindow"); }
            catch { };
            try { open = n.GetAttribute("open"); }
            catch { };
            try { refresh = n.GetAttribute("refresh"); }
            catch { };
            try { gotoimage = n.GetAttribute("gotoimage"); }
            catch { };
            try { thumbnail = n.GetAttribute("thumbnail"); }
            catch { };
            try { checkBackground = n.GetAttribute("caro"); }
            catch { };
            try { fullscreen = n.GetAttribute("fullscreen"); }
            catch { };
            try { slideshow = n.GetAttribute("slideshow"); }
            catch { };
            try { convert = n.GetAttribute("convert"); }
            catch { };
            try { print = n.GetAttribute("print"); }
            catch { };
            try { uploadfb = n.GetAttribute("uploadfb"); }
            catch { };
            try { extension = n.GetAttribute("extension"); }
            catch { };
            try { settings = n.GetAttribute("settings"); }
            catch { };
            try { about = n.GetAttribute("about"); }
            catch { };
            //try { like = n.GetAttribute("like"); }
            //catch { };
            //try { dislike = n.GetAttribute("dislike"); }
            //catch { };
            //try { report = n.GetAttribute("report"); }
            //catch { };
            try { report = n.GetAttribute("menu"); }
            catch { };

            return true;
        }