Exemplo n.º 1
0
        public static void Init()
        {
            if (ms_styles.Count == 0)
            {
                string path = Path.Combine(Constants.CustomPath, "Styles.field");
                if (File.Exists(path))
                    DoLoadStyles(path);

                path = Path.Combine(Constants.StandardPath, "Styles.field");
                DoLoadStyles(path);

                ms_default = FindStyle("default");
            }
        }
Exemplo n.º 2
0
        private static void DoProcessStyle(Field[] fields, int i)
        {
            try
            {
                Log.Indent();

                string name = fields[i++].Value;
                Log.WriteLine("Processing {0} style", name);
                var style = new Style();

                while (i < fields.Length && fields[i].Name != "Name")
                {
                    DoProcessField(style, fields[i++]);
                }

                if (!ms_styles.ContainsKey(name))
                    ms_styles.Add(name, style);
                else
                    Log.WriteLine("Ignoring style {0} (it was already defined).", name);
            }
            catch (Exception e)
            {
                Log.WriteLine(e.Message);
            }
            finally
            {
                Log.Unndent();
            }
        }
Exemplo n.º 3
0
        private static void DoProcessField(Style style, Field field)
        {
            switch (field.Name)
            {
                case "BackColor":
                    style.BackColor = DoParseColor(field.Name, field.Value);
                    break;

                case "Bold":
                    style.Bold = DoParseBool(field.Name, field.Value);
                    break;

                case "FontName":
                    style.FontName = field.Value;
                    break;

                case "ForeColor":
                    style.ForeColor = DoParseColor(field.Name, field.Value);
                    break;

                case "Italic":
                    style.Italic = DoParseBool(field.Name, field.Value);
                    break;

                case "PointSize":
                    style.PointSize = DoParseDouble(field.Name, field.Value);
                    break;

                default:
                    Log.WriteLine("Ignoring field {0},", field.Name);
                    break;
            }
        }