Exemplo n.º 1
0
        public override bool TakeAction()
        {
            CacheServer cacheServer = new CacheServer();
            serverList = cacheServer.GetClientServerList(gameID);
            return true;

        }
Exemplo n.º 2
0
        public override bool TakeAction()
        {
            CacheServer cacheServer = new CacheServer();
            cacheServer.ServerStatus(_gameId, _serverid, _status);
            return true;

        }
Exemplo n.º 3
0
 public void AddServer(int gameID, int serverId, string serverName, string serverUrl, string status, string intranetAddress)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.AddToCache(new ServerInfo()
     {
         ID = serverId,
         GameID = gameID,
         ServerName = serverName,
         ServerUrl = serverUrl,
         Status = status,
         IntranetAddress = intranetAddress
     });
 }
Exemplo n.º 4
0
 private string DoComboWrite(int gameId)
 {
     CacheServer cacheServer = new CacheServer();
     var serverList = cacheServer.GetOfficialServerList(gameId);
     List<ComboData> responseList = new List<ComboData>();
     int index = 0;
     foreach (var serverInfo in serverList)
     {
         ComboData item = new ComboData();
         item.id = serverInfo.ID;
         item.text = string.Format("{0}({1}服)", serverInfo.ServerName, serverInfo.ID);
         if (index == 0)
         {
             item.selected = true;
         }
         responseList.Add(item);
         index++;
     }
     JavaScriptSerializer serializer = new JavaScriptSerializer();
     return serializer.Serialize(responseList);
 }
Exemplo n.º 5
0
 public void SetServerEnableDate(int gameID, int serverID, DateTime enableDate)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.SetServerEnableDate(gameID, serverID, enableDate);
 }
Exemplo n.º 6
0
 public void RemoveServer(int gameID, int serverID)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.RemoveServer(gameID, serverID);
 }
Exemplo n.º 7
0
 public bool ReloadServer(int gameID)
 {
     CacheServer cacheServer = new CacheServer();
     return cacheServer.ReloadServer(gameID);
 }
Exemplo n.º 8
0
 public void SetServer(int serverID, int gameID, string serverName, string serverUrl, string status, int weight, string intranetAddress)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.SetServer(serverID, gameID, serverName, serverID, serverUrl, status, weight, intranetAddress);
 }
Exemplo n.º 9
0
 public ServerInfo[] GetServers(int gameID, bool isSort, bool isEnable)
 {
     CacheServer cacheServer = new CacheServer();
     return cacheServer.GetServers(gameID, isSort, isEnable).ToArray();
 }
Exemplo n.º 10
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return sorted set remove response</returns>
 protected override async Task <SortedSetRemoveResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.SortedSetRemoveAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 11
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return get all database response</returns>
 protected override async Task <GetAllDataBaseResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.GetAllDataBaseAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 12
0
 protected override async Task <HashDecrementResponse <T> > ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.HashDecrementAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 13
0
 protected override async Task <SortedSetRangeByScoreResponse> ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.SortedSetRangeByScoreAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 14
0
        public void EnableServer(int gameID, int serverID, bool isEnable)
        {
            CacheServer cacheServer = new CacheServer();

            cacheServer.EnableServer(gameID, serverID, isEnable);
        }
Exemplo n.º 15
0
 public ServerHost(CacheServer server)
     : base(server, CacheServer.ObjectUri)
 {
     CacheServer.Instance = server;
 }
Exemplo n.º 16
0
 public string GetServerName(int gameID, int serverID)
 {
     CacheServer cacheServer = new CacheServer();
     return cacheServer.GetServerName(gameID, serverID);
 }
Exemplo n.º 17
0
 public ServerInfo[] GetServerList(int gameID)
 {
     CacheServer cacheServer = new CacheServer();
     return cacheServer.GetServerList(gameID, false);
 }
Exemplo n.º 18
0
 /// <summary>
 /// get execute handler
 /// </summary>
 /// <param name="cacheProvider">cache provider</param>
 /// <returns></returns>
 protected abstract Task <TR> ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server);
Exemplo n.º 19
0
 public void ServerStatus(int gameID, int serverID, int Status)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.ServerStatus(gameID, serverID, Status);
 }
Exemplo n.º 20
0
 static RemoteCacheServer()
 {
     CacheServer.RegisterCompactTypes();
 }
Exemplo n.º 21
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return random response</returns>
 protected override async Task <RandomResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.KeyRandomAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 22
0
        /// <summary>
        /// Returns a running instance of CacheServer; does not start the service.
        /// If user specifies in the client application an ip address to server channels to bind to
        /// then this method creates the server channel bound to that ip. also the object uri then uses
        /// the ip address instead of server name.
        /// </summary>
        /// <returns></returns>
#if !NETCORE
        public override ICacheServer ConnectCacheServer()
        {
            string objectUri = "";
            string protocol;
            string ip = "";

            try
            {
                if (_channel == null)
                {
                    _channel = new RemotingChannels();


                    ip = ServiceConfiguration.BindToIP.ToString();

                    if (ip != null && ip.Length > 0)
                    {
                        if (_useTcp)
                        {
                            _channel.RegisterTcpChannels("NCC", ip, 0);
                        }
                        else
                        {
                            _channel.RegisterHttpChannels("NCC", ip, 0);
                        }
                    }
                    else
                    {
                        if (_useTcp)
                        {
                            _channel.RegisterTcpChannels("NCC", 0);
                        }
                        else
                        {
                            _channel.RegisterHttpChannels("NCC", 0);
                        }
                    }
                }
                protocol = _useTcp ? @"tcp://" : @"http://";

                if (ip != null && ip.Length > 0)
                {
                    objectUri = protocol + ip + ":" + _port + @"/" +
                                CacheHost.ApplicationName + @"/" + Alachisoft.NCache.Management.CacheServer.ObjectUri;
                }
                else
                {
                    objectUri = protocol + _serverName + ":" + _port + @"/" +
                                CacheHost.ApplicationName + @"/" + Alachisoft.NCache.Management.CacheServer.ObjectUri;
                }

                CacheServer server = (CacheServer)

                                     Activator.GetObject(typeof(CacheServer), objectUri, WellKnownObjectMode.Singleton);

                int ccount = server.Caches.Count;

                return(server);
            }

            catch (SocketException socketException)
            {
                throw;
            }
            catch (ManagementException mexp)
            {
                throw;
            }
            catch (Exception e)
            {
                throw new ManagementException(e.Message, e);
            }
        }
Exemplo n.º 23
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return string length response</returns>
 protected override async Task <IEnumerable <StringLengthResponse> > ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.StringLengthAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 24
0
 public ServerHandShakeHandler(TcpClient tcp, CacheServer server, Guid tempGuid) : base(tcp, server.Config)
 {
     this.TemporaryID = tempGuid;
     this._server     = server;
 }
Exemplo n.º 25
0
 protected override async Task <SetCombineAndStoreResponse> ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.SetCombineAndStoreAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 26
0
 public void Init()
 {
     cacheSrv = CacheServer.Instance;
     cfgSvc   = CfgSvc.Instance;
     PECommon.Log("GuideSystem Init Done");
 }
Exemplo n.º 27
0
 public ServerInfo GetServerObj(int gameID, int serverId)
 {
     CacheServer cacheServer = new CacheServer();
     return cacheServer.GetServers(gameID, serverId);
 }
Exemplo n.º 28
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return hash increment response</returns>
 protected override async Task <HashIncrementResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.HashIncrementAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 29
0
 public ServerInfo[] GetServerSortList(int gameID)
 {
     CacheServer cacheServer = new CacheServer();
     return cacheServer.GetServerList(gameID, true).ToArray();
 }
Exemplo n.º 30
0
 /// <summary>
 /// Get config connection
 /// </summary>
 /// <param name="cacheServer">Cache server</param>
 /// <returns></returns>
 public static ConnectionMultiplexer GetConfigConnection(CacheServer cacheServer)
 {
     ConnectionMultiplexers.TryGetValue(cacheServer?.Name, out var conn);
     return(conn);
 }
Exemplo n.º 31
0
 public void SetActiveNum(int serverID, int gameID, int activeNum)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.SetActiveNum(serverID, gameID, activeNum);
 }
Exemplo n.º 32
0
 protected override async Task <StringSetBitResponse> ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.StringSetBitAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 33
0
 public string GetServerName(int gameID, int serverID)
 {
     CacheServer cacheServer = new CacheServer();
     var info = cacheServer.GetServers(gameID, serverID);
     return info == null ? "" : info.ServerName;
 }
 public LatentCacheServer(CacheServer cacheServer, int latencyInMilliSeconds)
 {
     _cacheServer          = cacheServer;
     LatencyInMilliSeconds = latencyInMilliSeconds;
 }
Exemplo n.º 35
0
 public void EnableServer(int gameID, int serverID, bool isEnable)
 {
     CacheServer cacheServer = new CacheServer();
     cacheServer.EnableServer(gameID, serverID, isEnable);
 }
Exemplo n.º 36
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return get key detail response</returns>
 protected override async Task <IEnumerable <GetDetailResponse> > ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.GetKeyDetailAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 37
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return sorted set decrement response</returns>
 protected override async Task <IEnumerable <SortedSetDecrementResponse> > ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.SortedSetDecrementAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 38
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return exists key response</returns>
 protected override Task <ExistsResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 39
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return string append response</returns>
 protected override async Task <StringAppendResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.StringAppendAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 40
0
        public void SetServerEnableDate(int gameID, int serverID, DateTime enableDate)
        {
            CacheServer cacheServer = new CacheServer();

            cacheServer.SetServerEnableDate(gameID, serverID, enableDate);
        }
Exemplo n.º 41
0
 protected override async Task <ClearDataResponse> ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.ClearDataAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 42
0
        public bool ReloadServer(int gameID)
        {
            CacheServer cacheServer = new CacheServer();

            return(cacheServer.ReloadServer(gameID));
        }
Exemplo n.º 43
0
 public void Init()
 {
     PECommon.Log("LoginSystem Init Done");
     cacheSrv = CacheServer.Instance;
 }
Exemplo n.º 44
0
 protected override async Task <ListSetByIndexResponse> ExecuteCommandAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.ListSetByIndexAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 45
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return right pop left push response</returns>
 protected override async Task <ListRightPopLeftPushResponse> ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.ListRightPopLeftPushAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 46
0
        public void ServerStatus(int gameID, int serverID, int Status)
        {
            CacheServer cacheServer = new CacheServer();

            cacheServer.ServerStatus(gameID, serverID, Status);
        }
Exemplo n.º 47
0
 /// <summary>
 /// Execute cache operation
 /// </summary>
 /// <param name="cacheProvider">Cache provider</param>
 /// <param name="server">Cache server</param>
 /// <returns>Return insert before response</returns>
 protected override async Task <IEnumerable <ListInsertBeforeResponse> > ExecuteCacheOperationAsync(ICacheProvider cacheProvider, CacheServer server)
 {
     return(await cacheProvider.ListInsertBeforeAsync(server, this).ConfigureAwait(false));
 }
Exemplo n.º 48
0
        void conToCacheServer(string ip)
        {
            UriBuilder uriBuilder = new UriBuilder(ip);
            uriBuilder.Port = Convert.ToInt32(ConfigurationManager.AppSettings["cacheServicePort"].ToString());

            cs = new CacheServer(uriBuilder.Uri.ToString());

            Console.WriteLine("Запущен клиент сервиса кэш-сервера");

            string msmqName = ConfigurationManager.AppSettings["cacheMSMQName"];
            cacheMSMQ = new MSMQClient(ip, msmqName);
        }