private void bFull_Click(object sender, EventArgs e) { int i = 0; try { for (; i < numSteps.Value; i++) { MoveFunktion moveFunktion = machine.PerformStep(); if (moveFunktion == null) { string lauf = ""; foreach (var item in machine.Functions) { lauf += item.COUNTER + " " + item + "\r\n"; } break; } moveFunktion.COUNTER++; lStepCount.Text = "Steps: " + (++counter); //history += "Schritt " + counter + ": Leseköpfe" + machine.CurrentChars.GetString() + " " + moveFunktion + "\r\n"; //foreach (var item in machine.Baender) //{ // history += "\t" + item.List.GetString().Replace("(","{").Replace(")","}")+"\r\n"; //} //history += "\r\n"; } } catch (Exception ex) { tbError.Text = "After the " + (i + 1) + " Step: \r\n" + ex.Message + "\r\n\r\n" + ex.StackTrace; } DumpMachine(); }
public static MoveFunktion[] ParseMoveFunctions(string text) { string formal = ""; text = text.Replace("\r", ""); string[] lines = text.Split('\n'); List <MoveFunktion> moveFunktions = new List <MoveFunktion>(); for (int i = 0; i < lines.Length; i++) { string line = lines[i].Replace(" ", "").Replace("\t", ""); if (line.Contains("//")) { formal += line += "\r\n"; continue; } try { if (!String.IsNullOrWhiteSpace(line)) { MoveFunktion m = ParseMoveFunction(new StringReader(line)); m.TB_INFO = i; formal += m + "\r\n"; moveFunktions.Add(m); } else { formal += "\r\n"; } } catch (Exception ex) { throw new Exception("Error parsing line " + (i + 1) + " \"" + line + "\" \r\nInner Exception: " + ex, ex); } } List <string> states = moveFunktions.Select(n => n.StateName).ToList(); List <string> ust = new List <string>(); foreach (var item in states) { if (!ust.Contains(item)) { ust.Add(item); } } string s = ust.GetString(); return(moveFunktions.ToArray()); }
private void bStep_Click(object sender, EventArgs e) { lastfilename = "lolTOURINGBILD" + new Random().Next() + ".jpg"; try { MoveFunktion moveFunktion = machine.PerformStep(true, (int)numImageSize.Value, lastfilename); if (moveFunktion == null) { return; } GoToLine(moveFunktion.TB_INFO); pbCurState.Image = Image.FromFile(lastfilename); lStepCount.Text = "Steps: " + (++counter); history += "Step " + counter + ": " + machine.CurrentChars.GetString() + " " + moveFunktion; } catch (Exception ex) { tbError.Text = ex.Message + "\r\n\r\n" + ex.StackTrace; return; } DumpMachine(); }