public void Run() { string logMessage = string.Format("Macro #{0} ({1}) is executed externally or from another macro.", ID, Name); LogDispatcher.I(LOG_TAG, logMessage); _run(); }
public void Triggered(MacroTriggerWithArguments source) { string logMessage = string.Format("Macro #{0} ({1}) triggered. Event: {2}.", ID, Name, source.HumanReadable); LogDispatcher.I(LOG_TAG, logMessage); _run(); }
private void execMessageReceived(OscMessage message, string idFromAddress) { if (!int.TryParse(idFromAddress, out int id) || (id < 0)) { string errorMessage = string.Format("Received macro execute command through OSC, but ID \"{0}\" for macro is invalid.", id); LogDispatcher.I(LOG_TAG, errorMessage); return; } Macro macro = MacroDatabase.Instance.GetTById(id); if (macro == null) { string errorMessage = string.Format("Received macro execute command through OSC, but no macro found with ID #{0}.", id); LogDispatcher.I(LOG_TAG, errorMessage); return; } string logMessage = string.Format("Executing macro #{0} ({1}) by OSC.", macro.ID, macro.Name); LogDispatcher.I(LOG_TAG, logMessage); macro.Run(); }
static void Main() { // Logger string loggerDirectory = Application.StartupPath + Path.DirectorySeparatorChar + "log"; FileLogger logger = new FileLogger(loggerDirectory, "opensc"); LogDispatcher.I(LOG_TAG, "Main() started, created file logger."); // Init Win32 GUI Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // Splash screen splashScreen = new GUI.SplashScreen(); splashScreen.Show(); LogDispatcher.I(LOG_TAG, "Initializing components..."); Application.DoEvents(); // Thread helpers init ThreadHelpers.InvokeHelper.Init(); Form mainForm = GUI.MainForm.Instance; // Start components StartupController.Init(); // Main message loop mainForm.Load += mainFormOpenedHandler; Application.Run(GUI.MainForm.Instance); }
private void initModules() { foreach (ModuleData moduleData in loadedModules) { if (moduleData.ToInit) { moduleData.Instance.Initialize(); LogDispatcher.I(LOG_TAG, "Initializing module [{0}]...", moduleData.Name); } } }
public void RequestCrosspointUpdate(RouterOutput output, RouterInput input) { if (!outputs.Contains(output)) { throw new ArgumentException(); } string logMessage = $"Router single crosspoint update request. Router: [{this}], destination: {output}, source: {input}."; LogDispatcher.I(LOG_TAG, logMessage); requestCrosspointUpdateImpl(output, input); }
public void RequestLockOperation(RouterOutput output, RouterOutputLockType lockType, RouterOutputLockOperationType lockOperationType) { if (!outputs.Contains(output)) { throw new ArgumentException(); } string logMessage = string.Format("Router output {0} request. Router: [(#{1}) #2], destination: {3}.", translateLockOperation(lockType, lockOperationType), ID, Name, output.Index); LogDispatcher.I(LOG_TAG, logMessage); requestLockOperationImpl(output, lockType, lockOperationType); }
private void commandMessageReceived(OscMessage message) { int commandCount = message.Data.Count; string logMessage = string.Format("Received {0} macro commands by OSC.", commandCount); LogDispatcher.I(LOG_TAG, logMessage); for (int i = 0; i < commandCount; i++) { string commandString = message.Data[i]?.ToString() ?? ""; MACRO_CODE_INTERPRETER.Formula = commandString; if (MACRO_CODE_INTERPRETER.HasSyntaxError) { string errorMessage = string.Format("Command line #{0} [{1}] received by OSC has syntax error.", i, commandString); LogDispatcher.I(LOG_TAG, errorMessage); return; } if (!MACRO_CODE_INTERPRETER.IsComplete) { string errorMessage = string.Format("Command line #{0} [{1}] received by OSC is incomplete.", i, commandString); LogDispatcher.I(LOG_TAG, errorMessage); return; } if (!MACRO_CODE_INTERPRETER.CommandExists) { string errorMessage = string.Format("Command line #{0} [{1}] contains unknown command [{2}].", i, commandString, MACRO_CODE_INTERPRETER.CommandCode); LogDispatcher.I(LOG_TAG, errorMessage); return; } if (MACRO_CODE_INTERPRETER.ArgumentCountMismatch) { string errorMessage = string.Format("Command line #{0} [{1}] contains not enough or too much arguments.", i, commandString); LogDispatcher.I(LOG_TAG, errorMessage); return; } if (!MACRO_CODE_INTERPRETER.ArgumentTypeMatches.All(atm => atm)) { string errorMessage = string.Format("Command line #{0} [{1}] contains one or more argument with invalid type.", i, commandString); LogDispatcher.I(LOG_TAG, errorMessage); return; } logMessage = string.Format("Execution command line #{0} received by OSC: [{1}].", i, commandString); LogDispatcher.I(LOG_TAG, logMessage); MACRO_CODE_INTERPRETER.GetCommandWithArguments().Run(); } }
public bool UpdateCrosspoint(RouterOutput output, RouterInput input) { if (!outputs.Contains(output)) { return(false); } string logMessage = string.Format("Router crosspoint update request. Router ID: {0}, destination: {1}, source: {2}.", ID, output.Index, input.Index); LogDispatcher.I(LOG_TAG, logMessage); return(setCrosspoint(output, input)); }
public void RequestCrosspointUpdates(IEnumerable <RouterCrosspoint> crosspoints) { List <string> logMessageDetailsPieces = new List <string>(); foreach (RouterCrosspoint crosspoint in crosspoints) { logMessageDetailsPieces.Add($"[destination: {crosspoint.Output}, source: {crosspoint.Input}]"); if (!outputs.Contains(crosspoint.Output)) { throw new ArgumentException(); } } string logMessageDetails = string.Join(", ", logMessageDetailsPieces); string logMessage = $"Router multi crosspoint update request. Router: [{this}], crosspoints: [{logMessageDetails}]."; LogDispatcher.I(LOG_TAG, logMessage); requestCrosspointUpdatesImpl(crosspoints); }
private void MainForm_Load(object sender, EventArgs e) { LogDispatcher.I(LOG_TAG, "Opened."); WindowManager.Instance.ChildWindowOpened += childWindowOpenedHandler; WindowManager.Instance.ChildWindowClosed += childWindowClosedHandler; WindowManager.Instance.ActiveWindowChanged += activeWindowChangedHandler; MdiChildActivate += mdiChildActivateHandler; WindowManager.Instance.MainFormPositionChanged += mainFormPositionChangedHandler; WindowManager.Instance.MainFormSizeChanged += mainFormSizeChangedHandler; WindowManager.Instance.MainFormMaximizedChanged += mainFormMaximizedChangedHandler; Resize += resizeEndHandler; menuStrip.DynamicChildrenInsertPosition = 1; menuStrip.AssociatedMenuItem = MenuManager.Instance.TopMenu; }
private void lookupForModules() { string moduleDirectoryPath = Directory.GetCurrentDirectory(); DirectoryInfo moduleDirectory = new DirectoryInfo(moduleDirectoryPath); foreach (FileInfo fileInfo in moduleDirectory.GetFiles()) { if (fileInfo.Extension == ".dll") { Assembly assembly = Assembly.LoadFrom(fileInfo.FullName); IEnumerable <TypeInfo> moduleDescriptorTypeInfos = assembly.DefinedTypes.Where(ti => ti.ImplementedInterfaces.Contains(MODULE_DESCRIPTOR_TYPE)); foreach (TypeInfo moduleDescriptorTypeInfo in moduleDescriptorTypeInfos) { ModuleAttribute moduleAttribute = moduleDescriptorTypeInfo.GetCustomAttribute <ModuleAttribute>(); if (moduleAttribute == null) { continue; } ConstructorInfo constuctorInfo = moduleDescriptorTypeInfo.GetConstructor(EMPTY_TYPE_ARRAY); if (constuctorInfo == null) { continue; } IModule moduleDescriptor = constuctorInfo.Invoke(EMPTY_ARRAY) as IModule; if (moduleDescriptor == null) { continue; } ModuleData moduleData = new ModuleData() { Name = moduleAttribute.Name, Path = fileInfo.FullName, Assembly = assembly, Instance = moduleDescriptor, Type = moduleDescriptorTypeInfo.AsType() }; loadedModules.Add(moduleData); loadedModulesByName.Add(moduleData.Name, moduleData); loadedModulesByType.Add(moduleData.Type, moduleData); LogDispatcher.I(LOG_TAG, "Found module [{0}] in [{1}].", moduleData.Name, moduleData.Path); } } } }
private void autoReconnectThreadMethod() { string logMessage = string.Format("Trying auto reconnect to a BlackMagic Design router/videohub (ID: {0}) with IP {1}...", ID, IpAddress); LogDispatcher.I(LOG_TAG, logMessage); if (autoReconnect && !connected) { Connect(); } while (autoReconnect && !connected) { Thread.Sleep(RECONNECT_TRY_INTERVAL); if (autoReconnect && !connected) { Connect(); } } }
private static void log(string message) => LogDispatcher.I(LOG_TAG, message);
private static void mainFormOpenedHandler(object sender, EventArgs e) { LogDispatcher.I(LOG_TAG, "Main form opened."); splashScreen.Close(); }