示例#1
0
        public virtual void Push(Guid[] devices, params object[] objs)
        {
            String vpath = this.Provider["authkey"];

            if (String.IsNullOrEmpty(vpath) == false && devices.Length > 0 && objs.Length > 0)
            {
                String sts = String.Format("https://ali.365lu.cn/OSS/Push/{0}", this.Provider["authkey"]);


                var httpClient = new UMC.Net.HttpClient();
                var res        = httpClient.PostAsync(sts, new System.Net.Http.StringContent(JSON.Serialize(new Web.WebMeta().Put("device", devices).Put("data", objs)))).Result;
            }
        }
示例#2
0
        public virtual void Transfer(Uri uri, Guid guid, int seq, string type)
        {
            String vpath = this.Provider["authkey"];

            if (String.IsNullOrEmpty(vpath) == false)
            {
                String code = Utility.ParseEncode(Utility.Guid(vpath).GetHashCode(), 36);
                vpath = code + "/";


                String key = String.Format("{0}images/{1}/{2}/{3}.{4}", vpath, guid, seq, 0, type.ToLower());


                String sts = String.Format("https://ali.365lu.cn/OSS/Transfer/{0}", this.Provider["authkey"]);


                var httpClient = new UMC.Net.HttpClient();
                var res        = httpClient.PostAsync(sts, new System.Net.Http.StringContent(JSON.Serialize(new Web.WebMeta().Put("src", uri.AbsoluteUri, "key", key)))).Result;
            }
        }
示例#3
0
        public virtual void Transfer(Uri soureUrl, string targetKey)
        {
            if (targetKey.StartsWith("bin/", StringComparison.CurrentCultureIgnoreCase))
            {
                return;
            }
            else if (targetKey.StartsWith("app_data/", StringComparison.CurrentCultureIgnoreCase))
            {
                return;
            }
            else if (targetKey.StartsWith("UserResources/") || targetKey.StartsWith("images/"))
            {
                var httpClient = new UMC.Net.HttpClient();

                Utility.Copy(httpClient.GetStreamAsync(soureUrl).Result, Utility.MapPath(targetKey));
            }
            else if (targetKey.IndexOf('.') == -1)
            {
                var httpClient = new UMC.Net.HttpClient();

                Transfer(httpClient.GetStreamAsync(soureUrl).Result, targetKey);
            }
        }