Ejemplo n.º 1
0
        /// <summary>
        /// Làm mới thương minh.
        /// </summary>
        public static async Task <MerchantInfo> RefreshMerchantAsync(this IPacketWriter writer)
        {
            var packet = await writer.SendCommandAsync("43201");

            if (packet == null)
            {
                return(null);
            }
            return(MerchantInfo.Parse(JToken.Parse(packet.Message)));
        }
Ejemplo n.º 2
0
        public static MerchantInfo Parse(JToken token)
        {
            var defMerchantId = (int)token["defMerchantId"];

            if (defMerchantId == 0)
            {
                return(null);
            }
            var result = new MerchantInfo();

            result.OwnedMerchant = (Merchant)defMerchantId;

            var merchants = new List <Merchant>();

            foreach (var subToken in token["merchantIds"])
            {
                merchants.Add((Merchant)(int)subToken);
            }
            result.Merchants = merchants;
            return(result);
        }