Exemple #1
0
 //
 //      path        string      文件夹路径                 "/Netdisk/" or "/Netdisk/软件/" ...
 //      fields      string[]    需要查询的文件属性数组       type name createTime size url ...
 //      type        int         1-文件,2-文件夹,3-文件与文件夹
 //      或者 option  dictionay<string,object>
 //
 public LsResult lsdir(string path,string[]fields,int type) {
     Dictionary<Object, Object> sendParams = new Dictionary<object, object>();
     Dictionary<Object, Object> combi = new Dictionary<object, object>();
     for (int i = 0; i < fields.Count(); i++) {
         combi.Add(i, fields[i]);
     }
     sendParams[0] = path;
     sendParams[1] = combi;
     sendParams[2] = type;
     Object res = this.nspClient.callService("nsp.vfs.lsdir", sendParams);
     return (LsResult)NSPWrapper.toBean(res, typeof(LsResult));
 }
Exemple #2
0
 //
 //      files       string[]    文件路径数组。该接口支持移动文件以及文件夹,文件夹会递归移动内容。
 //      path        string      移动目标文件夹文件路径
 //      attribute   map<string,string> 移动文件夹时的可选参数配置
 //
 public Result movefile(string[] files, string path, Dictionary<string, string> attribute) {
     Dictionary<Object, Object> sendParams = new Dictionary<object, object>();
     Dictionary<Object, Object> combi = new Dictionary<object, object>();
     for (int i = 0; i < files.Count(); i++)
     {
         combi.Add(i, files[i]);
     }
     sendParams[0] = combi;
     sendParams[1] = path;
     if (attribute != null && attribute.Count != 0)
     {
         sendParams[2] = attribute;
     }
     Object res = this.nspClient.callService("nsp.vfs.movefile", sendParams);
     return (Result)NSPWrapper.toBean(res, typeof(Result));       
 }
Exemple #3
0
        public Result uploadFileProgress(string dirpath, string file, ProgressDelegate progress)
        {
            NSPLog.log(LogMsgType.NSP_LOG_NOTICE, "调用上传服务回调函数接口 uploadFileProgress");
            // call upauth 上传鉴权
            Object upauth = this.callService("nsp.vfs.upauth", null);

            ArrayList filesArray = new ArrayList();

            filesArray.Add(file);

            // upload 上传
            string upfiles = uploadFiles(upauth, filesArray, progress);
            // call mkfile 创建上传文件
            Dictionary <Object, Object> dt = new Dictionary <object, object>();

            dt["files"] = upfiles;
            dt["path"]  = dirpath;
            Object res = this.callService("nsp.vfs.mkfile", dt);

            return((Result)NSPWrapper.toBean(res, typeof(Result)));
        }
Exemple #4
0
 //
 //      files       string[]    文件路径数组
 //      fields      string[]    要查询的文件属性数组。“type,name”,两个属性,系统会自动返回,可以不用加入到列表中。
 //
 public Result getattr(string[] files, string[] fields) {
     Dictionary<Object, Object> sendParams = new Dictionary<object, object>();
     Dictionary<Object, Object> combi1 = new Dictionary<object, object>();
     Dictionary<Object, Object> combi2 = new Dictionary<object, object>();
     int i;
     for (i = 0; i < files.Count(); i++)
     {
         combi1.Add(i, files[i]);
     }
     for (i = 0; i < fields.Count(); i++)
     {
         combi2.Add(i, fields[i]);
     }
     sendParams[0] = combi1;
     if (combi2.Count != 0)
     {
         sendParams[1] = combi2;
     }
     Object res = this.nspClient.callService("nsp.vfs.getattr", sendParams);
     return (Result)NSPWrapper.toBean(res, typeof(Result));
 }
Exemple #5
0
        public bool downloadFile(string objfile, string savefullname, ProgressDelegate progress = null)
        {
            NSPLog.log(LogMsgType.NSP_LOG_NOTICE, "下载文件 " + objfile);
            //获取文件url
            Dictionary <Object, Object> sendParams = new Dictionary <object, object>();
            Dictionary <Object, Object> files      = new Dictionary <object, object>();
            Dictionary <Object, Object> fields     = new Dictionary <object, object>();

            files.Add(0, objfile);
            fields.Add(0, "url");
            sendParams.Add(0, files);
            sendParams.Add(1, fields);
            Result res = (Result)NSPWrapper.toBean(this.callService("nsp.VFS.getattr", sendParams), typeof(Result));

            if (res == null || res.successList.Count() == 0)
            {
                return(false);
            }
            string url = res.successList[0].url;

            return(downloadfile(url, savefullname, progress));
        }