コード例 #1
0
ファイル: Handler.cs プロジェクト: johnduhart/wikimedia-bot
 /// <summary>
 /// Intialise module
 /// </summary>
 /// <param name="module"></param>
 public static void InitialiseMod(Module module)
 {
     if (string.IsNullOrEmpty(module.Name))
     {
         Syslog.Log("This module has invalid name and was terminated to prevent troubles", true);
         throw new Exception("Invalid name");
     }
     module.Date = DateTime.Now;
     if (Module.Exist(module.Name))
     {
         Syslog.Log("This module is already registered " + module.Name + " this new instance was terminated to prevent troubles", true);
         throw new Exception("This module is already registered");
     }
     try
     {
         lock (module)
         {
             Syslog.Log("Loading module: " + module.Name + " v" + module.Version);
             ExtensionHandler.Extensions.Add(module);
         }
         module.Init();
     }
     catch (Exception fail)
     {
         module.IsWorking = false;
         Syslog.Log("Unable to create instance of " + module.Name);
         Core.HandleException(fail);
     }
 }
コード例 #2
0
ファイル: Modules_Loader.cs プロジェクト: reedy/wikimedia-bot
 /// <summary>
 /// Intialise module
 /// </summary>
 /// <param name="module"></param>
 public static void InitialiseMod(Module module)
 {
     if (module.Name == null || module.Name == "")
     {
         core.Log("This module has invalid name and was terminated to prevent troubles", true);
         throw new Exception("Invalid name");
     }
     module.Date = DateTime.Now;
     if (Module.Exist(module.Name))
     {
         core.Log("This module is already registered " + module.Name + " this new instance was terminated to prevent troubles", true);
         throw new Exception("This module is already registered");
     }
     try
     {
         lock (module)
         {
             core.Log("Loading module: " + module.Name + " v" + module.Version);
             Module.module.Add(module);
         }
         if (module.start)
         {
             module.Init();
         }
     }
     catch (Exception fail)
     {
         module.working = false;
         core.Log("Unable to create instance of " + module.Name);
         core.handleException(fail);
     }
 }
コード例 #3
0
ファイル: Module.cs プロジェクト: johnduhart/wikimedia-bot
 public override bool Construct()
 {
     m = this;
     Name = "Feed";
     Version = "1.0.12.26";
     return true;
 }
コード例 #4
0
ファイル: Infobot.cs プロジェクト: johnduhart/wikimedia-bot
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="database"></param>
 /// <param name="channel"></param>
 public Infobot(string database, Channel channel, Module module, bool sensitive = true)
 {
     Sensitive = sensitive;
     datafile_xml = database + ".xml";
     datafile_raw = database;
     pChannel = channel;
     Parent = module;
     prefix = Module.GetConfig(pChannel, "Infobot.Prefix", DefaultPrefix);
     LoadData();
 }
コード例 #5
0
 public override bool Construct()
 {
     ptrModule = this;
     Name = "RC";
     Version = "1.2.0.5";
     return true;
 }
コード例 #6
0
 public override bool Construct()
 {
     ptrModule = this;
     Version = new Version(1, 2, 0, 6);
     return true;
 }