Beispiel #1
0
        private List <string> GetInstalledPalettes()
        {
            var colors = Vanilla.Descendants().Where(key => (string)key.Attribute("name") == "Colors");

            var name =
                colors.Descendants()
                .Elements("value")
                .Where(value => (string)value.Attribute("name") == "Name" && value.AttributeOrEmpty("data").Value != "")
                .Select(value => value.AttributeOrEmpty("data").Value);

            return(name.ToList());
        }
Beispiel #2
0
        public ColorPalette(ConfigOptions config)
        {
            var configFolder = config.ConfigurationFolder;

            _configFile = Path.Combine(configFolder, FileName);
            _localPath  = Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location);
            SchemaSet   = SetXmlSchema(config.XmlValidation);

            Xdoc    = XDocument.Load(_configFile);
            Vanilla = Xdoc.Descendants().First(key => (string)key.Attribute("name") == ".Vanilla");
            Build   = Vanilla.AttributeOrEmpty("build").Value;

            if (config.BackupConfiguration)
            {
                BackupConfiguration(configFolder, _configFile);
            }

            ColorCount = Vanilla.Descendants().Count(key => (string)key.Attribute("name") == "Colors");

            InstalledThemes = ColorCount == 0 ? new List <string>() : GetInstalledPalettes();
        }