Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- // Made by XeClutch
- //
- // Got a question? Contact me on 7S or Twitter
- namespace PPC2C_v2
- {
- public partial class MainForm : Form
- {
- private string ProcessInstruction(string instruction)
- {
- string str = "";
- #region PPC:add
- if (instruction.StartsWith("add "))
- {
- instruction = instruction.Replace("add ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} + {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} += {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:addi
- else if (instruction.StartsWith("addi "))
- {
- instruction = instruction.Replace("addi ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} + {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} += {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:and
- else if (instruction.StartsWith("and "))
- {
- instruction = instruction.Replace("and ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} & {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} &= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:andi
- else if (instruction.StartsWith("andi "))
- {
- instruction = instruction.Replace("andi ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} & {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} &= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:andis
- else if (instruction.StartsWith("andis "))
- {
- instruction = instruction.Replace("andis ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = ({1} & {2}) << 16;", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} &= {1} << 16;", operands[1], operands[2]);
- }
- #endregion
- #region PPC:beq
- else if (instruction.StartsWith("beq "))
- {
- instruction = instruction.Replace("beq ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("if ({0} == 4) {1};", operands[0], operands[1].StartsWith("sub") ? (operands[1] + "()") : ("goto " + operands[1]));
- }
- #endregion
- #region PPC:bgt
- else if (instruction.StartsWith("bgt "))
- {
- instruction = instruction.Replace("bgt ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("if ({0} == 2) {1};", operands[0], operands[1].StartsWith("sub") ? (operands[1] + "()") : ("goto " + operands[1]));
- }
- #endregion
- #region PPC:bl
- else if (instruction.StartsWith("bl "))
- {
- instruction = instruction.Replace("bl ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0};", operands[0].StartsWith("sub") ? (operands[0] + "()") : ("goto " + operands[0]));
- }
- #endregion
- #region PPC:blr
- else if (instruction.StartsWith("blr "))
- str = "return;";
- #endregion
- #region PPC:blt
- else if (instruction.StartsWith("blt "))
- {
- instruction = instruction.Replace("blt ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("if ({0} == 1) {1};", operands[0], operands[1].StartsWith("sub") ? (operands[1] + "()") : ("goto " + operands[1]));
- }
- #endregion
- #region PPC:bne
- else if (instruction.StartsWith("bne "))
- {
- instruction = instruction.Replace("bne ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("if ({0} != 4) {1};", operands[0], operands[1].StartsWith("sub") ? (operands[1] + "()") : ("goto " + operands[1]));
- }
- #endregion
- #region PPC:divw
- else if (instruction.StartsWith("divw "))
- {
- instruction = instruction.Replace("divw ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} / {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} /= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:eqv
- else if (instruction.StartsWith("eqv "))
- {
- instruction = instruction.Replace("eqv ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} ^ {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} ^= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:lbz
- else if (instruction.StartsWith("lbz "))
- {
- instruction = instruction.Replace("lbz ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = *(byte*)({1} + {2});", operands[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""));
- }
- #endregion
- #region PPC:lbzu
- else if (instruction.StartsWith("lbzu "))
- {
- instruction = instruction.Replace("lbzu ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = *(byte*)({1} = ({2} + {3}));", operands[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""));
- }
- #endregion
- #region PPC:lhz
- else if (instruction.StartsWith("lhz "))
- {
- instruction = instruction.Replace("lhz ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = *(word*)({1} + {2});", operands[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""));
- }
- #endregion
- #region PPC:lhzu
- else if (instruction.StartsWith("lhzu "))
- {
- instruction = instruction.Replace("lhzu ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = *(word*)({1} = ({2} + {3}));", operands[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""));
- }
- #endregion
- #region PPC:li
- else if (instruction.StartsWith("li "))
- {
- instruction = instruction.Replace("li ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = {1};", operands[0], operands[1]);
- }
- #endregion
- #region PPC:lis
- else if (instruction.StartsWith("lis "))
- {
- instruction = instruction.Replace("lis ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = {1} << 16;", operands[0], operands[1]);
- }
- #endregion
- #region PPC:lwz
- else if (instruction.StartsWith("lwz "))
- {
- instruction = instruction.Replace("lwz ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = *(dword*)({1} + {2});", operands[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""));
- }
- #endregion
- #region PPC:lwzu
- else if (instruction.StartsWith("lwzu "))
- {
- instruction = instruction.Replace("lwzu ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = *(dword*)({1} = ({2} + {3}));", operands[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""));
- }
- #endregion
- #region PPC:mfcr
- else if (instruction.StartsWith("mfcr "))
- {
- instruction = instruction.Replace("mfcr ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = CR;", operands[0]);
- }
- #endregion
- #region PPC:mr
- else if (instruction.StartsWith("mr "))
- {
- instruction = instruction.Replace("mr ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("{0} = {1};", operands[0], operands[1]);
- }
- #endregion
- #region PPC:mulli
- else if (instruction.StartsWith("mulli "))
- {
- instruction = instruction.Replace("mulli ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} * {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} *= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:mullw
- else if (instruction.StartsWith("mullw "))
- {
- instruction = instruction.Replace("mullw ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} * {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} *= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:or
- else if (instruction.StartsWith("or "))
- {
- instruction = instruction.Replace("or ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} | {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} |= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:ori
- else if (instruction.StartsWith("ori "))
- {
- instruction = instruction.Replace("ori ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} | {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} |= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:oris
- else if (instruction.StartsWith("oris "))
- {
- instruction = instruction.Replace("oris ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = ({1} | {2}) << 16;", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} |= {1} << 16;", operands[1], operands[2]);
- }
- #endregion
- #region PPC:slw
- else if (instruction.StartsWith("slw "))
- {
- instruction = instruction.Replace("slw ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} << {2}", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} <<= {1}", operands[1], operands[2]);
- }
- #endregion
- #region PPC:slwi
- else if (instruction.StartsWith("slwi "))
- {
- instruction = instruction.Replace("slwi ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} << {2}", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} <<= {1}", operands[1], operands[2]);
- }
- #endregion
- #region PPC:srw
- else if (instruction.StartsWith("srw "))
- {
- instruction = instruction.Replace("srw ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} >> {2}", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} >>= {1}", operands[1], operands[2]);
- }
- #endregion
- #region PPC:srwi
- else if (instruction.StartsWith("srwi "))
- {
- instruction = instruction.Replace("srwi ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} >> {2}", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} >>= {1}", operands[1], operands[2]);
- }
- #endregion
- #region PPC:stb
- else if (instruction.StartsWith("stb "))
- {
- instruction = instruction.Replace("stb ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("*(byte*)({0} + {1}) = (byte){2};", operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""), operands[0]);
- }
- #endregion
- #region PPC:stbu
- else if (instruction.StartsWith("stbu "))
- {
- instruction = instruction.Replace("stbu ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("*(byte*)({0} = ({1} + {2})) = (byte){3};", operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""), operands[0]);
- }
- #endregion
- #region PPC:sth
- else if (instruction.StartsWith("sth "))
- {
- instruction = instruction.Replace("sth ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("*(word*)({0} + {1}) = (word){2};", operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""), operands[0]);
- }
- #endregion
- #region PPC:sthu
- else if (instruction.StartsWith("sthu "))
- {
- instruction = instruction.Replace("sthu ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("*(byte*)({0} = ({1} + {2})) = (byte){3};", operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""), operands[0]);
- }
- #endregion
- #region PPC:stw
- else if (instruction.StartsWith("stw "))
- {
- instruction = instruction.Replace("stw ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("*(dword*)({0} + {1}) = (dword){2};", operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""), operands[0]);
- }
- #endregion
- #region PPC:stwu
- else if (instruction.StartsWith("stwu "))
- {
- instruction = instruction.Replace("stwu ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- str = string.Format("*(byte*)({0} = ({1} + {2})) = (byte){3};", operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[0], operands[1].Split("(".ToCharArray())[1].Replace(")", ""), operands[0]);
- }
- #endregion
- #region PPC:subf
- else if (instruction.StartsWith("subf "))
- {
- instruction = instruction.Replace("subf ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} - {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} -= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:subi
- else if (instruction.StartsWith("subi "))
- {
- instruction = instruction.Replace("subi ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} - {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} -= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:xor
- else if (instruction.StartsWith("xor "))
- {
- instruction = instruction.Replace("xor ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} ^ {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} ^= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:xori
- else if (instruction.StartsWith("xori "))
- {
- instruction = instruction.Replace("xori ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = {1} ^ {2};", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} ^= {1};", operands[1], operands[2]);
- }
- #endregion
- #region PPC:xoris
- else if (instruction.StartsWith("xoris "))
- {
- instruction = instruction.Replace("xoris ", "");
- string[] operands = instruction.Replace(" ", "").Split(",".ToCharArray());
- if (operands[0] != operands[1])
- str = string.Format("{0} = ({1} ^ {2}) << 16;", operands[0], operands[1], operands[2]);
- else
- str = string.Format("{0} ^= {1} << 16;", operands[1], operands[2]);
- }
- #endregion
- #region PPC:?
- else if (instruction != "")
- str = "//" + instruction.Replace("#", "");
- #endregion
- #region PPC:#
- str = str.Replace("#", "//");
- #endregion
- return str + "\n";
- }
- public MainForm()
- {
- InitializeComponent();
- MinimumSize = new Size(663, 483);
- MaximumSize = new Size(663, 800);
- /// Format PPC code box
- // Comments
- richTextBox1.Settings.Comment = "#";
- richTextBox1.Settings.CommentColor = Color.Green;
- richTextBox1.Settings.EnableComments = true;
- // Integers
- richTextBox1.Settings.IntegerColor = Color.Orange;
- richTextBox1.Settings.EnableIntegers = true;
- // Strings
- richTextBox1.Settings.StringColor = Color.Red;
- richTextBox1.Settings.EnableStrings = true;
- // Keywords
- richTextBox1.Settings.Keywords.Add("add");
- richTextBox1.Settings.Keywords.Add("addi");
- richTextBox1.Settings.Keywords.Add("addis");
- richTextBox1.Settings.Keywords.Add("and");
- richTextBox1.Settings.Keywords.Add("andi");
- richTextBox1.Settings.Keywords.Add("andis");
- richTextBox1.Settings.Keywords.Add("beq");
- richTextBox1.Settings.Keywords.Add("bgt");
- richTextBox1.Settings.Keywords.Add("bl");
- richTextBox1.Settings.Keywords.Add("blr");
- richTextBox1.Settings.Keywords.Add("blt");
- richTextBox1.Settings.Keywords.Add("bne");
- richTextBox1.Settings.Keywords.Add("divw");
- richTextBox1.Settings.Keywords.Add("eqv");
- richTextBox1.Settings.Keywords.Add("lbz");
- richTextBox1.Settings.Keywords.Add("lbzu");
- richTextBox1.Settings.Keywords.Add("lhz");
- richTextBox1.Settings.Keywords.Add("lhzu");
- richTextBox1.Settings.Keywords.Add("li");
- richTextBox1.Settings.Keywords.Add("lis");
- richTextBox1.Settings.Keywords.Add("lwz");
- richTextBox1.Settings.Keywords.Add("lwzu");
- richTextBox1.Settings.Keywords.Add("mfcr");
- richTextBox1.Settings.Keywords.Add("mulli");
- richTextBox1.Settings.Keywords.Add("mullw");
- richTextBox1.Settings.Keywords.Add("mr");
- richTextBox1.Settings.Keywords.Add("or");
- richTextBox1.Settings.Keywords.Add("ori");
- richTextBox1.Settings.Keywords.Add("oris");
- richTextBox1.Settings.Keywords.Add("slw");
- richTextBox1.Settings.Keywords.Add("slwi");
- richTextBox1.Settings.Keywords.Add("srw");
- richTextBox1.Settings.Keywords.Add("srwi");
- richTextBox1.Settings.Keywords.Add("stb");
- richTextBox1.Settings.Keywords.Add("stbu");
- richTextBox1.Settings.Keywords.Add("sth");
- richTextBox1.Settings.Keywords.Add("sthu");
- richTextBox1.Settings.Keywords.Add("stw");
- richTextBox1.Settings.Keywords.Add("stwu");
- richTextBox1.Settings.Keywords.Add("subf");
- richTextBox1.Settings.Keywords.Add("subi");
- richTextBox1.Settings.Keywords.Add("xor");
- richTextBox1.Settings.Keywords.Add("xori");
- richTextBox1.Settings.Keywords.Add("xoris");
- richTextBox1.Settings.KeywordColor = Color.Blue;
- richTextBox1.CompileKeywords();
- /// Format C code box
- // Comments
- richTextBox2.Settings.Comment = "//";
- richTextBox2.Settings.CommentColor = Color.Green;
- richTextBox2.Settings.EnableComments = true;
- // Integers
- richTextBox2.Settings.IntegerColor = Color.Orange;
- richTextBox2.Settings.EnableIntegers = true;
- // Strings
- richTextBox2.Settings.StringColor = Color.Red;
- richTextBox2.Settings.EnableStrings = true;
- // Keywords
- richTextBox2.Settings.Keywords.Add("byte");
- richTextBox2.Settings.Keywords.Add("dword");
- richTextBox2.Settings.Keywords.Add("if");
- richTextBox2.Settings.Keywords.Add("goto");
- richTextBox2.Settings.Keywords.Add("word");
- richTextBox2.Settings.Keywords.Add(">>");
- richTextBox2.Settings.Keywords.Add("<<");
- richTextBox2.Settings.Keywords.Add("=");
- richTextBox2.Settings.Keywords.Add("|");
- richTextBox2.Settings.Keywords.Add("&");
- richTextBox2.Settings.Keywords.Add("!");
- richTextBox2.Settings.Keywords.Add("^");
- richTextBox2.Settings.Keywords.Add("~");
- richTextBox2.Settings.KeywordColor = Color.Blue;
- richTextBox2.CompileKeywords();
- }
- private void openPPCFileToolStripMenuItem_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- ofd.Title = "Load a file containing PowerPC instructions..";
- ofd.Filter = "PPC File (*.ppc)|*.ppc";
- if (ofd.ShowDialog() == DialogResult.OK)
- {
- richTextBox1.Text = "";
- string[] lines = File.ReadAllLines(ofd.FileName);
- for (int i = 0; i < lines.Count(); i++)
- richTextBox1.Text += lines[i] + "\n";
- richTextBox1.ProcessAllLines();
- }
- }
- private void saveCFileToolStripMenuItem_Click(object sender, EventArgs e)
- {
- SaveFileDialog sfd = new SaveFileDialog();
- sfd.Title = "Create a new file that will contain C code..";
- sfd.Filter = "C File (*.c)|*.c";
- if (sfd.ShowDialog() == DialogResult.OK)
- File.WriteAllText(sfd.FileName, richTextBox2.Text.Replace("\n", Environment.NewLine));
- }
- private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
- {
- new AboutForm().ShowDialog();
- }
- private void convert_Click(object sender, EventArgs e)
- {
- if (richTextBox1.Text == "")
- return;
- richTextBox2.Text = "// Converted using PPC2C2 by XeClutch\n";
- string[] lines = richTextBox1.Text.Split("\n".ToCharArray());
- foreach (string line in lines)
- richTextBox2.Text += ProcessInstruction(line);
- richTextBox2.Text = richTextBox2.Text.TrimEnd("\n".ToCharArray());
- richTextBox1.ProcessAllLines();
- richTextBox2.ProcessAllLines();
- }
- private void richTextBox1_TextChanged(object sender, EventArgs e)
- {
- richTextBox1.ProcessAllLines();
- }
- private void richTextBox2_TextChanged(object sender, EventArgs e)
- {
- richTextBox2.ProcessAllLines();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement