Пример #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);
            }
        }
Пример #2
0
        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);
            }
        }
Пример #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;
     }
 }
Пример #4
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;
     }
 }
Пример #5
0
 private void ValidateResponse(DevClientPackets type, LoginData data)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <DevClientPackets, LoginData>(ValidateResponse), type, data);
         return;
     }
 }
Пример #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);
                        }
                    }
                }
            }
        }
Пример #7
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);
            }
        }
Пример #8
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;
     }
 }
Пример #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;
     }
 }
Пример #10
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();
     }
 }
Пример #11
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.BlacklistName)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistNameBlackList);
         }
         else if (packet == DevClientPackets.MailFormat)
         {
             MessageBox.Show(Program.LanguageManager.Translation.RegistMailFormat);
         }
         RegisterBtn.Enabled = true;
     }
 }
Пример #12
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;
     }
 }
Пример #13
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;
     }
 }
Пример #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;
            }

        }
Пример #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;
     }
 }
Пример #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;
     }
 }
Пример #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;
     }
 }
Пример #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;
 }
Пример #20
0
        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;
            }
        }
Пример #21
0
 private void ValidateResponse(DevClientPackets type, LoginData data)
 {
     if (InvokeRequired)
     {
         Invoke(new Action<DevClientPackets, LoginData>(ValidateResponse), type, data);
         return;
     }
 }
Пример #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);
                        }
                    }
                }
            }
        }
Пример #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;
     }
 }
Пример #24
0
 public MessageReceived(DevClientPackets packet, byte[] raw, BinaryReader reader)
 {
     Packet = packet;
     Raw = raw;
     Reader = reader;
 }