public static SaveResult DirectFileSave(Guid userId, FileUpload fuFile, string rootFile, WikiSection section, string configLocation, int tenantId, HttpContext context) { if (!fuFile.HasFile) { return(SaveResult.FileEmpty); } var wikiEngine = new WikiEngine(); File file = null; try { file = wikiEngine.CreateOrUpdateFile(new File { FileName = fuFile.FileName, FileSize = fuFile.FileBytes.Length }); FileContentSave(file.FileLocation, fuFile.FileBytes, section, configLocation, tenantId, context); } catch (TenantQuotaException) { if (file != null) { wikiEngine.RemoveFile(file.FileName); } return(SaveResult.FileSizeExceeded); } return(SaveResult.Ok); }
public static SaveResult DirectFileSave(Guid UserId, FileUpload fuFile, string rootFile, WikiSection section, string configLocation, int tenantId, HttpContext context) { if (!fuFile.HasFile) { return(SaveResult.FileEmpty); } //var fileName = fuFile.FileName; //var fileLocation = GetFileLocation(fileName, section, rootFile); //var file = new File // { // FileName = fileName, // UploadFileName = fileName, // UserID = UserId, // FileLocation = fileLocation, // FileSize = fuFile.FileBytes.Length, // }; var wikiEngine = new WikiEngine(); //wikiEngine.SaveFile(file); var file = wikiEngine.CreateOrUpdateFile(new File { FileName = fuFile.FileName, FileSize = fuFile.FileBytes.Length }); try { FileContentSave(file.FileLocation /*fileLocation*/, fuFile.FileBytes, section, configLocation, tenantId, context); } catch (TenantQuotaException) { wikiEngine.RemoveFile(file.FileName); return(SaveResult.FileSizeExceeded); } return(SaveResult.Ok); }
public void DeleteFile(string name) { _engine.RemoveFile(name); }
public static SaveResult DirectFileSave(Guid UserId, FileUpload fuFile, string rootFile, WikiSection section, string configLocation, int tenantId, HttpContext context) { if (!fuFile.HasFile) return SaveResult.FileEmpty; //var fileName = fuFile.FileName; //var fileLocation = GetFileLocation(fileName, section, rootFile); //var file = new File // { // FileName = fileName, // UploadFileName = fileName, // UserID = UserId, // FileLocation = fileLocation, // FileSize = fuFile.FileBytes.Length, // }; var wikiEngine = new WikiEngine(); //wikiEngine.SaveFile(file); var file = wikiEngine.CreateOrUpdateFile(new File {FileName = fuFile.FileName, FileSize = fuFile.FileBytes.Length}); try { FileContentSave(file.FileLocation/*fileLocation*/, fuFile.FileBytes, section, configLocation, tenantId, context); } catch (TenantQuotaException) { wikiEngine.RemoveFile(file.FileName); return SaveResult.FileSizeExceeded; } return SaveResult.Ok; }
public static SaveResult DirectFileSave(Guid userId, FileUpload fuFile, string rootFile, WikiSection section, string configLocation, int tenantId, HttpContext context) { if (!fuFile.HasFile) return SaveResult.FileEmpty; var wikiEngine = new WikiEngine(); File file = null; try { file = wikiEngine.CreateOrUpdateFile(new File {FileName = fuFile.FileName, FileSize = fuFile.FileBytes.Length}); FileContentSave(file.FileLocation, fuFile.FileBytes, section, configLocation, tenantId, context); } catch (TenantQuotaException) { if (file != null) wikiEngine.RemoveFile(file.FileName); return SaveResult.FileSizeExceeded; } return SaveResult.Ok; }