private static void GetReport(ReportArguments arguments) { var config = ConfigHelper.GetConfig(arguments.ConfigFilePath); var report = new Report(config); report.GetReport(); }
/// <summary> /// Read the report configuration file /// </summary> /// <param name="reportFileName"></param> private void ReadFile(string reportFileName) { using (StreamReader reader = new StreamReader(reportFileName)) { int lineNo = 1; int argumentLine = -1; ReportArgument currentArgument = new ReportArgument(); string line; while ((line = reader.ReadLine()) != null) { if (line.TrimStart().StartsWith("#")) { continue; } lineNo++; if (!line.StartsWith("\t")) { Name = line; } else if (line.StartsWith("\t\t")) { switch (argumentLine) { case 1: // xpath currentArgument.XPath = line.Trim(); break; case 2: // value currentArgument.Value = line.Trim(); break; case 3: // use default currentArgument.UseDefault = Boolean.Parse(line.Trim()); ReportArguments.Add(currentArgument); currentArgument = new ReportArgument(); break; case 4: // error! throw new Exception("Invalid config file at line " + line); } argumentLine++; } else if (line.StartsWith("\t")) { // We are processing a new argument. var argumentName = line.TrimStart(); argumentLine = 1; currentArgument.Name = line.Trim(); } } } }