Пример #1
0
        public object Run()
        {
            var cusParam = new BatchCustomPathWoffFontFaceParam();

            //开始构建生成项
            cusParam.Datas.Add(new CustomPathFontFaceParam
            {
                AccessKey = "xxx",
                Content   = "有字库,让中文跃上云端!",
                Url       = "youziku/test-1"
            });
            cusParam.Datas.Add(new CustomPathFontFaceParam
            {
                AccessKey = "xxx",
                Content   = "有字库,让中文跃上云端!",
                Url       = "youziku/test-2"
            });

            //全格式
            var response1 = YouzikuClient.GetCustomPathBatchWebFont(cusParam);

            //2.Woff格式
            var response2 = YouzikuClient.GetCustomPathBatchWoffWebFont(cusParam);


            return(null);
        }
Пример #2
0
        /// <summary>
        ///异步请求 自定义路径接口;该接口底层实现为异步
        /// </summary>
        /// <param name="param">请求参数</param>
        /// <returns></returns>
        public Task <BatchCustomPathFontFaceResult> GetCustomPathBatchWebFontAsync(
            BatchCustomPathWoffFontFaceParam param)
        {
            var paramDic = ParamBuilder.GetCustomPathFontFace(param, _config);

            return(CommonGetFontFaceAsync <BatchCustomPathFontFaceResult>(paramDic, _config.Host + ServiceMethod.CustomPath.CreateBatchWebFont, _config));
        }
Пример #3
0
        public async Task <dynamic> Run(dynamic param = null)
        {
            var cusParam = new BatchCustomPathWoffFontFaceParam();

            //开始构建生成项
            cusParam.Datas.Add(new CustomPathFontFaceParam
            {
                AccessKey = "xxx",
                Content   = "有字库,让中文跃上云端!异步",
                Url       = "youziku/async/test-1"
            });
            cusParam.Datas.Add(new CustomPathFontFaceParam
            {
                AccessKey = "9a81f34c66f54248925999c330feec51 ",
                Content   = "有字库,让中文跃上云端!异步",
                Url       = "youziku/async/test-2"
            });

            //全格式
            var response1 = await YouzikuClient.GetCustomPathBatchWebFontAsync(cusParam);

            //2.Woff格式
            var response2 = await YouzikuClient.GetCustomPathBatchWoffWebFontAsync(cusParam);


            return(null);
        }
Пример #4
0
 /// <summary>
 /// 验证CreateBatchWoffWebFontAsync 自定义路径接口
 /// </summary>
 /// <param name="param">请求参数</param>
 public static void CreateCustomPathBatchWoffWebFont(BatchCustomPathWoffFontFaceParam param)
 {
     if (param == null)
     {
         throw new ArgumentException(nameof(BatchCustomPathWoffFontFaceParam) + " instance is null!");
     }
     if (param.Datas.Count <= 0)
     {
         throw new ArgumentException(nameof(BatchCustomPathWoffFontFaceParam) + " field Datas.Count<=0!");
     }
 }
Пример #5
0
        /// <summary>
        /// GetCustomPathFontFace 自定义路径接口
        /// </summary>
        /// <param name="param">param</param>
        /// <param name="config">config</param>
        /// <returns></returns>
        public static IDictionary <string, string> GetCustomPathFontFace(BatchCustomPathWoffFontFaceParam param, YouzikuConfig config)
        {
            ParamValidate.CreateCustomPathBatchWoffWebFont(param);
            //builder batch param
            var paramDic = new Dictionary <string, string>
            {
                { "ApiKey", config.ApiKey }
            };

            for (var i = 0; i < param.Datas.Count; i++)
            {
                paramDic.Add($"Datas[{i}][AccessKey]", param.Datas[i].AccessKey);
                paramDic.Add($"Datas[{i}][Url]", param.Datas[i].Url);
                paramDic.Add($"Datas[{i}][Content]", param.Datas[i].Content.Replace("&", string.Empty));
            }

            return(paramDic);
        }