public void Exit() { config.ModulesDictionary = CommandsManager.ModuleDictionaryForJson(); File.WriteAllText("settings.json", JsonConvert.SerializeObject(config)); if (CommandsManager.UserRoles != null && CommandsManager.UserRoles.Count > 0) { File.WriteAllText("permissions.json", JsonConvert.SerializeObject(CommandsManager.UserRoles)); } client.Logout(); client.Dispose(); Cleanup(); Environment.Exit(0); }