Exemplo n.º 1
0
        public static TcpMapLicense CreateNew(string key, string name)
        {
            TcpMapLicense lic = new TcpMapLicense()
            {
                Key = key, Name = name
            };
            RSACryptoServiceProvider rsa = new RSACryptoServiceProvider();

            lic.RSAXmlData = rsa.ToXmlString(true);
            return(lic);
        }
Exemplo n.º 2
0
        static public TcpMapServerWorker CreateServerWorker(TcpMapLicense lic, int port)
        {
            CheckPortAvailable(port);

            TcpMapServer server = new TcpMapServer();

            server.Id          = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            server.License     = lic;
            server.IsDisabled  = false;
            server.IsValidated = true;
            server.ServerPort  = port;
            string jsonfilepath = Path.Combine(DataFolder, "TcpMapServer_" + server.Id + ".json");

            File.WriteAllText(jsonfilepath, JsonSerializer.Serialize(server));
            return(AddStartServer(server));
        }
Exemplo n.º 3
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));
        }