コード例 #1
0
    bool ParseUserProp(JSONNode pData)
    {
        string header = "  ParseUserProp ::>>   ";

        try {
            Ag.LogStartWithStr(1, header + " Country , League, etcInfo, freeCoupon ");
            WAS.Country = pData ["country"].AsInt;
            try {
                WAS.TeamName = pData ["teamName"];
            } catch {
                " Team Name Error.  ".HtLog();
            }
            pData.ParseTo("league", out WAS.League, "etcInfo", out WAS.etcInfo);
            try {
                FreeCouponTime = long.Parse(pData ["freeCouponDate"]) / 1000;  // formatVersion 1 : yyyyMMddHHmmss .. parse ..
                FreeCouponDT   = Ag.UnixTimeStampToDateTime(FreeCouponTime);

                Ag.LogString("  freeCouponDate : " + pData ["freeCouponDate"]);  // Ag.UnixTimeStampToDateTime (
                Ag.LogString("  FreeCouponDT : " + FreeCouponDT + "   Remain Sec   " + FreeCouponTS.TotalSeconds + "  IsFreeCouponRemain ? " + IsFreeCouponRemain);
            } catch {
                FreeCouponTime = Ag.TimeNow;
                " Free Coupon Date Not Set  >>  set to now  ".HtLog();
            }
        } catch {
            Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse User Info  [ Country, league, freeCoupon  ] >>>>>  E R R O R  :: ");
        }

        if (WAS.League == null || WAS.League.Length < 3)
        {
            WAS.League = "PRO_5";
        }

        try {
            pData.ParseTo("cost", out WAS.Cost, "reviewEvent", out WAS.reviewEvent);  // 리뷰 확인 0: 아직 안함, 1: 함..
            pData.ParseTo("gold", out mGold, "cash1", out mCash1, "cash2", out mCash2);
            (header + " gold / cash1 / cash2  " + mGold + "  " + mCash1 + "  " + mCash2).HtLog();
        } catch {
            Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse User Info  [ cost, review, gold/cash  ] >>>>>  E R R O R  :: ");
            return(false);
        }

        if (pData ["etcInfo"].ToString().IsJsonNull())
        {
            "   etcInfo is NULL  Reset ... and Update   ".HtLog();
            etcInfoObj = new WasUserEtcInfo();
            DateTime dtNow = DateTime.Now;
            etcInfoObj.DailyChkMon = dtNow.Month;
            etcInfoObj.DailyChkDay = dtNow.Day;

            etcInfoObj.HeartRemainSec = AgStt.CTHeartMaxSeconds;
            etcInfoObj.DtHeart        = Ag.Now();

            UpdateEtcInfoObj("Parsing ..  JsonNull");
        }
        else
        {
            try {
                (header + "   etcInfo  :  " + pData ["etcInfo"]).HtLog();
                //etcInfoObj = JsonMapper.ToObject<WasUserEtcInfo> (pData ["etcInfo"].ToJson ().RecoverFromDodge ().RemoveHeadFootOneChar ());
                etcInfoObj = new WasUserEtcInfo();
                etcInfoObj.Parse(JSON.Parse(pData ["etcInfo"].ToString().RecoverFromDodge().RemoveHeadFootOneChar()));
                etcInfoObj.ShowMyself();
            } catch {
                Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse etc Info >>>>>  E R R O R  ::  Read etcInfo  ");
            }
        }
        try {
            ("  My Rank : " + pData ["myRank"].ToString()).HtLog();
            myRank = new Rank(pData ["myRank"]);  // JsonMapper.ToObject<WasRank> (pData ["myRank"].ToJson ()); //.HtLog ();
        } catch {
            Ag.LogIntenseWord(" [< AmUserNet.cs >]       Parse Rank   >>>>>  E R R O R  :: ");
        }
        //Ag.LogString (" FreeCoupon ::   " + WAS.freeCouponDate + "   Length : " + WAS.freeCouponDate.Length);

        //FreeCouponLimitDT = WAS.freeCouponDate.ToDateTime ();
//        if (WAS.freeCouponDate.Length > 5) { // < 10) {
//            try {
//                FreeCouponLimitDT = WAS.freeCouponDate.ToDateTime ();
//            } catch {
//                FreeCouponLimitDT = DateTime.Now;
//            }
//        } else
//            FreeCouponLimitDT = DateTime.Now;

        Ag.LogString(header + WAS.TeamName + "     has      Cash : " + mCash1 + " / " + mCash2 + "         Gold : " + mGold +
                     "     Review : " + WAS.reviewEvent + "     Cost : " + WAS.Cost + "  in league : " + WAS.League);
        Ag.LogString(header + WAS.TeamName + "     etcInfo :: " + WAS.etcInfo);
        myRank.WAS.ShowMyself();
        Ag.LogIntense(2, false);
        return(true);
    }