public static PcbDesign Parse(string contents) { //Parse units from the header int i = contents.IndexOf(FileHeaderDesignator,1); int j = contents.LastIndexOf(FileHeaderSeparator,i) + 1; string temp = contents.Substring(j,i - j); PcbUnits coordinateUnits = HeaderUnits.First(x => x.Value == temp).Key; //Get section boundaries i = contents.IndexOf(LineSeparator,i) + 1; Dictionary <ControlStatement,int> sections = new Dictionary <ControlStatement,int>(ControlStatements.Length); for (int k = 0; k < ControlStatements.Length; k++) { j = contents.IndexOf(ControlStatements[k],i); if (j > -1) { j = contents.IndexOf(LineSeparator,j) + 1; if (j < contents.Length) { if (contents[j] == LineSeparator) { j++; } if (contents[j] == CaretReset) { j += 2; } } sections.Add((ControlStatement)k,j); } } //Parse partdecal int currentSectionStart = sections[ControlStatement.PARTDECAL]; int currentSectionEnd = FindSectionEnd(sections,ControlStatement.PARTDECAL); int currentSectionLength = currentSectionEnd - currentSectionStart; Partdecal decal = null; try { decal = Partdecal.Parse(contents.Substring(currentSectionStart,currentSectionLength)); } catch (Exception e) { WarningListener.Add(e); } //Others are not needed yet return(PADSToPcbDesign(coordinateUnits,decal)); }