예제 #1
0
        public override bool Hook_OnUnload()
        {
            bool success = true;

            if (writer != null)
            {
                writer.Exit();
                writer = null;
            }
            lock (config.channels)
            {
                foreach (config.channel channel in config.channels)
                {
                    if (!channel.UnregisterObject("Infobot"))
                    {
                        success = false;
                    }
                }
            }
            if (!success)
            {
                core.Log("Failed to unregister infobot objects in some channels", true);
            }
            return(success);
        }
예제 #2
0
        public override bool Hook_OnRegister()
        {
            bool success = true;

            DebugLog("Registering channels");
            try
            {
                if (!Directory.Exists(SnapshotsDirectory))
                {
                    core.Log("Creating snapshot directory for infobot");
                    Directory.CreateDirectory(SnapshotsDirectory);
                }
            }
            catch (Exception fail)
            {
                Snapshots = false;
                core.handleException(fail);
            }
            writer = new infobot_writer();
            writer.Construct();
            core.InitialiseMod(writer);
            lock (config.channels)
            {
                foreach (config.channel channel in config.channels)
                {
                    config.channel curr = channel;
                    bool           cs   = Module.GetConfig(curr, "Infobot.Case", true);
                    if (!channel.RegisterObject(new infobot_core(getDB(ref curr), channel.Name, cs), "Infobot"))
                    {
                        success = false;
                    }
                    if (Snapshots)
                    {
                        try
                        {
                            if (Directory.Exists(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name) == false)
                            {
                                core.Log("Creating directory for infobot for " + channel.Name);
                                Directory.CreateDirectory(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name);
                            }
                        }
                        catch (Exception fail)
                        {
                            core.handleException(fail);
                        }
                    }
                }
            }
            if (!success)
            {
                core.Log("Failed to register infobot objects in some channels", true);
            }
            return(success);
        }
예제 #3
0
 public override bool Hook_OnUnload()
 {
     bool success = true;
     if (writer != null)
     {
         writer.Exit();
         writer = null;
     }
     lock (config.channels)
     {
         foreach (config.channel channel in config.channels)
         {
             if (!channel.UnregisterObject("Infobot"))
             {
                 success = false;
             }
         }
     }
     if (!success)
     {
         core.Log("Failed to unregister infobot objects in some channels", true);
     }
     return success;
 }
예제 #4
0
 public override bool Hook_OnRegister()
 {
     bool success = true;
     try
     {
         if (!Directory.Exists(SnapshotsDirectory))
         {
             core.Log("Creating snapshot directory for infobot");
             Directory.CreateDirectory(SnapshotsDirectory);
         }
     }
     catch (Exception fail)
     {
         Snapshots = false;
         core.handleException(fail);
     }
     writer = new infobot_writer();
     writer.Construct();
     core.InitialiseMod(writer);
     lock (config.channels)
     {
         foreach (config.channel channel in config.channels)
         {
             config.channel curr = channel;
             bool cs = Module.GetConfig(curr, "Infobot.Case", true);
             if (!channel.RegisterObject(new infobot_core(getDB(ref curr), channel.Name, cs), "Infobot"))
             {
                 success = false;
             }
             if (Snapshots)
             {
                 try
                 {
                     if (Directory.Exists(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name) == false)
                     {
                         core.Log("Creating directory for infobot for " + channel.Name);
                         Directory.CreateDirectory(SnapshotsDirectory + Path.DirectorySeparatorChar + channel.Name);
                     }
                 }
                 catch (Exception fail)
                 {
                     core.handleException(fail);
                 }
             }
         }
     }
     if (!success)
     {
         core.Log("Failed to register infobot objects in some channels", true);
     }
     return success;
 }