public void Init(FileType srcFile, FileType outputFile, WCStateHandler countWords, WCStateHandler extractWords, WCStateHandler saveFile, WCStateHandler saveDB, string sourceUrl, string outputUrl) { switch (srcFile) { case FileType.Txt: source = new TxtFile(sourceUrl); break; } switch (outputFile) { case FileType.Csv: output = new CsvFile(outputUrl); break; } if (source == null || output == null) { throw new Exception("Error creating source and output files"); } source.WordsCounted += countWords; source.WordsExtracted += extractWords; output.SavedToFile += saveFile; output.SavedToDB += saveDB; }
private void CallEvent(WCStateHandler handler) { if (handler != null) { handler(this); } }