public object Deserialize(StructuredText storage) { RenderProfile prof = new RenderProfile(); prof.FontName = storage.Get("font-name", "Courier New"); prof.CJKFontName = storage.Get("cjk-font-name", storage.Get("japanese-font-name", storage.Get("chinese-font-name", "Courier New"))); prof.FontSize = ParseUtil.ParseFloat(storage.Get("font-size"), 10.0f); prof.LineSpacing = ParseUtil.ParseInt(storage.Get("line-spacing"), 0); prof.UseClearType = ParseUtil.ParseBool(storage.Get("clear-type"), false); prof.EnableBoldStyle = ParseUtil.ParseBool(storage.Get("enable-bold-style"), true); prof.ForceBoldStyle = ParseUtil.ParseBool(storage.Get("force-bold-style"), false); prof.ForeColor = ParseUtil.ParseColor(storage.Get("text-color"), Color.FromKnownColor(KnownColor.WindowText)); prof.BackColor = ParseUtil.ParseColor(storage.Get("back-color"), Color.FromKnownColor(KnownColor.Window)); prof.ImageStyle = ParseUtil.ParseEnum <ImageStyle>(storage.Get("back-style"), ImageStyle.Center); prof.BackgroundImageFileName = storage.Get("back-image", ""); prof.ESColorSet = new EscapesequenceColorSet(); string escolor = storage.Get("escape-sequence-color"); if (escolor != null) { prof.ESColorSet.Load(escolor); } prof.DarkenEsColorForBackground = ParseUtil.ParseBool(storage.Get("darken-escolor-for-background"), true); return(prof); }
public void Load(string value) { if (value == null) { SetDefault(); } else { string[] cols = value.Split(','); int n = Math.Min(cols.Length, _colors.Length); int i; for (i = 0; i < n; i++) { Color c = ParseUtil.ParseColor(cols[i], Color.Empty); if (!c.IsEmpty) { _colors[i] = c; _isDefault = true; } else { _colors[i] = GetDefaultColor(i); } } for (; i < _colors.Length; i++) { _colors[i] = GetDefaultColor(i); } } }
public void Load(string value) { if (!_isDefault) { ResetToDefault(); } if (value == null) { return; // use default colors } string[] cols = value.Split(','); int overrides = 0; for (int i = 0; i < cols.Length; i++) { string w = cols[i].Trim(); bool isExactColor; if (w.Length > 0 && w[0] == '!') { isExactColor = true; w = w.Substring(1); } else { isExactColor = false; } if (w.Length == 0) { continue; // use default color } Color color = ParseUtil.ParseColor(w, Color.Empty); if (!color.IsEmpty) { _colors[i] = new ESColor(color, isExactColor); overrides++; } } if (overrides > 0) { _isDefault = false; } }