public void Copy(CalibrationSourcePara csp) { Description = csp.Description; Count = csp.Count; datetime = csp.datetime; CSRows.Clear(); foreach (CSRow csr in csp.CSRows) { CSRows.Add(csr); } }
public static void listcspLoad() { Settings.listcsp.Clear(); if (!File.Exists(CalibrationSourcePath)) { File.Create(CalibrationSourcePath).Close(); } else { StreamReader sr = new StreamReader(CalibrationSourcePath); String line; while ((line = sr.ReadLine()) != null) { CalibrationSourcePara csp = new CalibrationSourcePara(); //add new code here csp.Description = line; { line = sr.ReadLine(); int tmp; int.TryParse(line, out tmp); csp.Count = tmp; } line = sr.ReadLine(); csp.datetime = Convert.ToDateTime(line); line = sr.ReadLine(); while (line[0] != '#') { string[] data = line.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries); CSRow csr = new CSRow(); csr.核素 = data[0]; double tmp; double.TryParse(data[1], out tmp); csr.能量keV = tmp; double.TryParse(data[2], out tmp); csr.计数率 = tmp; double.TryParse(data[3], out tmp); csr.确定度1 = tmp; double.TryParse(data[4], out tmp); csr.衰变周期 = tmp; double.TryParse(data[5], out tmp); csr.确定度2 = tmp; int tmp2; int.TryParse(data[6], out tmp2); csr.时间单位 = (timeUnit)tmp2; csp.CSRows.Add(csr); line = sr.ReadLine(); } Settings.listcsp.Add(csp); } sr.Close(); } }