do { string instruction = string.Empty; string nextstate; string output; string direction; string temp; temp = CurrentInstruction.Substring(CurrentInstruction.IndexOf('{') + 1); temp = temp.Substring(0, temp.IndexOf('}')); string[] temp1 = temp.Split(','); currentstate = temp1[0]; output = temp1[1]; direction = temp1[2]; StringBuilder sb = new StringBuilder(richTextBox1.Text); sb[currentinputindex] = Convert.ToChar(output); richTextBox1.Text = sb.ToString(); if (direction == "R") { //resetting the color for present input richTextBox1.Select(currentinputindex, 1); richTextBox1.SelectionBackColor = System.Drawing.SystemColors.Control; richTextBox1.Focus(); //higlisting the next input currentinputindex = currentinputindex + 1; richTextBox1.Select(currentinputindex, 1); richTextBox1.SelectionBackColor = Color.Blue; richTextBox1.Focus(); //richTextBox1.SelectionBullet = true; } else { //resetting the color for present input richTextBox1.Select(currentinputindex, 1); richTextBox1.SelectionBackColor = System.Drawing.SystemColors.Control; richTextBox1.Focus(); //higlisting the next input currentinputindex = currentinputindex - 1; richTextBox1.Select(currentinputindex, 1); richTextBox1.SelectionBackColor = Color.Blue; richTextBox1.Focus(); // richTextBox1.SelectionBullet = true; } txtCurrentState.Text = currentstate; string SearchString = "d[" + txtCurrentState.Text + "," + richTextBox1.Text[currentinputindex] + "]"; sr = new System.IO.StreamReader(filename); string line; while ((line = sr.ReadLine()) != null) { if (line.Contains(SearchString)) { instruction = line; } } sr.Close(); CurrentInstruction = instruction; txtInstructions.SelectionStart = txtInstructions.Text.IndexOf(instruction); txtInstructions.SelectionLength = instruction.Length; txtInstructions.Focus(); }while (currentstate !="h" && currentstate != "H");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)