public InterpretException[] InterpretDiagramText(string text, Generator generator, Output output) { string[] lines = new string[]{String.Empty}; uint line =1; uint fileLine =0; interpretExceptions.Clear(); lines = text.Split('\n'); output.SetWorksheetWidth(1000.0f,Worksheet.WS_UNIT_PICSEL); output.SetWorksheetHeight(1000.0f,Worksheet.WS_UNIT_PICSEL); sameline=false; for(int i=0; i<lines.Length; i++){ fileLine++; line = InterpretLine(lines[i].Trim('\r'), line, fileLine, generator, output); } generator.addMSCEnd(line); if (interpretExceptions.Count>0){ return (InterpretException[]) interpretExceptions.ToArray(typeof(InterpretException)); } return null; }
public InterpretException[] InterpretFile(string filename, Generator generator, Output output) { string s = String.Empty; StreamReader sr = new StreamReader(@filename, Encoding.Default); uint line =1; uint fileLine =0; interpretExceptions.Clear(); output.SetWorksheetWidth(1000.0f,Worksheet.WS_UNIT_PICSEL); output.SetWorksheetHeight(1000.0f,Worksheet.WS_UNIT_PICSEL); sameline=false; do{ s = sr.ReadLine(); fileLine++; nl=false; if (s!=null){ line = InterpretLine(s, line, fileLine, generator, output); } }while (s!=null); generator.addMSCEnd(line); sr.Close(); if (interpretExceptions.Count>0){ return (InterpretException[]) interpretExceptions.ToArray(typeof(InterpretException)); } return null; }