public void Colorize(RichTextBox textBox) { var index = textBox.SelectionStart; var length = textBox.SelectionLength; try { TextBoxConsole.StopUpdating(textBox); textBox.SelectAll(); textBox.ForeColor = Color.Black; textBox.BackColor = Color.White; var newPattern = pattern.WithMultiline(true); if (textBox.Text.Matches(newPattern).If(out var result)) { for (var i = 0; i < result.MatchCount; i++) { var match = result.GetMatch(i); var groups = match.Groups; for (var j = 0; j < groups.Length - 1; j++) { colorize(textBox, groups[j + 1], colors[j]); } } } } finally { textBox.SelectionStart = index; textBox.SelectionLength = length; TextBoxConsole.ResumeUpdating(textBox); textBox.Refresh(); } }
private void Button_Click_SaveTempFile(object sender, RoutedEventArgs e) { // Временный файл перемещается в директорию сохранения со штампом времени string SavePath = Environment.CurrentDirectory + "\\Saved"; DateTime DateNow = DateTime.Now; string FullName = string.Concat("\\HexCode_" + DateNow.ToString("MM.dd.yyyy_HH.mm.ss") + ".txt"); // Полный путь откуда идет запуск .exe - Environment.CurrentDirectory string FullPathOfTempFile = Environment.CurrentDirectory + "//TempHexFile.txt"; if (File.Exists(FullPathOfTempFile) == true) { if (Directory.Exists(SavePath) != true) { Directory.CreateDirectory(SavePath); TextBoxConsole.AppendText("Папки «Saved» не существовало - она была создана.\n"); } File.Move(Environment.CurrentDirectory + "\\TempHexFile.txt", SavePath + FullName); TextBoxConsole.AppendText("Файл с hex кодом сохранён по пути:\n"); TextBoxConsole.AppendText(string.Concat(SavePath + FullName + "\n")); } else { MessageBox.Show( this, "Извлечение не проводилось или файл с извлечённым кодом повреждён", "Ошибка сохранения кода", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private void ClearTextBoxes() { TextBoxGameName.Clear(); TextBoxRating.Clear(); TextBoxPrice.Clear(); TextBoxGenre.Clear(); TextBoxConsole.Clear(); }
public MainWindow() { InitializeComponent(); TextWriter writer = new TextBoxConsole(tbConsole); Console.SetOut(writer); engine.alertEngine.engine(323000); engine.startTimer(323000); }
public void Run(Action <IConsole> main) { if (main == null) { throw new ArgumentNullException("main"); } var console = new TextBoxConsole(this); Task.Run(() => main(console)); }
private void backgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e) { LHEProgressBar.Value = LHEProgressBar.Maximum; StopOperationButton.IsEnabled = false; TextBoxConsole.AppendText("Извлечение hex кода ЗАВЕРШЕНО. "); DateTime DateOfEndGetHex = DateTime.Now; TimeSpan TimeGetHexCode = DateOfEndGetHex - DateOfStartGetHex; TextBoxConsole.AppendText("На извлечение кода потребовалось: " + TimeGetHexCode.TotalSeconds + " секунд.\n"); }
public ConsoleDocument(Form form, DocumentConfiguration documentConfiguration, ConsoleConfiguration consoleConfiguration) { editTextBox = documentConfiguration.TextBox; consoleTextBox = consoleConfiguration.TextBox; console = consoleConfiguration.Console(form); document = documentConfiguration.Document(form); writer = console.Writer(); reader = console.Reader(); document.StandardMenus(); }
private void getobjectsandtiles_Click_1(object sender, EventArgs e) { TextWriter writer = new TextBoxConsole(tbConsole); Console.SetOut(writer); Console.WriteLine("Downloading Objects.xml..."); WebClient Client = new WebClient(); Client.DownloadFileAsync(new Uri("https://static.drips.pw/rotmg/production/current/xmlc/Objects.xml"), "objects.xml"); Client.DownloadProgressChanged += Client_DownloadProgressChanged; Client.DownloadFileCompleted += Client_DownloadFileCompleted; }
private void getprod_Click_1(object sender, EventArgs e) { TextWriter writer = new TextBoxConsole(tbConsole); Console.SetOut(writer); Console.WriteLine("Downloading current production client.swf..."); WebClient Client = new WebClient(); Client.DownloadProgressChanged += Client_DownloadProgressChanged; Client.DownloadFileCompleted += Client_DownloadFileCompleted; Client.DownloadFileAsync(new Uri("https://realmofthemadgodhrd.appspot.com/client"), "client.swf"); }
private void Button_Click_DeleteTempData(object sender, RoutedEventArgs e) { // Полный путь откуда идет запуск .exe - Environment.CurrentDirectory string FullPathOfTempFile = Environment.CurrentDirectory + "//TempHexFile.txt"; if (File.Exists(FullPathOfTempFile) == true) { File.Delete(FullPathOfTempFile); TextBoxConsole.AppendText("Был удалён 1 временный файл.\n"); } else { TextBoxConsole.AppendText("Временных файлов не обнаружено.\n"); } }
private void Button_Click_LoadHex(object sender, RoutedEventArgs e) { // Полный путь откуда идет запуск .exe - Environment.CurrentDirectory string FullPathOfTempFile = Environment.CurrentDirectory + "//TempHexFile.txt"; if (File.Exists(FullPathOfTempFile) == true) { FileInfo Test = new FileInfo(FullPathOfTempFile); TextBoxConsole.AppendText("Размер файла: " + Test.Length + " байт.\n"); if (Test.Length > 3000000) { string FullMesg = string.Concat("Обратите внимание: размер файла очень велик и равен" + Test.Length + " байт. Его закгрузка будет длиться приблизительно: " + (Math.Round(Test.Length / 1000000.0) * 3.33) + " секунд(-ы). Вы уверены, что хотите продолжить?"); MessageBoxResult result = MessageBox.Show( this, FullMesg, "Операция загрузки кода в окно программы", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { HexCodeViewer.Text = File.ReadAllText(FullPathOfTempFile); } } else { HexCodeViewer.Text = File.ReadAllText(FullPathOfTempFile); } } else { MessageBox.Show( this, "Извлечение не проводилось или файл с извлечённым кодом повреждён", "Ошибка загрузки кода в окно", MessageBoxButton.OK, MessageBoxImage.Warning); } }
private int CheckMD5() { // Проверка целостности .dll файла string MD5HashCode; using (var md5 = MD5.Create()) { using (var stream = File.OpenRead("lhe_32.dll")) { byte[] Ex = md5.ComputeHash(stream); string Tmp; MD5HashCode = ""; for (int i = 0; i < Ex.Length; i++) { Tmp = Ex[i].ToString("X2"); MD5HashCode = string.Concat(MD5HashCode, Tmp); } } } string ReallyMD5HashCode = "29CC1A1CA12FAE6B1F72BA7B01F19775"; if (string.Compare(ReallyMD5HashCode, MD5HashCode) == 0) { TextBoxConsole.AppendText("Файл lhe_32.dll успешно прошёл проверку целостности.\n"); return(0); } else { TextBoxConsole.AppendText("Файл lhe_32.dll повреждён.\n"); return(1); } // Конец проверки }
protected void Playground_Load(object sender, EventArgs e) { results = new AutoHash <int, string>(_ => ""); settings = getSettings(); errorConsole = new TextBoxConsole(this, textErrors, settings.ErrorFont, settings.ErrorFontSize, TextBoxConsole.ConsoleColorType.Cathode); errorWriter = errorConsole.Writer(); try { try { tabStops = array(32, 64, 96, 128); textEditor.SelectionTabs = tabStops; } catch (Exception exception) { displayException(exception); } outputConsole = new TextBoxConsole(this, textConsole, settings.ConsoleFont, settings.ConsoleFontSize, TextBoxConsole.ConsoleColorType.Quick); consoleWriter = outputConsole.Writer(); textReader = outputConsole.Reader(); document = new Document(this, textEditor, ".orange", "Orange", settings.EditorFont, settings.EditorFontSize); document.StandardMenus(); menus = document.Menus; menus.Menu(MENU_FILE, "Set Current Folder", (_, _) => setCurrentFolder()); menus.Menu(MENU_EDIT, "Duplicate", (_, _) => duplicate(), "^D"); menus.Menu(MENU_EDIT, "Indent", (_, _) => indent(), "^I"); menus.Menu(MENU_EDIT, "Unindent", (_, _) => unindent(), "^%I"); menus.Menu($"&{MENU_BUILD}"); menus.Menu(MENU_BUILD, "Run", (_, _) => run(), "F5"); menus.Menu(MENU_BUILD, "Manual", (s, _) => { manual = !manual; ((ToolStripMenuItem)s).Checked = manual; }, "^F5"); menus.Menu($"&{MENU_TEXT}"); menus.Menu(MENU_TEXT, "Clipboard -> Text", (_, _) => { if (ClipboardText().If(out var clipboardText)) { var windowsText = GetWindowsText(clipboardText); if (textText.SelectionLength == 0) { textText.Text = windowsText; } else { textText.SelectedText = windowsText; } tabs.SelectedTab = tabText; } }, "^|V"); menus.Menu(MENU_TEXT, "Clipboard -> Append to Text", (_, _) => { if (ClipboardText().If(out var clipboardText)) { var windowsText = GetWindowsText(clipboardText); textText.AppendText(windowsText); tabs.SelectedTab = tabText; } });
protected void Playground_Load(object sender, EventArgs e) { try { var result = from file in existingConfigurationFile() from config in getConfiguration(file) select config; if (result.If(out playgroundConfiguration)) { } else { playgroundConfiguration = new PlaygroundConfiguration { DefaultFolder = FolderName.Current, FontName = PLAYGROUND_FONT_NAME, FontSize = PLAYGROUND_FONT_SIZE, PackageFolder = "C" + PLAYGROUND_PACKAGE_FOLDER }; } } catch (Exception exception) { labelStatus.Text = exception.Message; } packageFolder = playgroundConfiguration.PackageFolder; outputConsole = new TextBoxConsole(this, textConsole, playgroundConfiguration.FontName, playgroundConfiguration.FontSize, TextBoxConsole.ConsoleColorType.Quick); textWriter = outputConsole.Writer(); textReader = outputConsole.Reader(); context = new PlaygroundContext(textWriter, textReader); colorizer = new Colorizer(textEditor); try { _exceptionData = none <ExceptionData>(); document = new Document(this, textEditor, ".kagami", "Kagami", playgroundConfiguration.FontName, playgroundConfiguration.FontSize); var menus = document.Menus; menus.Menu("&File"); menus.Menu("File", "&New", (_, _) => { textEditor.ClearModificationGlyphs(); document.New(); }); menus.Menu("File", "&Open", (_, _) => { textEditor.ClearModificationGlyphs(); document.Open(); }, "^O"); menus.Menu("File", "&Save", (_, _) => { textEditor.SetToSavedGlyphs(); document.Save(); }, "^S"); menus.Menu("File", "Save As", (_, _) => { textEditor.SetToSavedGlyphs(); document.SaveAs(); }); menus.Menu("File", "Exit", (_, _) => Close(), "%F4"); document.StandardEditMenu(); menus.Menu("Edit", "Duplicate", (_, _) => duplicate(), "^D"); menus.Menu("Edit", "Indent", (_, _) => indent(), "^I"); menus.Menu("Edit", "Unindent", (_, _) => unindent(), "^%I"); menus.Menu("&Build"); menus.Menu("Build", "Run", (_, _) => run(), "F5"); menus.Menu("Build", "Manual", (s, _) => { manual = !manual; ((ToolStripMenuItem)s).Checked = manual; }, "^F5"); menus.Menu("Build", "Dump operations", (s, _) => { dumpOperations = !dumpOperations; ((ToolStripMenuItem)s).Checked = dumpOperations; }); menus.Menu("Build", "Trace", (s, _) => { tracing = !tracing; ((ToolStripMenuItem)s).Checked = tracing; }, "^T"); menus.Menu("&Insert"); menus.Menu("Insert", "open sys", (_, _) => insertText("open sys\n\n", 0, 0), "^%S"); menus.Menu("Insert", "open math", (_, _) => insertText("open math\n\n", 0, 0), "^%M"); menus.Menu("Insert", "println()", (_, _) => insertText("println()", -1, 0), "^P"); menus.Menu("Insert", "println() interpolated", (_, _) => insertText("println($\"\")", -2, 0), "^%P"); menus.Menu("Insert", "print()", (_, _) => insertText("print()", -1, 0)); menus.Menu("Insert", "put()", (_, _) => insertText("put()", -1, 0)); menus.Menu("Insert", "peek()", (_, _) => surround("peek(", ")"), "^K"); menus.Menu("Insert", "Triple quotes", (_, _) => insertText("\"\"\"\n\"\"\"", -3), "^Q"); menus.Menu("Insert", "List", (_, _) => insertText("⌈⌉", -1), "^L"); menus.Menu("Insert", "Set", (_, _) => insertText("⎩⎭", -1), "^E"); menus.Menu("&Debug"); menus.Menu("Debug", "Step Into", (_, _) => stepInto(), "F11"); menus.Menu("Debug", "Step Over", (_, _) => stepOver(), "F10"); menus.CreateMainMenu(this); menus.StandardContextEdit(document); textEditor.SetTabs(32, 64, 96, 128); textEditor.SetLeftMargin(70); textEditor.ReassignHandle(); textEditor.Paint += (_, evt) => paint(evt); textEditor.AnnotationFont = new Font(textEditor.Font, FontStyle.Bold); locked = false; manual = false; dumpOperations = false; tracing = false; stopwatch = new Stopwatch(); _exceptionIndex = none <int>(); cancelled = false; if (playgroundConfiguration.LastFile != null) { document.Open(playgroundConfiguration.LastFile); } } catch (Exception exception) { textWriter.WriteLine(exception.Message); } }
// Конец секции импорта private void Button_Click_GetHex(object sender, RoutedEventArgs e) { // Переменная для проверки целостности int result_md5 = -1; // Начало проверки существования .dll файла if (File.Exists("lhe_32.dll") == true) { TextBoxConsole.AppendText("Файл lhe_32.dll существует. "); TextBoxConsole.AppendText("Начата проверка...\n"); result_md5 = CheckMD5(); } else { TextBoxConsole.AppendText("Файла lhe_32.dll не существует.\n"); } // Конец проверки // Вызов функции из .dll (если .dll нет, то будет вызван обработчик исключения try { if (FilePathIn == "") { TextBoxConsole.AppendText("Путь до файла ПУСТ - проверьте путь.\n"); } else { if (result_md5 == 0) { PathToFile(FilePathIn, Environment.CurrentDirectory + "//TempHexFile.txt"); DateTime DateOfStartStat, DateOfEndStat; DateOfStartStat = DateTime.Now; int SizeFile = SizeOfFile(); TextBoxStatistics.AppendText("Размер файла: " + SizeFile + " байт.\n"); double NumOfAllLine = (SizeFile / 16.0); TextBoxStatistics.AppendText("Всего строк: " + Math.Ceiling(NumOfAllLine) + ".\n"); double NumOfFullLine = (SizeFile / 16.0); TextBoxStatistics.AppendText("Количество полных строк: " + Math.Floor(NumOfFullLine) + ".\n"); // Если байт 1700, а чтение 1600, то будет 1,0625: Ceiling = 2, Floor = 1 double StageForProgressBar = (SizeFile / 3200.0); TextBoxStatistics.AppendText("Делений у прогресс бара: " + Math.Ceiling(StageForProgressBar) + ".\n"); LHEProgressBar.Minimum = 0; LHEProgressBar.Maximum = Math.Ceiling(StageForProgressBar); DateOfEndStat = DateTime.Now; TimeSpan TimeInWork = DateOfEndStat - DateOfStartStat; TextBoxConsole.AppendText("На анализ потрачено: " + (TimeInWork.TotalSeconds) + " секунд.\n"); MessageBoxResult result = MessageBox.Show( this, "Начать операцию извлечения кода?", "Получение кода", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { TextBoxConsole.AppendText("Разрешение на операцию извлечения - дано.\n"); //******************************* ДОЛГАЯ ОПЕРАЦИЯ *******************************\\ StopOperationButton.IsEnabled = true; DateOfStartGetHex = DateTime.Now; backgroundWorker.RunWorkerAsync(); //******************************* ДОЛГАЯ ОПЕРАЦИЯ *******************************\\ } else { TextBoxConsole.AppendText("Разрешение на операцию извлечения НЕ дано.\n"); } } else { TextBoxConsole.AppendText("Необходимо вновь получить lhe_32.dll - нарушена его целостность."); MessageBox.Show(this, "Файл .dll повреждён", "Критическая ошибка", MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (DllNotFoundException text) { MessageBox.Show(text.Message); } // Конец секции вызова и проверки }
private void Button_Click_CleanConsole(object sender, RoutedEventArgs e) { TextBoxConsole.Clear(); }
private void getpackets_Click_1(object sender, EventArgs e) { { TextWriter writer = new TextBoxConsole(tbConsole); Console.SetOut(writer); string swfPath = Path.Combine(Directory.GetCurrentDirectory(), "client.swf"); bool all = true; if (!File.Exists(swfPath)) { MessageBox.Show("Cant find client.swf."); return; } Console.WriteLine("Reading swf..."); SwfReader swfReader = new SwfReader(swfPath); Swf swf = swfReader.ReadSwf(); Console.WriteLine("Completed reading the swf!"); IEnumerator tagsEnu = swf.Tags.GetEnumerator(); while (tagsEnu.MoveNext()) { BaseTag tag = (BaseTag)tagsEnu.Current; if (tag.name != null) { if (tag.TagCode == (int)TagCodeEnum.DoABC2 && all) { Console.WriteLine("Extracting..."); BinaryWriter abc = new BinaryWriter(File.Open("abcdata.abc", FileMode.Create)); for (int i = 0; i < ((DoABC2Tag)tag).ABC.Length; i++) { abc.Write(((DoABC2Tag)tag).ABC[i]); } abc.Close(); if (!File.Exists("rabcdasm.exe")) { string tempExeName = Path.Combine(Directory.GetCurrentDirectory(), "rabcdasm.exe"); using (FileStream fsDst = new FileStream(tempExeName, FileMode.CreateNew, FileAccess.Write)) { byte[] bytes = Resource1.GetRabcdasmExe(); fsDst.Write(bytes, 0, bytes.Length); } } ProcessStartInfo Info = new ProcessStartInfo(); Info.FileName = "rabcdasm.exe"; Info.Arguments = "abcdata.abc"; Info.RedirectStandardOutput = true; Info.RedirectStandardError = true; Info.UseShellExecute = false; Info.CreateNoWindow = true; Info.WindowStyle = ProcessWindowStyle.Hidden; Process processTemp = new Process(); processTemp.StartInfo = Info; processTemp.EnableRaisingEvents = true; try { processTemp.Start(); processTemp.WaitForExit(); } catch (Exception) { throw; } Console.WriteLine("Extracting completed!"); if (File.Exists("abcdata\\kabam\\rotmg\\messaging\\impl\\GameServerConnection.class.asasm")) { Console.WriteLine("Writing Packets.xml..."); StreamWriter packets = new StreamWriter("packets.xml"); packets.WriteLine("<Packets>"); StreamReader read = new StreamReader("abcdata\\kabam\\rotmg\\messaging\\impl\\GameServerConnection.class.asasm"); string pattern = "QName\\(PackageNamespace\\(\\\"\\\"\\), \\\"(\\w+)\\\"\\) slotid (?:.+) type QName\\(PackageNamespace\\(\\\"\\\"\\), \\\"int\\\"\\) value Integer\\((\\d+)\\)"; Regex rgx = new Regex(pattern, RegexOptions.IgnoreCase | RegexOptions.Multiline); MatchCollection matches = rgx.Matches(read.ReadToEnd()); foreach (Match match in matches) { if (match.Groups.Count == 3) { //Console.WriteLine("{0} = {1}", match.Groups[1].Value, match.Groups[2].Value); packets.WriteLine("\t<Packet>\n\t\t<PacketName>{0}</PacketName>\n\t\t<PacketID>{1}</PacketID>\n\t</Packet>", match.Groups[1].Value.ToString().Replace("_", ""), match.Groups[2].Value.ToString()); } } packets.WriteLine("</Packets>"); packets.Close(); Console.WriteLine("Writing Packets.xml done..."); string[] a = Directory.GetFiles(Environment.CurrentDirectory, "rabcdasm.exe"); Array.ForEach(a, File.Delete); string[] b = Directory.GetFiles(Environment.CurrentDirectory, "abcdata.abc"); Array.ForEach(b, File.Delete); } else { Console.WriteLine("Cant find data for packets.xml"); } } } } Thread.Sleep(1000); swfReader.Close(); } }
public TextBoxInterface(Form form, ExRichTextBox textBox) { console = new TextBoxConsole(form, textBox); writer = console.Writer(); reader = console.Reader(); }
void Playground_Load(object sender, EventArgs e) { results = new AutoHash <int, string>(k => ""); settings = getSettings(); errorConsole = new TextBoxConsole(this, textErrors, settings.ErrorFont, settings.ErrorFontSize, Cathode); errorWriter = errorConsole.Writer(); try { try { tabStops = array(32, 64, 96, 128); textEditor.SelectionTabs = tabStops; } catch (Exception exception) { displayException(exception); } outputConsole = new TextBoxConsole(this, textConsole, settings.ConsoleFont, settings.ConsoleFontSize, Quick); consoleWriter = outputConsole.Writer(); textReader = outputConsole.Reader(); document = new Document(this, textEditor, ".orange", "Orange", settings.EditorFont, settings.EditorFontSize); document.StandardMenus(); menus = document.Menus; menus.Menu(MENU_FILE, "Set Current Folder", (s, evt) => setCurrentFolder()); menus.Menu(MENU_EDIT, "Duplicate", (s, evt) => duplicate(), "^D"); menus.Menu(MENU_EDIT, "Indent", (s, evt) => indent(), "^I"); menus.Menu(MENU_EDIT, "Unindent", (s, evt) => unindent(), "^%I"); menus.Menu($"&{MENU_BUILD}"); menus.Menu(MENU_BUILD, "Run", (s, evt) => run(), "F5"); menus.Menu(MENU_BUILD, "Manual", (s, evt) => { manual = !manual; ((ToolStripMenuItem)s).Checked = manual; }, "^F5"); menus.Menu($"&{MENU_TEXT}"); menus.Menu(MENU_TEXT, "Clipboard -> Text", (s, evt) => { var text = ClipboardText(); if (text.IsSome) { var windowsText = GetWindowsText(text.Value); if (textText.SelectionLength == 0) { textText.Text = windowsText; } else { textText.SelectedText = windowsText; } tabs.SelectedTab = tabText; } }, "^|V"); menus.Menu(MENU_TEXT, "Clipboard -> Append to Text", (s, evt) => { var text = ClipboardText(); if (text.IsSome) { var windowsText = GetWindowsText(text.Value); textText.AppendText(windowsText); tabs.SelectedTab = tabText; } }); menus.Menu(MENU_TEXT, "Clipboard -> Text & Run", (s, evt) => { var text = ClipboardText(); if (text.IsSome) { textText.Text = GetWindowsText(text.Value); } DoEvents(); run(); var selectedText = textConsole.SelectionLength == 0 ? textConsole.Text : textConsole.SelectedText; selectedText = GetWindowsText(selectedText); SetText(selectedText); }, "F6"); menus.Menu(MENU_TEXT, "Text -> Clipboard", (s, evt) => { var text = textConsole.SelectionLength == 0 ? textConsole.Text : textConsole.SelectedText; text = GetWindowsText(text); SetText(text); }, "^|C"); menus.Menu(MENU_TEXT, "Save text to file", (s, evt) => { var text = textConsole.SelectionLength == 0 ? textConsole.Text : textConsole.SelectedText; text = GetWindowsText(text); if (dialogSave.ShowDialog() == DialogResult.OK) { FileName file = dialogSave.FileName; try { file.Text = text; } catch (Exception exception) { displayException(exception); } } }); menus.Menu($"&{MENU_INSERT}"); menus.Menu(MENU_INSERT, "println", (s, evt) => insertText("println ", 0, 0), "^P"); menus.Menu(MENU_INSERT, "println interpolated", (s, evt) => insertText("println $\"\"", -1, 0), "^%P"); menus.Menu(MENU_INSERT, "print", (s, evt) => insertText("print ", 0, 0)); menus.Menu(MENU_INSERT, "manifln", (s, evt) => insertText("manifln ", 0, 0), "^M"); menus.Menu(MENU_INSERT, "manif", (s, evt) => insertText("manif", 0, 0)); menus.Menu(MENU_INSERT, "put", (s, evt) => insertText("put ", 0, 0)); menus.Menu(MENU_INSERT, "peek", (s, evt) => surround("peek(", ")"), "^K"); menus.MenuSeparator(MENU_INSERT); menus.Menu(MENU_INSERT, "if template", (s, evt) => insertTemplate("if true", "true"), "^|I"); menus.Menu(MENU_INSERT, "while template", (s, evt) => insertTemplate("while true", "true"), "^|W"); menus.Menu(MENU_INSERT, "for template", (s, evt) => insertTemplate("for i in ^0", "^0"), "^|F"); menus.Menu(MENU_INSERT, "func template", (s, evt) => insertTemplate("func proc()", "proc"), "^|P"); menus.Menu(MENU_INSERT, "func template", (s, evt) => insertTemplate("func proc()", "proc"), "^|P"); menus.CreateMainMenu(this); menus.StandardContextEdit(document); textEditor.ReassignHandle(); locked = false; manual = false; stopwatch = new Stopwatch(); fileCache = new InteractiveFileCache(); textEditor.Paint += (s, evt) => paintResults(evt); setManual(settings.Manual); if (settings.DefaultFolder != null) { FolderName.Current = settings.DefaultFolder; } textText.Text = settings.Text.FromBase64(Encoding.UTF8) ?? ""; if (PassedFileName.IsSome) { document.Open(PassedFileName.Value); } else if (settings.LastFile != null && ((FileName)settings.LastFile).Exists()) { document.Open(settings.LastFile); } } catch (Exception exception) { displayException(exception); } }
public void Clear() { Items.Clear(); TextBoxConsole.Clear(); }