Пример #1
0
 public static async ValueTask Dispose()
 {
     while (connecting)
     {
         await Task.Delay(10);
     }
     BotCore.AutoSave = false;
     foreach (var w in MiddlewareCore.Middlewares)
     {
         w.SaveData();
     }
     foreach (var m in ModuleCore.Modules)
     {
         m.SaveData();
     }
     foreach (var s in ServiceCore.Services)
     {
         s.SaveData();
     }
     foreach (var c in ComponentCore.Components)
     {
         c.SaveData();
     }
     while (DataManager.SavingData)
     {
         await Task.Delay(10);
     }
     await session.DisposeAsync();
 }
Пример #2
0
        public async Task Terminate()
        {
            Logger.Log("Mirai session status:", _session.Connected);
            await _session.DisposeAsync();

            Logger.Log("Mirai session disposed");
        }
Пример #3
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                    _session.DisposeAsync().AsTask().Wait();
                    _client.Dispose();
                    _timer.Dispose();
                }

                disposedValue = true;
            }
        }