Esempio n. 1
0
 protected virtual void Dispose(bool disposing)
 {
     try {
         // TRANSLATORS: Log message. Dispose Nursery.
         Logger.Log(T._("Clean up ..."));
         // TRANSLATORS: Log message. Dispose Nursery.
         Logger.Log(T._("- unload Bouyomi-chan ..."));
         if (this.bouyomichan != null)
         {
             this.bouyomichan.Dispose();
             this.bouyomichan = null;
         }
         // TRANSLATORS: Log message. Dispose Nursery.
         Logger.Log(T._("- unload sound devices ..."));
         BassWrapper.Free();
         // TRANSLATORS: Log message. Dispose Nursery.
         Logger.Log(T._("- unload discord ..."));
         if (this.discord != null)
         {
             this.discord.Dispose();
             this.discord = null;
         }
         // TRANSLATORS: Log message. Dispose Nursery.
         Logger.Log(T._("Disposing Done!"));
         GC.SuppressFinalize(this);
     } catch (Exception e) {
         // TRANSLATORS: Log message. Dispose Nursery.
         Logger.Log(T._("Could not clean up VoiceBot instance."));
         Logger.DebugLog(e.ToString());
     }
 }
Esempio n. 2
0
 private VoiceBot()
 {
     this.state = new BotState();
     // TRANSLATORS: Log message. Initializing Nursery.
     Logger.Log(T._("- initialize Bouyomi-chan ..."));
     this.bouyomichan = new BouyomiChanClient();
     try {
         this.bouyomichan.ClearTalkTasks();
     } catch (Exception e) {
         this.Dispose();
         // TRANSLATORS: Error message. Initializing Nursery.
         throw new Exception(T._("Could not load Bouyomi-chan. Please check Bouyomi-chan awaking."), e);
     }
     // TRANSLATORS: Log message. Initializing Nursery.
     Logger.Log(T._("- initialize sound devices ..."));
     try {
         BassWrapper.Initialize(Config.Instance.MainConfig);
     } catch (Exception e) {
         this.Dispose();
         // TRANSLATORS: Error message. Initializing Nursery.
         throw new Exception(T._("Could not initialize sound devices. Please check virtual devices installed and valid name set."), e);
     }
     try {
         this.voice = new VoiceChat(Config.Instance.MainConfig);
     } catch (Exception e) {
         this.Dispose();
         // TRANSLATORS: Error message. Initializing Nursery.
         throw new Exception(T._("Could not initialize recording devices. Please check virtual devices installed and valid name set."), e);
     }
     // TRANSLATORS: Log message. Initializing Nursery.
     Logger.Log(T._("- initialize Discord client ..."));
     this.discord = new DiscordSocketClient();
     // TRANSLATORS: Log message. Initializing Nursery.
     Logger.Log(T._("- load plugins ..."));
     PluginManager.Instance.Load(this);
 }