/// <summary> /// Updates this menu item's properties after a definition change. /// </summary> public void Update() { string displayText = TextProvider?.GetText(); if (!string.IsNullOrWhiteSpace(displayText)) { if (!OpensDialog) { // Make sure ampersand characters are shown in menu items, instead of giving rise to a mnemonic. Text = displayText.Replace("&", "&&"); } else { // Add OpensDialogIndicatorSuffix. Text = displayText.Replace("&", "&&") + OpensDialogIndicatorSuffix; } } else { DisplayStyle = ToolStripItemDisplayStyle.Image; Text = string.Empty; } Image = IconProvider?.GetImage(); if (ShortcutKeyDisplayTextProviders != null) { ShortcutKeyDisplayString = string.Join("+", ShortcutKeyDisplayTextProviders.Select(x => x.GetText())); } else { ShortcutKeyDisplayString = string.Empty; } }
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) { var text = TextProvider.GetText(new TextRange(sourceIndex, count)); for (int i = 0; i < count; i++) { destination[destinationIndex + i] = text[i]; } }
public void TextProvider_GetText() { var text = "Quick brown fox jumps over the lazy dog"; var textBuffer = new TextBufferMock(text, "text"); var textProvider = new TextProvider(textBuffer.CurrentSnapshot, 10); textProvider.GetText(9, 5).Should().Be("wn fo"); }
public void Execute(ActionContext context) { GuiTextField textField = (GuiTextField)context.GetSession().FindById(path); if (textField != null) { textField.Text = TextProvider.GetText(); } }
private static string GetName(MarkdownObject mdo, TextProvider textProvider) { switch (mdo) { case HeadingBlock heading: var text = textProvider.GetText(heading); var name = text.Trim(heading.HeaderChar).Trim(); return(name); default: return(string.Empty); // TODO: RKN mdo.GetType().Name; } }
public void updateHudTexts() { // 0404.MT.0600.L.01[Höhe] m //0404.MT.0600.L.02[Geschwindigkeit] km / h //0404.MT.0600.L.03 m / sek //0404.MT.0600.C Welt[Zahl] / 4 // TextProvider.GetText("") string alt = "0404.MT." + stateToString(state) + ".L.01"; string speed = "0404.MT." + stateToString(state) + ".L.02"; string level = "0404.MT." + stateToString(state) + ".C"; HUD.altUnit = TextProvider.GetText(alt); HUD.speedUnit = TextProvider.GetText(speed); HUD.setLevelString(TextProvider.GetText(level) + " " + currentLevel + "/" + levelControl.getLastLevel()); }
public string GetText(string key, params string[] args) => TextProvider.GetText(string.Empty, string.Empty, key, args) ?? throw new Exception($"{key} was not found in the resources file");
public string this[string key] => TextProvider.GetText(string.Empty, string.Empty, key) ?? throw new Exception($"{key} was not found in the resources file");
public string GetText(Span span) { return(TextProvider.GetText(new TextRange(span.Start, span.Length))); }
public string GetText(int startIndex, int length) { return(TextProvider.GetText(new TextRange(startIndex, length))); }
public string GetText() { return(TextProvider.GetText(new TextRange(0, TextProvider.Length))); }
public void ReportError(Error error) { HasErrors = true; #if DEBUG && PRINT_SRC_LOCATION Log($"{error.File}:{error.LineNumber} - {error.Function}()", ConsoleColor.DarkYellow); #endif if (error.Location != null) { var text = TextProvider.GetText(error.Location); TokenLocation beginning = error.Location.Beginning; TokenLocation end = error.Location.End; // location, message LogInline($"{beginning}: ", ConsoleColor.White); Log(error.Message, ConsoleColor.Red); if (DoPrintLocation) { PrintLocation(text, error.Location, linesBefore: LinesBeforeError, linesAfter: LinesAfterError); } } else { Log(error.Message, ConsoleColor.Red); } // details if (error.Details != null) { foreach (var d in error.Details) { Console.WriteLine("|"); foreach (var line in d.message.Split('\n')) { if (!string.IsNullOrEmpty(line)) { Log("| " + line, ConsoleColor.White); } } if (d.location != null) { var detailText = TextProvider.GetText(d.location); Log($"{d.location.Beginning}: ", ConsoleColor.White); if (DoPrintLocation) { PrintLocation(detailText, d.location, linesBefore: 0, highlightColor: ConsoleColor.Green); } } } } if (error.SubErrors?.Count > 0) { Log("| Related:", ConsoleColor.White); foreach (var e in error.SubErrors) { ReportError(e); } } }
public string GetText() => TextProvider.GetText(new TextRange(0, TextProvider.Length));
public string this[string key] => TextProvider.GetText(string.Empty, string.Empty, key);