Ejemplo n.º 1
0
 public bool RegisterServer(WorldServerDto dto)
 {
     dto.ChannelId = (short)_set.Count;
     dto.Id        = Guid.NewGuid();
     _set.Add(dto);
     _worldInstance = dto;
     return(false);
 }
Ejemplo n.º 2
0
        public bool RegisterServer(WorldServerDto dto)
        {
            dto.Id = Guid.NewGuid();
            IDictionary <string, CacheValue <WorldServerDto> > servers = _cache.GetAllAsync <WorldServerDto>().ConfigureAwait(false).GetAwaiter().GetResult();

            if (servers.Values.Any(s => s?.Value?.Id == dto.Id))
            {
                _log.Warn("Server with the same Guid is already registered");
                return(true);
            }

            GetRunningServer = dto;
            _cache.AddAsync(ToKey(dto), dto);
            return(false);
        }
Ejemplo n.º 3
0
        public static bool RegisterServer()
        {
            var worldServer = new WorldServerDto
            {
                WorldGroup = WorldGroup,
                Ip         = Ip,
                Port       = Port,
                Color      = ChannelColor.White,
                Id         = Guid.Empty,
                ChannelId  = 0
            };
            var api = ChickenContainer.Instance.Resolve <IServerApiService>();

            if (api?.RegisterServer(worldServer) == true)
            {
                return(true);
            }

            WorldServer = worldServer;
            ClientSession.SetWorldServerId(WorldServer.Id);
            _running = true;
            Log.Info($"Registering server {WorldServer.Id}");
            return(false);
        }