protected virtual void OnFileReceived(ReceivedFileEventArgs e) { if (FileReceived != null) { FileReceived(this, e); } }
private void onReceivedFile(object sender, ReceivedFileEventArgs args) { if (InvokeRequired) { // we need to make sure we are on the GUI thread Invoke(new Action <object, args>(onReceivedFile), sender, args); return; } // we are in the GUI thread, so we can show the SaveFileDialog using (SaveFileDialog dialog = new SaveFileDialog()) { args.FileName = dialog.FileName; } }
public void SocketFileReceived(object sender, ReceivedFileEventArgs e) { StringBuilder logMsg = new StringBuilder(); logMsg.AppendLine("Order Update File Received. See below for more details."); logMsg.AppendLine(); logMsg.AppendLine(e.FileData); _log.WriteInformationLog(logMsg.ToString()); string[] lines = e.FileData.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); OrderHistoryFileReturn parsedFiles = ParseFile(lines); if (parsedFiles.Files.Count == 0) { var logMessage = "No instances of OrderHistoryFile were extracted."; _log.WriteWarningLog(logMessage); } foreach (OrderHistoryFile parsedFile in parsedFiles.Files) { parsedFile.SenderApplicationName = Configuration.ApplicationName; parsedFile.SenderProcessName = "Process Order History Updates From Mainframe (Socket Connection)"; var jsonValue = JsonConvert.SerializeObject(parsedFile); _queue.PublishToQueue(jsonValue, Configuration.RabbitMQConfirmationServer, Configuration.RabbitMQUserNamePublisher, Configuration.RabbitMQUserPasswordPublisher, Configuration.RabbitMQVHostConfirmation, Configuration.RabbitMQExchangeHourlyUpdates); logMsg = new StringBuilder(); logMsg.AppendLine(string.Format("Publishing order history to queue for message ({0}).", parsedFile.MessageId)); logMsg.AppendLine(); logMsg.AppendLine(jsonValue); _log.WriteInformationLog(logMsg.ToString()); } }
public void SocketFileReceived(object sender, ReceivedFileEventArgs e) { string[] lines = e.FileData.Split(new string[] { Environment.NewLine }, StringSplitOptions.None); ProcessFileData(lines); }