static void Main(string[] args) { var setupFilename = args.Length > 0 ? args[0] : "CSBot.xml"; IrcClientSetup setup; using (var streamReader = new StreamReader(setupFilename)) setup = IrcClientSetup.Deserialize(streamReader); var client = new IrcClient(setup); var moduleManager = new ModuleManager(client); moduleManager.LoadAllModules(); client.Connect(); }
// stay on the caller's appdomain, may go away when i fix ModuleManager to properly resolve things in the main appdomain public static T Get <T>(this ModuleManager moduleManager) where T : CSBotModule { return(moduleManager.LoadedModules.Values.Select(m => m.Module as T).FirstOrDefault(m => m != null)); }