Пример #1
0
        public string getString(ref string CssText)
        {
            string valuelist = string.Empty;

            foreach (var item in this.value)
            {
                if (item.Type == CompoenentValueType.preservedToken)
                {
                    PreservedToken pretoken = item as PreservedToken;
                    valuelist += pretoken.token.GetString(ref CssText);
                }
                else if (item.Type == CompoenentValueType.function)
                {
                    Function func = item as Function;
                    valuelist += func.getString(ref CssText);
                }
                else if (item.Type == CompoenentValueType.simpleBlock)
                {
                    SimpleBlock simpleblock = item as SimpleBlock;
                    valuelist += simpleblock.getString(ref CssText);
                }
            }

            return(this.name + "(" + valuelist + ")");
        }
Пример #2
0
        public string getString(ref string CssText)
        {
            string valuelist = string.Empty;

            foreach (var item in this.value)
            {
                if (item.Type == CompoenentValueType.preservedToken)
                {
                    PreservedToken pretoken = item as PreservedToken;
                    valuelist += pretoken.token.GetString(ref CssText);
                }
                else if (item.Type == CompoenentValueType.function)
                {
                    Function func = item as Function;
                    valuelist += func.getString(ref CssText);
                }
                else if (item.Type == CompoenentValueType.simpleBlock)
                {
                    SimpleBlock simpleblock = item as SimpleBlock;
                    valuelist += simpleblock.getString(ref CssText);
                }
            }

            if (token != null)
            {
                if (token.Type == enumTokenType.curly_bracket_left || token.Type == enumTokenType.curly_bracket_right)
                {
                    valuelist = "{" + valuelist + "}";
                }
                else if (token.Type == enumTokenType.square_bracket_left || token.Type == enumTokenType.square_bracket_right)
                {
                    valuelist = "[" + valuelist + "]";
                }
                else if (token.Type == enumTokenType.round_bracket_left || token.Type == enumTokenType.round_bracket_right)
                {
                    valuelist = "(" + valuelist + ")";
                }
            }

            return(valuelist);
        }
Пример #3
0
        public static string getString(List <ComponentValue> valuelist, ref int startindex, ref int endindex, ref string CssText)
        {
            string returnstring = string.Empty;

            foreach (var item in valuelist)
            {
                if (startindex <= 0)
                {
                    startindex = item.startindex;
                }

                if (item.endindex > endindex)
                {
                    endindex = item.endindex;
                }

                if (item.Type == CompoenentValueType.preservedToken)
                {
                    PreservedToken pretoken = item as PreservedToken;
                    returnstring += pretoken.token.GetString(ref CssText);
                }
                else if (item.Type == CompoenentValueType.function)
                {
                    Function func = item as Function;
                    returnstring += func.getString(ref CssText);
                }
                else if (item.Type == CompoenentValueType.simpleBlock)
                {
                    SimpleBlock simpleblock = item as SimpleBlock;
                    returnstring += simpleblock.getString(ref CssText);
                }
            }


            return(returnstring.Trim());
        }