public void ReadConfigureFile(string sConfigPath) { if (!File.Exists(sConfigPath)) { log.Error("Configure file does not exist!"); return; } bool bFirstRow = true; using (StreamReader sr = new StreamReader(sConfigPath, System.Text.Encoding.Default)) { string sContent = ""; while (true) { sContent = sr.ReadLine(); if (sContent == null) { break; } if (bFirstRow) { bFirstRow = false; } else { DestRack destRackInfo = ExtractRackInfo(sContent.Split('\t').ToList()); rackInfos.Add(destRackInfo); } } } }
private DestRack ExtractRackInfo(List <string> list) { if (list.Count < 4) { throw new Exception("配置文件格式错误,配置项不全"); } DestRack rack = new DestRack(); rack.Name = list[0]; rack.Alignment = (PipettingApproach)Enum.Parse(typeof(PipettingApproach), list[1]); rack.Width = int.Parse(list[2]); rack.Height = int.Parse(list[3]); return(rack); }
private DestRack ExtractRackInfo(List<string> list) { if (list.Count < 4) { throw new Exception("配置文件格式错误,配置项不全"); } DestRack rack = new DestRack(); rack.Name = list[0]; rack.Alignment = (PipettingApproach) Enum.Parse(typeof(PipettingApproach), list[1]); rack.Width = int.Parse(list[2]); rack.Height = int.Parse(list[3]); return rack; }