public void Copy(TransmissionSourcePara tsp) { Description = tsp.Description; TSRows.Clear(); foreach (TSRow tsr in tsp.TSRows) { TSRows.Add(tsr); } }
public static void listtspLoad() { Settings.listtsp.Clear(); if (!File.Exists(TransmissionSourcePath)) { File.Create(TransmissionSourcePath).Close(); } else { StreamReader sr = new StreamReader(TransmissionSourcePath); String line; while ((line = sr.ReadLine()) != null) { TransmissionSourcePara tsp = new TransmissionSourcePara(); //add new code here tsp.Description = line; line = sr.ReadLine(); while (line[0] != '#') { string[] data = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); TSRow tsr = new TSRow(); tsr.核素 = data[0]; double tmp; double.TryParse(data[1], out tmp); tsr.光峰能量keV = tmp; double.TryParse(data[2], out tmp); tsr.衰变周期 = tmp; int tmp2; int.TryParse(data[3], out tmp2); tsr.时间单位 = (timeUnit)tmp2; tsp.TSRows.Add(tsr); line = sr.ReadLine(); } Settings.listtsp.Add(tsp); } sr.Close(); } }