예제 #1
0
        BaseStyleBuilder GetStyleBuilder(StyleTypes styleType, int index)
        {
            index += ((int)styleType) * 1000;
            if (styleBuilders.ContainsKey(index))
            {
                return(styleBuilders[index]);
            }
            BaseStyleBuilder sb = CreateStyleBuilder(styleType);

            styleBuilders[index] = sb;
            return(sb);
        }
예제 #2
0
        void AddParam(string key, string val)
        {
            if (key.Length == 0)
            {
                return;
            }
            char             firstChar = key[0];
            string           keyWithoutIndex;
            int              index           = GetIndex(key, out keyWithoutIndex);
            BaseStyleBuilder sb              = null;
            bool             removeFirstChar = true;

            switch (firstChar)
            {
            case 'p':
                sb = GetStyleBuilder(StyleTypes.Pen, index);
                break;

            case 'b':
                sb = GetStyleBuilder(StyleTypes.Brush, index);
                break;

            case 'i':
                sb = GetStyleBuilder(StyleTypes.Image, index);
                break;

            case 't':
            case 'f':
                sb = GetStyleBuilder(StyleTypes.Text, index);
                removeFirstChar = false;
                break;

            default:
                string s = string.Format("{0}: {1}", Locale.Get("sbwrongparname"), key);
                AddErrorMsg(s);
                break;
            }
            if (sb != null)
            {
                sb.AddParam(removeFirstChar ? keyWithoutIndex.Substring(1) : keyWithoutIndex, val);
            }
        }