public PluginLoader(IRCQueueBot q, ConnectionService cs, EventDispatcher disp) : base(q) { _baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + Path.DirectorySeparatorChar; _asm = new Dictionary<string, Assembly>(StringComparer.InvariantCultureIgnoreCase); _cs = cs; _disp = disp; }
public ConnectionService(IRCQueueBot q) : base(q) { _csettings = LoadConnectionSettings(Q.Config); if (_csettings == null) { Log(LogLevel.Error, "Failed to load IRC connection settings."); throw new Exception(); } _irc = new IrcConnection(_csettings, Q.Enqueue); }
public Logger(IRCQueueBot q) : base(q) { var dsc = Path.DirectorySeparatorChar; var lrp = q.Config["connection.logroot"]; if (String.IsNullOrWhiteSpace(lrp)) lrp = "logs"; _logBaseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + dsc + lrp + dsc; try { // Testing for file access using a fake logging event // It also makes for a nice welcome message var a = Assembly.GetEntryAssembly(); string welcome = $"{nameof(IRCQueueBot)} v{a.GetName().Version.ToString(4)} is starting."; if (!Directory.Exists(_logBaseDir)) Directory.CreateDirectory(_logBaseDir); ProcessLog(DateTime.Now, LogLevel.Info, nameof(IRCQueueBot), welcome); } catch (Exception ex) { if (ex is IOException || ex is UnauthorizedAccessException || ex is PathTooLongException) { // Can't write logs for some reason or another. The bot can't continue running in these conditions. Console.WriteLine("Unable to start: " + ex.Message); Environment.Exit(1); } throw; } }
public EventDispatcher(IRCQueueBot q) : base(q) { InitializeContainers(); _pi = new List<PluginInfo>(); }
protected Service(IRCQueueBot q) { _q = q; }