Example #1
0
        public void RemovePlugin(string id, string version)
        {
            Log.DebugFormat("Removing plugin {0} v{1}...", id, version);

            if (!Version.TryParse(version, out var v))
            {
                throw new CannotRemovePluginException($"'{version}' is not a valid version.");
            }

            using (var transaction = _database.BeginTransaction())
            {
                var identifier = new PluginIdentifier(id, v);
                if (!_plugins.Remove(identifier))
                {
                    throw new CannotRemovePluginException($"No plugin {id} v{version} exists.");
                }

                _pluginDescriptions.Remove(identifier);
                _pluginIcons.Remove(identifier);

                transaction.Commit();

                Log.InfoFormat("Removed plugin {0} v{1}", id, version);
            }
        }
Example #2
0
 public void Remove(Guid alarmId)
 {
     _scheduler.StartNew(() =>
     {
         try
         {
             _alarms.Remove(alarmId);
         }
         catch (Exception e)
         {
             Log.ErrorFormat("Caught unexpected exception: {0}", e);
         }
     });
 }
Example #3
0
        public void RemoveUser(string username)
        {
            using (var transaction = _database.BeginTransaction())
            {
                if (!_users.TryGet(username, out var user))
                {
                    throw new CannotRemoveUserException($"The user '{username}' does not exist.");
                }

                _users.Remove(username);
                _usernamesByAccessToken.Remove(user.AccessToken);

                transaction.Commit();
            }
        }