static void Main(string[] args) { // Location of text files - Change this if necessary string readfileName = @"c:input.txt"; string writefileName = @"c:output.txt"; // Create new manager mgr = new TriangleManager(); // Read text file incremental data input using (StreamReader sr = new StreamReader(readfileName)) { string[] item = new string[4]; string line; // For each line, read and store data while ((line = sr.ReadLine()) != null) { Factory.input(line); } sr.Close(); } // Write to text file with converted cummulative data using (StreamWriter sw = new StreamWriter(writefileName)) { string text = Factory.output(); sw.Write(text); sw.Close(); } }
// On input, verify the data and add this new entry to data stores public static void input(string line) { string[] items = verify(line); if (items == null) { return; } TriangleManager.setValues(items[0], int.Parse(items[1]), int.Parse(items[2]), float.Parse(items[3])); }