Exemple #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;
     moduleInfo  = new Dictionary <uint, string>();
     Dev         = dev;
     API         = new openAPI();
     raw         = "";
     rom         = "";
     pub         = "";
 }
Exemple #2
0
 /// <summary>
 /// 构造函数,主要用于修改产品,删除产品,查询产品
 /// </summary>
 public product(developer dev)
 {
     licenseId   = 0;
     productName = "";
     licenseForm = 0;
     moduleInfo  = new Dictionary <uint, string>();
     API         = new openAPI();
     Dev         = dev;
     raw         = "";
     rom         = "";
     pub         = "";
 }
        /// <summary>
        /// 向深思云平台发送请求
        /// </summary>
        /// <returns></returns>
        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));
        }