static void Main(string[] args) { ParserClass foo = new ParserClass(); foo.Parse("parse this file"); Console.ReadLine(); }
/// <summary> /// Execute the parsing process, with the drawing process. /// </summary> /// <param name="panel">Where to put the parsed content.</param> public void Parse(PanelActive panel) { var FileName = Path.GetFileName(panel.Label2.Text); var ParsingMode = GetParsingMode(FileName, panel.Label2.Text); if (ParsingMode == 1) { ParserClass = new ParserMode1(); } else if (ParsingMode == 2) { ParserClass = new ParserMode2(); } else if (ParsingMode == 3) { ParserClass = new ParserMode3(); } else if (ParsingMode == 4) { ParserClass = new ParserMode4(); } else { MessageBox.Show("Cross Log cannot read this file.\n\nTo get help, click the \"?\" button on the top menu.", "Invalid parsing mode"); return; } var taskResult = new List <Log>(); taskResult = ParserClass.Parse(panel.Label2.Text); var tmp = ParserClass.GetDateFromFileName(panel.Label2.Text); if (tmp.Year != 1) { panel.Label4.Text = tmp.Day + " - " + tmp.Month + " - " + tmp.Year; } else { panel.Label4.Text = "Cannot load date"; } logList.Add(new LogList(panel, taskResult)); return; }