private static void TestConfigReader() { try { // Read and display the custom section. ResumeScoringSection resumeScoringSection = ConfigurationManager.GetSection("ResumeScoring") as ResumeScoringSection; if (resumeScoringSection == null) { throw new ApplicationException("Failed to load ResumeScoringSection."); } else { Console.WriteLine("WordGroups defined in the configuration file:"); for (int i = 0; i < resumeScoringSection.WordGroups.Count; i++) { Console.WriteLine(" Type={0} Name={1} Words={2} Weight={3} CaseSensitive={4}", resumeScoringSection.WordGroups[i].Type, resumeScoringSection.WordGroups[i].Name, resumeScoringSection.WordGroups[i].WordGroup, resumeScoringSection.WordGroups[i].Weight, resumeScoringSection.WordGroups[i].CaseSensitive); } } } catch (ConfigurationErrorsException err) { Console.WriteLine("ReadCustomSection(string): {0}", err.ToString()); } }
public ScoringReport Score() { ScoringReport report = new ScoringReport(); ResumeScoringSection resumeScoringSection = ConfigurationManager.GetSection("ResumeScoring") as ResumeScoringSection; if (resumeScoringSection == null) { throw new ApplicationException("Failed to load ResumeScoringSection."); } else { for (int i = 0; i < resumeScoringSection.WordGroups.Count; i++) { WordGroupConfigElement wg = resumeScoringSection.WordGroups[i]; report.AddReportItem(ScoreWordGroup(wg, _resume)); } } _report = report; return(report); }