/**
         * 时效结束的时间,如果不再时效内,返回0
         * @param current_tm
         * @param tmchk
         * @return
         *
         */
        static public double next_end_tm(double tm_now, Variant tmchk, double firstracttmt = 0, double combracttm = 0)
        {
            if (!check_tm(tm_now, tmchk, firstracttmt, combracttm))
            {
                return(0);
            }

            double _end_tm = 0;

            if (tmchk.ContainsKey("tb") && tmchk.ContainsKey("te"))
            {
                Variant te = tmchk["te"];

                TZDate tedate = TZDate.createByYMDHMS(te["y"], te["mon"] - 1, te["d"], te["h"], te["min"], te["s"]);
                _end_tm = tedate.time;
            }
            else if (tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte"))
            {
                Variant dte  = tmchk["dte"];
                TZDate  dted = TZDate.createByYMDHMS((int)tm_now);
                dted.setHours(dte["h"], dte["min"], dte["s"], 0);
                _end_tm = dted.time;
            }
            return(_end_tm);
        }
示例#2
0
        public static double next_end_tm(double tm_now, Variant tmchk, double firstracttmt = 0.0, double combracttm = 0.0)
        {
            bool   flag = !ConfigUtil.check_tm(tm_now, tmchk, firstracttmt, combracttm);
            double result;

            if (flag)
            {
                result = 0.0;
            }
            else
            {
                double num   = 0.0;
                bool   flag2 = tmchk.ContainsKey("tb") && tmchk.ContainsKey("te");
                if (flag2)
                {
                    Variant variant = tmchk["te"];
                    TZDate  tZDate  = TZDate.createByYMDHMS(variant["y"], variant["mon"] - 1, variant["d"], variant["h"], variant["min"], variant["s"], 0);
                    num = tZDate.time;
                }
                else
                {
                    bool flag3 = tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte");
                    if (flag3)
                    {
                        Variant variant2 = tmchk["dte"];
                        TZDate  tZDate2  = TZDate.createByYMDHMS((int)tm_now, 0, 0, 0, 0, 0, 0);
                        tZDate2.setHours(variant2["h"], variant2["min"], variant2["s"], 0);
                        num = tZDate2.time;
                    }
                }
                result = num;
            }
            return(result);
        }
        /**
         * 根据tmchk返回开始/结束的时间戳
         */
        static public Variant get_tmchk_time(double tm_now, Variant tmchk, double firstopentm = 0, double cbtm = 0)
        {
            double s_tm = 0;
            double e_tm = 0;

            if (firstopentm > 0)
            {
                if (tmchk.ContainsKey("optm"))
                {
                    s_tm = (firstopentm + tmchk["optm"]._int * 86400) * 1000;
                }
                if (tmchk.ContainsKey("cltm"))
                {
                    e_tm = (firstopentm + (tmchk["cltm"]._int + 1) * 86400) * 1000;
                }
            }
            else if (cbtm > 0)
            {
                if (tmchk.ContainsKey("cb_optm"))
                {
                    s_tm = (cbtm + tmchk["cb_optm"]._int * 86400) * 1000;
                }
                if (tmchk.ContainsKey("cb_cltm"))
                {
                    e_tm = (cbtm + (tmchk["cb_cltm"]._int + 1) * 86400) * 1000;
                }
            }
            if (tmchk.ContainsKey("tb"))
            {
                //绝对开始时间
                Variant tb     = tmchk["tb"];
                TZDate  tbdate = TZDate.createByYMDHMS(tb["y"], tb["mon"]._int - 1, tb["d"], tb["h"], tb["min"], tb["s"]);
                s_tm = tbdate.time;
            }
            if (tmchk.ContainsKey("te"))
            {
                Variant te     = tmchk["te"];
                TZDate  tedate = TZDate.createByYMDHMS(te["y"], te["mon"]._int - 1, te["d"], te["h"], te["min"], te["s"]);
                e_tm = tedate.time;
            }


            if (tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte"))
            {
                //一天中的开始时间
                TZDate dtbd;
                TZDate dted;

                dtbd = new TZDate(tm_now);
                dted = new TZDate(tm_now);

                Variant dtb = tmchk["dtb"];
                Variant dte = tmchk["dte"];

                dtbd.setHours(dtb["h"], dtb["min"], dtb["s"], 0);

                dted.setHours(dte["h"], dte["min"], dte["s"], 0);

                s_tm = dtbd.time;
                e_tm = dted.time;
            }
            Variant ret = new Variant();

            ret["stm"] = s_tm;
            ret["etm"] = e_tm;
            return(ret);
        }
        static public Variant GetTodayActiveTime(double tm_now, Variant tmchk, double firstracttmt, double combracttm)
        {
            Variant ret = new Variant();

            ret["begin"] = 0;
            ret["end"]   = 0;
            TZDate tmpDate;
            bool   todayHasAct = true;//今天是否有活动

            if (tmchk.ContainsKey("tb") && tmchk.ContainsKey("te"))
            {
                Variant tb = tmchk["tb"];
                Variant te = tmchk["te"];

                tmpDate = TZDate.createByYMDHMS(tb["y"], tb["mon"] - 1, tb["d"], tb["h"], tb["min"], tb["s"]);


                ret["begin"] = tmpDate.time;
                //				var today:TZDate = new TZDate(tm_now);
                tmpDate.setHours(0, 0, 0, 0);
                if (tm_now < tmpDate.time)
                {
                    todayHasAct  = false;
                    ret["begin"] = 0;
                }

                tmpDate    = TZDate.createByYMDHMS(te["y"], te["mon"] - 1, te["d"], te["h"], te["min"], te["s"]);
                ret["end"] = tmpDate.time;
                tmpDate.setHours(23, 59, 59, 0);
                if (tm_now >= tmpDate.time)
                {
                    todayHasAct  = false;
                    ret["begin"] = 0;
                }
                return(ret);
            }
            else if (tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte"))
            {
                tmpDate = new TZDate(tm_now);
                int today = tmpDate.getDay();
                if (today == 0)
                {
                    today = 7;            //星期天 为 7
                }
                if (tmchk.ContainsKey("wtb") && tmchk.ContainsKey("wte"))
                {
                    todayHasAct = today >= tmchk["wtb"]._int && today <= tmchk["wte"]._int - 1;
                }
                else if (tmchk.ContainsKey("wd"))
                {
                    todayHasAct = false;
                    Variant wds = GameTools.split(tmchk["wd"]._str, ",");
                    for (int i = 0; i < wds.Count; ++i)
                    {
                        if (wds[i]._int == today)
                        {
                            todayHasAct = true;
                            break;
                        }
                    }
                }

                if (todayHasAct)
                {
                    if (tmchk.ContainsKey("optm"))
                    {
                        if ((tm_now / 1000 - firstracttmt) < tmchk["optm"]._int * 86400)
                        {
                            todayHasAct = false;
                        }
                    }
                    if (tmchk.ContainsKey("cltm"))
                    {
                        if ((tm_now / 1000 - firstracttmt) > (tmchk["cltm"]._int + 1) * 86400)
                        {
                            todayHasAct = false;
                        }
                    }
                    if (tmchk.ContainsKey("cb_optm"))
                    {
                        if ((tm_now / 1000 - combracttm) < tmchk["cb_optm"]._int * 86400)
                        {
                            todayHasAct = false;
                        }
                    }
                    if (tmchk.ContainsKey("cb_cltm"))
                    {
                        if ((tm_now / 1000 - combracttm) > (tmchk["cb_cltm"]._int + 1) * 86400)
                        {
                            todayHasAct = false;
                        }
                    }
                }

                if (todayHasAct)
                {
                    Variant dtb = tmchk["dtb"];
                    Variant dte = tmchk["dte"];

                    tmpDate.setHours(dtb["h"], dtb["min"], dtb["s"], 0);
                    ret["begin"] = tmpDate.time;

                    tmpDate.setHours(dte["h"], dte["min"], dte["s"], 0);
                    ret["end"] = tmpDate.time;
                }
            }
            else if ((tmchk.ContainsKey("optm") && tmchk.ContainsKey("cltm")) ||
                     (tmchk.ContainsKey("cb_optm") && tmchk.ContainsKey("cb_cltm")))
            {
                if (tmchk.ContainsKey("optm"))
                {
                    if ((tm_now / 1000 - firstracttmt) >= tmchk["optm"]._int * 86400 && ((tm_now / 1000 - firstracttmt) < (tmchk["cltm"]._int + 1) * 86400))
                    {
                        ret["begin"] = firstracttmt + tmchk["optm"]._int * 86400;
                        ret["end"]   = firstracttmt + (tmchk["cltm"]._int + 1) * 86400;
                    }
                }
                else if (tmchk.ContainsKey("cb_optm"))
                {
                    if ((tm_now / 1000 - combracttm) >= tmchk["cb_optm"]._int * 86400 && (tm_now / 1000 - combracttm) < (tmchk["cb_cltm"]._int + 1) * 86400)
                    {
                        ret["begin"] = firstracttmt + tmchk["cb_optm"]._int * 86400;
                        ret["end"]   = firstracttmt + (tmchk["cb_cltm"]._int + 1) * 86400;
                    }
                }
            }

            return(ret);
        }
        static private double next_start(double tm_now, Variant tmchk, double firstopentm = 0)
        {
            bool calc_notopen = false;

            if (firstopentm > 0 && tmchk.ContainsKey("optm"))
            {
                if ((tm_now / 1000 - firstopentm) < tmchk["optm"]._int * 86400)
                {
                    tm_now       = (tmchk["optm"]._int) * 86400 * 1000 + (firstopentm * 1000);
                    calc_notopen = true;
                }
            }

            double  _start_tm = 0;
            double  _end_tm   = 0;
            string  wd        = "";
            Variant wda       = null;

            if (tmchk.ContainsKey("tb") && tmchk.ContainsKey("te"))
            {
                //绝对开始时间
                Variant tb = tmchk["tb"];
                Variant te = tmchk["te"];

                TZDate tbdate = TZDate.createByYMDHMS(tb["y"], tb["mon"]._int - 1, tb["d"], tb["h"], tb["min"], tb["s"]);
                _start_tm = tbdate.time;

                TZDate tedate = TZDate.createByYMDHMS(te["y"], te["mon"] - 1, te["d"], te["h"], te["min"], te["s"]);
                _end_tm = tedate.time;

                //绝对开始时间如果已过开始时间,那么不会再次开启了
                if (_start_tm < tm_now)
                {
                    return(0);
                }
                else
                {
                    return(_start_tm);
                }
            }
            else if (tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte"))
            {
                bool haswchk = false;

                TZDate data_now = new TZDate(tm_now);
                int    day      = data_now.getDay();

                if (day == 0)
                {
                    day = 7;
                }

                Variant dtb = tmchk["dtb"];
                Variant dte = tmchk["dte"];

                //一天中的开始时间
                TZDate dtbd;
                TZDate dted;

                //一周中的开始时间
                int wtb = 0;
                int wte = 0;
                if (tmchk.ContainsKey("wtb") && tmchk.ContainsKey("wte"))
                {
                    wtb     = tmchk["wtb"];
                    wte     = tmchk["wte"] - 1;
                    haswchk = true;
                }
                else if (tmchk.ContainsKey("wd"))
                {
                    wd  = tmchk["wd"];
                    wda = GameTools.split(wd, ",");
                }

                dtbd = new TZDate(tm_now);
                dted = new TZDate(tm_now);

                dtbd.setHours(dtb["h"], dtb["min"], dtb["s"], 0);
                dted.setHours(dte["h"], dte["min"], dte["s"], 0);

                _start_tm = dtbd.time;
                _end_tm   = dted.time;

                //今天是否未开启,如果有周限制,且今天不在限制内,那么标为非未开启.否则查看今天的时间是否已开启
                bool notopen = true;
                if (haswchk && (day > wte || day < wtb))
                {
                    notopen = true;
                }
                else if (tmchk.ContainsKey("wd"))
                {
                    wd  = tmchk["wd"];
                    wda = GameTools.split(wd, ",");

                    notopen = true;
                    for (int j = 0; j < wda.Count; j++)
                    {
                        int wds = wda[j];
                        if (wds == day)
                        {
                            if (tm_now > _start_tm && tm_now < _end_tm)
                            {
                                notopen = false;
                            }
                            break;
                        }
                    }
                }
                else
                {
                    if (tm_now < _start_tm)
                    {
                        notopen = true;
                    }
                    else
                    {
                        notopen = false;
                    }
                }

                int dc;
                if (notopen || calc_notopen)
                {
                    if (tmchk.ContainsKey("wd"))
                    {
                        //返回下一天的开启时间
                        wd  = tmchk["wd"];
                        wda = GameTools.split(wd, ",");

                        int next_day = -1;
                        int min_day  = -1;
                        for (int i = 0; i < wda.Count; ++i)
                        {
                            int wdp = wda[i];

                            if (min_day < 0 || wdp < min_day)
                            {
                                min_day = wdp;
                            }

                            if (day > wdp || (day == wdp) && (tm_now > _end_tm))
                            {
                                continue;
                            }

                            if (next_day < 0 || wdp < next_day)
                            {
                                next_day = wdp;
                            }
                        }

                        if (next_day < 0)
                        {
                            //本周已过,取下周第一天
                            return(_start_tm + 86400000 * (7 - day + min_day));
                        }
                        else
                        {
                            return(_start_tm + 86400000 * (next_day - day));
                        }
                    }
                    else if (!haswchk)
                    {
                        //返回今天的开启时间
                        return(_start_tm);
                    }
                    else
                    {
                        //如果有周限制,则要判断下一个周限制的自然日

                        if (day < wtb || day > wte)
                        {
                            dc = wtb - day;
                            if (dc < 0)
                            {
                                dc += 7;
                            }

                            return(_start_tm + 86400000 * dc);
                        }
                        else
                        {
                            return(_start_tm /* + 86400000 */);
                        }
                    }
                }
                else
                {
                    //返回下一天的开启时间
                    if (tmchk.ContainsKey("wd"))
                    {
                        //
                        return(0);
                    }
                    else if (!haswchk)
                    {
                        //如果没有周限制,则为下一个自然日
                        return(_start_tm + 86400000);
                    }
                    else
                    {
                        //如果有周限制,则要判断下一个周限制的自然日
                        ++day;
                        if (day > 6)
                        {
                            day = 0;
                        }

                        if (day < wtb || day > wte)
                        {
                            dc = wtb - day;
                            if (dc < 0)
                            {
                                dc += 7;
                            }

                            return(_start_tm + 86400000 * dc);
                        }
                        else
                        {
                            return(_start_tm + 86400000);
                        }
                    }
                }
            }
            else
            {
                return(0);
            }
        }
        static private bool check_tm_impl(double tm_now, Variant tmchk, double firstopentm = 0, double cbtm = 0)
        {
            if (cbtm > 0)
            {
                if (tmchk.ContainsKey("cb_optm"))
                {
                    if ((tm_now / 1000 - cbtm) < tmchk["cb_optm"]._int * 86400)
                    {
                        return(false);
                    }
                }
                if (tmchk.ContainsKey("cb_cltm"))
                {
                    if ((tm_now / 1000 - cbtm) > (tmchk["cb_cltm"]._int + 1) * 86400)
                    {
                        return(false);
                    }
                }
            }
            else
            {
                if (tmchk.ContainsKey("cb_optm") || tmchk.ContainsKey("cb_cltm"))
                {
                    return(false);
                }
            }
            if (firstopentm > 0)
            {
                if (tmchk.ContainsKey("optm"))
                {
                    if ((tm_now / 1000 - firstopentm) < tmchk["optm"]._int * 86400)
                    {
                        return(false);
                    }
                }
                if (tmchk.ContainsKey("cltm"))
                {
                    if ((tm_now / 1000 - firstopentm) > (tmchk["cltm"]._int + 1) * 86400)
                    {
                        return(false);
                    }
                }
            }

            double _start_tm = 0;
            double _end_tm   = 0;

            if (tmchk.ContainsKey("tb"))
            {
                //绝对开始时间
                Variant tb     = tmchk["tb"];
                TZDate  tbdate = TZDate.createByYMDHMS(tb["y"], tb["mon"]._int - 1, tb["d"], tb["h"], tb["min"], tb["s"]);
                _start_tm = tbdate.time;
                if (tm_now < _start_tm)
                {
                    return(false);
                }
            }
            if (tmchk.ContainsKey("te"))
            {
                Variant te     = tmchk["te"];
                TZDate  tedate = TZDate.createByYMDHMS(te["y"], te["mon"] - 1, te["d"], te["h"], te["min"], te["s"]);
                _end_tm = tedate.time;
                if (tm_now > _end_tm)
                {
                    return(false);
                }
            }


            if (tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte"))
            {
                //一天中的开始时间
                TZDate dtbd;
                TZDate dted;

                TZDate data_now = new TZDate(tm_now);
                int    day      = data_now.getDay();

                if (day == 0)
                {
                    day = 7;
                }

                if (tmchk.ContainsKey("wtb") && tmchk.ContainsKey("wte"))
                {
                    //一周中的开始时间
                    int wtb = tmchk["wtb"];
                    int wte = tmchk["wte"] - 1;

                    if (day > wte || day < wtb)
                    {
                        return(false);
                    }
                }
                else if (tmchk.ContainsKey("wd"))
                {
                    string  wd  = tmchk["wd"];
                    Variant wda = GameTools.split(wd, ",");

                    bool inday = false;
                    for (int i = 0; i < wda.Count; ++i)
                    {
                        int dday = wda[i];
                        if (dday == day)
                        {
                            inday = true;
                            break;
                        }
                    }
                    if (!inday)
                    {
                        return(false);
                    }
                }

                dtbd = new TZDate(tm_now);
                dted = new TZDate(tm_now);

                Variant dtb = tmchk["dtb"];
                Variant dte = tmchk["dte"];

                dtbd.setHours(dtb["h"], dtb["min"], dtb["s"], 0);

                dted.setHours(dte["h"], dte["min"], dte["s"], 0);

                _start_tm = dtbd.time;
                _end_tm   = dted.time;

                if (tm_now < _start_tm || tm_now > _end_tm)
                {
                    return(false);
                }
            }
            return(true);
        }
示例#7
0
        public static Variant GetTodayActiveTime(double tm_now, Variant tmchk, double firstracttmt, double combracttm)
        {
            Variant variant = new Variant();

            variant["begin"] = 0;
            variant["end"]   = 0;
            bool    flag  = true;
            bool    flag2 = tmchk.ContainsKey("tb") && tmchk.ContainsKey("te");
            Variant result;

            if (flag2)
            {
                Variant variant2 = tmchk["tb"];
                Variant variant3 = tmchk["te"];
                TZDate  tZDate   = TZDate.createByYMDHMS(variant2["y"], variant2["mon"] - 1, variant2["d"], variant2["h"], variant2["min"], variant2["s"], 0);
                variant["begin"] = tZDate.time;
                tZDate.setHours(0, 0, 0, 0);
                bool flag3 = tm_now < tZDate.time;
                if (flag3)
                {
                    variant["begin"] = 0;
                }
                tZDate         = TZDate.createByYMDHMS(variant3["y"], variant3["mon"] - 1, variant3["d"], variant3["h"], variant3["min"], variant3["s"], 0);
                variant["end"] = tZDate.time;
                tZDate.setHours(23, 59, 59, 0);
                bool flag4 = tm_now >= tZDate.time;
                if (flag4)
                {
                    variant["begin"] = 0;
                }
                result = variant;
            }
            else
            {
                bool flag5 = tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte");
                if (flag5)
                {
                    TZDate tZDate = new TZDate(tm_now);
                    int    num    = tZDate.getDay();
                    bool   flag6  = num == 0;
                    if (flag6)
                    {
                        num = 7;
                    }
                    bool flag7 = tmchk.ContainsKey("wtb") && tmchk.ContainsKey("wte");
                    if (flag7)
                    {
                        flag = (num >= tmchk["wtb"]._int && num <= tmchk["wte"]._int - 1);
                    }
                    else
                    {
                        bool flag8 = tmchk.ContainsKey("wd");
                        if (flag8)
                        {
                            flag = false;
                            Variant variant4 = GameTools.split(tmchk["wd"]._str, ",", 1u);
                            for (int i = 0; i < variant4.Count; i++)
                            {
                                bool flag9 = variant4[i]._int == num;
                                if (flag9)
                                {
                                    flag = true;
                                    break;
                                }
                            }
                        }
                    }
                    bool flag10 = flag;
                    if (flag10)
                    {
                        bool flag11 = tmchk.ContainsKey("optm");
                        if (flag11)
                        {
                            bool flag12 = tm_now / 1000.0 - firstracttmt < (double)(tmchk["optm"]._int * 86400);
                            if (flag12)
                            {
                                flag = false;
                            }
                        }
                        bool flag13 = tmchk.ContainsKey("cltm");
                        if (flag13)
                        {
                            bool flag14 = tm_now / 1000.0 - firstracttmt > (double)((tmchk["cltm"]._int + 1) * 86400);
                            if (flag14)
                            {
                                flag = false;
                            }
                        }
                        bool flag15 = tmchk.ContainsKey("cb_optm");
                        if (flag15)
                        {
                            bool flag16 = tm_now / 1000.0 - combracttm < (double)(tmchk["cb_optm"]._int * 86400);
                            if (flag16)
                            {
                                flag = false;
                            }
                        }
                        bool flag17 = tmchk.ContainsKey("cb_cltm");
                        if (flag17)
                        {
                            bool flag18 = tm_now / 1000.0 - combracttm > (double)((tmchk["cb_cltm"]._int + 1) * 86400);
                            if (flag18)
                            {
                                flag = false;
                            }
                        }
                    }
                    bool flag19 = flag;
                    if (flag19)
                    {
                        Variant variant5 = tmchk["dtb"];
                        Variant variant6 = tmchk["dte"];
                        tZDate.setHours(variant5["h"], variant5["min"], variant5["s"], 0);
                        variant["begin"] = tZDate.time;
                        tZDate.setHours(variant6["h"], variant6["min"], variant6["s"], 0);
                        variant["end"] = tZDate.time;
                    }
                }
                else
                {
                    bool flag20 = (tmchk.ContainsKey("optm") && tmchk.ContainsKey("cltm")) || (tmchk.ContainsKey("cb_optm") && tmchk.ContainsKey("cb_cltm"));
                    if (flag20)
                    {
                        bool flag21 = tmchk.ContainsKey("optm");
                        if (flag21)
                        {
                            bool flag22 = tm_now / 1000.0 - firstracttmt >= (double)(tmchk["optm"]._int * 86400) && tm_now / 1000.0 - firstracttmt < (double)((tmchk["cltm"]._int + 1) * 86400);
                            if (flag22)
                            {
                                variant["begin"] = firstracttmt + (double)(tmchk["optm"]._int * 86400);
                                variant["end"]   = firstracttmt + (double)((tmchk["cltm"]._int + 1) * 86400);
                            }
                        }
                        else
                        {
                            bool flag23 = tmchk.ContainsKey("cb_optm");
                            if (flag23)
                            {
                                bool flag24 = tm_now / 1000.0 - combracttm >= (double)(tmchk["cb_optm"]._int * 86400) && tm_now / 1000.0 - combracttm < (double)((tmchk["cb_cltm"]._int + 1) * 86400);
                                if (flag24)
                                {
                                    variant["begin"] = firstracttmt + (double)(tmchk["cb_optm"]._int * 86400);
                                    variant["end"]   = firstracttmt + (double)((tmchk["cb_cltm"]._int + 1) * 86400);
                                }
                            }
                        }
                    }
                }
                result = variant;
            }
            return(result);
        }
示例#8
0
        private static double next_start(double tm_now, Variant tmchk, double firstopentm = 0.0)
        {
            bool flag  = false;
            bool flag2 = firstopentm > 0.0 && tmchk.ContainsKey("optm");

            if (flag2)
            {
                bool flag3 = tm_now / 1000.0 - firstopentm < (double)(tmchk["optm"]._int * 86400);
                if (flag3)
                {
                    tm_now = (double)(tmchk["optm"]._int * 86400 * 1000) + firstopentm * 1000.0;
                    flag   = true;
                }
            }
            bool   flag4 = tmchk.ContainsKey("tb") && tmchk.ContainsKey("te");
            double result;

            if (flag4)
            {
                Variant variant  = tmchk["tb"];
                Variant variant2 = tmchk["te"];
                TZDate  tZDate   = TZDate.createByYMDHMS(variant["y"], variant["mon"]._int - 1, variant["d"], variant["h"], variant["min"], variant["s"], 0);
                double  time     = tZDate.time;
                TZDate  tZDate2  = TZDate.createByYMDHMS(variant2["y"], variant2["mon"] - 1, variant2["d"], variant2["h"], variant2["min"], variant2["s"], 0);
                double  time2    = tZDate2.time;
                bool    flag5    = time < tm_now;
                if (flag5)
                {
                    result = 0.0;
                }
                else
                {
                    result = time;
                }
            }
            else
            {
                bool flag6 = tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte");
                if (flag6)
                {
                    bool   flag7   = false;
                    TZDate tZDate3 = new TZDate(tm_now);
                    int    num     = tZDate3.getDay();
                    bool   flag8   = num == 0;
                    if (flag8)
                    {
                        num = 7;
                    }
                    Variant variant3 = tmchk["dtb"];
                    Variant variant4 = tmchk["dte"];
                    int     num2     = 0;
                    int     num3     = 0;
                    bool    flag9    = tmchk.ContainsKey("wtb") && tmchk.ContainsKey("wte");
                    if (flag9)
                    {
                        num2  = tmchk["wtb"];
                        num3  = tmchk["wte"] - 1;
                        flag7 = true;
                    }
                    else
                    {
                        bool flag10 = tmchk.ContainsKey("wd");
                        if (flag10)
                        {
                            string  str      = tmchk["wd"];
                            Variant variant5 = GameTools.split(str, ",", 1u);
                        }
                    }
                    TZDate tZDate4 = new TZDate(tm_now);
                    TZDate tZDate5 = new TZDate(tm_now);
                    tZDate4.setHours(variant3["h"], variant3["min"], variant3["s"], 0);
                    tZDate5.setHours(variant4["h"], variant4["min"], variant4["s"], 0);
                    double time   = tZDate4.time;
                    double time2  = tZDate5.time;
                    bool   flag11 = flag7 && (num > num3 || num < num2);
                    bool   flag12;
                    if (flag11)
                    {
                        flag12 = true;
                    }
                    else
                    {
                        bool flag13 = tmchk.ContainsKey("wd");
                        if (flag13)
                        {
                            string  str      = tmchk["wd"];
                            Variant variant5 = GameTools.split(str, ",", 1u);
                            flag12 = true;
                            for (int i = 0; i < variant5.Count; i++)
                            {
                                int  num4   = variant5[i];
                                bool flag14 = num4 == num;
                                if (flag14)
                                {
                                    bool flag15 = tm_now > time && tm_now < time2;
                                    if (flag15)
                                    {
                                        flag12 = false;
                                    }
                                    break;
                                }
                            }
                        }
                        else
                        {
                            bool flag16 = tm_now < time;
                            flag12 = flag16;
                        }
                    }
                    bool flag17 = flag12 | flag;
                    if (flag17)
                    {
                        bool flag18 = tmchk.ContainsKey("wd");
                        if (flag18)
                        {
                            string  str      = tmchk["wd"];
                            Variant variant5 = GameTools.split(str, ",", 1u);
                            int     num5     = -1;
                            int     num6     = -1;
                            for (int j = 0; j < variant5.Count; j++)
                            {
                                int  num7   = variant5[j];
                                bool flag19 = num6 < 0 || num7 < num6;
                                if (flag19)
                                {
                                    num6 = num7;
                                }
                                bool flag20 = num > num7 || (num == num7 && tm_now > time2);
                                if (!flag20)
                                {
                                    bool flag21 = num5 < 0 || num7 < num5;
                                    if (flag21)
                                    {
                                        num5 = num7;
                                    }
                                }
                            }
                            bool flag22 = num5 < 0;
                            if (flag22)
                            {
                                result = time + (double)(86400000 * (7 - num + num6));
                            }
                            else
                            {
                                result = time + (double)(86400000 * (num5 - num));
                            }
                        }
                        else
                        {
                            bool flag23 = !flag7;
                            if (flag23)
                            {
                                result = time;
                            }
                            else
                            {
                                bool flag24 = num <num2 || num> num3;
                                if (flag24)
                                {
                                    int  num8   = num2 - num;
                                    bool flag25 = num8 < 0;
                                    if (flag25)
                                    {
                                        num8 += 7;
                                    }
                                    result = time + (double)(86400000 * num8);
                                }
                                else
                                {
                                    result = time;
                                }
                            }
                        }
                    }
                    else
                    {
                        bool flag26 = tmchk.ContainsKey("wd");
                        if (flag26)
                        {
                            result = 0.0;
                        }
                        else
                        {
                            bool flag27 = !flag7;
                            if (flag27)
                            {
                                result = time + 86400000.0;
                            }
                            else
                            {
                                num++;
                                bool flag28 = num > 6;
                                if (flag28)
                                {
                                    num = 0;
                                }
                                bool flag29 = num <num2 || num> num3;
                                if (flag29)
                                {
                                    int  num8   = num2 - num;
                                    bool flag30 = num8 < 0;
                                    if (flag30)
                                    {
                                        num8 += 7;
                                    }
                                    result = time + (double)(86400000 * num8);
                                }
                                else
                                {
                                    result = time + 86400000.0;
                                }
                            }
                        }
                    }
                }
                else
                {
                    result = 0.0;
                }
            }
            return(result);
        }
示例#9
0
        private static bool check_tm_impl(double tm_now, Variant tmchk, double firstopentm = 0.0, double cbtm = 0.0)
        {
            bool flag = cbtm > 0.0;
            bool result;

            if (flag)
            {
                bool flag2 = tmchk.ContainsKey("cb_optm");
                if (flag2)
                {
                    bool flag3 = tm_now / 1000.0 - cbtm < (double)(tmchk["cb_optm"]._int * 86400);
                    if (flag3)
                    {
                        result = false;
                        return(result);
                    }
                }
                bool flag4 = tmchk.ContainsKey("cb_cltm");
                if (flag4)
                {
                    bool flag5 = tm_now / 1000.0 - cbtm > (double)((tmchk["cb_cltm"]._int + 1) * 86400);
                    if (flag5)
                    {
                        result = false;
                        return(result);
                    }
                }
            }
            else
            {
                bool flag6 = tmchk.ContainsKey("cb_optm") || tmchk.ContainsKey("cb_cltm");
                if (flag6)
                {
                    result = false;
                    return(result);
                }
            }
            bool flag7 = firstopentm > 0.0;

            if (flag7)
            {
                bool flag8 = tmchk.ContainsKey("optm");
                if (flag8)
                {
                    bool flag9 = tm_now / 1000.0 - firstopentm < (double)(tmchk["optm"]._int * 86400);
                    if (flag9)
                    {
                        result = false;
                        return(result);
                    }
                }
                bool flag10 = tmchk.ContainsKey("cltm");
                if (flag10)
                {
                    bool flag11 = tm_now / 1000.0 - firstopentm > (double)((tmchk["cltm"]._int + 1) * 86400);
                    if (flag11)
                    {
                        result = false;
                        return(result);
                    }
                }
            }
            bool flag12 = tmchk.ContainsKey("tb");

            if (flag12)
            {
                Variant variant = tmchk["tb"];
                TZDate  tZDate  = TZDate.createByYMDHMS(variant["y"], variant["mon"]._int - 1, variant["d"], variant["h"], variant["min"], variant["s"], 0);
                double  time    = tZDate.time;
                bool    flag13  = tm_now < time;
                if (flag13)
                {
                    result = false;
                    return(result);
                }
            }
            bool flag14 = tmchk.ContainsKey("te");

            if (flag14)
            {
                Variant variant2 = tmchk["te"];
                TZDate  tZDate2  = TZDate.createByYMDHMS(variant2["y"], variant2["mon"] - 1, variant2["d"], variant2["h"], variant2["min"], variant2["s"], 0);
                double  time2    = tZDate2.time;
                bool    flag15   = tm_now > time2;
                if (flag15)
                {
                    result = false;
                    return(result);
                }
            }
            bool flag16 = tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte");

            if (flag16)
            {
                TZDate tZDate3 = new TZDate(tm_now);
                int    num     = tZDate3.getDay();
                bool   flag17  = num == 0;
                if (flag17)
                {
                    num = 7;
                }
                bool flag18 = tmchk.ContainsKey("wtb") && tmchk.ContainsKey("wte");
                if (flag18)
                {
                    int  num2   = tmchk["wtb"];
                    int  num3   = tmchk["wte"] - 1;
                    bool flag19 = num > num3 || num < num2;
                    if (flag19)
                    {
                        result = false;
                        return(result);
                    }
                }
                else
                {
                    bool flag20 = tmchk.ContainsKey("wd");
                    if (flag20)
                    {
                        string  str      = tmchk["wd"];
                        Variant variant3 = GameTools.split(str, ",", 1u);
                        bool    flag21   = false;
                        for (int i = 0; i < variant3.Count; i++)
                        {
                            int  num4   = variant3[i];
                            bool flag22 = num4 == num;
                            if (flag22)
                            {
                                flag21 = true;
                                break;
                            }
                        }
                        bool flag23 = !flag21;
                        if (flag23)
                        {
                            result = false;
                            return(result);
                        }
                    }
                }
                TZDate  tZDate4  = new TZDate(tm_now);
                TZDate  tZDate5  = new TZDate(tm_now);
                Variant variant4 = tmchk["dtb"];
                Variant variant5 = tmchk["dte"];
                tZDate4.setHours(variant4["h"], variant4["min"], variant4["s"], 0);
                tZDate5.setHours(variant5["h"], variant5["min"], variant5["s"], 0);
                double time = tZDate4.time;
                double time2 = tZDate5.time;
                bool   flag24 = tm_now <time || tm_now> time2;
                if (flag24)
                {
                    result = false;
                    return(result);
                }
            }
            result = true;
            return(result);
        }
示例#10
0
        public static Variant get_tmchk_time(double tm_now, Variant tmchk, double firstopentm = 0.0, double cbtm = 0.0)
        {
            double val  = 0.0;
            double val2 = 0.0;
            bool   flag = firstopentm > 0.0;

            if (flag)
            {
                bool flag2 = tmchk.ContainsKey("optm");
                if (flag2)
                {
                    val = (firstopentm + (double)(tmchk["optm"]._int * 86400)) * 1000.0;
                }
                bool flag3 = tmchk.ContainsKey("cltm");
                if (flag3)
                {
                    val2 = (firstopentm + (double)((tmchk["cltm"]._int + 1) * 86400)) * 1000.0;
                }
            }
            else
            {
                bool flag4 = cbtm > 0.0;
                if (flag4)
                {
                    bool flag5 = tmchk.ContainsKey("cb_optm");
                    if (flag5)
                    {
                        val = (cbtm + (double)(tmchk["cb_optm"]._int * 86400)) * 1000.0;
                    }
                    bool flag6 = tmchk.ContainsKey("cb_cltm");
                    if (flag6)
                    {
                        val2 = (cbtm + (double)((tmchk["cb_cltm"]._int + 1) * 86400)) * 1000.0;
                    }
                }
            }
            bool flag7 = tmchk.ContainsKey("tb");

            if (flag7)
            {
                Variant variant = tmchk["tb"];
                TZDate  tZDate  = TZDate.createByYMDHMS(variant["y"], variant["mon"]._int - 1, variant["d"], variant["h"], variant["min"], variant["s"], 0);
                val = tZDate.time;
            }
            bool flag8 = tmchk.ContainsKey("te");

            if (flag8)
            {
                Variant variant2 = tmchk["te"];
                TZDate  tZDate2  = TZDate.createByYMDHMS(variant2["y"], variant2["mon"]._int - 1, variant2["d"], variant2["h"], variant2["min"], variant2["s"], 0);
                val2 = tZDate2.time;
            }
            bool flag9 = tmchk.ContainsKey("dtb") && tmchk.ContainsKey("dte");

            if (flag9)
            {
                TZDate  tZDate3  = new TZDate(tm_now);
                TZDate  tZDate4  = new TZDate(tm_now);
                Variant variant3 = tmchk["dtb"];
                Variant variant4 = tmchk["dte"];
                tZDate3.setHours(variant3["h"], variant3["min"], variant3["s"], 0);
                tZDate4.setHours(variant4["h"], variant4["min"], variant4["s"], 0);
                val  = tZDate3.time;
                val2 = tZDate4.time;
            }
            Variant variant5 = new Variant();

            variant5["stm"] = val;
            variant5["etm"] = val2;
            return(variant5);
        }