コード例 #1
0
ファイル: PluginLoader.cs プロジェクト: Rafa652/IRCQueueBot
 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;
 }
コード例 #2
0
ファイル: Connection.cs プロジェクト: Rafa652/IRCQueueBot
 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);
 }
コード例 #3
0
ファイル: Logger.cs プロジェクト: Rafa652/IRCQueueBot
 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;
     }
 }
コード例 #4
0
 public EventDispatcher(IRCQueueBot q)
     : base(q)
 {
     InitializeContainers();
     _pi = new List<PluginInfo>();
 }
コード例 #5
0
ファイル: ServiceBase.cs プロジェクト: Rafa652/IRCQueueBot
 protected Service(IRCQueueBot q)
 {
     _q = q;
 }