Exemplo n.º 1
0
 public void Moveto(AMeta meta, string path, string name)
 {
     string src = Path.Combine(_Root, meta.GetMeta());
     if (!File.Exists(src))
     {
         return;
     }
     string dst = Path.Combine(path, name);
     if (File.Exists(dst))
     {
         dst = GenDupName(meta.GetMetaPath(), name);
     }
     File.Move(src, dst);
 }
Exemplo n.º 2
0
        public AMeta Moveto(AMeta meta, string dstPath, string dstName)
        {
            ResetParams();
            string url = KuaipanServer.MOVETO;

            PrepareParams();
            AddParam(OAuthConstants.OAUTH_TOKEN, Token.oauth_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;
        }
Exemplo n.º 3
0
        public AMetaRef CopyRef(AMeta meta)
        {
            ResetParams();
            string url = string.Format(KuaipanServer.COPYREF, _Root, meta.GetMeta());

            PrepareParams();
            AddParam(OAuthConstants.OAUTH_TOKEN, Token.oauth_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);
        }
Exemplo n.º 4
0
        public AMeta Copyto(AMeta meta, string dstPath, string dstName)
        {
            ResetParams();
            string url = KuaipanServer.COPYTO;

            PrepareParams();
            AddParam(OAuthConstants.OAUTH_TOKEN, Token.oauth_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;
        }
Exemplo n.º 5
0
 private void ShowInfo(AMeta meta)
 {
     if (MetaUri != null && meta != null)
     {
         MetaUri.Text = _PcsClient.Name;
         MetaUri.Path = _PcsClient.Display(meta.GetMeta());
         MetaUri.Icon = _PcsClient.Icon;
     }
 }