static public Protocol CreateFromCSVFile(string csvFile) { int commaCnt = 6; FileInfo fileInfo = new FileInfo(csvFile); string name = fileInfo.Name; string[] strLines = File.ReadAllLines(csvFile); strLines = strLines.Where(x => x != "").ToArray(); List <StepDefinition> stepDefinitions = new List <StepDefinition>(); for (int i = 1; i < strLines.Length; i++) { string sLine = strLines[i]; int currentCnt = sLine.Count(x => x == comma); if (currentCnt != commaCnt) { throw new Exception(string.Format("CSV文件格式非法,期望列数为{0},实际列数为{1}!", commaCnt, currentCnt)); } string[] lineContents = sLine.Split(','); StepDefinition stepDefinition = new StepDefinition(lineContents, i); stepDefinitions.Add(stepDefinition); } return(new Protocol(name, stepDefinitions)); }
public StepDefinitionWithProgressInfo(StepDefinition stepDef) { Description = stepDef.Description; SourceLabware = stepDef.SourceLabware; Volume = stepDef.Volume; DeadVolume = stepDef.DeadVolume; DestLabware = stepDef.DestLabware; RepeatTimes = stepDef.RepeatTimes; //ReuseTimes = stepDef.ReuseTimes; TipType = stepDef.TipType; LineNumber = stepDef.LineNumber; }