상속: INotifyPropertyChanged
예제 #1
0
        /// <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();
        }
예제 #2
0
        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;
        }
예제 #3
0
 protected GablarskiServer(ServerSettings serverSettings)
     : base(MessageTypes.All)
 {
     this.settings = serverSettings;
     this.context  = this;
 }
예제 #4
0
 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 ();
 }
예제 #5
0
 public void ServerTestCleanup()
 {
     this.server.Stop();
     this.server = null;
     this.provider = null;
     this.users = null;
     this.channels = null;
     this.permissions = null;
     this.settings = null;
 }
예제 #6
0
 protected GablarskiServer(ServerSettings serverSettings)
     : base(MessageTypes.All)
 {
     this.settings = serverSettings;
     this.context = this;
 }
예제 #7
0
        public static void Shutdown()
        {
            if (server == null)
                return;

            server.Stop();
            server = null;
            channels = null;
            authorization = null;
            permissions = null;
            settings = null;
        }
예제 #8
0
        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();
            }
        }