Ejemplo n.º 1
0
        public static DeviceStatus active(string udid, string deviceName, string cardNum)
        {
            string random = new Random().Next(1000, 10000).ToString();
            Dictionary <string, string> dictionary = new Dictionary <string, string>();

            dictionary.Add("deviceId", udid);
            dictionary.Add("deviceName", deviceName);
            dictionary.Add("cardNum", cardNum);
            string encryptUrl = DESHelper.GetEncryptUrl(Resources.baseUrl + "b", JsonConvert.SerializeObject(dictionary), Resources.appId, Resources.version, Resources.secertKey, random);
            Task <HttpResponseMessage> async = httpClient.GetAsync(encryptUrl);

            if (async.Result.StatusCode == HttpStatusCode.OK)
            {
                return(JsonConvert.DeserializeObject <DeviceStatus>(DESHelper.Decrypt(async.Result.Content.ReadAsByteArrayAsync().Result, Resources.secertKey, random)));
            }
            return(new DeviceStatus(false, "网络异常"));
        }