//parses the different Session Types public void parse(String singleSession) { switch (RegularExpressions.getRecordType(singleSession)) { case "complete": { mParser.parseXML(singleSession, RegularExpressions.getRecordType(singleSession)); break; } case "incomplete": { mParser.parseXML(singleSession, RegularExpressions.getRecordType(singleSession)); break; } case "system-crash": { mParser.parseXML(singleSession, RegularExpressions.getRecordType(singleSession)); break; } case "system-shutdown": { mParser.parseXML(singleSession, RegularExpressions.getRecordType(singleSession)); break; } case "reboot": { mParser.parseXML(singleSession, RegularExpressions.getRecordType(singleSession)); break; } case "runlevel-change": { mParser.parseXML(singleSession, RegularExpressions.getRecordType(singleSession)); break; } default: { Console.WriteLine("other"); break; } } }
public void readSessions() { if (!lastInputFile.isValid()) { //Write to error log and exit here error.writeError("Specified file is not valid" + Argconstants.INPUT_FILE); Console.WriteLine("Is valid"); } int counter = 0; String line; Console.WriteLine(this.lastInputFile.getInputStartTime()); Console.WriteLine(this.lastInputFile.getCreationTime()); try { StreamReader file = new StreamReader(this.lastInputFile.getFileName()); while ((line = file.ReadLine()) != null) { if (RegularExpressions.getRecordType(line).Equals("none")) { this.writeToSuspenseFile(line); continue; } this.parse(line); counter++; } file.Close(); Console.ReadLine(); } catch (Exception e) { Console.WriteLine(e); throw; } }