public virtual async Task HandleEventAsync(UserUpdatedEventData eventData)
        {
            var user = await _userManager.GetUserByIdAsync(eventData.UserId);

            user.Surname = eventData.PhoneNumber;
            await _userManager.UpdateAsync(user);

            await _userManager.ChangePhoneNumberAsync(user, eventData.PhoneNumber, string.Empty);

            try
            {
                Credential cred = new Credential
                {
                    SecretId  = "AKID1sZ03uwxf9Ub",
                    SecretKey = "JEyWwAA0bxBE4jAML"
                };

                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("sms.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;

                SmsClient      client    = new SmsClient(cred, "ap-shanghai", clientProfile);
                SendSmsRequest req       = new SendSmsRequest();
                string         strParams = "{\"PhoneNumberSet\":[\"+8618538705067\"],\"TemplateID\":\"186797\",\"Sign\":\"江南艺考\",\"TemplateParamSet\":[\"王彤\",\"最近学习好\",\"成绩提升很快\"],\"SmsSdkAppid\":\"1466134967\"}";
                req = SendSmsRequest.FromJsonString <SendSmsRequest>(strParams);

                SendSmsResponse resp = client.SendSms(req).ConfigureAwait(false).GetAwaiter().GetResult();;
                Logger.Info(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Logger.Error(e.ToString());
            }
        }
예제 #2
0
        public static string Translation(string srcText, string from, string to)
        {
            Credential cred = new Credential
            {
                SecretId  = TengxunKey.SecretId,
                SecretKey = TengxunKey.SecretKey
            };

            ClientProfile clientProfile = new ClientProfile();
            HttpProfile   httpProfile   = new HttpProfile();

            httpProfile.Timeout       = 6;
            httpProfile.Endpoint      = ("tmt.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;
            TmtClient            client  = new TmtClient(cred, "ap-guangzhou", clientProfile);
            TextTranslateRequest request = new TextTranslateRequest();

            request.SourceText = srcText;
            request.Source     = from;
            request.Target     = to;
            request.ProjectId  = 0;
            TextTranslateResponse response;

            try
            {
                response = client.TextTranslateSync(request);
            }
            catch (Exception ex) { throw ex.InnerException; }
            string result = AbstractModel.ToJsonString(response);
            var    list   = JsonConvert.DeserializeObject <TranslationJson>(result);

            return(list.TargetText);
        }
예제 #3
0
        private void SendRequest(object state)
        {
            mServerResult = string.Empty;
            try
            {
#if TENCENT
                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("iai.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;
                IaiClient          client = new IaiClient(mCredential, "", clientProfile);
                DetectFaceRequest  req    = DetectFaceRequest.FromJsonString <DetectFaceRequest>(state.ToString());
                DetectFaceResponse resp   = client.DetectFace(req).ConfigureAwait(false).GetAwaiter().GetResult();
                mServerResult = AbstractModel.ToJsonString(resp);
                mResult       = JsonUtility.FromJson <DFServerResult>(mServerResult);
#endif
                mIsDone = true;
            }
            catch (System.Exception ex)
            {
                mServerResult = ex.Message;
                string[]       sf = mServerResult.Split(' ');
                DFServerResult rs = new DFServerResult();

                rs.Error         = new DFError();
                rs.Error.Code    = sf[0].Split(':')[1];
                rs.Error.Message = sf[1].Split(':')[1];
                mResult          = rs;
                mIsDone          = true;
            }
        }
예제 #4
0
        public static string recognize(string img)
        {
            try {
                Credential cred = new Credential {
                    SecretId  = SecretID,
                    SecretKey = SecretKey
                };

                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("ocr.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;

                OcrClient client           = new OcrClient(cred, "ap-beijing", clientProfile);
                GeneralBasicOCRRequest req = new GeneralBasicOCRRequest();
                string strParams           = String.Format("{{\"ImageBase64\":\"{0}\"}}", img);
                req = GeneralBasicOCRRequest.FromJsonString <GeneralBasicOCRRequest>(strParams);
                GeneralBasicOCRResponse resp = client.GeneralBasicOCRSync(req);

                JavaScriptSerializer js = new JavaScriptSerializer();
                var dic    = js.Deserialize <Dictionary <string, object> >(AbstractModel.ToJsonString(resp));
                var list   = (System.Collections.ArrayList)dic["TextDetections"];
                var output = new StringBuilder();
                foreach (var item in list)
                {
                    output.Append(((Dictionary <string, object>)item)["DetectedText"]).Append("\n");
                }

                return(output.ToString());
            }
            catch (Exception e) {
                return(e.ToString());
            }
        }
예제 #5
0
        public async Task <VodUploadResponse> Upload(string region, VodUploadRequest req)
        {
            CheckRequest(region, req);

            TencentCloud.Common.Credential cred = new TencentCloud.Common.Credential
            {
                SecretId  = SecretId,
                SecretKey = SecretKey
            };
            VodClient vodClient = new VodClient(cred, region);

            ApplyUploadResponse applyResp = await DoApplyRequest(vodClient, req);

            //Console.WriteLine(AbstractModel.ToJsonString(applyResp));

            await DoUploadAction(applyResp, req);

            CommitUploadResponse commitResp = await DoCommitRequest(vodClient, applyResp);

            //Console.WriteLine(AbstractModel.ToJsonString(commitResp));

            VodUploadResponse rsp = AbstractModel.FromJsonString <VodUploadResponse>(AbstractModel.ToJsonString(commitResp));

            return(rsp);
        }
        static void Main1(string[] args)
        {
            try
            {
                Credential cred = new Credential
                {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };
                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy      = Environment.GetEnvironmentVariable("HTTPS_PROXY");
                clientProfile.HttpProfile = httpProfile;
                VpcClient client = new VpcClient(cred, "ap-guangzhou", clientProfile);

                ModifyAddressTemplateAttributeRequest req = new ModifyAddressTemplateAttributeRequest();
                req.Addresses           = new string[] { "eip-hxlqja90" };
                req.AddressTemplateId   = "ipm-mdunqeb6";
                req.AddressTemplateName = "TestName";
                ModifyAddressTemplateAttributeResponse resp = client.ModifyAddressTemplateAttributeSync(req);
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #7
0
        //internal void send()
        //{
        //    try
        //    {
        //        /* 必要步骤:
        //         * 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
        //         * 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
        //         * 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
        //         * 以免泄露密钥对危及你的财产安全。
        //         * CAM密匙查询: https://console.cloud.tencent.com/cam/capi*/
        //        Credential cred = new Credential
        //        {
        //            SecretId = "我的id",
        //            SecretKey = "密匙"
        //        };
        //        /*
        //        Credential cred = new Credential {
        //            SecretId = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
        //            SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
        //        };*/

        //        /* 非必要步骤:
        //         * 实例化一个客户端配置对象,可以指定超时时间等配置 */
        //        ClientProfile clientProfile = new ClientProfile();
        //        /* SDK默认用TC3-HMAC-SHA256进行签名
        //      * 非必要请不要修改这个字段 */
        //        clientProfile.SignMethod = ClientProfile.SIGN_TC3SHA256;
        //        /* 非必要步骤
        //         * 实例化一个客户端配置对象,可以指定超时时间等配置 */
        //        HttpProfile httpProfile = new HttpProfile();
        //        /* SDK默认使用POST方法。
        //      * 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求 */
        //        httpProfile.ReqMethod = "GET";
        //        /* SDK有默认的超时时间,非必要请不要进行调整
        //      * 如有需要请在代码中查阅以获取最新的默认值 */
        //        httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)
        //        /* SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务
        //      * 则必须手动指定域名,例如sms的上海金融区域名: sms.ap-shanghai-fsi.tencentcloudapi.com */
        //        httpProfile.Endpoint = "sms.tencentcloudapi.com";
        //        // 代理服务器,当你的环境下有代理服务器时设定
        //        httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

        //        clientProfile.HttpProfile = httpProfile;
        //        /* 实例化要请求产品(以sms为例)的client对象
        //      * 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量 */
        //        SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);

        //        /* 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
        //      * 你可以直接查询SDK源码确定SendSmsRequest有哪些属性可以设置
        //      * 属性可能是基本类型,也可能引用了另一个数据结构
        //      * 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明 */
        //        SendSmsRequest req = new SendSmsRequest();

        //        /* 基本类型的设置:
        //      * SDK采用的是指针风格指定参数,即使对于基本类型你也需要用指针来对参数赋值。
        //      * SDK提供对基本类型的指针引用封装函数
        //      * 帮助链接:
        //      * 短信控制台: https://console.cloud.tencent.com/sms/smslist
        //      * sms helper: https://cloud.tencent.com/document/product/382/3773 */

        //        req.SmsSdkAppid = "1400787878";
        //        /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看 */
        //        req.Sign = "雪雪雪个人技术站";
        //        /* 短信码号扩展号: 默认未开通,如需开通请联系 [sms helper] */
        //        req.ExtendCode = "x";
        //        /* 国际/港澳台短信 senderid: 国内短信填空,默认未开通,如需开通请联系 [sms helper] */
        //        req.SenderId = "";
        //        /* 用户的 session 内容: 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
        //        req.SessionContext = "";
        //        /* 下发手机号码,采用 e.164 标准,+[国家或地区码][手机号]
        //         * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号*/
        //        req.PhoneNumberSet = new String[] { "+8618030297576" };
        //        /* 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查看 */
        //        req.TemplateID = "590943";
        //        /* 模板参数: 若无模板参数,则设置为空*/
        //        req.TemplateParamSet = new String[] { "666" };


        //        // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
        //        // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
        //        SendSmsResponse resp = client.SendSmsSync(req);

        //        // 输出json格式的字符串回包
        //        Console.WriteLine(AbstractModel.ToJsonString(resp));
        //    }
        //    catch (Exception e)
        //    {
        //        Console.WriteLine(e.ToString());
        //    }
        //    Console.Read();
        //}

        internal void Send()
        {
            try
            {
                Credential cred = new Credential
                {
                    SecretId  = "AKIDKeRJuDD5i4AKVjdwvjfLkwrUqMzLdGpW",
                    SecretKey = "avzqRlB44AONALIzJMccMp42jBMwFIzP"
                };

                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("sms.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;

                SmsClient      client    = new SmsClient(cred, "ap-beijing", clientProfile);
                SendSmsRequest req       = new SendSmsRequest();
                string         strParams = "{\"PhoneNumberSet\":[\"+8618030297576\"],\"TemplateID\":\"590943\",\"Sign\":\"雪雪雪个人技术站\",\"TemplateParamSet\":[\"123\"],\"SmsSdkAppid\":\"1400358718\"}";
                req = SendSmsRequest.FromJsonString <SendSmsRequest>(strParams);
                SendSmsResponse resp = client.SendSmsSync(req);
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #8
0
        public string GetResult()
        {
            client = new TmtClient(cred, "ap-guangzhou-open", clientProfile);
            string strParams = "{\"SourceText\":\"" + SourceText + "\",\"Source\":\"" + Source + "\",\"Target\":\"" + Target + "\",\"ProjectId\":0}";

            req = AbstractModel.FromJsonString <TextTranslateRequest>(strParams);
            TextTranslateResponse resp = client.TextTranslate(req).Result;

            return(AbstractModel.ToJsonString(resp));
        }
예제 #9
0
        static void Main1(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential
                {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品(以cvm为例)的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                HcmClient client = new HcmClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定DescribeZonesRequest有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                EvaluationRequest req = new EvaluationRequest();
                req.SessionId = "123456";
                req.Image     = "iVBORw0KGgoAAAANSUhEUgAAAYsAAADSCAIAAAA0dHtXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAa1SURBVHhe7d1hWtpMGIbRb10syPWwGjbDYvoFm9qqEELeTOYxOedf9Wor7zA3A0b87xdAKoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIpVBALoUCcikUkEuhgFwKBeRSKCCXQgG5FArIFVyo64fxA2xnnPxg/AB0EVqo6/n034fT2TbZkuG3dL1eLpfz283pm9tHz8PnPTB8CCzU9fz2zw4Z2CTbMfw2rkOUTp8n+9xQrPPl6OPPKtSwjndW0SbZhOG38J6mcZZLDaU6bqhyCnW9PFpJm6Q5w2/g8VAXGQ5UR1yKiEI9WUqbpCXDb2DlOP11OtzTvs6FmnUGtknaMPwmmtXpj2MtSb9C3RZy3kraJKsz/EY+fR+0nQOtSo9Czd8ev9kkKzL8dhbk6fdFBuMfXvJ2Gf/Xndu0UNdlB2CbZA2G39qsQJ1uFzw9uBB2+PArFyUcY2m2KdT77lj0SHFjk5QY/kYmC/XapU0zr1E4wuK0LVRtc/xhkyxi+Bt7UKjFl13OOfTu/7leo0INi1XeGx9sktcYfh/fC1W/0nKo1PhvPbD79WlUqGdz/WJYyfPjv2GTvMbw+/hcqNWuA39wNPtj7wvUv1DjpbITf8MmeY3h9/E3JSv/lMp0o3a+Qn0L9c9K2iSrMfw+xpC0mNhko/a9RN0K9fVhxiZZjeH3ccvIuoenvyYTteuXyzsU6v73NmyS1Rh+H03f728qUbteo00LNfV9V5tkNYa/RxNrtOtD1DaFen+Dm+l7uk2yGsPfo6lDlEK9bLzLv/AmgTbJagx/lyYWSaFedr3O3BsffuomufvQ1vcrPs7wD0Wh+lKojhTqB1CovhSqI4XK53WozhSqI4XKd9Q1UqgihWILRz1CKVSVQrGFwy6RQhUpFBuYWKF9H6EUqkqhaO+4gVKoKoWitanXoHa/QApVpFA1t3fkDjL3KvwtTR2g9v8IolBFClUzeT7YXt7KTfZp70/xBgpVpFA1CjVpuk8/7X62hEIVKVSNQj32bDb7P0ANFKpIoWoU6oGng/lpd7KFFKpIoWoU6p7nUzlInxSqTKFqFOqbGSM5xPO73xSqSKFqXG3wyZzfM3ykPilUmUKxllnnyVa/TSaVQhUpFGuYdXg64mooVJFCUTWvTgddCoW6RebttNz4RX4xfnKJ37+ofFMK1c3cOh3tyd0HhXpwDOqnQxMUqou5d7xDr4FCKZRCbe96mVunwx6eRgqlUAq1rZlP7NTpnUIplEJtR51epVAKpVDbUKclFEqhFGoDc+9k5v2FQg2ul+XO9x4XT2/n8dNLbH8XVaimhsPTOM1Jjk73KFTR3cfGn7atFaqdeYcndXpEoYoUiofmvfKkTlMUqkihuG/Wc7tT4q9uiKJQRQpVU/uRo9Wt9iNHM/Ik/nMoVJFC1cx7mWYz69zc5zdKneZSqCKFqtlhoZ4dn7zu9AqFKlKomr0V6tnt+Wl3je4UqkihavZVqCe3xuHpdQpVpFA1eyrU9G051LuLr0ehihSqZkeFmpjij7tH5FCoIoWqukYZv6jXTaVWn5ZTqCKF4sYIG1GoIoViMDFBrz+VKFSRQiFQDSlUkUIx9RqU+RUpVJFCMREoR6gqhSpSKIyvIYUqUqjDmzpC3d5dZTPj17MvClWkUIc3Vagt7XOpFKro7vsbdfjF5iUKVTExvU0pVFM2SUeGX6FQLSkUhl+jUC0pFIZfkvIylEK1ZZN0ZPgFCtWUQmH4JQrVlEJh+CUK1VRMoQC+USggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJBLoYBcCgXkUiggl0IBuRQKyKVQQC6FAnIpFJDq16//AcjLGczv/edxAAAAAElFTkSuQmCC";
                req.HcmAppId  = "";
                req.Url       = "";

                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                EvaluationResponse resp = client.Evaluation(req).
                                          ConfigureAwait(false).GetAwaiter().GetResult();

                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #10
0
        /// <summary>
        /// CDN刷新
        /// </summary>
        /// <param name="urls"></param>
        /// <returns></returns>
        public async Task<ServiceResult<string>> CdnRefreshAsync(IEnumerable<string> urls)
        {
            var result = new ServiceResult<string>();

            var parameters = new { Urls = urls };
            DoCdnAction(out CdnClient client, out PurgeUrlsCacheRequest req, parameters.ToJson());

            var resp = await client.PurgeUrlsCache(req);

            result.IsSuccess(AbstractModel.ToJsonString(resp));
            return result;
        }
예제 #11
0
        public void cloudCheck()
        {
            String aaaa = path + "aaa.png";

            Console.WriteLine(aaaa);
            String ImagBase64 = ImgToBase64String(aaaa);

            //String ImagBase64 = "";
            //StreamWriter sw = new StreamWriter(Application.StartupPath + "\\Log.txt", true, Encoding.Default);
            //sw.WriteLine(ImagBase64);
            //sw.Close();
            //  Console.WriteLine(ImagBase64);


            try
            {
                Credential cred = new Credential
                {
                    SecretId  = "XXXX",
                    SecretKey = "yyyy"
                };

                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("iai.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;

                IaiClient          client    = new IaiClient(cred, "ap-seoul", clientProfile);
                SearchFacesRequest req       = new SearchFacesRequest();
                string             strParams = "{\"GroupIds\":[\"hjtest\"],\"Image\":\"" + ImagBase64 + "\"}";
                req = SearchFacesRequest.FromJsonString <SearchFacesRequest>(strParams);
                SearchFacesResponse resp = client.SearchFacesSync(req);
                String tt = AbstractModel.ToJsonString(resp);
                //   Console.WriteLine(tt);
                String temp = GetPerson(tt);
                if (temp.Equals("error"))
                {
                    //MessageBox.Show("존재하지 않는 Person");
                }
                else
                {
                }
                // Console.WriteLine(temp);
                ListBoxItemAdd(this, this.listBox1, temp);
            }
            catch (Exception e)
            {
                ListBoxItemAdd(this, this.listBox1, "존재하지 않는 Person");
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
        public void Run()
        {
            try
            {
                TencentCloudAPI manager = new TencentCloudAPI();

                //使用默认配置
                AllocateHostsRequest req1 = new AllocateHostsRequest();
                string strParams1         = "{}";
                req1 = AllocateHostsRequest.FromJsonString <AllocateHostsRequest>(strParams1);

                //使用 CvmClient 相关的方法
                AllocateHostsResponse resp1 = manager.CvmClient.AllocateHosts(req1).ConfigureAwait(false).GetAwaiter().GetResult();

                Console.WriteLine(AbstractModel.ToJsonString(resp1));


                //不使用默认配置
                Credential cred = new Credential
                {
                    SecretId  = "",
                    SecretKey = ""
                };

                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("cbs.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;

                TencentCloudApiClientParam param = new TencentCloudApiClientParam();
                param.ClientProfile = clientProfile;
                param.Credential    = cred;

                //设置 CbsClient 相关的配置
                manager.TencentCloudApiClientParams["CbsClient"] = param;

                DescribeDisksRequest req = new DescribeDisksRequest();
                string strParams         = "{}";
                req = DescribeDisksRequest.FromJsonString <DescribeDisksRequest>(strParams);

                //使用 CbsClient 相关的方法
                DescribeDisksResponse resp = manager.CbsClient.DescribeDisks(req).ConfigureAwait(false).GetAwaiter().GetResult();

                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception ex)
            {
                Console.WriteLine("ex:" + ex.ToString());
                throw ex;
            }
        }
예제 #13
0
        public static List <SMS> PullSMSStatus(string student, string Phone, ulong BeginTime, ulong EndTime)
        {
            Credential cred = new Credential
            {
                SecretId  = "AKIDqZ1DBslX2NUSJvv0U4RYP0LJ4YEeEnTu",
                SecretKey = "PULL6aoKagW5PSFp0sUqxiDSRGpg6EBu"
            };

            ClientProfile clientProfile = new ClientProfile();
            HttpProfile   httpProfile   = new HttpProfile();

            httpProfile.Endpoint      = ("sms.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;

            SmsClient client = new SmsClient(cred, "", clientProfile);
            PullSmsReplyStatusByPhoneNumberRequest req = new PullSmsReplyStatusByPhoneNumberRequest();

            req.PhoneNumber  = "+86" + Phone;
            req.SendDateTime = BeginTime;
            req.EndDateTime  = EndTime;
            req.Limit        = 10;
            req.SmsSdkAppid  = "1400410910";
            req.Offset       = 0;
            string strParams = Newtonsoft.Json.JsonConvert.SerializeObject(req);

            req = PullSmsReplyStatusByPhoneNumberRequest.FromJsonString <PullSmsReplyStatusByPhoneNumberRequest>(strParams);
            PullSmsReplyStatusByPhoneNumberResponse resp = client.PullSmsReplyStatusByPhoneNumberSync(req);

            Console.WriteLine(AbstractModel.ToJsonString(resp));
            List <SMS> ans = new List <SMS>();

            try
            {
                foreach (var x in resp.PullSmsReplyStatusSet)
                {
                    ans.Add(new SMS()
                    {
                        id_student   = student,
                        sendTime     = Convert.ToDateTime(x.ReplyTime),
                        type         = "PullResponse",
                        OperatorName = x.ReplyContent,
                        Status       = 1
                    });
                }
            }
            catch (Exception e)
            {
                throw e;
            }
            return(ans);
        }
예제 #14
0
        public async Task <Response <string> > CdnRefresh(List <string> urls)
        {
            var response = new Response <string>();

            var parameters = new { Urls = urls };

            DoCdnAction(out CdnClient client, out PurgeUrlsCacheRequest req, parameters.SerializeToJson());

            var resp = await client.PurgeUrlsCache(req);

            response.Result = AbstractModel.ToJsonString(resp);

            return(response);
        }
예제 #15
0
        static void Main1(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential
                {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品(以cvm为例)的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                CvmClient client = new CvmClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定DescribeZonesRequest有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                DescribeZonesRequest req = new DescribeZonesRequest();

                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                DescribeZonesResponse resp = client.DescribeZones(req).
                                             ConfigureAwait(false).GetAwaiter().GetResult();

                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #16
0
        public async Task <Response <string> > CdnRefresh(List <string> urls)
        {
            var response = new Response <string>();

            var dic = new Dictionary <string, List <string> > {
                { "Urls", urls }
            };

            DoCdnAction(out CdnClient client, out PurgeUrlsCacheRequest req, dic.SerializeToJson());
            var resp = await client.PurgeUrlsCache(req);

            response.Result = AbstractModel.ToJsonString(resp);

            return(response);
        }
        protected async Task TencentCloudSmsMessageAsync(TencentCloudSmsMessage smsMessage)
        {
            /* 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
             * 你可以直接查询SDK源码确定SendSmsRequest有哪些属性可以设置
             * 属性可能是基本类型,也可能引用了另一个数据结构
             * 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明 */
            SendSmsRequest req = new SendSmsRequest();

            req.SmsSdkAppid = _smsOptions.AppId;
            /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看 */
            req.Sign = string.IsNullOrEmpty(smsMessage.Sign)? _smsOptions.Sign : smsMessage.Sign;
            /* 短信码号扩展号: 默认未开通,如需开通请联系 [sms helper] */
            //req.ExtendCode = "x";
            /* 国际/港澳台短信 senderid: 国内短信填空,默认未开通,如需开通请联系 [sms helper] */
            //req.SenderId = "";
            /* 用户的 session 内容: 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
            //req.SessionContext = "";

            /* 下发手机号码,采用 e.164 标准,+[国家或地区码][手机号]
             * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号*/
            req.PhoneNumberSet = new String[] { smsMessage.PhoneNumber };
            /* 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查看 */
            req.TemplateID = smsMessage.TemplateID;
            /* 模板参数: 若无模板参数,则设置为空*/
            req.TemplateParamSet = smsMessage.TemplateParamSet.Split(";");

            Credential cred = new Credential
            {
                SecretId  = _smsOptions.SecretId,
                SecretKey = _smsOptions.SecretKey
            };
            ClientProfile clientProfile = new ClientProfile();
            HttpProfile   httpProfile   = new HttpProfile();

            httpProfile.Timeout       = 60;
            httpProfile.Endpoint      = "sms.tencentcloudapi.com";
            clientProfile.HttpProfile = httpProfile;
            SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);
            //return client;

            SendSmsResponse resp = await client.SendSms(req);

            //TODO:记录服务器发送信息

            // 输出json格式的字符串回包
            Console.WriteLine(AbstractModel.ToJsonString(resp));
        }
예제 #18
0
        private string GetZonesSync()
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential
                {
                    SecretId  = this.secretIdText.Text,
                    SecretKey = this.secretKeyText.Text
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = this.httpProxyText.Text;

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品(以cvm为例)的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                CvmClient client = new CvmClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定DescribeZonesRequest有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                DescribeZonesRequest req = new DescribeZonesRequest();

                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                DescribeZonesResponse resp = client.DescribeZonesSync(req);
                // Thread.Sleep(60000);
                // 输出json格式的字符串回包
                return(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
        }
예제 #19
0
        public override string OCR(Image image)
        {
            ClientProfile.HttpProfile = HttpProfile;

            OcrClient           client = new OcrClient(Credential, "ap-beijing", ClientProfile);
            AdvertiseOCRRequest req    = new AdvertiseOCRRequest();

            var imageByte = ImageToByte(image);

            req.ImageBase64 = Convert.ToBase64String(imageByte);

            AdvertiseOCRResponse resp = client.AdvertiseOCRSync(req);
            var resultJobj            = JObject.Parse(AbstractModel.ToJsonString(resp));

            var resultWodsJArry = JArray.Parse(resultJobj["TextDetections"].ToString());
            var sb = new StringBuilder("");

            foreach (var item in resultWodsJArry)
            {
                sb.AppendLine(item["DetectedText"].ToString());
            }

            return(sb.ToString());
        }
예제 #20
0
        public static void GetMonitorData(string SecretID, string SecretKey, string Region, string Metric, string InstanceID)
        {
            try
            {
                Credential cred = new Credential
                {
                    SecretId  = SecretID,
                    SecretKey = SecretKey
                };

                ClientProfile clientProfile = new ClientProfile();
                HttpProfile   httpProfile   = new HttpProfile();
                httpProfile.Endpoint      = ("monitor.tencentcloudapi.com");
                clientProfile.HttpProfile = httpProfile;

                MonitorClient         client = new MonitorClient(cred, Region, clientProfile);
                GetMonitorDataRequest req    = new GetMonitorDataRequest();
                req.Namespace  = "QCE/CVM";
                req.MetricName = Metric;
                Instance  instance1  = new Instance();
                Dimension dimension1 = new Dimension();
                dimension1.Name      = "InstanceId";
                dimension1.Value     = InstanceID;
                instance1.Dimensions = new Dimension[] { dimension1 };

                req.Instances = new Instance[] { instance1 };

                GetMonitorDataResponse resp = client.GetMonitorDataSync(req);
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #21
0
        static void Main1(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 指定签名算法(默认为HmacSHA256)
                clientProfile.SignMethod = ClientProfile.SIGN_SHA1;
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // SDK默认使用POST方法。
                // 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求。
                httpProfile.ReqMethod = "POST";
                // SDK有默认的超时时间,非必要请不要进行调整。
                // 如有需要请在代码中查阅以获取最新的默认值。
                httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)
                // SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务,
                // 则必须手动指定域名,例如云服务器的上海金融区域名: aai.ap-shanghai-fsi.tencentcloudapi.com
                httpProfile.Endpoint = ("aai.tencentcloudapi.com");
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品(以cvm为例)的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                AaiClient client = new AaiClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定DescribeInstancesRequest有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                SentenceRecognitionRequest req = new SentenceRecognitionRequest();
                string     path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorChar + "test.mp3";
                FileStream fs   = new FileStream(path, FileMode.Open);
                byte[]     raw  = new byte[fs.Length];
                fs.Read(raw, 0, raw.Length);
                string base64data = Convert.ToBase64String(raw);
                fs.Close();
                // 基本类型的设置。
                req.ProjectId      = 0;
                req.SubServiceType = 2;
                req.EngSerViceType = "16k";
                req.SourceType     = 1;
                req.VoiceFormat    = "mp3";
                req.UsrAudioKey    = "5c79510a12da-whatever";
                req.Data           = base64data;
                req.DataLen        = base64data.Length;
                // 数组类型的设置。

                // 复杂对象的设置。


                //// 这里还支持以标准json格式的string来赋值请求参数的方式。下面的代码跟上面的参数赋值是等效的
                //string strParams = "{\"Filters\":[{\"Name\":\"zone\",\"Values\":[\"ap-guangzhou-1\",\"ap-guangzhou-2\"]}]}";
                //req = DescribeInstancesRequest.FromJsonString<DescribeInstancesRequest>(strParams);

                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                SentenceRecognitionResponse resp = client.SentenceRecognitionSync(req);

                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }

            Console.Read();
        }
예제 #22
0
        public void Test()
        {
            int createFileIndex = 1;

            string[] allFiles = Directory.GetFiles(path, "*.xlsx");
            foreach (string strFile in allFiles)
            {
                File.Delete(strFile);
            }
            ListBoxItemAdd(this, this.listBox1, "프로그램 시작 합니다. ^_^");
            foreach (int indexChecked in checkedListBox1.CheckedIndices)
            {
                String lineStr = tt[indexChecked].ToString();
                Console.WriteLine(lineStr);
                try
                {
                    string[] sArray = lineStr.Split('	');
                    if (sArray.Count() < 2)                                      //작업완료 판단
                    {
                        break;
                    }

                    Company            = sArray[0];
                    UIN                = sArray[1].Replace(" ", "");
                    SecretIdfromeFile  = sArray[2].Replace(" ", "");
                    SecretKeyfromeFile = sArray[3].Replace(" ", "");
                    SecretKeyfromeFile = sArray[3].Replace(" ", "");
                    CVMRegion          = sArray[4].Replace(" ", "");

                    BeginTime = dateTimePicker1.Value.ToString("yyyy-MM-01 00:00:00");
                    EndTime   = dateTimePicker1.Value.ToString("yyyy-MM-01 00:00:01");
                    months    = dateTimePicker1.Value.ToString("yyyy년MM월");
                    Console.WriteLine(Company);
                    Console.WriteLine(UIN);
                    Console.WriteLine(SecretIdfromeFile);
                    Console.WriteLine(SecretKeyfromeFile);
                    Console.WriteLine(BeginTime);
                    Console.WriteLine(EndTime);
                    Thread.Sleep(1000);
                    ListBoxItemAdd(this, this.listBox1, "======<< 업체명 : " + Company + " >>=====");

                    fileName = createFileIndex + "-" + Company + "-" + months + ".xlsx";   //파일생성
                    WriteExel(fileName, 1, 1, "TotalCost");
                    WriteExel("모든업체-" + months + ".xlsx", allCompanyIndex, 1, Company);

                    Credential cred = new Credential
                    {
                        SecretId  = SecretIdfromeFile,
                        SecretKey = SecretKeyfromeFile
                    };

                    ClientProfile clientProfile = new ClientProfile();
                    HttpProfile   httpProfile   = new HttpProfile();
                    httpProfile.Endpoint      = ("billing.tencentcloudapi.com");
                    clientProfile.HttpProfile = httpProfile;
                    BillingClient client = new BillingClient(cred, CVMRegion, clientProfile);
                    DescribeBillSummaryByProductRequest req = new DescribeBillSummaryByProductRequest();
                    string strParams = "{\"PayerUin\":\"" + UIN + "\",\"BeginTime\":\"" + BeginTime + "\",\"EndTime\":\"" + EndTime + "\"}";
                    req = DescribeBillSummaryByProductRequest.FromJsonString <DescribeBillSummaryByProductRequest>(strParams);
                    DescribeBillSummaryByProductResponse resp = client.DescribeBillSummaryByProduct(req).ConfigureAwait(false).GetAwaiter().GetResult();
                    //  Console.WriteLine(AbstractModel.ToJsonString(resp));
                    String ttt = AbstractModel.ToJsonString(resp);

                    String total = GetSummaryTotal(ttt);
                    WriteExel(fileName, 1, 2, total);
                    WriteExel("모든업체-" + months + ".xlsx", allCompanyIndex, 2, total);
                    allCompanyIndex++;

                    ListBoxItemAdd(this, this.listBox1, "Total : =》  " + total);

                    Dictionary <string, string> Overview = GetSummaryOverview(ttt);
                    exelIndex = 2;
                    foreach (var item in Overview)
                    {
                        Console.WriteLine(item.Key + item.Value);
                        WriteExel(fileName, exelIndex, 1, item.Key);
                        WriteExel(fileName, exelIndex, 2, item.Value);
                        exelIndex++;
                        ListBoxItemAdd(this, this.listBox1, item.Key + "  --->    " + item.Value);
                    }
                    createFileIndex++;
                    Thread.Sleep(100);
                }
                catch (Exception e)
                {
                    //WriteExel(fileName, exelIndex, 1, Company);
                    WriteExel("모든업체-" + months + ".xlsx", allCompanyIndex, 2, "에러");
                    createFileIndex++;
                    ListBoxItemAdd(this, this.listBox1, "<< 업체명 : " + Company + " >> 요금 실패~~");
                }
                ListBoxItemAdd(this, this.listBox1, " ");
                ListBoxItemAdd(this, this.listBox1, " ");
            }
        }
예제 #23
0
        static void Main1(string[] args)
        {
            try
            {
                /* 必要步骤:
                 * 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                 * 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                 * 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                 * 以免泄露密钥对危及你的财产安全。
                 * CAM密匙查询: https://console.cloud.tencent.com/cam/capi*/
                Credential cred = new Credential {
                    SecretId  = "xxx",
                    SecretKey = "xxx"
                };

                /*
                 * Credential cred = new Credential {
                 *  SecretId = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                 *  SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                 * };*/

                /* 非必要步骤:
                 * 实例化一个客户端配置对象,可以指定超时时间等配置 */
                ClientProfile clientProfile = new ClientProfile();

                /* SDK默认用TC3-HMAC-SHA256进行签名
                 * 非必要请不要修改这个字段 */
                clientProfile.SignMethod = ClientProfile.SIGN_TC3SHA256;

                /* 非必要步骤
                 * 实例化一个客户端配置对象,可以指定超时时间等配置 */
                HttpProfile httpProfile = new HttpProfile();

                /* SDK默认使用POST方法。
                 * 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求 */
                httpProfile.ReqMethod = "GET";

                /* SDK有默认的超时时间,非必要请不要进行调整
                * 如有需要请在代码中查阅以获取最新的默认值 */
                httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)

                /* SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务
                 * 则必须手动指定域名,例如sms的上海金融区域名: sms.ap-shanghai-fsi.tencentcloudapi.com */
                httpProfile.Endpoint = "sms.tencentcloudapi.com";
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                /* 实例化要请求产品(以sms为例)的client对象
                 * 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量 */
                SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);

                /* 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                 * 你可以直接查询SDK源码确定SendSmsRequest有哪些属性可以设置
                 * 属性可能是基本类型,也可能引用了另一个数据结构
                 * 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明 */
                SendSmsRequest req = new SendSmsRequest();

                /* 基本类型的设置:
                 * SDK采用的是指针风格指定参数,即使对于基本类型你也需要用指针来对参数赋值。
                 * SDK提供对基本类型的指针引用封装函数
                 * 帮助链接:
                 * 短信控制台: https://console.cloud.tencent.com/sms/smslist
                 * sms helper: https://cloud.tencent.com/document/product/382/3773 */

                req.SmsSdkAppid = "1400787878";
                /* 短信签名内容: 使用 UTF-8 编码,必须填写已审核通过的签名,签名信息可登录 [短信控制台] 查看 */
                req.Sign = "xxx";
                /* 短信码号扩展号: 默认未开通,如需开通请联系 [sms helper] */
                req.ExtendCode = "x";
                /* 国际/港澳台短信 senderid: 国内短信填空,默认未开通,如需开通请联系 [sms helper] */
                req.SenderId = "";
                /* 用户的 session 内容: 可以携带用户侧 ID 等上下文信息,server 会原样返回 */
                req.SessionContext = "";

                /* 下发手机号码,采用 e.164 标准,+[国家或地区码][手机号]
                 * 示例如:+8613711112222, 其中前面有一个+号 ,86为国家码,13711112222为手机号,最多不要超过200个手机号*/
                req.PhoneNumberSet = new String[] { "+8613711112222" };
                /* 模板 ID: 必须填写已审核通过的模板 ID。模板ID可登录 [短信控制台] 查看 */
                req.TemplateID = "449739";
                /* 模板参数: 若无模板参数,则设置为空*/
                req.TemplateParamSet = new String[] { "666" };


                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                SendSmsResponse resp = client.SendSms(req).
                                       ConfigureAwait(false).GetAwaiter().GetResult();

                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #24
0
        static void Main(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 指定签名算法(默认为HmacSHA256)
                clientProfile.SignMethod = ClientProfile.SIGN_TC3SHA256;
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // SDK默认使用POST方法。
                // 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求。
                httpProfile.ReqMethod = "GET";
                // SDK有默认的超时时间,非必要请不要进行调整。
                // 如有需要请在代码中查阅以获取最新的默认值。
                httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)
                // SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务,
                // 则必须手动指定域名,例如云服务器的上海金融区域名: cvm.ap-shanghai-fsi.tencentcloudapi.com
                httpProfile.Endpoint = "cvm.tencentcloudapi.com";
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品(以cvm为例)的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                CvmClient client = new CvmClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定DescribeInstancesRequest有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                DescribeInstancesRequest req = new DescribeInstancesRequest();

                // 基本类型的设置。
                // 此接口允许设置返回的实例数量。此处指定为只返回一个。
                // SDK采用的是指针风格指定参数,即使对于基本类型你也需要用指针来对参数赋值。
                // SDK提供对基本类型的指针引用封装函数
                req.Limit = 1;
                // 数组类型的设置。
                // 此接口允许指定实例 ID 进行过滤,但是由于和接下来要演示的 Filter 参数冲突,先注释掉。
                // req.InstanceIds = new string[] { "ins-r8hr2upy" };

                // 复杂对象的设置。
                // 在这个接口中,Filters是数组,数组的元素是复杂对象Filter,Filter的成员Values是string数组。
                // 填充请求参数,这里request对象的成员变量即对应接口的入参
                // 你可以通过官网接口文档或跳转到request对象的定义处查看请求参数的定义
                Filter zoneFilter = new Filter(); // 创建Filter对象, 以zone的维度来查询cvm实例
                zoneFilter.Name   = "zone";
                zoneFilter.Values = new string[] { "ap-guangzhou-1", "ap-guangzhou-2" };
                Filter nameFilter = new Filter();
                nameFilter.Name   = "instance-name";
                nameFilter.Values = new string[] { "中文测试" };
                req.Filters       = new Filter[] { zoneFilter, nameFilter }; // Filters 是成员为Filter对象的列表

                //// 这里还支持以标准json格式的string来赋值请求参数的方式。下面的代码跟上面的参数赋值是等效的
                //string strParams = "{\"Filters\":[{\"Name\":\"zone\",\"Values\":[\"ap-guangzhou-1\",\"ap-guangzhou-2\"]}]}";
                //req = DescribeInstancesRequest.FromJsonString<DescribeInstancesRequest>(strParams);

                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                DescribeInstancesResponse resp = client.DescribeInstances(req).
                                                 ConfigureAwait(false).GetAwaiter().GetResult();

                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));

                // 也可以取出单个值。
                // 你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
                Console.WriteLine(resp.TotalCount);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #25
0
        static void Main2(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential
                {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 指定签名算法(默认为HmacSHA256)
                clientProfile.SignMethod = ClientProfile.SIGN_SHA1;
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // SDK默认使用POST方法。
                // 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求。
                httpProfile.ReqMethod = "POST";
                // SDK有默认的超时时间,非必要请不要进行调整。
                // 如有需要请在代码中查阅以获取最新的默认值。
                httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)
                // SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务,
                // 则必须手动指定域名,例如云服务器的上海金融区域名: cvm.ap-shanghai-fsi.tencentcloudapi.com
                httpProfile.Endpoint = ("tmt.tencentcloudapi.com");
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                TmtClient client = new TmtClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定ImageTranslateRequest 有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                TextTranslateRequest req = new TextTranslateRequest();
                //req.SessionUuid = Guid.NewGuid().ToString();
                //req.Scene = "doc";
                //string imageData = GetImageBase64(@"D:\workshop\社区活动\1672483724\1672483724.inv.201809181403110010.png");
                //req.Data = imageData;
                req.Source     = "en";
                req.Target     = "zh";
                req.SourceText = @"Blazor is a .NET web framework that runs in any browser. You author Blazor apps using C#/Razor and HTML.

Blazor uses only the latest web standards. No plugins or transpilation needed. It runs in the browser on a real .NET runtime (Mono) implemented in WebAssembly that executes normal .NET assemblies. It works in older browsers too by falling back to an asm.js based .NET runtime.

Blazor will have all the features of a modern web framework, including:

A component model for building composable UI
Routing
Layouts
Forms and validation
Dependency injection
JavaScript interop
Live reloading in the browser during development
Server-side rendering
Full .NET debugging both in browsers and in the IDE
Rich IntelliSense and tooling
Ability to run on older (non-WebAssembly) browsers via asm.js
Publishing and app size trimming";
                req.ProjectId  = 0;

                var resp = client.TextTranslate(req).ConfigureAwait(false).GetAwaiter().GetResult();
                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));

                // 也可以取出单个值。
                // 你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
                Console.WriteLine(resp.Target);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
        // 该示例要运行成功,需要修改一些网络和安全组的设置。
        // 请慎重运行该示例,因为创建成功后会产生扣费。
        static void Main1(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential
                {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品(以cvm为例)的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                CvmClient client = new CvmClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定DescribeZonesRequest有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                RunInstancesRequest req = new RunInstancesRequest();

                Placement placement = new Placement();
                placement.Zone = "ap-guangzhou-3";
                req.Placement  = placement;

                req.ImageId            = "img-8toqc6s3";
                req.InstanceChargeType = "POSTPAID_BY_HOUR";
                req.InstanceName       = "DOTNET_SDK_TEST";
                req.InstanceType       = "S2.SMALL1";

                InternetAccessible ia = new InternetAccessible();
                ia.InternetChargeType      = "BANDWIDTH_POSTPAID_BY_HOUR";
                ia.InternetMaxBandwidthOut = 10;
                ia.PublicIpAssigned        = true;
                req.InternetAccessible     = ia;

                LoginSettings ls = new LoginSettings();
                ls.Password       = "******";
                req.LoginSettings = ls;

                req.SecurityGroupIds = new string[] { "sg-icy671l9" };

                SystemDisk sd = new SystemDisk();
                sd.DiskSize    = 50;
                sd.DiskType    = "CLOUD_BASIC";
                req.SystemDisk = sd;

                VirtualPrivateCloud vpc = new VirtualPrivateCloud();
                vpc.VpcId               = "vpc-8ek64x3d";
                vpc.SubnetId            = "subnet-b1wk8b10";
                req.VirtualPrivateCloud = vpc;

                // 通过client对象调用DescribeInstances方法发起请求。注意请求方法名与请求对象是对应的
                // 返回的resp是一个DescribeInstancesResponse类的实例,与请求对象对应
                RunInstancesResponse resp = client.RunInstancesSync(req);

                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #27
0
        static void Main(string[] args)
        {
            try
            {
                // 必要步骤:
                // 实例化一个认证对象,入参需要传入腾讯云账户密钥对secretId,secretKey。
                // 这里采用的是从环境变量读取的方式,需要在环境变量中先设置这两个值。
                // 你也可以直接在代码中写死密钥对,但是小心不要将代码复制、上传或者分享给他人,
                // 以免泄露密钥对危及你的财产安全。
                Credential cred = new Credential
                {
                    SecretId  = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                    SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                };

                // 实例化一个client选项,可选的,没有特殊需求可以跳过
                ClientProfile clientProfile = new ClientProfile();
                // 指定签名算法(默认为HmacSHA256)
                clientProfile.SignMethod = ClientProfile.SIGN_SHA1;
                // 非必要步骤
                // 实例化一个客户端配置对象,可以指定超时时间等配置
                HttpProfile httpProfile = new HttpProfile();
                // SDK默认使用POST方法。
                // 如果你一定要使用GET方法,可以在这里设置。GET方法无法处理一些较大的请求。
                httpProfile.ReqMethod = "POST";
                // SDK有默认的超时时间,非必要请不要进行调整。
                // 如有需要请在代码中查阅以获取最新的默认值。
                httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)
                // SDK会自动指定域名。通常是不需要特地指定域名的,但是如果你访问的是金融区的服务,
                // 则必须手动指定域名,例如云服务器的上海金融区域名: cvm.ap-shanghai-fsi.tencentcloudapi.com
                httpProfile.Endpoint = ("tmt.tencentcloudapi.com");
                // 代理服务器,当你的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                // 实例化要请求产品的client对象
                // 第二个参数是地域信息,可以直接填写字符串ap-guangzhou,或者引用预设的常量,clientProfile是可选的
                TmtClient client = new TmtClient(cred, "ap-guangzhou", clientProfile);

                // 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                // 你可以直接查询SDK源码确定ImageTranslateRequest 有哪些属性可以设置,
                // 属性可能是基本类型,也可能引用了另一个数据结构。
                // 推荐使用IDE进行开发,可以方便的跳转查阅各个接口和数据结构的文档说明。
                ImageTranslateRequest req = new ImageTranslateRequest();
                req.SessionUuid = Guid.NewGuid().ToString();
                req.Scene       = "doc";
                string imageData = ImageHelper.GetImageBase64(@"D:\workshop\Github\TencentMTDemo\20180928133022.jpg");
                req.Data      = imageData;
                req.Source    = "zh";
                req.Target    = "en";
                req.ProjectId = 0;
                var resp = client.ImageTranslate(req).ConfigureAwait(false).GetAwaiter().GetResult();
                // 输出json格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));

                // 也可以取出单个值。
                // 你可以通过官网接口文档或跳转到response对象的定义处查看返回字段的定义
                Console.WriteLine(resp.Target);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }
예제 #28
0
        /// <summary>
        /// 图片翻译
        /// </summary>
        /// <param name="img">图片</param>
        /// <param name="from">源语言</param>
        /// <param name="to">目标语言</param>
        public static void PictureTranslation(Image img, string from, string to, out string src_text, out string dst_text)
        {
            if (TengxunKey.IsEmptyOrNull)
            {
                throw new Exception("请设置腾讯图片翻译Key!");
            }

            Credential cred = new Credential
            {
                SecretId  = TengxunKey.SecretId,
                SecretKey = TengxunKey.SecretKey
            };

            ClientProfile clientProfile = new ClientProfile();
            HttpProfile   httpProfile   = new HttpProfile();

            httpProfile.Timeout       = 6;
            httpProfile.Endpoint      = ("tmt.tencentcloudapi.com");
            clientProfile.HttpProfile = httpProfile;
            TmtClient             client = new TmtClient(cred, "ap-guangzhou", clientProfile);
            ImageTranslateRequest req    = new ImageTranslateRequest();

            req.SessionUuid = DateTime.Now.ToString("G");
            req.Scene       = DateTime.Now.ToString("G");
            req.Data        = ImageToBase64(img);
            req.Source      = from;
            req.Target      = to;
            req.ProjectId   = 0;
            ImageTranslateResponse resp;

            try
            {
                resp = client.ImageTranslateSync(req);
            }
            catch (Exception ex) { throw ex.InnerException; }
            string result = AbstractModel.ToJsonString(resp);
            var    list   = JsonConvert.DeserializeObject <PictureTranslationJson>(result);

            if (list.ImageRecord.Value.Count == 0)
            {
                throw new Exception("未识别到文字!");
            }
            // 接收序列化后的数据
            StringBuilder dst = new StringBuilder();
            StringBuilder src = new StringBuilder();

            foreach (var item in list.ImageRecord.Value)
            {
                src.Append(item.SourceText + "\r\n");
                if (string.IsNullOrEmpty(item.TargetText))
                {
                    continue;
                }
                dst.Append(item.TargetText + "\r\n");
            }

            if (dst.Length == 0)
            {
                throw new Exception("翻译失败!");
            }
            src_text = src.ToString();
            dst_text = dst.ToString();
            int sLen = src_text.LastIndexOf('\r');
            int dLen = dst_text.LastIndexOf('\r');

            src_text = (sLen != -1) ? src_text.Remove(sLen) : src_text;
            dst_text = (dLen != -1) ? dst_text.Remove(dLen) : dst_text;
        }
예제 #29
0
        static void Main(string[] args)
        {
            try
            {
                /* 必要步骤:
                 * 实例化一个认证对象,入参需要传入腾讯云账户密钥对 secretId 和 secretKey
                 * 本示例采用从环境变量读取的方式,需要预先在环境变量中设置这两个值
                 * 您也可以直接在代码中写入密钥对,但需谨防泄露,不要将代码复制、上传或者分享给他人
                 * CAM 密匙查询:https://console.cloud.tencent.com/cam/capi*/
                Credential cred = new Credential
                {
                    SecretId  = "xxx",
                    SecretKey = "xxx"
                };

                /*
                 * Credential cred = new Credential {
                 *  SecretId = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_ID"),
                 *  SecretKey = Environment.GetEnvironmentVariable("TENCENTCLOUD_SECRET_KEY")
                 * };*/

                /* 非必要步骤:
                 * 实例化一个客户端配置对象,可以指定超时时间等配置 */
                ClientProfile clientProfile = new ClientProfile();

                /* SDK 默认用 TC3-HMAC-SHA256 进行签名
                 * 非必要请不要修改该字段 */
                clientProfile.SignMethod = ClientProfile.SIGN_TC3SHA256;

                /* 非必要步骤
                 * 实例化一个客户端配置对象,可以指定超时时间等配置 */
                HttpProfile httpProfile = new HttpProfile();

                /* SDK 默认使用 POST 方法
                 * 如需使用 GET 方法,可以在此处设置,但 GET 方法无法处理较大的请求 */
                httpProfile.ReqMethod = "POST";

                /* SDK 有默认的超时时间,非必要请不要进行调整
                 * 如有需要请在代码中查阅以获取最新的默认值 */
                httpProfile.Timeout = 10; // 请求连接超时时间,单位为秒(默认60秒)

                /* SDK 会自动指定域名,通常无需指定域名,但访问金融区的服务时必须手动指定域名
                 * 例如 SMS 的上海金融区域名为 sms.ap-shanghai-fsi.tencentcloudapi.com */
                httpProfile.Endpoint = "sms.tencentcloudapi.com";
                // 代理服务器,当您的环境下有代理服务器时设定
                httpProfile.WebProxy = Environment.GetEnvironmentVariable("HTTPS_PROXY");

                clientProfile.HttpProfile = httpProfile;

                /* 实例化 SMS 的 client 对象
                 * 第二个参数是地域信息,可以直接填写字符串 ap-guangzhou,或者引用预设的常量 */
                SmsClient client = new SmsClient(cred, "ap-guangzhou", clientProfile);

                /* 实例化一个请求对象,根据调用的接口和实际情况,可以进一步设置请求参数
                 * 您可以直接查询 SDK 源码确定 SendSmsRequest 有哪些属性可以设置
                 * 属性可能是基本类型,也可能引用了另一个数据结构
                 * 推荐使用 IDE 进行开发,可以方便地跳转查阅各个接口和数据结构的文档说明 */
                SendStatusStatisticsRequest req = new SendStatusStatisticsRequest();

                /* 基本类型的设置:
                 * SDK 采用的是指针风格指定参数,即使对于基本类型也需要用指针来对参数赋值
                 * SDK 提供对基本类型的指针引用封装函数
                 * 帮助链接:
                 * 短信控制台:https://console.cloud.tencent.com/sms/smslist
                 * sms helper:https://cloud.tencent.com/document/product/382/3773 */

                /* 短信应用 ID: 在 [短信控制台] 添加应用后生成的实际 SDKAppID,例如1400006666 */
                req.SmsSdkAppid = "1400009099";
                // 设置拉取最大条数,最多100条
                req.Limit = 5L;
                /* 偏移量,目前固定设置为0 */
                req.Offset = 0L;
                /* 开始时间,yyyymmddhh 需要拉取的起始时间,精确到小时 */
                req.StartDateTime = "2019071100";

                /* 结束时间,yyyymmddhh 需要拉取的截止时间,精确到小时
                 * 注:EndDataTime 必须大于 StartDateTime */
                req.EndDataTime = "2019071123";

                // 通过 client 对象调用 AddSmsTemplateRequest 方法发起请求,注意请求方法名与请求对象是对应的
                // 返回的 resp 是一个 AddSmsTemplateResponse 类的实例,与请求对象对应
                SendStatusStatisticsResponse resp = client.SendStatusStatisticsRequest(req);

                // 输出 JSON 格式的字符串回包
                Console.WriteLine(AbstractModel.ToJsonString(resp));
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            Console.Read();
        }