Exemple #1
0
        public void beginConnect(string IP, string port, string UN, string PW, bool online)
        {
            lstOnline.Items.Clear();
            username   = UN;
            onlineMode = online;
            sip        = IP;
            sport      = port;

            if (online && sessionId == null)
            {
                puts("Logging in to Minecraft.net...");

                Minecraft_Net_Interaction Login = new Minecraft_Net_Interaction();

                string Response = Login.Login(UN, PW);

                if (Response.Contains(':'))
                {
                    string[] mysplit = Response.Split(':');
                    username  = mysplit[2];
                    sessionId = mysplit[3];
                    puts("Done.");
                }
                else
                {
                    if (sessionId != null)
                    {
                        puts("Error logging in to Minecraft.net!");
                        puts(Response);
                    }
                    else
                    {
                        puts("Attempting to log in with old credentials..");
                    }
                }
            }
            else
            {
                sessionId = "epicw1n";
            }

            //Begin connection to server.
            nh = new networkHandler(IP, port, this);
            nh.start();
        }
Exemple #2
0
        public void beginConnect(string IP, string port, string UN, string PW, bool online)
        {
            lstOnline.Items.Clear();
            username   = UN;
            onlineMode = online;
            sip        = IP;
            sport      = port;

            if (online && sessionId == null)
            {
                puts("Logging in to Minecraft.net...");

                Minecraft_Net_Interaction Login = new Minecraft_Net_Interaction();

                // string Response = Login.Login(UN, PW);
                string[] response = Login.newLogin(UN, PW);

                if (response[0] != "")
                {
                    sessionId = "token:" + response[0] + ":" + response[1];
                }
                else
                {
                    if (sessionId != null)
                    {
                        puts("Error logging in to Minecraft.net!");
                        puts(response.ToString());
                    }
                    else
                    {
                        puts("Attempting to log in with old credentials..");
                    }
                }
            }
            else
            {
                sessionId = "epicw1n";
            }

            //Begin connection to server.
            nh = new networkHandler(IP, port, this);
            nh.start();
        }