Beispiel #1
0
        public AlephTheme(string n, Version v, CompatibilityVersionRange c, string fn, string src, bool fb)
        {
            Name           = n;
            Version        = v;
            Compatibility  = c;
            SourceFilename = fn;
            Source         = src;

            IsFallback = fb;
        }
Beispiel #2
0
 public AlephTheme(string n, Version v, CompatibilityVersionRange c, string fn, string src, string a, AlephThemeType att)
 {
     Name           = n;
     Version        = v;
     Author         = a;
     Compatibility  = c;
     SourceFilename = fn;
     Source         = src;
     ThemeType      = att;
 }
Beispiel #3
0
        public void Parse()
        {
            _name          = _xdoc.XListSingle("theme", "meta", "name");
            _version       = Version.Parse(_xdoc.XListSingle("theme", "meta", "version"));
            _compatibility = CompatibilityVersionRange.Parse(_xdoc.XListSingle("theme", "meta", "compatibility"));
            _author        = _xdoc.XListSingleOrDefault("theme", "meta", "author") ?? "Unknown";
            _themetype     = AlephThemeTypeHelper.Parse(_xdoc.XListSingleOrDefault("theme", "meta", "type") ?? "theme");

            _references = new Dictionary <string, ValueRef>();
            foreach (var vr in _xdoc.XElemList("theme", "ref", "valueref@key=~&type=~"))
            {
                var key   = vr.Attribute("key").Value;
                var typ   = vr.Attribute("type").Value;
                var value = vr.Value;

                if (value.StartsWith("@"))
                {
                    value = value.Substring(1);

                    if (_references.TryGetValue(value.ToLower(), out var vref))
                    {
                        value = vref.Value;
                    }
                    else
                    {
                        throw new Exception($"Reference not found: '{value}'");
                    }
                }

                _references.Add(key.ToLower(), new ValueRef(key, typ, value));
            }

            _properties = new Dictionary <string, string>();
            foreach (var prop in _xdoc.XElemList("theme", "data", "*group", "property@name=~&value=~"))
            {
                var name  = prop.Attribute("name").Value.ToLower();
                var value = prop.Attribute("value").Value;

                if (value.StartsWith("@"))
                {
                    value = value.Substring(1);

                    if (_references.TryGetValue(value.ToLower(), out var vref))
                    {
                        value = vref.Value;
                    }
                    else
                    {
                        throw new Exception($"Reference not found: '{value}'");
                    }
                }

                _properties[name] = value;
            }
        }
Beispiel #4
0
 public AlephTheme(string n, Version v, CompatibilityVersionRange c, string fn, string src, string a, AlephThemeType att, IReadOnlyDictionary <string, byte[]> res)
 {
     Name           = n;
     Version        = v;
     Author         = a;
     Compatibility  = c;
     SourceFilename = fn;
     Source         = src;
     ThemeType      = att;
     Resources      = res;
 }