private void Loader() { CleanBoxData(); if (Number_Of_Lines > ListLines.Count) { Number_Of_Lines = ListLines.Count; } LineNumber = 0; ListLines.Insert(0, "=================== Start Of The File ==================="); ListLines.Add("=================== End Of The File ==================="); for (int i = 0; i < Number_Of_Lines; i++) { rtbEditor.AppendText("=> " + ListLines[i]); rtbEditor.AppendText("\n"); SuffixColumns.AppendText(i + " ===== "); SuffixColumns.AppendText("\n"); SuffixBox.AppendText(i + ":"); SuffixBox.AppendText("\n"); } Current_Line = 1; Highlight(1); }
private void Suffix_Executed(object sender, ExecutedRoutedEventArgs e) { String command = FindSuffix(); LineNumber = command[0] - '0'; string Command = command.Remove(0, 2); Command = Command.ToLower(); char OP = Command[0]; try { switch (OP) { case 'a': Insert(1, LineNumber + 1); break; case 'b': Insert(1, LineNumber - 1); break; case 'i': Command = Command.Remove(0, 1); Insert(Convert.ToInt32(Command), LineNumber); break; case '"': Command = Command.Remove(0, 1); Command = Command.Remove(Command.Length - 1, 1); Command = Command.Remove(Command.Length - 1, 1); Copy(Convert.ToInt32(Command), LineNumber); break; default: break; } } catch (Exception ex) { MessageBox.Show("Format Error, see help"); } SuffixBox.Clear(); foreach (string text in SuffixCommands) { SuffixBox.AppendText(text); //SuffixBox.AppendText("\n"); } }
private string FindSuffix() { SuffixCommands = new List <String>(); string text = ""; bool found; bool flag = false; for (int i = 0; i < SuffixBox.LineCount; i++) { SuffixCommands.Add(SuffixBox.GetLineText(i)); found = Regex.IsMatch(SuffixCommands[i], @"[a-zA-Z | "" ]"); if (found && flag == false) { text = SuffixCommands[i]; SuffixCommands[i] = i + ":" + "\n"; flag = true; } } return(text); }
private void Update(int start, int end) { CleanBoxData(); if (end > ListLines.Count) { end = ListLines.Count; } if (end <= 0) { end = 2; } if (start >= end) { start = end - 1; } if (start < 0) { start = 0; } for (int i = start; i < end; i++) { rtbEditor.AppendText("=> " + ListLines[i]); rtbEditor.AppendText("\n"); SuffixColumns.AppendText(i + " ===== "); SuffixColumns.AppendText("\n"); SuffixBox.AppendText(i + ":"); SuffixBox.AppendText("\n"); } //Highlight(0);//first item }
private void CleanBoxData() { rtbEditor.Document.Blocks.Clear(); SuffixBox.Clear(); SuffixColumns.Clear(); }