示例#1
0
        public ClientParser()
        {
            this.client_ip = ClientUtils.GetLocalIPAddress();
            //bool client_port_isnt_taken = false;

            Console.Write("Type the client parameters within the following format \"c1 tcp://localhost:4001/client1 tcp://localhost:3001/server1 cs1\": ");

            client_arguments       = Console.ReadLine();
            client_arguments_split = client_arguments.Split(' ');

            this.client_identifier = client_arguments_split[0];
            this.client_url        = client_arguments_split[1];
            this.server_url        = client_arguments_split[2];

            this.client_ip       = ClientUtils.GetIPFromUrl(this.client_url);
            this.client_port     = ClientUtils.GetPortFromUrl(this.client_url);
            this.client_remoting = ClientUtils.GetRemotingIdFromUrl(this.client_url);

            this.client_library = new ClientLibrary(this.client_identifier, this.client_remoting, this.server_url, this.client_ip, this.client_port);

            try
            {
                new Initialize(ref this.client_library).Execute();
            }
            catch (ServerCoreException sce)
            {
                Console.WriteLine("\r\nCould not properly initialize the client! Aborting...");
                Console.WriteLine(sce.Message);
            }
            this.script_name = client_arguments_split[3];
        }
示例#2
0
        public ClientParser(string client_identifier, string client_url, string server_url, string script_name)
        {
            this.server_url      = server_url;
            this.client_ip       = ClientUtils.GetIPFromUrl(client_url);
            this.client_remoting = ClientUtils.GetRemotingIdFromUrl(client_url);
            this.client_port     = ClientUtils.GetPortFromUrl(client_url);

            this.client_library = new ClientLibrary(client_identifier, this.client_remoting, server_url, this.client_ip, this.client_port);
            try
            {
                new Initialize(ref this.client_library).Execute();
            }
            catch (ServerCoreException sce)
            {
                Console.WriteLine("Could not properly initialize the client! Aborting...");
                Console.WriteLine(sce.StackTrace);
            }

            this.script_name = script_name;
        }