Esempio n. 1
0
        public Model.CloudDisk.CloudFileInfoModel CreateDirectory(string dir)
        {
            string url = "https://api.weipan.cn/2/fileops/create_folder";
            //url += "?access_token=" + _accessToken + "&root=sandbox&path=" +  UrlEncoder.UrlEncode(dir);
            IDictionary <string, string> postParameters = new Dictionary <string, string>();

            postParameters.Add("access_token", _accessToken);
            postParameters.Add("root", "sandbox");
            postParameters.Add("path", dir);
            CloudFileInfoModel m = new CloudFileInfoModel();

            try
            {
                var request = new WebRequestHelper(url);
                var result  = request.Post(url, postParameters);
                var entity  = JsonHelper.DeserializeObject <SinaResponseFileInfoJsonEntity>(result);

                m.Bytes            = 0;
                m.Path             = UrlEncoder.UrlDecode(entity.path);
                m.RootPath         = entity.root;
                m.LastModifiedDate = Convert.ToDateTime(entity.modified);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(m);
        }