コード例 #1
0
ファイル: ApocLauncher.cs プロジェクト: cooler-SAI/ProjectWAR
        private void bnConnectToLocal_Click(object sender, EventArgs e)
        {
            Client.Connect(LocalServerIP, LocalServerPort);
            lblConnection.Text = $@"Connecting to : {LocalServerIP}:{LocalServerPort}";

            string userCode     = T_username.Text.ToLower();
            string userPassword = T_password.Text.ToLower();


            Client.User = userCode;

            string encryptedPassword = ConvertSHA256(userCode + ":" + userPassword);

            _logger.Info($@"Connecting to : {LocalServerIP}:{LocalServerPort} as {userCode} [{encryptedPassword}]");

            _logger.Info($"Sending CL_START to {LocalServerIP}:{LocalServerPort}");
            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);

            Out.WriteString(userCode);
            Out.WriteString(encryptedPassword);

            Client.SendTCP(Out);
        }
コード例 #2
0
ファイル: ApocLauncher.cs プロジェクト: cooler-SAI/ProjectWAR
        private void bnConnectToServer_Click(object sender, EventArgs e)
        {
            Client.Connect(TestServerIP, TestServerPort);
            lblConnection.Text = $@"Connecting to : {TestServerIP}:{TestServerPort}";

            string userCode     = T_username.Text.ToLower();
            string userPassword = T_password.Text.ToLower();


            Client.User = userCode;

            string encryptedPassword = ConvertSHA256(userCode + ":" + userPassword);

            _logger.Info($@"Connecting to : {TestServerIP}:{TestServerPort} as {userCode} [{encryptedPassword}]");

            _logger.Info($"Sending CL_START to {TestServerIP}:{TestServerPort}");
            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);

            Out.WriteString(userCode);
            Out.WriteString(encryptedPassword);

            Client.SendTCP(Out);

            Configuration configuration = System.Configuration.ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

            if (configuration.AppSettings.Settings["LastUSerCode"] == null)
            {
                configuration.AppSettings.Settings.Add("LastUserCode", T_username.Text);
            }
            else
            {
                configuration.AppSettings.Settings["LastUserCode"].Value = T_username.Text;
            }
            configuration.Save();

            System.Configuration.ConfigurationManager.RefreshSection("appSettings");
        }
コード例 #3
0
ファイル: Accueil.cs プロジェクト: dzikun/WarEmu
        private void B_start_Click(object sender, EventArgs e)
        {
            string Username = T_username.Text.ToLower();
            string NCPass = T_password.Text.ToLower();

            Client.User = Username;

            SHA256Managed Sha = new SHA256Managed();
            string CP = Username + ":" + NCPass;
            byte[] Result = Sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(CP));

            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);
            Out.WriteString(Username);
            Out.WriteUInt32((uint)Result.Length);
            Out.Write(Result, 0, Result.Length);

            Client.SendTCP(Out);
            B_start.Enabled = false;
        }
コード例 #4
0
ファイル: Accueil.cs プロジェクト: cooler-SAI/waremu-1
        private void B_start_Click(object sender, EventArgs e)
        {
            string Username = T_username.Text.ToLower();
            string NCPass   = T_password.Text.ToLower();

            Client.User = Username;

            SHA256Managed Sha = new SHA256Managed();
            string        CP  = Username + ":" + NCPass;

            byte[] Result = Sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(CP));

            PacketOut Out = new PacketOut((byte)Opcodes.CL_START);

            Out.WriteString(Username);
            Out.WriteUInt32((uint)Result.Length);
            Out.Write(Result, 0, Result.Length);

            Client.SendTCP(Out);
            B_start.Enabled = false;
        }
コード例 #5
0
ファイル: Accueil.cs プロジェクト: JeFawk/WarEmu
        private void B_start_Click(object sender, EventArgs e)
        {
            string Username = T_username.Text.ToLower();
            string NCPass = T_password.Text.ToLower();
            // Je Fawk | 13 April 2014 | Making it fool proof encapsulating everything in the if statement
            if (Username.Length > 1 && NCPass.Length > 1 && textBox_serverIp.Text.Length > 8 && textBox_port.Text.Length > 0)
            {
                // Je Fawk | 13 April 2014 | Getting the server ip and port via interface
                // Putting the server IP from the textBox to Client.IP
                Client.IP = textBox_serverIp.Text.Trim();
                // Putting the server port from the textBox to Client.Port
                Client.Port = Convert.ToInt32(textBox_port.Text.Trim());
                Client.User = Username;

                // Connecting to the client now that we have all the credentials
                Client.Connect();

                SHA256Managed Sha = new SHA256Managed();
                string CP = Username + ":" + NCPass;
                byte[] Result = Sha.ComputeHash(UTF8Encoding.UTF8.GetBytes(CP));

                PacketOut Out = new PacketOut((byte)Opcodes.CL_START);
                Out.WriteString(Username);
                Out.WriteUInt32((uint)Result.Length);
                Out.Write(Result, 0, Result.Length);

                Client.SendTCP(Out);
                B_start.Enabled = false;

                // Je Fawk | 13 April 2014 | Setting the isConnected to true in case the user checks the realm status
                isConnected = true;
                // Je Fawk | 13 April 2014 | Minimizing the form that gets in the way
                this.WindowState = FormWindowState.Minimized;
            }
            else
            {
                MessageBox.Show("Credentials are too short.");
            }
        }