private void GetData() { if (string.IsNullOrEmpty(FilePath)) { Wat = null; return; } Wat = new WAT(); StreamReader sr = new StreamReader(FilePath, Encoding.Default); try { string line = sr.ReadLine(); //如果文件第一行不包含5个“=”,则断定为格式错误。 if (!line.Contains("=====")) { return; } while (!(line = sr.ReadLine()).Contains("=====")) { GetData_Overview(line); } sr.ReadLine(); while (!(line = sr.ReadLine()).Contains("=")) { GetData_SiteCoordinate(line); } WATWafer wafer = new WATWafer(); while ((line = sr.ReadLine()) != null) { if (string.IsNullOrEmpty(line)) { continue; } string[] array = line.Split(','); if (array[0] == "SYS_WAFERID") { if (!string.IsNullOrEmpty(wafer.WaferID)) { Wat.wafers.Add(wafer); wafer = new WATWafer(); } wafer.WaferID = array[1]; } else if (string.IsNullOrEmpty(array[0])) { for (int i = 1; i < array.Length; i++) { wafer.parameters[wafer.parameters.Count - 1].ValueList.Add(array[i]); } } else if (array[0].Substring(0, 2) == "R[") { WATParameter parameter = new WATParameter { ItemNo = array[0], ParameterName = array[1], unit = array[2] }; for (int i = 3; i < array.Length; i++) { parameter.ValueList.Add(array[i]); } wafer.parameters.Add(parameter); } } if (!string.IsNullOrEmpty(wafer.WaferID)) { Wat.wafers.Add(wafer); } } catch (Exception) { throw; } finally { sr.Close(); } }
public static void TakesANestedParam(WAT wat) { }