public void GetInput(string fileName) { if (!File.Exists(fileName)) { return; } System.IO.StreamReader file = new System.IO.StreamReader(fileName); Regex findAcceptStates = new Regex(@"^accept:\.*?"); Regex findStartStates = new Regex(@"^init:\.*?"); Regex findName = new Regex(@"^name:\.*"); TransitionFunction TF = null; string line; while ((line = file.ReadLine()) != null) { string[] splitLine = ParseLine(line).ToArray(); bool tryParseLine = true; if (AcceptStates.Count == 0) { Match match = findAcceptStates.Match(splitLine[0]); // Get the accept states. if (match.Success) { AcceptStates = ParseLine(line.Substring(match.Length)).ToList(); tryParseLine = !match.Success; } } if (Name == "") { Match match = findName.Match(splitLine[0]); if (match.Success) { Name = splitLine[0].Substring(match.Length).Trim(); tryParseLine = false; } } if (StartState == "") { Match match = findStartStates.Match(splitLine[0]); if (match.Success) { StartState = splitLine[0].Substring(match.Length).Trim(); tryParseLine = false; } } if (splitLine.Length > 1 && tryParseLine) { if (TF == null) { TF = new TransitionFunction(splitLine); } else { TF.DefineRange(splitLine); TransitionFunctions.Add(TF); TF = null; } } } }