private void bgwk_DoWork(object sender, DoWorkEventArgs e)
 {
     string[] arg = e.Argument as string[];
     if (arg == null) return;
     switch (arg[0])
     {
         case "init":
             bf = new MapleBeanfun();
             bool result = bf.Init();
             e.Result = new Result(arg[0], !result, bf.GetCaptcha());
             break;
         case "recaptcha":
             Image captcha = bf.GetCaptcha();
             e.Result = new Result(arg[0], captcha == null, captcha);
             break;
         case "login":
             try
             {
                 bf.Login(arg[1], arg[2], arg[3]);
                 e.Result = new Result("login", false);
             }
             catch (BeanfunLoginFailedException ex)
             {
                 e.Result = new Result("login", true, ex.Message);
             }
             break;
         case "list":
             List<BeanfunGameAccountData> list = bf.GetAccountList();
             e.Result = new Result(arg[0], list == null, list);
             break;
     }
 }
Example #2
0
        private void bgwk_DoWork(object sender, DoWorkEventArgs e)
        {
            string[] arg = e.Argument as string[];
            if (arg == null)
            {
                return;
            }
            switch (arg[0])
            {
            case "init":
                bf = new MapleBeanfun();
                bool result = bf.Init();
                e.Result = new Result(arg[0], !result, bf.GetCaptcha());
                break;

            case "recaptcha":
                Image captcha = bf.GetCaptcha();
                e.Result = new Result(arg[0], captcha == null, captcha);
                break;

            case "login":
                try
                {
                    bf.Login(arg[1], arg[2], arg[3]);
                    e.Result = new Result("login", false);
                }
                catch (BeanfunLoginFailedException ex)
                {
                    e.Result = new Result("login", true, ex.Message);
                }
                break;

            case "list":
                List <BeanfunGameAccountData> list = bf.GetAccountList();
                e.Result = new Result(arg[0], list == null, list);
                break;
            }
        }