private void LoadCommands()
        {
            try {
                _commandsFile = AppSettingsUtil.AppSettingsString("commandsFile", true, string.Empty);

                if (Persistence.FileExists(_commandsFile))
                {
                    _commands = Persistence.LoadCommands(_commandsFile);
                }
                else
                {
                    _commands = new List <CommandDTO>();
                    SaveCommands();
                }
            }
            catch (Exception e) {
                throw new Exception("Failed to load commands.json file", e);
            }
        }
Beispiel #2
0
        private void LoadAFKUsers()
        {
            try {
                _afkUsersFile = AppSettingsUtil.AppSettingsString("afkUsersFile", true, string.Empty);

                if (Persistence.FileExists(_afkUsersFile))
                {
                    _afk = Persistence.LoadAFKUsers(_afkUsersFile);
                }
                else
                {
                    _afk = new List <AFKDTO>();
                    SaveAFKUsers();
                }
            }
            catch (Exception e) {
                throw new Exception(ERR_AFK_FILE, e);
            }
        }
Beispiel #3
0
        private void LoadSubscriptions()
        {
            try
            {
                _subscriptionsUsersFile = AppSettingsUtil.AppSettingsString("subscriptionsFile", true, string.Empty);

                if (Persistence.FileExists(_subscriptionsUsersFile))
                {
                    _subscriptions = Persistence.LoadSubscriptions(_subscriptionsUsersFile);
                }
                else
                {
                    _subscriptions = new List <SubscribeDTO>();
                    SaveSubscriptions();
                }
            }
            catch (Exception e)
            {
                throw new Exception(Constants.ERR_SUBSCRIPTION_FILE, e);
            }
        }
        private void LoadViolations()
        {
            try
            {
                _violationsFile = AppSettingsUtil.AppSettingsString("violationsFile", true, string.Empty);

                if (Persistence.FileExists(_violationsFile))
                {
                    _violations = Persistence.LoadViolations(_violationsFile);
                }
                else
                {
                    _violations = new List <ViolatorDTO>();
                    SaveViolations();
                }
            }
            catch (Exception e)
            {
                throw new Exception(Constants.ERR_VIOLATIONS_FILE, e);
            }
        }