/// <summary> /// Initializes a new instance of the <see cref="Backend.Controller"/> class. /// </summary> /// <param name="ConfigurationPath">Configuration path.</param> public Controller(string ConfigurationPath = null) { Configuration = new BoardConfiguration(); using (MemoryStream memstream = new MemoryStream(Encoding.ASCII.GetBytes(Resources.Boards))) { using (StreamReader str = new StreamReader(memstream)) { BoardConfigs = ConfigurationManager.ParseBoards(str); } } LastConfigurationLocations [0] = Backend.Properties.Settings.Default.Config1; LastConfigurationLocations [1] = Backend.Properties.Settings.Default.Config2; LastConfigurationLocations [2] = Backend.Properties.Settings.Default.Config3; LastConfigurationLocations [3] = Backend.Properties.Settings.Default.Config4; LastConfigurationLocations [4] = Backend.Properties.Settings.Default.Config5; #if DEBUG ConLogger = new InfoLogger(Resources.LogFileName, true, false, Settings.Default.LogLevel, Settings.Default.LogFilePath); #endif #if !DEBUG ConLogger = new InfoLogger(Resources.LogFileName, true, false, LogLevel.INFO, Settings.Default.LogFilePath); #endif ConLogger.LogToFile = Settings.Default.LogToFile; ConLogger.Start(); ArduinoController.AutoConnect = Settings.Default.AutoConnect; ArduinoController.Init(); ArduinoController.OnReceiveMessage += (sender, e) => ConLogger.Log("IN < " + e.Message, LogLevel.DEBUG); ArduinoController.OnSendMessage += (sender, e) => ConLogger.Log("OUT > " + e.Message, LogLevel.DEBUG); ArduinoController.OnConnectionChanged += ((o, e) => { if (e.Connected) { ConLogger.Log("Connected to: " + ArduinoController.Board.ToString(), LogLevel.INFO); } else { ConLogger.Log("Disconnected", LogLevel.INFO); } }); Configuration.OnPinsUpdated += (o, e) => { if (e.UpdateOperation == UpdateOperation.Change) { ConLogger.Log("Pin Update: [" + e.UpdateOperation + "] " + e.OldPin + " to " + e.NewPin); } else { ConLogger.Log("Pin Update: [" + e.UpdateOperation + "] " + e.OldPin); } }; Configuration.OnSequencesUpdated += (o, e) => { if (e.UpdateOperation == UpdateOperation.Change) { ConLogger.Log("Sequence Update: [" + e.UpdateOperation + "] " + e.OldSeq + " to " + e.OldSeq); } else { ConLogger.Log("Sequence Update: [" + e.UpdateOperation + "] " + e.OldSeq); } }; Configuration.OnSignalsUpdated += (o, e) => { if (e.UpdateOperation == UpdateOperation.Change) { ConLogger.Log("Sequence Update: [" + e.UpdateOperation + "] " + e.OldMeCom + " to " + e.NewMeCom); } else { ConLogger.Log("Sequence Update: [" + e.UpdateOperation + "] " + e.OldMeCom); } }; }