protected void ManagerThreadMethod() { OutputTypes prevOutputType = OutputTypes.NONE; while (Running) { try { // Depending on current control set, pick right agent var newOutputType = BFFManager.CurrentControlSet.ProcessDescriptor.OutputType; if (newOutputType != prevOutputType) { prevOutputType = newOutputType; switch (newOutputType) { case OutputTypes.RAW_MEMORY_READ: // Start Rawmemory RawMemory.Start(); CurrentOutputsAgent = RawMemory; // Stop others MAMEWin.Stop(); MAMENet.Stop(); break; case OutputTypes.MAME_WIN: // Start MAME Win MAMEWin.Start(); CurrentOutputsAgent = MAMEWin; // Stop others RawMemory.Stop(); MAMENet.Stop(); break; case OutputTypes.MAME_NET: // Start MAME Net MAMENet.Start(); CurrentOutputsAgent = MAMENet; // Stop others MAMEWin.Stop(); RawMemory.Stop(); break; case OutputTypes.NONE: default: MAMENet.Stop(); MAMEWin.Stop(); RawMemory.Stop(); break; } } } catch (Exception ex) { Log("Outputs got exception " + ex.Message, LogLevels.IMPORTANT); } Thread.Sleep(64); } Log("Outputs manager terminated", LogLevels.IMPORTANT); }
public OutputsManager() { RawMemory = new RawMemoryM2OutputsAgent(); MAMEWin = new MAMEOutputsWinAgent(); MAMENet = new MAMEOutputsNetAgent(); AllAgents.Add(RawMemory); AllAgents.Add(MAMEWin); AllAgents.Add(MAMENet); CurrentOutputsAgent = MAMEWin; }