public void SwitchTo(FormatMode newMode) { if (m_currentMode == newMode) { return; } BaseViewer preViewer = GetCurrentMode(); if (preViewer != null) { preViewer.OnLeave(); } m_currentMode = newMode; BaseViewer curViewer = GetCurrentMode(); if (curViewer != null) { curViewer.OnEnter(); } EditorPrefs.SetInt(TableConst.CurrentMode, (int)(m_currentMode)); }
private void SwitchFormatMode(FormatMode mode) { switch (mode) { case FormatMode.Mini: lbHex.Width = Util.ScaleX(68); lbHex.Visible = true; lbRgb.Visible = false; pnExt.Visible = false; Height = Util.ScaleY(20); Width = Util.ScaleX(88); break; case FormatMode.Standard: lbHex.Width = Util.ScaleX(68); lbRgb.Width = Util.ScaleX(140); lbRgb.Left = Util.ScaleX(88); lbRgb.Top = 0; lbHex.Visible = true; lbRgb.Visible = true; pnExt.Visible = false; Height = Util.ScaleY(20); Width = Util.ScaleX(228); break; case FormatMode.Extention: // 让两边都留下20宽度,以使显示居中 lbHex.Width = Util.ScaleX(140); lbRgb.Width = Util.ScaleX(180); lbRgb.Left = 0; lbRgb.Top = Util.ScaleY(20); lbHex.Visible = true; lbRgb.Visible = true; pnExt.Visible = true; Height = Util.ScaleY(100); Width = Util.ScaleX(180); break; case FormatMode.Shot: lbHex.Visible = false; lbRgb.Visible = false; pnExt.Visible = false; Height = Util.ScaleY(20); Width = Util.ScaleX(20); break; } currentFormatMode = mode; if (settingLoaded) { Settings.Main.Format = mode; } // 切换了显示格式后,自动重算预览窗口位置 if (previewForm.Visible && Settings.Preview.PinPosition != PinPosition.None) { UpdatePreviewPosition(); } }
public override string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { if (Signature != null) { return($"({string.Join(", ", Signature.Parameters.Select(p => p.Format(lib, mode)))}) => {Signature.Type.Format(lib, mode)}"); } return(MarkdownBuilder.MarkdownCodeQuote("any")); }
public string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { var sb = new StringBuilder(); foreach (var singature in Signatures) { sb.AppendLine("▸ " + singature.Format(lib)); } return(sb.ToString()); }
public void addInfo <K, V>(string key, K value, IDictionary <K, V> dict, FormatMode format, bool extra) { if (dict.TryGetValue(value, out V v)) { addInfo(key, v, format, extra); } else { addInfo(key, String.Format("Unknown ({0})", value), extra); } }
private void SwitchFormatMode(FormatMode mode) { switch (mode) { case FormatMode.Mini: trayMenuFormatMini.Checked = true; trayMenuFormatStandard.Checked = false; trayMenuFormatExtention.Checked = false; lbHex.Width = 68; lbRgb.Visible = false; pnExt.Visible = false; Height = 20; Width = 88; break; case FormatMode.Standard: trayMenuFormatMini.Checked = false; trayMenuFormatStandard.Checked = true; trayMenuFormatExtention.Checked = false; lbHex.Width = 68; lbRgb.Width = 140; lbRgb.Left = 68; lbRgb.Top = 0; lbRgb.Visible = true; pnExt.Visible = false; Height = 20; Width = 208; break; case FormatMode.Extention: trayMenuFormatMini.Checked = false; trayMenuFormatStandard.Checked = false; trayMenuFormatExtention.Checked = true; lbHex.Width = 180; lbRgb.Width = 180; lbRgb.Left = 0; lbRgb.Top = 20; lbRgb.Visible = true; pnExt.Visible = true; Height = 100; Width = 180; break; } currentFormatMode = mode; if (settingLoaded) { Settings.Main.Format = mode; } }
public override string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { var path = lib.FindPathToType(Name); var name = path != null?MarkdownBuilder.MarkdownUrl(Name, path) : MarkdownBuilder.MarkdownCodeQuote(Name); if (TypeArguments.Any()) { name += "<" + string.Join(",", TypeArguments.Select(t => t.Format(lib, mode))) + ">"; } return(name); }
/// <summary> /// Formats a specified string replacing placeholders with content /// </summary> /// <param name="theme"></param> /// <param name="content"></param> /// <param name="formatMode"></param> /// <param name="staticContentLookup"></param> /// <param name="themeFolderLookup"></param> /// <returns></returns> public static string Format( string theme , string content , IStaticContentLookup staticContentLookup , IThemeFolderLookup themeFolderLookup , FormatMode formatMode) { if (string.IsNullOrWhiteSpace(content)) { return(content); } // TODO (Roman): implement URL.RESOLVE to be able to resolve url root folders, not only theme paths... string value; foreach (Match match in _ContentRegex.Matches(content)) { value = staticContentLookup.GetContent(theme, match.Groups[1].Value); if ((formatMode & FormatMode.EscapeSingleQuotes) != 0) { value = value.Replace("'", @"\'"); } if ((formatMode & FormatMode.EscapeDoubleQuotes) != 0) { value = value.Replace("\"", @"\"""); } content = content.Replace(match.Value, value); } foreach (Match match in _UrlRegex.Matches(content)) { value = themeFolderLookup.GetAbsoluteThemePath(theme, match.Groups[1].Value); if ((formatMode & FormatMode.EscapeSingleQuotes) != 0) { value = value.Replace("'", @"\'"); } if ((formatMode & FormatMode.EscapeDoubleQuotes) != 0) { value = value.Replace("\"", @"\"""); } content = content.Replace(match.Value, value); } return(content); }
public string Format(ITypeScriptLibrary lib, FormatMode mode) { var sb = new StringBuilder(); if (GetSignature != null) { sb.AppendLine("⇄ " + GetSignature.Format(lib)); sb.AppendLine(); } if (SetSignature != null) { sb.AppendLine("⇄ " + SetSignature.Format(lib)); sb.AppendLine(); } return(sb.ToString()); }
public static string Create(FormatMode mode, ObservableCollection <ColorInfo> colorInfos, Range rect = null) { return(mode switch { FormatMode.compareStr => CompareStr(colorInfos), FormatMode.dmFindStr => DmFindStr(colorInfos, rect), FormatMode.ajFindStr => AjFindStr(colorInfos, rect), FormatMode.ajCompareStr => AjCompareStr(colorInfos), FormatMode.cdFindStr => CdFindStr(colorInfos, rect), FormatMode.cdCompareStr => CdCompareStr(colorInfos), FormatMode.autojsFindStr => AutojsFindStr(colorInfos, rect), FormatMode.ecFindStr => EcFindStr(colorInfos, rect), FormatMode.diyFindStr => DiyFindStr(colorInfos, rect), FormatMode.diyCompareStr => DiyCompareStr(colorInfos), FormatMode.anchorsCompareStr => AnchorsCompareStr(colorInfos), FormatMode.anchorsFindStr => AnchorsFindStr(colorInfos, rect), FormatMode.anchorsCompareStrTest => AnchorsCompareStrTest(colorInfos), FormatMode.anchorsFindStrTest => AnchorsCompareStrTest(colorInfos), _ => CompareStr(colorInfos), });
public string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { var result = ""; if (IsRest) { result += "..."; } result += Name; if (IsOptional || DefaultValue != null) { result += "?"; } result += ": "; result += Type.Format(lib, mode); return(result); }
string FormatTime(int milliseconds, FormatMode mode = FormatMode.Lap, int smallSize = 10) { bool negative = false; if (milliseconds < 0) { negative = true; milliseconds = -milliseconds; } int seconds = milliseconds / 1000; int m = seconds / 60; int s = seconds % 60; int mm = milliseconds % 1000; string prefix = negative? "-" : mode == FormatMode.Delta? "+" : ""; if (m < 100) { if (seconds < 100 && mode != FormatMode.Lap) { return(string.Format("{0}{1}<size={2}>.{3,3:000}</size>", prefix, seconds, smallSize, mm)); } else { return(string.Format("{0}{1}:{2,2:00}<size={3}>.{4,3:000}</size>", prefix, m, s, smallSize, mm)); } } else { int h = m / 60; m = m % 60; int d = mm / 100; return(string.Format("{0}{1}:{2,2:00}:{3,2:00}<size={4}>.{5}</size>", prefix, h, m, s, smallSize, d)); } }
public void addInfo(string key, object value, FormatMode format) { addInfo(key, value, format, false); }
public override string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return(string.Join(" | ", Types.Select(t => t.Format(lib, mode)))); }
public string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return("▸ " + Signature.Format(lib)); }
public override string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return(ElementType.Format(lib, mode) + "[]"); }
public override string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return(MarkdownBuilder.MarkdownCodeQuote("\"" + Value + "\"")); }
public virtual string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return(MarkdownBuilder.MarkdownCodeQuote(Name)); }
private void SwitchFormatMode(FormatMode mode) { switch (mode) { case FormatMode.Mini: trayMenuFormatMini.Checked = true; trayMenuFormatStandard.Checked = false; trayMenuFormatExtention.Checked = false; trayMenuFormatShot.Checked = false; lbHex.Width = 68; lbHex.Visible = true; lbRgb.Visible = false; pnExt.Visible = false; Height = 20; Width = 108; break; case FormatMode.Standard: trayMenuFormatMini.Checked = false; trayMenuFormatStandard.Checked = true; trayMenuFormatExtention.Checked = false; trayMenuFormatShot.Checked = false; lbHex.Width = 68; lbRgb.Width = 140; lbRgb.Left = 88; lbRgb.Top = 0; lbHex.Visible = true; lbRgb.Visible = true; pnExt.Visible = false; Height = 20; Width = 228; break; case FormatMode.Extention: trayMenuFormatMini.Checked = false; trayMenuFormatStandard.Checked = false; trayMenuFormatExtention.Checked = true; trayMenuFormatShot.Checked = false; // 让两边都留下20宽度,以使显示居中 lbHex.Width = 140; lbRgb.Width = 180; lbRgb.Left = 0; lbRgb.Top = 20; lbHex.Visible = true; lbRgb.Visible = true; pnExt.Visible = true; Height = 100; Width = 180; break; case FormatMode.Shot: trayMenuFormatMini.Checked = false; trayMenuFormatStandard.Checked = false; trayMenuFormatExtention.Checked = false; trayMenuFormatShot.Checked = true; lbHex.Visible = false; lbRgb.Visible = false; pnExt.Visible = false; Height = 20; Width = 20; break; } currentFormatMode = mode; if (settingLoaded) { Settings.Main.Format = mode; } // 切换了显示格式后,自动重算预览窗口位置 if (previewForm.Visible && Settings.Preview.PinPosition != PinPosition.None) { UpdatePreviewPosition(); } }
protected FormattableComponent() { this.format = "{0}"; this.mode = FormatMode.String; }
public virtual IFormattableComponent FormattedAs(string formatString) { this.mode = FormatMode.String; this.format = string.Concat("{0:", formatString, "}"); return(this); }
public virtual IFormattableComponent <TProperty> FormatWith(Func <TProperty, string> formatFunc) { this.mode = FormatMode.Func; this.formatFunction = formatFunc; return(this); }
public void addInfo <K, V>(string key, K value, IDictionary <K, V> dict, FormatMode format) { addInfo(key, value, dict, format, false); }
public InfoItem(object value, FormatMode formatMode) : this(value, formatMode, false) { }
public InfoItem(object value, FormatMode formatMode, bool extra) { this.value = value; this.formatMode = formatMode; this.extra = extra; }
public string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return($"{Name}({string.Join(",", Parameters.Select(p => p.Format(lib, mode)))}): {Type.Format(lib, mode)}"); }
public void addInfo(string key, object value, FormatMode format, bool extra) { info.Add(key, new InfoItem(value, format, extra)); }
public string Format(ITypeScriptLibrary lib, FormatMode mode = FormatMode.Markdown) { return($"● {Name}:{Type.Format(lib)}{((DefaultValue != null) ? " = " + MarkdownBuilder.MarkdownCodeQuote(DefaultValue) : "")}"); }
/// <summary> /// Initializes a new instance of the <see cref="EnumDisplayAttribute"/> class. /// </summary> /// <param name="mode">The formatting mode.</param> public EnumDisplayAttribute(FormatMode mode) { Mode = mode; }