public virtual object GetFolderDocuments(HttpContext context) { YZRequest request = new YZRequest(context); string root = request.GetString("root"); string path = request.GetString("path", ""); BPMObjectNameCollection excludes = BPMObjectNameCollection.FromStringList(request.GetString("excludes", null), ','); string rootPath = OSDirectoryManager.GetRootPath(root); string folderPath = Path.Combine(context.Server.MapPath(rootPath), path); OSFileInfoCollection files = OSDirectoryManager.GetFiles(folderPath, excludes); return(this.Serialize(files, path)); }
public virtual void DeleteFiles(HttpContext context) { YZRequest request = new YZRequest(context); string root = request.GetString("root"); string path = request.GetString("path", null); string rootPath = OSDirectoryManager.GetRootPath(root); string folderPath = Path.Combine(context.Server.MapPath(rootPath), path); JArray post = request.GetPostData <JArray>(); List <string> filenames = post.ToObject <List <string> >(); foreach (string filename in filenames) { OSDirectoryManager.DeleteFile(folderPath, filename); } }
public virtual void MoveFiles(HttpContext context) { YZRequest request = new YZRequest(context); string root = request.GetString("root"); string path = request.GetString("path", null); BPMObjectNameCollection excludes = BPMObjectNameCollection.FromStringList(request.GetString("excludes", null), ','); string tergetfilename = request.GetString("tergetfilename"); MovePosition position = request.GetEnum <MovePosition>("position"); string rootPath = OSDirectoryManager.GetRootPath(root); string folderPath = Path.Combine(context.Server.MapPath(rootPath), path); JArray post = request.GetPostData <JArray>(); List <string> filenames = post.ToObject <List <string> >(); OSDirectoryManager.MoveFiles(folderPath, excludes, filenames.ToArray(), tergetfilename, position); }
public virtual JObject RenameFile(HttpContext context) { YZRequest request = new YZRequest(context); string root = request.GetString("root"); string path = request.GetString("path", null); string name = request.GetString("name"); string newname = request.GetString("newname"); string rootPath = OSDirectoryManager.GetRootPath(root); string folderPath = Path.Combine(context.Server.MapPath(rootPath), path); OSDirectoryManager.RenameFile(folderPath, name, newname); OSFileInfo fileinfo = new OSFileInfo(Path.Combine(folderPath, newname)); return(this.Serialize(fileinfo, path)); }
public virtual JObject AddFileFromFileSystem(HttpContext context) { YZRequest request = new YZRequest(context); bool thumbnail = request.GetBool("thumbnail", false); string root = request.GetString("root"); string path = request.GetString("path", null); string fileid = request.GetString("fileid"); string rootPath = OSDirectoryManager.GetRootPath(root); string folderPath = Path.Combine(context.Server.MapPath(rootPath), path); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { string file = OSDirectoryManager.AddFileFromFileSystem(provider, cn, folderPath, fileid, thumbnail); OSFileInfo fileinfo = new OSFileInfo(file); return(this.Serialize(fileinfo, path)); } } }