Beispiel #1
0
        private static ThemeStyle ProcessStyle(string name, string content, StringDictionary variables, ContextDictionary context)
        {
            if (string.IsNullOrWhiteSpace(name) || string.IsNullOrWhiteSpace(content))
            {
                return(null);
            }

            StringDictionary values = new StringDictionary();

            content.ParseKeyValuePair((t1, t2) => values.Add(t1, t2));

            string             module       = null;
            ThemeParserContext styleContext = ThemeParserContext.Default;

            if (values.TryGetValue("$module", out module))
            {
                context.TryGetValue(module, out styleContext);
                values.Remove("$module");
            }

            ThemeStyle style = new ThemeStyle(styleContext, name);

            style.UpdateProperties(values);

            return(style);
        }
Beispiel #2
0
        public void Test_object()
        {
            var storage = new ContextDictionary();
            var val     = new object();

            storage.AddValue(val, 8, true, Context1.A, Context2.A);

            Assert.IsFalse(storage.TryGetValue(out var result, 8, false, Context1.A, Context2.A));
            Assert.IsTrue(storage.TryGetValue(out result, 8, true, Context1.A, Context2.A));
            Assert.AreEqual(val, result);
        }
Beispiel #3
0
        public void Test_int()
        {
            var       storage = new ContextDictionary();
            const int val     = 5;

            storage.AddValue(val, 8, true, Context1.A, Context2.A);

            Assert.IsFalse(storage.TryGetValue(out var result, 7, true, Context1.A, Context2.A));
            Assert.IsTrue(storage.TryGetValue(out result, 8, true, Context1.A, Context2.A));
            Assert.AreEqual(val, result);
        }