コード例 #1
0
        static TcpMapClientWorker AddStartClient(TcpMapClient client)
        {
            var conn = new TcpMapClientWorker()
            {
                Client = client
            };

            lock (_clients)
                _clients.Add(conn);
            if (!client.IsDisabled)
            {
                conn.StartWork();
            }
            return(conn);
        }
コード例 #2
0
        static public TcpMapClientWorker CreateClientWorker(TcpMapLicense lic, int serverPort)
        {
            TcpMapClient client = new TcpMapClient()
            {
                License = lic
            };

            client.Id         = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            client.IsDisabled = true;
            client.ServerHost = "servername";
            client.ServerPort = serverPort;
            client.ClientHost = "localhost";
            client.ClientPort = 80;
            string jsonfilepath = Path.Combine(DataFolder, "TcpMapClient_" + client.Id + ".json");

            File.WriteAllText(jsonfilepath, JsonSerializer.Serialize(client));
            return(AddStartClient(client));
        }
コード例 #3
0
        static public void ReAddClient(TcpMapClient client)
        {
            string jsonfilepath = Path.Combine(DataFolder, "TcpMapClient_" + client.Id + ".json");

            File.WriteAllText(jsonfilepath, JsonSerializer.Serialize(client));
            TcpMapClientWorker clientWorker = null;

            lock (_clients)
            {
                clientWorker = _clients.Where(v => v.Client.Id == client.Id).FirstOrDefault();
                if (clientWorker != null)
                {
                    _clients.Remove(clientWorker);
                }
            }
            if (clientWorker != null)
            {
                clientWorker.Stop();
            }
            AddStartClient(client);
        }
コード例 #4
0
 public TcpMapClientSession(TcpMapClient client, string sid)
 {
     Client    = client;
     SessionId = sid;
 }
コード例 #5
0
 public TcpMapClientSession(TcpMapClient client, string sid)
 {
     this.Client    = client;
     this.SessionId = sid;
 }