Example #1
0
        protected virtual PropertySetting CreatePropertySetting(CSSItem item)
        {
            if (item.childItems.Count <= 0)
            {
                return(new PropertySetting(item.name, PropertyReader.Deserialize(item.name, item.value)));
            }
            PropertySetting propertySetting = new PropertySetting(item.name, (object)null)
            {
                Value           = PropertyReader.Deserialize(item.name, item["Value"]),
                EndValue        = PropertyReader.Deserialize(item.name, item["EndValue"]),
                AnimatedSetting = new AnimatedPropertySetting()
            };

            propertySetting.AnimatedSetting.StartValue     = propertySetting.Value;
            propertySetting.AnimatedSetting.EndValue       = propertySetting.EndValue;
            propertySetting.AnimatedSetting.IsStyleSetting = true;
            if (item["MaxValue"] != null)
            {
                propertySetting.AnimatedSetting.MaxValue = PropertyReader.Deserialize(item.name, item["MaxValue"]);
            }
            string str1 = item["EasingType"];

            if (!string.IsNullOrEmpty(str1))
            {
                propertySetting.AnimatedSetting.ApplyEasingType = (RadEasingType)Enum.Parse(typeof(RadEasingType), str1);
            }
            string s1 = item["Interval"];

            if (!string.IsNullOrEmpty(s1))
            {
                propertySetting.AnimatedSetting.Interval = int.Parse(s1);
            }
            string s2 = item["Frames"];

            if (!string.IsNullOrEmpty(s2))
            {
                propertySetting.AnimatedSetting.NumFrames = int.Parse(s2);
            }
            string s3 = item["ApplyDelay"];

            if (!string.IsNullOrEmpty(s3))
            {
                propertySetting.AnimatedSetting.ApplyDelay = int.Parse(s3);
            }
            string s4 = item["RandomDelay"];

            if (!string.IsNullOrEmpty(s4))
            {
                propertySetting.AnimatedSetting.RandomDelay = int.Parse(s4);
            }
            string str2 = item["RemoveAfterApply"];

            if (!string.IsNullOrEmpty(str2))
            {
                propertySetting.AnimatedSetting.RemoveAfterApply = bool.Parse(str2);
            }
            return(propertySetting);
        }
Example #2
0
        private void Parse()
        {
            this.Reset();
            while (this.MoveNext())
            {
                bool flag = false;
                if (this.currentType == CSSParser.tokenTypes.SpecialOperator && this.current == "#")
                {
                    flag = true;
                    this.MoveNext();
                }
                if (this.currentType == CSSParser.tokenTypes.Identifier || this.currentType == CSSParser.tokenTypes.String)
                {
                    CSSGroup cssGroup = new CSSGroup();
                    cssGroup.isRoot = flag;
                    cssGroup.name   = this.current;
                    this.groups.Add(cssGroup);
                    this.MoveNext();
                    if (this.currentType != CSSParser.tokenTypes.SpecialOperator)
                    {
                        cssGroup.childName = this.current;
                        this.MoveNext();
                    }
                    if (this.currentType == CSSParser.tokenTypes.SpecialOperator)
                    {
                        if (this.current == ":")
                        {
                            do
                            {
                                this.MoveNext();
                                cssGroup.BasedOn.Add(this.current);
                                this.MoveNext();
                            }while (this.current == ",");
                        }
                        if (this.current == "{")
                        {
                            this.MoveNext();
                            while (this.current != "}")
                            {
                                CSSItem cssItem1 = new CSSItem();
                                cssItem1.name = this.current;
                                cssGroup.items.Add(cssItem1);
                                this.MoveNext();
                                if (this.current == "{")
                                {
                                    this.MoveNext();
                                    while (this.current != "}")
                                    {
                                        CSSItem cssItem2 = new CSSItem();
                                        cssItem2.name = this.current;
                                        this.MoveNext();
                                        cssItem2.value = this.ReadValue();
                                        cssItem1.childItems.Add(cssItem2);
label_14:
                                        if (this.MoveNext() && this.current == ";")
                                        {
                                            goto label_14;
                                        }
                                    }
                                }
                                else
                                {
                                    cssItem1.value = this.ReadValue();
label_18:
                                    if (this.MoveNext() && this.current == ";")
                                    {
                                        goto label_18;
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }