Beispiel #1
0
        public ThemeClass AddClass(string name, string appName, string className)
        {
            ThemeClass @class = FindClass(appName, className);

            if (@class == null)
            {
                @class = new ThemeClass(this, name, appName, className);
                classes.Add(@class);
            }

            return(@class);
        }
Beispiel #2
0
        private void AddKnownPartsAndStates(ThemeClass cls)
        {
            foreach (var partInfo in ThemeInfo.GetParts(cls.ClassName))
            {
                bool partDefined = cls.FindPart(partInfo.Item1) != null;
                var  part        = cls.AddPart(partInfo.Item1, partInfo.Item2);
                part.IsUndefined = !partDefined;

                foreach (var stateInfo in ThemeInfo.GetStates(part))
                {
                    bool stateDefined = part.FindState(stateInfo.Item1) != null;
                    var  state        = part.AddState(stateInfo.Item1, stateInfo.Item2);
                    state.IsUndefined = !stateDefined;
                }
            }
        }
Beispiel #3
0
        private void ReadProperties(ThemeFile themeFile, string type, string name)
        {
            ResInfoHandle rh      = themeFile.Theme.FindResourceEx(type, name, 0);
            var           data    = themeFile.Theme.LoadResourceAccessor(rh);
            bool          globals = false;

            ThemeClass cls         = null;
            int        recordCount = 0;
            int        currClass   = -1;

            for (long offset = 0; offset < data.Capacity;)
            {
                var recordOffset = offset;
                var recordId     = recordCount++;
                var record       = data.Read <VSRecord>(ref offset);
                if (cls == null || record.Class != currClass)
                {
                    string fullName  = themeFile.ClassNames[record.Class];
                    string className = fullName;
                    ParseClassName(ref className, out string appName);

                    globals = className == "globals";

                    cls       = themeFile.AddClass(fullName, appName, className);
                    currClass = record.Class;
                }

                if (LoadRecordValue(themeFile, record, data, offset, out var value))
                {
                }

                var prop = cls.AddProperty(
                    recordId, recordOffset, record.Part, record.State,
                    record.Type, record.SymbolVal, value, globals);

                if (record.ResId == 0)
                {
                    offset += record.ByteLength;
                }

                DataExtensions.AlignTo(ref offset, 8);
            }
        }
Beispiel #4
0
 private int CompareClass(ThemeClass l, ThemeClass r)
 {
     return(string.Compare(l.Name, r.Name, StringComparison.OrdinalIgnoreCase));
 }
Beispiel #5
0
 public ThemePart(ThemeClass parent, int id, string name)
 {
     Parent = parent;
     Id     = id;
     Name   = name;
 }