예제 #1
0
        public AMeta Copyto(AMeta meta, string dstPath, string dstName)
        {
            ResetParams();
            string url = KuaipanServer.COPYTO;

            PrepareParams();
            AddParam(OAuthConstants.OAUTH_TOKEN, Token.Token);
            AddParam("root", _Root);
            AddParam("from_path", meta.GetMeta());
            AddParam("to_path", Combine(dstPath, dstName));
            SortParam();
            AddParam(OAuthConstants.OAUTH_SIGNATURE, Signature(GenerateBaseString(url)));

            string t = GenBaseParams();
            byte[] r = _Server.Get(url, t);
            if (r == null || r.Length < 1)
            {
                return null;
            }

            t = GetString(r);
            KuaipanMeta m1 = meta as KuaipanMeta;
            KuaipanMeta m2 = JsonConvert.DeserializeObject<KuaipanMeta>(t);
            m2.root = m1.root;
            m2.path = dstPath;
            m2.name = dstName;
            m2.hash = m1.hash;
            m2.type = m1.type;
            m2.size = m1.size;
            m2.create_time = m1.create_time;
            m2.modify_time = m1.modify_time;
            return m2;
        }
예제 #2
0
        public AMeta Moveto(AMeta meta, string dstPath, string dstName)
        {
            ResetParams();
            string url = KuaipanServer.MOVETO;

            PrepareParams();
            AddParam(OAuthConstants.OAUTH_TOKEN, Token.Token);
            AddParam("root", _Root);
            AddParam("from_path", meta.GetMeta());
            AddParam("to_path", Combine(dstPath, dstName));
            SortParam();
            AddParam(OAuthConstants.OAUTH_SIGNATURE, Signature(GenerateBaseString(url)));

            string t = GenBaseParams();
            byte[] r = _Server.Get(url, t);
            if (r == null || r.Length < 1)
            {
                return null;
            }

            //t = GetString(r);
            //JsonConvert.DeserializeObject<CsMeta>(t);
            KuaipanMeta m1 = meta as KuaipanMeta;
            m1.path = dstPath;
            m1.name = dstName;
            return m1;
        }
예제 #3
0
        public AMetaRef CopyRef(AMeta meta)
        {
            ResetParams();
            string url = string.Format(KuaipanServer.COPYREF, _Root, meta.GetMeta());

            PrepareParams();
            AddParam(OAuthConstants.OAUTH_TOKEN, Token.Token);
            SortParam();
            AddParam(OAuthConstants.OAUTH_SIGNATURE, Signature(GenerateBaseString(url)));

            string t = GenBaseParams();
            byte[] r = _Server.Get(url, t);
            if (r == null || r.Length < 1)
            {
                return null;
            }

            t = GetString(r);
            return JsonConvert.DeserializeObject<KuaipanMetaRef>(t);
        }