public void printOutData(string data) { string[] lines = data.Split('\n'); int minute = 0; int second = 0; int milli = 0; int counter2 = 0; string timeStamp = ""; int prevMilli = -1; FrequencyData freqData = new FrequencyData(); foreach (string line in lines) { if (line != "") { string[] lr = line.Split('-'); string[] time = lr[0].Split(':'); string[] freqs = lr[1].Split(','); int[] fdata = new int[16]; minute = Convert.ToInt32(time[0]); second = Convert.ToInt32(time[1]); milli = Convert.ToInt32(time[2]) / 10; if (milli != prevMilli) { prevMilli = milli; counter2 = 0; foreach (string fd in freqs) { fdata[counter2++] = Convert.ToInt32(fd); } if (milli == 0) { timeStamp = minute + ":" + second + ":" + (milli * 10) + "00"; } else if (milli > 9) { timeStamp = minute + ":" + second + ":" + (milli) + "0"; } else { timeStamp = minute + ":" + second + ":0" + (milli) + "0"; } freqData.insertTime(timeStamp, fdata); } } } bool print = true; foreach (KeyValuePair <string, int[]> pair in freqData.Frequency) { if (print) { string str = ""; foreach (int i in pair.Value) { str += i + ","; } tw.Write(pair.Key + " - " + str.Substring(0, str.Length - 1) + "\r\n"); } print = !print; } }
public void printOutData(string data) { string[] lines = data.Split('\n'); int minute = 0; int second = 0; int milli = 0; int counter2 = 0; string timeStamp = ""; int prevMilli = -1; FrequencyData freqData = new FrequencyData(); foreach (string line in lines) { if (line != "") { string[] lr = line.Split('-'); string[] time = lr[0].Split(':'); string[] freqs = lr[1].Split(','); int[] fdata = new int[16]; minute = Convert.ToInt32(time[0]); second = Convert.ToInt32(time[1]); milli = Convert.ToInt32(time[2]) / 10; if (milli != prevMilli) { prevMilli = milli; counter2 = 0; foreach (string fd in freqs) { fdata[counter2++] = Convert.ToInt32(fd); } if (milli == 0) { timeStamp = minute + ":" + second + ":" + (milli * 10) + "00"; } else if (milli > 9) { timeStamp = minute + ":" + second + ":" + (milli) + "0"; } else { timeStamp = minute + ":" + second + ":0" + (milli) + "0"; } freqData.insertTime(timeStamp, fdata); } } } bool print = true; foreach (KeyValuePair<string, int[]> pair in freqData.Frequency) { if (print) { string str = ""; foreach (int i in pair.Value) { str += i + ","; } tw.Write(pair.Key + " - " + str.Substring(0, str.Length - 1) + "\r\n"); } print = !print; } }