Example #1
0
 /// <summary>
 /// 构造函数,主要用于创建产品
 /// </summary>
 /// <param name="licID">设定的许可ID</param>
 /// <param name="procName">产品名称</param>
 /// <param name="licForm">许可模式(云,软,云and软)</param>
 public product(uint licID, string procName, uint licForm, developer dev)
 {
     licenseId   = licID;
     productName = procName;
     licenseForm = licForm;
     Dev         = dev;
     API         = new openAPI();
 }
Example #2
0
        public string senseCloudRequest(string url, string JsonInfo, string appid, string secret)
        {
            string  ttp           = getTime();
            string  uuid          = getUUID();
            openAPI api           = new openAPI();
            string  addUserFormat = url.Substring(api.HttpsUrl.Length);

            //将数据转成字节数组形式,在网络上传递使用
            byte[] ttpBytes      = Encoding.UTF8.GetBytes(ttp);
            byte[] uuidBytes     = Encoding.UTF8.GetBytes(uuid);
            byte[] resourceURI   = Encoding.UTF8.GetBytes(addUserFormat);
            byte[] JsonInfoBytes = Encoding.UTF8.GetBytes(JsonInfo);
            byte[] allData       = new byte[ttpBytes.Length + uuidBytes.Length + resourceURI.Length + JsonInfoBytes.Length];
            //拼接字节数组
            ttpBytes.CopyTo(allData, 0);
            uuidBytes.CopyTo(allData, ttpBytes.Length);
            resourceURI.CopyTo(allData, ttpBytes.Length + uuidBytes.Length);
            JsonInfoBytes.CopyTo(allData, ttpBytes.Length + uuidBytes.Length + resourceURI.Length);
            //签名
            String signData = getSignData(allData, secret);

            //请求数据
            return(sendHttpPost(url, appid, ttp, uuid, signData, JsonInfoBytes));
        }