Ejemplo n.º 1
0
        /// <summary>
        /// 获得文件下载链接
        /// </summary>
        /// <param name="fileName">文件名</param>
        /// <returns></returns>
        public static string Download(string fileName)
        {
            string baseUrl    = GetPolicy.MakeBaseUrl(_domain, fileName);
            string privateUrl = GetPolicy.MakeRequest(baseUrl);

            return(privateUrl);
        }
Ejemplo n.º 2
0
        public void MakeRequestTest()
        {
            string  url    = GetPolicy.MakeBaseUrl("qiniuphotos.qiniudn.com", "gogopher.jpg");          // TODO: 初始化为适当的值
            string  actual = Exif.MakeRequest(url);
            ExifRet ret    = Exif.Call(actual);

            Assert.IsTrue(ret.OK, "MakeRequestTest Failure");
        }
Ejemplo n.º 3
0
        public void MakeBaseUrlTest()
        {
            string actual;

            actual = GetPolicy.MakeBaseUrl(Bucket + ".qiniudn.com", LocalKey);
            //System.Diagnostics.Process.Start(actual);
            PrintLn(actual);
            Assert.IsTrue(!string.IsNullOrEmpty(actual), "GetPolicyTest MakeBaseUrlTest Failure");
        }
Ejemplo n.º 4
0
        public async Task MakeRequestTest()
#endif
        {
            string url    = GetPolicy.MakeBaseUrl("qiniuphotos.qiniudn.com", "gogopher.jpg");           // TODO: 初始化为适当的值
            string actual = Exif.MakeRequest(url);

#if NET20 || NET40
            ExifRet ret = Exif.Call(actual);
            Assert.IsTrue(ret.OK, "MakeRequestTest Failure");
#else
            ExifRet ret = await Exif.CallAsync(actual);

            Assert.True(ret.OK, "MakeRequestTest Failure");
#endif
        }
Ejemplo n.º 5
0
        public string GetDownloadUrl(string fileKey, string type = "image")
        {
            string bucket;
            string domain;

            GetTokenAndDomain(type, out bucket, out domain);
            if (type == "video")
            {
                if (string.IsNullOrWhiteSpace(fileKey))
                {
                    return(string.Empty);
                }
                string baseUrl    = GetPolicy.MakeBaseUrl(domain, fileKey);
                string privateUrl = GetPolicy.MakeRequest(baseUrl);
                return(privateUrl);
            }
            else
            {
                return(string.Format("http://{0}/{1}", domain, fileKey));
            }
        }
Ejemplo n.º 6
0
 /// <summary>
 /// 获得url地址
 /// </summary>
 /// <returns></returns>
 public static string GetUrl(string key)
 {
     return(GetPolicy.MakeBaseUrl(Url, key));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// 获取下载连接
        /// </summary>
        /// <returns></returns>
        public static string MakeGetToken()
        {
            string baseUrl = GetPolicy.MakeBaseUrl(domain, key);

            return(GetPolicy.MakeRequest(baseUrl));
        }
Ejemplo n.º 8
0
        public static string GetPrivateThumbUrl(string domain, string bucket_name, string key)
        {
            string baseUrl = string.Format(GetPolicy.MakeBaseUrl(domain, key), bucket_name) + "?imageView2/1/w/50/h/50/q/75";

            return(GetPolicy.MakeRequest(baseUrl, 3600u, null));
        }
Ejemplo n.º 9
0
        public static string GetPublicThumbUrl(string domain, string bucket_name, string key)
        {
            string format = GetPolicy.MakeBaseUrl(domain, key) + "?imageView2/1/w/50/h/50/q/75";

            return(string.Format(format, bucket_name));
        }
Ejemplo n.º 10
0
        public static string GetDownloadUrlWithToken(string domain, string bucket_name, string key)
        {
            string baseUrl = string.Format(GetPolicy.MakeBaseUrl(domain, key), bucket_name);

            return(GetPolicy.MakeRequest(baseUrl, 3600u, null));
        }
Ejemplo n.º 11
0
        public static string GetDownloadUrl(string domain, string bucket_name, string key)
        {
            string format = GetPolicy.MakeBaseUrl(domain, key);

            return(string.Format(format, bucket_name));
        }