public void Send(string address, params object[] args) { try { var msg = new Rug.Osc.OscMessage(address, args); //Console.WriteLine($"Sending: {msg.ToString()}"); _sender.Send(msg.ToByteArray()); } catch (Exception e) { Console.WriteLine($"Could not send OSC message, {e.Message}"); } }
private void Connection_Message(Connection source, MessageDirection direction, Rug.Osc.OscMessage message) { lock (syncLock) { try { if (direction == MessageDirection.Transmit) { return; } if (isRunning == false) { return; } if (SetFirstAndLastTimestamps(message.TimeTag) == false) { return; } if (dataObjects.ContainsKey(message.Address) == true) { DataBase data = dataObjects[message.Address]; data.OnMessage_Inner(message); if (data.HasValidValues == false) { return; } CsvFileWriter logger; if (csvFileWriters.TryGetValue(message.Address, out logger) == false) { logger = new CsvFileWriter(Path.Combine(Directory, Helper.ToLowerCamelCase(message.Address) + ".csv")); logger.AddLine(data.CsvHeader); csvFileWriters.Add(message.Address, logger); } logger.AddLine(data.ToCsv(session.FirstTimestamp)); logger.IncrementMessageCount(); return; } if (excludedAddresses.Contains(message.Address) == false) { CsvFileWriter logger; if (csvFileWriters.TryGetValue(message.Address, out logger) == false) { logger = new CsvFileWriter(Path.Combine(Directory, Helper.ToLowerCamelCase(message.Address) + ".csv")); logger.AddLine(Helper.UnknownMessageToCsvHeader(message)); csvFileWriters.Add(message.Address, logger); } logger.AddLine(Helper.UnknownMessageToCsv(session.FirstTimestamp, message)); logger.IncrementMessageCount(); return; } } catch (Exception ex) { throw new Exception("Error while processing log message.", ex); } } }