/// <summary> /// Initializes a new <c>GablarskiServer</c> instance. /// </summary> /// <param name="settings">The settings for the server, providing name, description, etc.</param> /// <param name="authProvider">The user authentication provider for the server to use.</param> /// <param name="permissionProvider">The user permissions provider for the server to use.</param> /// <param name="channelProvider">The channel provider for the server to use.</param> public GablarskiServer(ServerSettings settings, IUserProvider authProvider, IPermissionsProvider permissionProvider, IChannelProvider channelProvider) : this(settings) { this.authProvider = authProvider; this.permissionProvider = permissionProvider; this.permissionProvider.PermissionsChanged += OnPermissionsChanged; this.channelProvider = channelProvider; SetupHandlers(); }
internal ServerInfo(ServerSettings settings, IUserProvider userProvider) { if (settings == null) throw new ArgumentNullException ("settings"); if (userProvider == null) throw new ArgumentNullException ("userProvider"); Name = settings.Name; Description = settings.Description; Logo = settings.ServerLogo; Passworded = !String.IsNullOrEmpty (settings.ServerPassword); RegistrationMode = (userProvider.UpdateSupported) ? userProvider.RegistrationMode : UserRegistrationMode.None; if (RegistrationMode != UserRegistrationMode.None) RegistrationContent = userProvider.RegistrationContent; }
protected GablarskiServer(ServerSettings serverSettings) : base(MessageTypes.All) { this.settings = serverSettings; this.context = this; }
public void ServerTestInitialize() { this.settings = new ServerSettings {Name = "Test Server", Description = "Test Server"}; this.permissions = new GuestPermissionProvider (); this.channels = new LobbyChannelProvider(); this.users = new GuestUserProvider(); this.server = new GablarskiServer (this.settings, this.users, this.permissions, this.channels); this.server.AddConnectionProvider (this.provider = new MockConnectionProvider (GablarskiProtocol.Instance), ExecutionMode.GlobalOrder); this.server.Start (); }
public void ServerTestCleanup() { this.server.Stop(); this.server = null; this.provider = null; this.users = null; this.channels = null; this.permissions = null; this.settings = null; }
public static void Shutdown() { if (server == null) return; server.Stop(); server = null; channels = null; authorization = null; permissions = null; settings = null; }
private static void Start(object s) { var key = (RSAAsymmetricKey)s; lock (Sync) { if (IsRunning) return; channels = new LobbyChannelProvider(); authorization = new GuestUserProvider { FirstUserIsAdmin = true }; permissions = new GuestPermissionProvider(); settings = new ServerSettings(); server = new GablarskiServer (settings, authorization, permissions, channels); server.AddConnectionProvider (new UdpConnectionProvider (GablarskiProtocol.Port, GablarskiProtocol.Instance, key), ExecutionMode.GlobalOrder); server.Start(); } }