public void Process(List <string> args) { var path = args[1]; Assembly loadedAssembly; try { loadedAssembly = Assembly.LoadFrom(path); GlobalCommandsManager.networkManager.WriteLine("OK"); } catch (Exception) { GlobalCommandsManager.networkManager.WriteLine("KO"); return; } // Instanciate command classes var loadedCommands = GlobalCommandsManager.LoadICommandsFromAssembly(new[] { loadedAssembly }); // Send result to master GlobalCommandsManager.networkManager.WriteLine( loadedCommands.Count != 0 ? loadedCommands.Aggregate((x, y) => $"{x} {y}") : "KO" ); }
public void Process(List <string> args) { var result = GlobalCommandsManager.networkManager.ReadLine(); if (result == "KO") { ColorTools.WriteCommandError($"IO exception encountered when reading remote DLL at {args[1]}"); return; } result = GlobalCommandsManager.networkManager.ReadLine(); if (result == "KO") { ColorTools.WriteCommandError("No classes implementing the ICommand interface were found on the remote DLL"); return; } ColorTools.WriteMessage("Loaded commands on Slave :"); ColorTools.WriteMessage(result.Split(' ').Aggregate((x, y) => $"{x}\n{y}")); var path = args[0]; Assembly loadedAssembly; try { loadedAssembly = Assembly.LoadFrom(path); } catch (Exception) { ColorTools.WriteCommandError($"IO exception encountered when reading local DLL at {args[1]}"); return; } // Instanciate command classes var loadedCommands = GlobalCommandsManager.LoadICommandsFromAssembly(new[] { loadedAssembly }); if (loadedCommands.Count == 0) { ColorTools.WriteCommandError("No classes implementing the ICommand interface were found on the local DLL"); return; } // Update autocompletion command list AutoCompletionManager.commands.AddRange(loadedCommands); ColorTools.WriteMessage("Loaded commands on Master :"); ColorTools.WriteMessage(result.Split(' ').Aggregate((x, y) => $"{x}\n{y}")); }