Exemplo n.º 1
0
        /// <summary>
        /// 设置客户端配置表数据!
        /// </summary>
        /// <param name="config">需要设置的客户端配置项</param>
        /// <param name="value">设置的最终值</param>
        public void SetClientConfig(ClientConfigs config, string value)
        {
            string key = config.ToString();

            if (!m_ClientConfigInfoMap.ContainsKey(key))
            {
                Debug.Log("配置项中不包含" + key);
                return;
            }
            //1:更新xml缓冲区
            if (m_ClientConfigInfoMap[key] == value)
            {
                return;
            }
            m_ClientConfigInfoMap[key] = value;

            //2:更新客户端xml文件中的内容
            LoadConfigXML(ref m_configFileName, false); // 先加载xml文件
            XmlNodeList configs = m_xmlDoc.SelectSingleNode(m_configRootName).ChildNodes;

            foreach (XmlElement element in configs)
            {
                if (element.Name == key)
                {
                    element.InnerText = value;
                    break;
                }
            }
            string rw_Path = AppManager.Inst.readAndWritePath + "Data/" + m_configFileName;

            //3: 保存到磁盘文件,以后这里需要定时保存,而不是来一条修改信息就保存一次!
            m_xmlDoc.Save(rw_Path);
        }
Exemplo n.º 2
0
 public HomeController(
     IIdentityServerInteractionService interaction,
     IOptions <ClientConfigs> clientConfigs)
 {
     _interaction   = interaction;
     _clientConfigs = clientConfigs.Value;
 }
                /// <summary>
                ///     Creates a UDP connection.
                /// </summary>
                public Udp(ClientConfigs configs)
                {
                    _configs = configs;
                    var ip        = _configs.Ip;
                    var ipAddress = IPAddress.Parse(ip);

                    _ipEndPoint = new IPEndPoint(ipAddress, _configs.Port);
                }
Exemplo n.º 4
0
        /// <summary>
        ///     Initialize the networking system with the configurations.
        /// </summary>
        public static void Initialize(ClientConfigs configs)
        {
            if (IsInitialized)
            {
                return;
            }

            Logger.Log("Initialize Network Client", Color.blue, "NetworkClient");
            Configs       = configs;
            _client       = new Client(Configs);
            IsInitialized = true;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 获取客户端 配置项
        /// </summary>
        /// <param name="config">客户端配置项</param>
        /// <returns></returns>
        public string GetClientConfig(ClientConfigs config)
        {
            string configKey = config.ToString();

            if (!m_ClientConfigInfoMap.ContainsKey(configKey))
            {
                //// 先清理客户端缓存信息!
                //m_ClientConfigInfoMap.Clear();
                //// 加载客户端配置文件
                //LoadConfigXML(ref m_configFileName, true);
                //// 读取客户端配置文件
                //ReadClientConfig();
                //if (GetClientConfig(config) == string.Empty)
                return(string.Empty);
            }
            if (!isConfigFileOK)
            {
                return(string.Empty);
            }
            return(m_ClientConfigInfoMap[configKey]);
        }
Exemplo n.º 6
0
        public AccountController(
            UserManager <ApplicationUser> userManager,
            SignInManager <ApplicationUser> signInManager,
            IEmailSender emailSender,
            ILogger <AccountController> logger,
            IIdentityServerInteractionService interaction,
            IClientStore clientStore,
            IHttpContextAccessor httpContextAccessor,
            IAuthenticationSchemeProvider schemeProvider,
            IChatService chatService,
            IOptions <ClientConfigs> clientConfigs
            )
        {
            _userManager   = userManager;
            _signInManager = signInManager;
            _emailSender   = emailSender;
            _logger        = logger;

            _interaction   = interaction;
            _account       = new AccountService(interaction, httpContextAccessor, schemeProvider, clientStore);
            _chatService   = chatService;
            _clientConfigs = clientConfigs.Value;
        }
Exemplo n.º 7
0
 /// <summary>
 ///     Creates a client with the network configs.
 /// </summary>
 public Client(ClientConfigs configs)
 {
     _tcp = new Tcp(configs);
 }
Exemplo n.º 8
0
 /// <summary>
 ///     Creates a TCP with the client.
 /// </summary>
 public Tcp(ClientConfigs configs)
 {
     _configs       = configs;
     _receiveBuffer = new byte[BufferSize];
 }