Exemplo n.º 1
0
 public void Init(ServerApi api, Player player, GameState game, Map map)
 {
     this.api = api;
     this.player = player;
     this.game = game;
     this.map = map;
 }
 public ServerMonitorFactory(
     ServerMonitorSettings serverMonitorSettings,
     IConnectionFactory connectionFactory,
     IEventSubscriber eventSubscriber,
     ServerApi serverApi)
 {
     _serverMonitorSettings = Ensure.IsNotNull(serverMonitorSettings, nameof(serverMonitorSettings));
     _connectionFactory     = Ensure.IsNotNull(connectionFactory, nameof(connectionFactory));
     _eventSubscriber       = Ensure.IsNotNull(eventSubscriber, nameof(eventSubscriber));
     _serverApi             = serverApi;
 }
        public void ConfigureServerApiNonStrict()
        {
            // Start Versioned API Example 3
            var connectionString    = "mongodb://localhost";
            var serverApi           = new ServerApi(ServerApiVersion.V1, strict: false);
            var mongoClientSettings = MongoClientSettings.FromConnectionString(connectionString);

            mongoClientSettings.ServerApi = serverApi;
            var mongoClient = new MongoClient(mongoClientSettings);
            // End Versioned API Example 3
        }
        public void ConfigureServerApiDeprecationErrors()
        {
            // Start Versioned API Example 4
            var connectionString    = "mongodb://localhost";
            var serverApi           = new ServerApi(ServerApiVersion.V1, deprecationErrors: true);
            var mongoClientSettings = MongoClientSettings.FromConnectionString(connectionString);

            mongoClientSettings.ServerApi = serverApi;
            var mongoClient = new MongoClient(mongoClientSettings);
            // End Versioned API Example 4
        }
 // constructors
 public BinaryConnectionFactory(
     ConnectionSettings settings,
     IStreamFactory streamFactory,
     IEventSubscriber eventSubscriber,
     ServerApi serverApi)
 {
     _settings              = Ensure.IsNotNull(settings, nameof(settings));
     _streamFactory         = Ensure.IsNotNull(streamFactory, nameof(streamFactory));
     _eventSubscriber       = Ensure.IsNotNull(eventSubscriber, nameof(eventSubscriber));
     _connectionInitializer = new ConnectionInitializer(settings.ApplicationName, settings.Compressors, serverApi);
 }
        public void ConfigureServerApi()
        {
            // Start Stable API Example 1
            var connectionString    = "mongodb://localhost";
            var serverApi           = new ServerApi(ServerApiVersion.V1);
            var mongoClientSettings = MongoClientSettings.FromConnectionString(connectionString);

            mongoClientSettings.ServerApi = serverApi;
            var mongoClient = new MongoClient(mongoClientSettings);
            // End Stable API Example 1
        }
        /// <summary>
        /// Configures a cluster builder from a connection string.
        /// </summary>
        /// <param name="builder">The cluster builder.</param>
        /// <param name="connectionString">The connection string.</param>
        /// <param name="serverApi">The server API.</param>
        /// <returns>A reconfigured cluster builder.</returns>
        public static ClusterBuilder ConfigureWithConnectionString(
            this ClusterBuilder builder,
            string connectionString,
            ServerApi serverApi)
        {
            Ensure.IsNotNull(builder, nameof(builder));
            Ensure.IsNotNullOrEmpty(connectionString, nameof(connectionString));

            var parsedConnectionString = new ConnectionString(connectionString);

            return(ConfigureWithConnectionString(builder, parsedConnectionString, serverApi));
        }
Exemplo n.º 8
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.F1))
        {
            SceneManager.LoadScene("Lobby");
        }

        if (Input.GetKeyDown(KeyCode.F12))
        {
            ServerApi.EndOfTurn();
        }
    }
Exemplo n.º 9
0
 protected async Task SaveActionData(int taskId, GameAction action, ServerApi serverApi, user_role role, DateTime?expireTime = null, Dictionary <string, string> taskData = null)
 {
     var saveActionDataTask = new SaveActionDataTask()
     {
         taskId      = taskId,
         action      = action,
         expiresTime = expireTime,
         roleData    = GetRoleData(serverApi, role.id, role.user_id),
         taskData    = taskData
     };
     await saveDataActor.Ask(saveActionDataTask);
 }
Exemplo n.º 10
0
        public void InitServerApi()
        {
            serverApi = new ServerApi(device.platform_type == 1);
            serverApi.PlatfromInfos["version"]       = AppInfo.version;
            serverApi.PlatfromInfos["dataVer"]       = AppInfo.dataVer;
            serverApi.PlatfromInfos["dateVer"]       = AppInfo.dateVer;
            serverApi.PlatfromInfos["deviceid"]      = device.deviceid;
            serverApi.PlatfromInfos["dp"]            = device.dp;
            serverApi.PlatfromInfos["idfa"]          = device.idfa;
            serverApi.PlatfromInfos["model"]         = device.model;
            serverApi.PlatfromInfos["os"]            = device.os;
            serverApi.PlatfromInfos["pf_ver"]        = device.pf_ver;
            serverApi.PlatfromInfos["platform_type"] = device.platform_type.ToString();
            serverApi.PlatfromInfos["ptype"]         = device.ptype;
            serverApi.PlatfromInfos["udid"]          = device.udid;

            if (data != null)
            {
                if (!string.IsNullOrEmpty(data.access_token))
                {
                    serverApi.PlatfromInfos["access_token"] = data.access_token;
                    serverApi.PlatfromInfos["access_key"]   = data.access_token;
                    serverApi.PlatfromInfos["expires"]      = data.access_token_expires.ToString();
                }
                if (!string.IsNullOrEmpty(data.usk))
                {
                    serverApi.PlatfromInfos["usk"]   = data.usk;
                    serverApi.PlatfromInfos["rgusk"] = data.usk;
                }
                if (!string.IsNullOrEmpty(data.rguid))
                {
                    serverApi.PlatfromInfos["rguid"] = data.rguid;
                }
                if (!string.IsNullOrEmpty(data.game_user_id))
                {
                    serverApi.PlatfromInfos["rguid"]   = data.rguid;
                    serverApi.PlatfromInfos["_userId"] = data.game_user_id;
                    serverApi.PlatfromInfos["userId"]  = data.game_user_id;
                    serverApi.PlatfromInfos["role_id"] = data.game_user_id;
                }
                if (!string.IsNullOrEmpty(data.nickname))
                {
                    serverApi.PlatfromInfos["nickname"] = data.nickname;
                    serverApi.PlatfromInfos["uname"]    = data.nickname;
                }
                if (!string.IsNullOrEmpty(data.bilibili_id))
                {
                    serverApi.PlatfromInfos["uid"] = data.bilibili_id;
                }
            }
            ServerApiManager.SetServerApi(role.id, serverApi);
        }
Exemplo n.º 11
0
        public static void Init(ServerInitializer initializer)
        {
            if (Interlocked.CompareExchange(ref _chat, new ServerChat(), null) != null)
            {
                throw new InvalidOperationException("model already inited");
            }

            Api    = new ServerApi(initializer.AdminPassword);
            Server = new AsyncServer(Api, _notifier, Logger);

            Plugins = new ServerPluginManager(initializer.PluginsPath);
            Plugins.LoadPlugins(initializer.ExcludedPlugins);
        }
Exemplo n.º 12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScramShaAuthenticator"/> class.
 /// </summary>
 /// <param name="credential">The credential.</param>
 /// <param name="hashAlgorithName">The hash algorithm name.</param>
 /// <param name="randomStringGenerator">The random string generator.</param>
 /// <param name="h">The H function to use.</param>
 /// <param name="hi">The Hi function to use.</param>
 /// <param name="hmac">The Hmac function to use.</param>
 /// <param name="cache">The cache to use.</param>
 /// <param name="serverApi">The server API.</param>
 internal ScramShaAuthenticator(
     UsernamePasswordCredential credential,
     HashAlgorithmName hashAlgorithName,
     IRandomStringGenerator randomStringGenerator,
     H h,
     Hi hi,
     Hmac hmac,
     ScramCache cache,
     ServerApi serverApi)
     : base(new ScramShaMechanism(credential, hashAlgorithName, randomStringGenerator, h, hi, hmac, cache), serverApi)
 {
     _databaseName = credential.Source;
 }
Exemplo n.º 13
0
        protected override void BeginProcessing()
        {
            var serverApi = new ServerApi(Utilities.Configuration);

            var err = serverApi.Start(this.DataCenterId, this.ServerId);

            if (err != null)
            {
                WriteObject(err);
                return;
            }
            WriteObject("Server starting...");
        }
        // private methods
        private CommandWireProtocol <BsonDocument> CreateGetLastErrorProtocol(ServerApi serverApi)
        {
            var getLastErrorCommand  = new BsonDocument("getLastError", 1);
            var getLastErrorProtocol = new CommandWireProtocol <BsonDocument>(
                databaseNamespace: DatabaseNamespace.Admin,
                command: getLastErrorCommand,
                secondaryOk: true,
                resultSerializer: BsonDocumentSerializer.Instance,
                messageEncoderSettings: null,
                serverApi: serverApi);

            return(getLastErrorProtocol);
        }
Exemplo n.º 15
0
        public static void Init(ServerInitializer initializer)
        {
            if (Interlocked.CompareExchange(ref model, new ServerModel(), null) != null)
            {
                throw new InvalidOperationException("model already inited");
            }

            Server = new AsyncServer();
            Api    = new ServerApi();

            Plugins = new ServerPluginManager(initializer.PluginsPath);
            Plugins.LoadPlugins(initializer.ExcludedPlugins);
        }
Exemplo n.º 16
0
        protected override void BeginProcessing()
        {
            try
            {
                var serverApi = new ServerApi(Utilities.Configuration);

                var resp = serverApi.Delete(this.DataCenterId, this.ServerId);
                WriteObject(resp);
            }
            catch (Exception ex)
            {
                WriteError(new ErrorRecord(ex, "", ErrorCategory.NotSpecified, null));
            }
        }
Exemplo n.º 17
0
 internal static CommandWireProtocol <BsonDocument> CreateProtocol(
     BsonDocument isMasterCommand,
     ServerApi serverApi,
     CommandResponseHandling commandResponseHandling = CommandResponseHandling.Return)
 {
     return(new CommandWireProtocol <BsonDocument>(
                databaseNamespace: DatabaseNamespace.Admin,
                command: isMasterCommand,
                slaveOk: true,
                commandResponseHandling: commandResponseHandling,
                resultSerializer: BsonDocumentSerializer.Instance,
                messageEncoderSettings: null,
                serverApi));
 }
Exemplo n.º 18
0
 static void Main(string[] args)
 {
     if (args.Length == 4)
     {
         System.Console.WriteLine(args);
         ServerApi serverApi = new ServerApi(Int32.Parse(args[1]));
         System.Console.ReadLine();
     }
     else
     {
         System.Console.WriteLine("Error, invalid arguments");
         System.Console.ReadLine();
     }
 }
 public static void Remove(GameRoom room)
 {
     if (room == null)
     {
         return;
     }
     lock (Games)
     {
         if (room.Name != null)
         {
             Games.Remove(room.Name);
             ServerApi.OnRoomClose(room);
         }
     }
 }
Exemplo n.º 20
0
 /// <summary>
 /// Default constructor
 /// </summary>
 /// <param name="apiKey">UWaterloo API Key</param>
 public UWaterlooApi(string apiKey)
 {
     // Initializing endpoints
     FoodServices        = new FoodServicesApi(apiKey);
     Courses             = new CoursesApi(apiKey);
     Events              = new EventsApi(apiKey);
     News                = new NewsApi(apiKey);
     Weather             = new WeatherApi(apiKey);
     Terms               = new TermsApi(apiKey);
     Resources           = new ResourcesApi(apiKey);
     DefinitionsAndCodes = new DefinitionsAndCodesApi(apiKey);
     Buildings           = new BuildingsApi(apiKey);
     Api    = new ApiApi(apiKey);
     Server = new ServerApi(apiKey);
 }
Exemplo n.º 21
0
 public RoundTripTimeMonitor(
     IConnectionFactory connectionFactory,
     ServerId serverId,
     EndPoint endpoint,
     TimeSpan heartbeatInterval,
     ServerApi serverApi)
 {
     _connectionFactory       = Ensure.IsNotNull(connectionFactory, nameof(connectionFactory));
     _serverId                = Ensure.IsNotNull(serverId, nameof(serverId));
     _endPoint                = Ensure.IsNotNull(endpoint, nameof(endpoint));
     _heartbeatInterval       = heartbeatInterval;
     _serverApi               = serverApi;
     _cancellationTokenSource = new CancellationTokenSource();
     _cancellationToken       = _cancellationTokenSource.Token;
 }
Exemplo n.º 22
0
        private async void UpdateDeviceList()
        {
            ObservableCollection <DeviceInfo> list = await ServerApi.GetDeviceList();

            if (list != null)
            {
                deviceList.ItemsSource = list;

                ICollectionView dataView = CollectionViewSource.GetDefaultView(deviceList.ItemsSource); //获取数据源视图
                dataView.SortDescriptions.Clear();                                                      //清空默认排序描述
                SortDescription sd = new SortDescription("alive", ListSortDirection.Descending);
                dataView.SortDescriptions.Add(sd);                                                      //加入新的排序描述
                dataView.Refresh();
            }
        }
Exemplo n.º 23
0
        public void Connect()
        {
            _client = new HttpPilotClient(_settings.ServerUrl);
            _client.Connect(false);

            ServerApi         = _client.GetServerApi(new NullableServerCallback());
            AuthenticationApi = _client.GetAuthenticationApi();
            AuthenticationApi.Login(_settings.DbName, _settings.Login, _settings.Password, false, _settings.LicenseCode);

            var dataBaseInfo = ServerApi.OpenDatabase();

            PersonId = dataBaseInfo.Person.Id;

            FileArchiveApi = _client.GetFileArchiveApi();
        }
Exemplo n.º 24
0
    public static void SendStep(int tutorialStep, Action successAction, Action failAction = null)
    {
        PacketStructPlayer StructPlayer = UserDataAdmin.Instance.m_StructPlayer;

#if BUILD_TYPE_DEBUG
        Debug.Log("CALL TutorialManager#SendStep: " + tutorialStep + " / renew_tutorial_step: " + StructPlayer.renew_tutorial_step);
#endif

        if (tutorialStep <= StructPlayer.renew_tutorial_step)
        {
            Debug.Log("TutorialManager#SendStep CANCEL: " + tutorialStep + " <= renew_tutorial_step: " + StructPlayer.renew_tutorial_step);
            successAction();
            return;
        }

        LoadingManager.Instance.RequestLoadingStart(LOADING_TYPE.GUARD);

        ServerApi api = ServerDataUtilSend.SendPacketAPI_RenewTutorial((uint)tutorialStep);
        api.setSuccessAction(
            (_data) =>
        {
#if BUILD_TYPE_DEBUG
            Debug.Log("TutorialManager#SendStep Success SendStep:" + tutorialStep + " / renew_tutorial_step: " + StructPlayer.renew_tutorial_step);
#endif
            LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.GUARD);

            if (successAction != null)
            {
                successAction();
            }
        }).
        setErrorAction(
            (_data) =>
        {
            Debug.LogError("TutorialManager#SendStep ERROR:" + _data.m_PacketCode + " / renew_tutorial_step: " + StructPlayer.renew_tutorial_step);

            LoadingManager.Instance.RequestLoadingFinish(LOADING_TYPE.GUARD);

            if (successAction != null)
            {
                successAction();
            }
        }).
        SendStart();

        //送信後にtutorialStepを更新
        StructPlayer.renew_tutorial_step = tutorialStep;
    }
Exemplo n.º 25
0
        protected role_data GetRoleData(ServerApi serverApi, int roleId, int userId = 0, role_data ndata = null)
        {
            var data = new role_data()
            {
                role_id = roleId
            };

            data.usk                  = serverApi.PlatfromInfos.ContainsKey("usk") ? serverApi.PlatfromInfos["usk"] : null;
            data.rguid                = serverApi.PlatfromInfos["rguid"];
            data.game_user_id         = serverApi.PlatfromInfos["userId"];
            data.access_token         = serverApi.PlatfromInfos["access_token"];
            data.access_token_expires = long.Parse(serverApi.PlatfromInfos["expires"]);
            data.bilibili_id          = serverApi.PlatfromInfos["uid"];
            if (serverApi.PlatfromInfos.ContainsKey("cookie"))
            {
                data.cookie = serverApi.PlatfromInfos["cookie"];
            }
            if (ndata.quest_info != null)
            {
                data.quest_info = ndata.quest_info;
            }
            if (ndata.deck_info != null)
            {
                data.deck_info = ndata.deck_info;
            }
            if (ndata.svt_info != null)
            {
                data.svt_info = ndata.svt_info;
            }
            if (ndata.user_game != null)
            {
                data.user_game = ndata.user_game;
            }
            if (ndata.user_item != null)
            {
                data.user_item = ndata.user_item;
            }
            if (ndata.cookie != null)
            {
                data.cookie = ndata.cookie;
            }
            if (ndata.battle_id != null)
            {
                data.battle_id = ndata.battle_id;
            }
            return(data);
        }
        public void VersionedAPI_Strict_Migration_Example()
        {
            var connectionString    = "mongodb://localhost";
            var serverApi           = new ServerApi(ServerApiVersion.V1, strict: true);
            var mongoClientSettings = MongoClientSettings.FromConnectionString(connectionString);

            mongoClientSettings.ServerApi = serverApi;
            var mongoClient = new MongoClient(mongoClientSettings);
            var database    = mongoClient.GetDatabase("test");

            database.DropCollection("coll");
            var collection = database.GetCollection <BsonDocument>("coll");

            // 1. Populate a test sales collection:
            collection.InsertMany(
                new[]
            {
                BsonDocument.Parse(@"{ ""_id"" : 1, ""item"" : ""ab"", ""price"" : 10, ""quantity"" : 2, ""date"" : ISODate(""2021-01-01T08:00:00Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 2, ""item"" : ""jkl"", ""price"" : 20, ""quantity"" : 1, ""date"" : ISODate(""2021-02-03T09:00:00Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 3, ""item"" : ""xyz"", ""price"" : 5, ""quantity"" : 5, ""date"" : ISODate(""2021-02-03T09:05:00Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 4, ""item"" : ""abc"", ""price"" : 10, ""quantity"" : 10, ""date"" : ISODate(""2021-02-15T08:00:00Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 5, ""item"" : ""xyz"", ""price"" : 5, ""quantity"" : 10, ""date"" : ISODate(""2021-02-15T09:05:00Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 6, ""item"" : ""xyz"", ""price"" : 5, ""quantity"" : 5, ""date"" : ISODate(""2021-02-15T12:05:10Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 7, ""item"" : ""xyz"", ""price"" : 5, ""quantity"" : 10, ""date"" : ISODate(""2021-02-15T14:12:12Z"") }"),
                BsonDocument.Parse(@"{ ""_id"" : 8, ""item"" : ""abc"", ""price"" : 10, ""quantity"" : 5, ""date"" : ISODate(""2021-03-16T20:20:13Z"") }")
            });

            // 2. The response from the server when running count using a strict client:
            try
            {
#pragma warning disable CS0618 // Type or member is obsolete
                collection.Count(FilterDefinition <BsonDocument> .Empty);
#pragma warning restore CS0618 // Type or member is obsolete
            }
            catch (MongoCommandException ex)
            {
                Console.WriteLine(ex.Code);     // 323
                Console.WriteLine(ex.CodeName); // APIStrictError
                Console.WriteLine(ex.Message);  // Command count failed: Provided apiStrict:true, but the command count is not in API Version 1. Information on supported commands and migrations in API Version 1 can be found at https://dochub.mongodb.org/core/manual-versioned-api.
            }

            // 3. An alternative, accepted command to count the number of documents:
            var count = collection.CountDocuments(FilterDefinition <BsonDocument> .Empty);

            // 4. The output of the above command:
            Console.WriteLine(count); // 8
        }
Exemplo n.º 27
0
        /// <summary>
        /// Constructs the server manager.
        /// </summary>
        /// <param name="netServer">The net server instance.</param>
        /// <param name="gameSettings">The server game settings.</param>
        /// <param name="packetManager">The packet manager instance.</param>
        protected ServerManager(
            NetServer netServer,
            Settings.GameSettings gameSettings,
            PacketManager packetManager
            )
        {
            _netServer   = netServer;
            GameSettings = gameSettings;
            _playerData  = new ConcurrentDictionary <ushort, ServerPlayerData>();

            CommandManager = new ServerCommandManager();
            var eventAggregator = new EventAggregator();

            var serverApi = new ServerApi(this, CommandManager, _netServer, eventAggregator);

            AddonManager = new ServerAddonManager(serverApi);

            // Load the lists
            _whiteList      = WhiteList.LoadFromFile();
            _authorizedList = AuthKeyList.LoadFromFile(AuthorizedFileName);
            _banList        = BanList.LoadFromFile();

            // Register packet handlers
            packetManager.RegisterServerPacketHandler <HelloServer>(ServerPacketId.HelloServer, OnHelloServer);
            packetManager.RegisterServerPacketHandler <ServerPlayerEnterScene>(ServerPacketId.PlayerEnterScene,
                                                                               OnClientEnterScene);
            packetManager.RegisterServerPacketHandler(ServerPacketId.PlayerLeaveScene, OnClientLeaveScene);
            packetManager.RegisterServerPacketHandler <PlayerUpdate>(ServerPacketId.PlayerUpdate, OnPlayerUpdate);
            packetManager.RegisterServerPacketHandler <EntityUpdate>(ServerPacketId.EntityUpdate, OnEntityUpdate);
            packetManager.RegisterServerPacketHandler(ServerPacketId.PlayerDisconnect, OnPlayerDisconnect);
            packetManager.RegisterServerPacketHandler(ServerPacketId.PlayerDeath, OnPlayerDeath);
            packetManager.RegisterServerPacketHandler <ServerPlayerTeamUpdate>(ServerPacketId.PlayerTeamUpdate,
                                                                               OnPlayerTeamUpdate);
            packetManager.RegisterServerPacketHandler <ServerPlayerSkinUpdate>(ServerPacketId.PlayerSkinUpdate,
                                                                               OnPlayerSkinUpdate);
            packetManager.RegisterServerPacketHandler <ChatMessage>(ServerPacketId.ChatMessage, OnChatMessage);

            // Register a timeout handler
            _netServer.ClientTimeoutEvent += OnClientTimeout;

            // Register server shutdown handler
            _netServer.ShutdownEvent += OnServerShutdown;

            // Register a handler for when a client wants to login
            _netServer.LoginRequestEvent += OnLoginRequest;
        }
Exemplo n.º 28
0
        internal static BsonDocument CreateCommand(ServerApi serverApi, bool helloOk = false, TopologyVersion topologyVersion = null, TimeSpan? maxAwaitTime = null, bool loadBalanced = false)
        {
            Ensure.That(
                (topologyVersion == null && !maxAwaitTime.HasValue) ||
                (topologyVersion != null && maxAwaitTime.HasValue),
                $"Both {nameof(topologyVersion)} and {nameof(maxAwaitTime)} must be filled or null.");

            var helloCommandName = helloOk || serverApi != null ? "hello" : OppressiveLanguageConstants.LegacyHelloCommandName;
            return new BsonDocument
            {
                { helloCommandName, 1 },
                { "helloOk", true },
                { "topologyVersion", () => topologyVersion.ToBsonDocument(), topologyVersion != null },
                { "maxAwaitTimeMS", () => (long)maxAwaitTime.Value.TotalMilliseconds, maxAwaitTime.HasValue },
                { "loadBalanced", true, loadBalanced }
            };
        }
        public void constructor_with_serverApi_should_initialize_instance()
        {
            var serverApi = new ServerApi(ServerApiVersion.V1, true, true);

            var subject = new ClusterSettings(serverApi: serverApi);

#pragma warning disable CS0618 // Type or member is obsolete
            subject.ConnectionMode.Should().Be(__defaults.ConnectionMode);
#pragma warning restore CS0618 // Type or member is obsolete
            subject.EndPoints.Should().EqualUsing(__defaults.EndPoints, EndPointHelper.EndPointEqualityComparer);
            subject.LocalThreshold.Should().Be(__defaults.LocalThreshold);
            subject.MaxServerSelectionWaitQueueSize.Should().Be(__defaults.MaxServerSelectionWaitQueueSize);
            subject.ReplicaSetName.Should().Be(__defaults.ReplicaSetName);
            subject.Scheme.Should().Be(__defaults.Scheme);
            subject.ServerApi.Should().Be(serverApi);
            subject.ServerSelectionTimeout.Should().Be(__defaults.ServerSelectionTimeout);
        }
Exemplo n.º 30
0
        async Task SaveSettingsInApp()
        {
            string newServerApi = ServerApi.Trim();
            string newapiName   = ApiName.Trim();

            if (!string.IsNullOrEmpty(newServerApi))
            {
                _SettingsApp.SetUrlApi = newServerApi;
            }
            if (!string.IsNullOrEmpty(newapiName))
            {
                _SettingsApp.SetApiName = newapiName;
            }
            await apiServices.LogoutUser();

            App.Current.MainPage = new NavigationPage(new MainPage());
        }
 // constructors
 public CommandWireProtocol(
     DatabaseNamespace databaseNamespace,
     BsonDocument command,
     bool secondaryOk,
     IBsonSerializer <TCommandResult> resultSerializer,
     MessageEncoderSettings messageEncoderSettings,
     ServerApi serverApi)
     : this(
         databaseNamespace,
         command,
         secondaryOk,
         CommandResponseHandling.Return,
         resultSerializer,
         messageEncoderSettings,
         serverApi)
 {
 }
Exemplo n.º 32
0
        public PostfixServer(ServerSetup setup)
            : base(setup)
        {
            _dbManager = new PostfixAdminDbManager(setup.ServerId, setup.ConnectionString);

            var json = JObject.Parse(setup.ConnectionString);

            if (json["Api"] != null)
            {
                _serverApi = new ServerApi
                    {
                        server_ip = json["Api"]["Server"].ToString(),
                        port = Convert.ToInt32(json["Api"]["Port"].ToString()),
                        protocol = json["Api"]["Protocol"].ToString(),
                        version = json["Api"]["Version"].ToString(),
                        token = json["Api"]["Token"].ToString()
                    };
            }
        }
Exemplo n.º 33
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            api = new ServerApi(SERVER_URL);

            base.Initialize();
        }
Exemplo n.º 34
0
 public void Init(ServerApi api, Player player)
 {
     this.api = api;
     this.player = player;
 }
Exemplo n.º 35
0
    public static void Init(ServerInitializer initializer)
    {
      if (Interlocked.CompareExchange(ref model, new ServerModel(), null) != null)
        throw new InvalidOperationException("model already inited");

      Server = new AsyncServer();
      Api = new ServerApi();

      Plugins = new ServerPluginManager(initializer.PluginsPath);
      Plugins.LoadPlugins(initializer.ExcludedPlugins);
    }