Beispiel #1
0
        private bool isOneByte(DevClientPackets packet)
        {
            switch (packet)
            {
            case DevClientPackets.Banned:
                return(true);

            case DevClientPackets.LoginFailed:
                return(true);

            case DevClientPackets.RegisterAccept:
                return(true);

            case DevClientPackets.RegisterFailed:
                return(true);

            case DevClientPackets.Pong:
                return(true);

            case DevClientPackets.Kicked:
                return(true);

            case DevClientPackets.RefuseDuelRequest:
                return(true);

            default:
                return(false);
            }
        }
        private bool isOneByte(DevClientPackets packet)
        {
            switch (packet)
            {
            case DevClientPackets.LoginFailed:
            case DevClientPackets.Invalid:
            case DevClientPackets.InvalidTemp:
            case DevClientPackets.ValidateAccept:
            case DevClientPackets.ValidateFailed:
            case DevClientPackets.ResendAccept:
            case DevClientPackets.ResendFailed:
            case DevClientPackets.ChangeAccept:
            case DevClientPackets.ChangeFailed:
            case DevClientPackets.RegisterAccept:
            case DevClientPackets.RegisterFailed:
            case DevClientPackets.DuplicateMail:
            case DevClientPackets.BlacklistMail:
            case DevClientPackets.BlacklistName:
            case DevClientPackets.MailFormat:
            case DevClientPackets.QueueFail:
            case DevClientPackets.Pong:
            case DevClientPackets.RefuseDuelRequest:
            case DevClientPackets.RecoverAccept:
            case DevClientPackets.RecoverFailed:
            case DevClientPackets.ResetAccept:
            case DevClientPackets.ResetFailed:
                return(true);

            default:
                return(false);
            }
        }
Beispiel #3
0
 private void ResendResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action <DevClientPackets>(ResendResponse), packet);
             return;
         }
         if (packet == DevClientPackets.ResendAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbResendOK) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         if (packet == DevClientPackets.ResendFailed)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbResendFail) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         submitBtn.Enabled = true;
     }
 }
 private void ResendResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action<DevClientPackets>(ResendResponse), packet);
             return;
         }
         if (packet == DevClientPackets.ResendAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbResendOK) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         if (packet == DevClientPackets.ResendFailed)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.ValidateMsbResendFail) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         submitBtn.Enabled = true;
     }
 }
 private void ValidateResponse(DevClientPackets type, LoginData data)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <DevClientPackets, LoginData>(ValidateResponse), type, data);
         return;
     }
 }
Beispiel #6
0
        private void LoginResponse(DevClientPackets type, LoginData data)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <DevClientPackets, LoginData>(LoginResponse), type, data);
                return;
            }

            if (type == DevClientPackets.Banned)
            {
                MessageBox.Show("You are banned.");
            }
            else if (type == DevClientPackets.LoginFailed)
            {
                loginBtn.Enabled = true;
                MessageBox.Show("Incorrect Password or Username.");
            }
            else
            {
                if (Program.UserInfo == null)
                {
                    Program.UserInfo = new UserData
                    {
                        rank     = data.UserRank,
                        username = data.Username,
                        team     = data.Team,
                        teamRank = data.TeamRank
                    };
                    Program.LoginKey = data.LoginKey;
                    Program.MainForm.Login();

                    if (savePassCheckBox.Checked)
                    {
                        if (!Program.Config.SavePassword || Program.Config.SavedUsername != usernameInput.Text)
                        {
                            Program.Config.SavePassword    = true;
                            Program.Config.SavedUsername   = usernameInput.Text;
                            Program.Config.EncodedPassword = LauncherHelper.EncodePassword(passwordInput.Text);
                            Program.SaveConfig(Program.ConfigurationFilename, Program.Config);
                        }
                    }
                    else
                    {
                        if (Program.Config.SavePassword)
                        {
                            Program.Config.SavePassword    = false;
                            Program.Config.EncodedPassword = string.Empty;
                            Program.SaveConfig(Program.ConfigurationFilename, Program.Config);
                        }
                    }
                }
            }
        }
        private bool isLargePacket(DevClientPackets packet)
        {
            switch (packet)
            {
            case DevClientPackets.GameList:
            case DevClientPackets.UserList:
            case DevClientPackets.FriendList:
            case DevClientPackets.TeamList:
            case DevClientPackets.ChannelList:
            case DevClientPackets.ChannelUsers:
                return(true);

            default:
                return(false);
            }
        }
 private void RegisterResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (packet == DevClientPackets.RegisterAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.RegistMsb4) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.RegisterFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMsb5);
         }
         RegisterBtn.Enabled = true;
     }
 }
Beispiel #9
0
 private void RegisterResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (packet == DevClientPackets.RegisterAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.RegistMsb4) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.RegisterFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMsb5);
         }
         RegisterBtn.Enabled = true;
     }
 }
 private void LoginResponse(DevClientPackets type, UserData data)
 {
     if (type == DevClientPackets.Banned)
     {
         MessageBox.Show("You are banned.");
     }
     else if (type == DevClientPackets.LoginFailed)
     {
         ResetTimeOut();
         MessageBox.Show("Incorrect Password or Username.");
     }
     else
     {
         Program.UserInfo = data;
         ResetTimeOut();
         Program.MainForm.Login();
     }
 }
 private void RegisterResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action <DevClientPackets>(RegisterResponse), packet);
             return;
         }
         if (packet == DevClientPackets.RegisterAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.RegistMsb4) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.RegisterFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMsb5);
         }
         else if (packet == DevClientPackets.DuplicateMail)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailExists);
         }
         else if (packet == DevClientPackets.BlacklistMail)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailBlacklist);
         }
         else if (packet == DevClientPackets.BlacklistName)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistNameBlackList);
         }
         else if (packet == DevClientPackets.MailFormat)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailFormat);
         }
         RegisterBtn.Enabled = true;
     }
 }
 private void ChangeResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action <DevClientPackets>(ChangeResponse), packet);
             return;
         }
         if (packet == DevClientPackets.ChangeAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.ChangeAccept) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.ChangeFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.ChangeFailed);
         }
         UpdateBtn.Enabled = true;
     }
 }
 private void ResetResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action <DevClientPackets>(ResetResponse), packet);
             return;
         }
         if (packet == DevClientPackets.ResetAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.RecoverMsbAccept) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.ResetFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RecoverMsbFailed);
         }
         submitBtn.Enabled = true;
     }
 }
Beispiel #14
0
         private void ResetResponse(DevClientPackets packet)
        {
            if (!IsDisposed)
            {
                if (InvokeRequired)
                {
                    Invoke(new Action<DevClientPackets>(ResetResponse),packet);
                    return;
                }
                if (packet == DevClientPackets.ResetAccept)
                {
                    if (MessageBox.Show(Program.LanguageManager.Translation.RecoverMsbAccept) == DialogResult.OK)
                    {
                        DialogResult = DialogResult.OK;
                    }
                }
                else if (packet == DevClientPackets.ResetFailed)
                {
                    MessageBox.Show(Program.LanguageManager.Translation.RecoverMsbFailed);
                }
                submitBtn.Enabled = true;
            }

        }
Beispiel #15
0
 private bool isOneByte(DevClientPackets packet)
 {
     switch (packet)
     {
         case DevClientPackets.LoginFailed:
         case DevClientPackets.RegisterAccept:
         case DevClientPackets.RegisterFailed:
         case DevClientPackets.Pong:
         case DevClientPackets.RefuseDuelRequest:
             return true;
         default:
             return false;
     }
 }
Beispiel #16
0
 private bool isLargePacket(DevClientPackets packet)
 {
     switch (packet)
     {
         case DevClientPackets.GameList:
         case DevClientPackets.UserList:
         case DevClientPackets.FriendList:
         case DevClientPackets.TeamList:
         case DevClientPackets.ChannelList:
         case DevClientPackets.ChannelUsers:
             return true;
         default:
             return false;
     }
 }
Beispiel #17
0
 private void ChangeResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action<DevClientPackets>(ChangeResponse), packet);
             return;
         }
         if (packet == DevClientPackets.ChangeAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.ChangeAccept) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.ChangeFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.ChangeFailed);
         }
         UpdateBtn.Enabled = true;
     }
 }
Beispiel #18
0
 private void LoginResponse(DevClientPackets type, UserData data)
 {
     if (type == DevClientPackets.Banned)
     {
         MessageBox.Show("You are banned.");
     }
     else if (type == DevClientPackets.LoginFailed)
     {
         ResetTimeOut();
         MessageBox.Show("Incorrect Password or Username.");
     }
     else
     {
         Program.UserInfo = data;
         ResetTimeOut();
         Program.MainForm.Login();
     }
 }
 public MessageReceived(DevClientPackets packet, byte[] raw, BinaryReader reader)
 {
     Packet = packet;
     Raw    = raw;
     Reader = reader;
 }
        private bool isOneByte(DevClientPackets packet)
        {
            switch (packet)
            {
                case DevClientPackets.LoginFailed:
                case DevClientPackets.Invalid:
                case DevClientPackets.InvalidTemp:
                case DevClientPackets.ValidateAccept:
                case DevClientPackets.ValidateFailed:
                case DevClientPackets.ResendAccept:
                case DevClientPackets.ResendFailed:
                case DevClientPackets.ChangeAccept:
                case DevClientPackets.ChangeFailed:
                case DevClientPackets.RegisterAccept:
                case DevClientPackets.RegisterFailed:
                case DevClientPackets.DuplicateMail:
                case DevClientPackets.BlacklistMail:
                case DevClientPackets.BlacklistName:
                case DevClientPackets.MailFormat:
                case DevClientPackets.QueueFail:
                case DevClientPackets.Pong:
                case DevClientPackets.RefuseDuelRequest:
                case DevClientPackets.RecoverAccept:
                case DevClientPackets.RecoverFailed:
                case DevClientPackets.ResetAccept:
                case DevClientPackets.ResetFailed:
                    return true;

                default:
                    return false;
            }
        }
Beispiel #21
0
 private void ValidateResponse(DevClientPackets type, LoginData data)
 {
     if (InvokeRequired)
     {
         Invoke(new Action<DevClientPackets, LoginData>(ValidateResponse), type, data);
         return;
     }
 }
Beispiel #22
0
        private void LoginResponse(DevClientPackets type, LoginData data)
        {
            if (InvokeRequired)
            {
                Invoke(new Action<DevClientPackets, LoginData>(LoginResponse), type, data);
                return;
            }
            else if (type == DevClientPackets.LoginFailed)
            {
                loginBtn.Enabled = true;
                MessageBox.Show(Program.LanguageManager.Translation.LoginFailed);
            }
            else if (type == DevClientPackets.Invalid)
            {
                loginBtn.Enabled = true;
                MessageBox.Show(Program.LanguageManager.Translation.LoginInvalid);
            }
            else
            {
                if (Program.UserInfo == null)
                {
                    Program.UserInfo = new UserData
                        {
                            rank = data.UserRank,
                            username = data.Username,
                            team = data.Team,
                            teamRank = data.TeamRank
                        };
                    Program.LoginKey = data.LoginKey;
                    Program.MainForm.Login();

                    if (savePassCheckBox.Checked)
                    {
                        if (!Program.Config.SavePassword || Program.Config.SavedUsername != usernameInput.Text)
                        {
                            Program.Config.SavePassword = true;
                            Program.Config.SavedUsername = usernameInput.Text;
                            Program.Config.EncodedPassword = LauncherHelper.EncodePassword(passwordInput.Text);
                            Program.SaveConfig(Program.ConfigurationFilename, Program.Config);
                        }
                    }
                    else
                    {
                        if (Program.Config.SavePassword)
                        {
                            Program.Config.SavePassword = false;
                            Program.Config.EncodedPassword = string.Empty;
                            Program.SaveConfig(Program.ConfigurationFilename, Program.Config);
                        }
                    }
                }
            }
        }
Beispiel #23
0
 private void RegisterResponse(DevClientPackets packet)
 {
     if (!IsDisposed)
     {
         if (InvokeRequired)
         {
             Invoke(new Action<DevClientPackets>(RegisterResponse),packet);
             return;
         }
         if (packet == DevClientPackets.RegisterAccept)
         {
             if (MessageBox.Show(Program.LanguageManager.Translation.RegistMsb4) == DialogResult.OK)
             {
                 DialogResult = DialogResult.OK;
             }
         }
         else if (packet == DevClientPackets.RegisterFailed)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMsb5);
         }
         else if (packet == DevClientPackets.DuplicateMail)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailExists);
         }
         else if (packet == DevClientPackets.BlacklistMail)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailBlacklist);
         }
         else if (packet == DevClientPackets.MailFormat)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailFormat);
         }
         RegisterBtn.Enabled = true;
     }
 }
 public MessageReceived(DevClientPackets packet, byte[] raw, BinaryReader reader)
 {
     Packet = packet;
     Raw = raw;
     Reader = reader;
 }