private void button_delete_Click(object sender, EventArgs e) { List <StaData> stadata = new List <StaData>(); using (StreamReader r = new StreamReader(this.textBox_satNLFile.Text)) { string line = null; line = r.ReadLine(); int j = 0; while ((line = r.ReadLine()) != null) { StaData currentdata = new StaData(); List <double> CurrentNL = new List <double>(); string[] tmp = SplitByBlank(line); if (tmp.Length == 1) { tmp = SplitByExcelBlank(line); } foreach (var item in tmp) { } } } }
private void button_extract_Click(object sender, EventArgs e) { for (int i = 1; i <= 32; i++) { totalsats.Add(SatelliteNumber.Parse(i.ToString())); } Dictionary <string, List <Data> > AllStaNL = new Dictionary <string, List <Data> >(); progressBar1.Maximum = SatNLFiles.Count + totalsats.Count * 2; progressBar1.Minimum = 1; progressBar1.Step = 1; progressBar1.Value = progressBar1.Minimum; foreach (var file in SatNLFiles) { List <Data> currentStaNL = new List <Data>(); using (StreamReader r = new StreamReader(file)) { string line = null; line = r.ReadLine(); int j = 0; while ((line = r.ReadLine()) != null) { Data data = new Data(); List <double> CurrentNL = new List <double>(); string[] tmp = SplitByBlank(line); if (tmp.Length == 1) { tmp = SplitByExcelBlank(line); } data.time = Time.Parse("2013" + " " + "1" + " " + "2" + " " + tmp[1]); //日期,要更改 for (int i = 7; i < 39; i++) //前6个均和卫星无关 { CurrentNL.Add(double.Parse(tmp[i])); if (j == 1145) { j = 1; } } j++; data.NL = CurrentNL; currentStaNL.Add(data); } string Staname = file.Substring(file.Length - 8, 4); AllStaNL.Add(Staname, currentStaNL); } progressBar1.PerformStep(); progressBar1.Refresh(); } foreach (var sat in totalsats) { int number = sat.PRN; List <StaData> staNL = new List <StaData>(); foreach (var item in AllStaNL) { StaData data2 = new StaData(); List <double> tmpsat = new List <double>(); List <Time> tmptime = new List <Time>(); foreach (var record in item.Value) { tmpsat.Add(record.NL[number - 1]); tmptime.Add(record.time); } data2.time = tmptime; data2.staname = item.Key; data2.SatNL = tmpsat; staNL.Add(data2); } ALLSatNL.Add(sat, staNL); progressBar1.PerformStep(); progressBar1.Refresh(); } foreach (var sat in totalsats) { int number = sat.PRN; string SavePath = textBox_OutputDir.Text + "\\G" + "\\NL_" + sat + ".txt"; FileInfo cFile = new FileInfo(SavePath); StreamWriter SW3 = cFile.CreateText(); SW3.Write("日期"); SW3.Write(" "); SW3.Write("时间"); SW3.Write(" "); foreach (var item in ALLSatNL[sat]) { SW3.Write(item.staname); SW3.Write(" "); } SW3.WriteLine(); for (int i = 0; i < 2851; i++) { Time currenttime = ALLSatNL[sat][0].time[i]; foreach (var item in ALLSatNL[sat]) { //if (path.SatNL.Count - 1 < time) //{ // SW3.Write(9999999.ToString()); // SW3.Write(" "); // continue; //} if (item.staname == "albh") { SW3.Write(currenttime.ToString()); SW3.Write(" "); } if (item.time.Contains(currenttime)) { int j = item.time.IndexOf(currenttime);//返回等于指定时间的索引值 if (item.SatNL[j] == 0) { SW3.Write(9999999.ToString()); } else { SW3.Write(item.SatNL[j].ToString());//注意是j } } else { SW3.Write(9999999.ToString()); } SW3.Write(" "); } SW3.WriteLine(); } SW3.Close(); progressBar1.PerformStep(); progressBar1.Refresh(); } FormUtil.ShowIfOpenDirMessageBox(this.textBox_OutputDir.Text); }