private void WritePlayers(IEnumerable <PlayersGroup> playersGroups) { Logger.Info("Starting WritePLayers"); if (playersGroups == null) { Logger.Warn("End WritePLayers, because playersGroups == null"); return; } var stopwatch = new Stopwatch(); stopwatch.Start(); //todo add Unity Container #if WordWriter IDataWriter dataWriter = new WordDataWriter(); #else IDataWriter dataWriter = new TextDataWriter(); #endif dataWriter.TargetDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "TigerGenerator"); IClusterWorker worker = new ClusterWorker(); foreach (var group in playersGroups) { SendNotification(null, $"Work with group {group.Type} {group.Weight}"); worker.Players = group.Players; worker.Work(); dataWriter.WriterDetails = $"{group.Type}_{group.Weight}"; dataWriter.WriteData(worker.Clusters); } stopwatch.Stop(); Logger.Info($"End WritePLayers. Time = {stopwatch.Elapsed}"); }
private void WriteMetadata(IDataLoadEventListener listener) { ExtractCommand.ElevateState(ExtractCommandState.WritingMetadata); WordDataWriter wordDataWriter; try { wordDataWriter = new WordDataWriter(this); wordDataWriter.GenerateWordFile();//run the report } catch (Exception e) { //something about the pipeline resulted i a known unsupported state (e.g. extracting to a database) so we can't use WordDataWritter with this // tell user that we could not run the report and set the status to warning ExtractCommand.ElevateState(ExtractCommandState.Warning); listener.OnNotify(this, new NotifyEventArgs(ProgressEventType.Error, "Word metadata document NOT CREATED", e)); return; } //if there were any exceptions if (wordDataWriter.ExceptionsGeneratingWordFile.Any()) { ExtractCommand.ElevateState(ExtractCommandState.Warning); foreach (Exception e in wordDataWriter.ExceptionsGeneratingWordFile) { listener.OnNotify(wordDataWriter, new NotifyEventArgs(ProgressEventType.Warning, "Word metadata document creation caused exception", e)); } } else { ExtractCommand.ElevateState(ExtractCommandState.Completed); } }