Ejemplo n.º 1
0
        /// <summary>
        /// 风速等级转换风速
        /// </summary>
        /// <param name="f"></param>
        /// <returns></returns>
        public static float LeveToWind(int f)
        {
            switch (f)
            {
            case 0:
                return(RandomHelp.GetRandom(0, 29) / 100.00f);

            case 1:
                return(RandomHelp.GetRandom(30, 159) / 100.00f);

            case 2:
                return(RandomHelp.GetRandom(160, 339) / 100.00f);

            case 3:
                return(RandomHelp.GetRandom(340, 549) / 100.00f);

            case 4:
                return(RandomHelp.GetRandom(550, 799) / 100.00f);

            case 5:
                return(RandomHelp.GetRandom(800, 1079) / 100.00f);

            case 6:
                return(RandomHelp.GetRandom(1080, 1389) / 100.00f);

            case 7:
                return(RandomHelp.GetRandom(1390, 1719) / 100.00f);

            case 8:
                return(RandomHelp.GetRandom(1720, 2079) / 100.00f);

            case 9:
                return(RandomHelp.GetRandom(2080, 2449) / 100.00f);

            case 10:
                return(RandomHelp.GetRandom(2450, 2849) / 100.00f);

            case 11:
                return(RandomHelp.GetRandom(2850, 3259) / 100.00f);

            case 12:
                return(RandomHelp.GetRandom(3260, 3400) / 100.00f);

            default:
                return(0f);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取验证码2019年9月版本
        /// </summary>
        /// <returns></returns>
        public Image GetValidateCode_201909()
        {
            Image img = null;

            try
            {
                var            num      = TimeHelp.GetTimeStamp(DateTime.Now);
                var            callback = $"jQuery{RandomHelp.GetRandomNumByLength(20)}_{TimeHelp.GetTimeStamp(DateTime.Now)}";
                RequestPackage request  = new RequestPackage("/passport/captcha/captcha-image64");
                request.Params.Add("login_site", "E");
                request.Params.Add("module", "login");
                request.Params.Add("rand", "sjrand");
                request.Params.Add(num, "");
                request.Params.Add("callback", callback);
                request.Params.Add("_", num);
                ArrayList list = TrainHttpContext.GetHtmlData(request);
                if (list.Count == 3)
                {
                    var resStr     = list[1].ToString().CallBackJson();
                    var streamJson = JsonConvert.DeserializeObject <ResCodeImgMsg>(resStr);
                    if (streamJson.result_code.Equals("0"))
                    {
                        img = Base64ToImgHelp.CetFromBase64String(streamJson.image);
                    }
                }
                else
                {
                    Log.Write(LogLevel.Info, "请求/otn/login/init失败");
                }
            }
            catch (Exception ex)
            {
                Log.Write(LogLevel.Error, ex.Message, ex);
            }
            return(img);
        }