/*Parse the TotalTemp file */ static void parseTotalTempAndApplyStatistic(string totaltemp_path, List <Configuration> config_array, Factory statistics_factory) { System.IO.StreamReader TotalTemp = null; string line; try { TotalTemp = new System.IO.StreamReader(totaltemp_path); TempHeader temp_header = new TempHeader(TotalTemp); while (null != (line = TotalTemp.ReadLine())) { string[] split_config = line.Split('\t'); foreach (Configuration config in config_array) { if (split_config.Contains(config.GetVarName())) { config.CalculatePeriod(statistics_factory, split_config, temp_header); } } } } catch (Exception e) { Console.WriteLine("Error reading TotalTemp file. Message = {1}", e.Message); Environment.Exit(0); } finally { if (null != TotalTemp) { TotalTemp.Close(); } } }
public void CalculatePeriod(Factory statistics_factory, string[] split_config, TempHeader temp_header) { try { double position_result = statistics_factory.plugin_dictionary[period].calculate(split_config, temp_header.GetValuePos()); statistic_list.Add(position_result); } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); return; } }