public static void Start(string[] files) { var properties = new Properties(); properties.Load(); mySerialPortConnectionService = new SerialPortConnectionService(); mySerialPortConnectionService.Start(properties); //files if (files != null && files.Length > 0) { _logger.Debug($"There are {files.Length} files to play"); foreach (var f in files) { PlayFile(f); } } //network new Thread(() => { new NetworkService(mySerialPortConnectionService, properties).Start(); }).Start(); //console while (true) { var nextLine = Console.ReadLine(); if (string.IsNullOrEmpty(nextLine)) { continue; } if (nextLine == "exit") { Environment.Exit(0); } if (nextLine.All(Char.IsDigit)) { byte note = byte.Parse(nextLine); _logger.Debug($"Note with code `{note}` received"); mySerialPortConnectionService.PlayNow(new[] { note }); } else { PlayFile(nextLine); } } }
public static void Start() { var properties = new Properties(); properties.Load(); mySerialPortConnectionService = new SerialPortConnectionService(); mySerialPortConnectionService.Start(properties); if (!properties.PlaySample) { var networkService = new NetworkService(mySerialPortConnectionService, properties); networkService.Start(); } TestSend(properties); while (Console.ReadLine().Length == 0) { TestSend(properties); } }