public void DeleteFile(IModelFilePath modelFile) { string path = $"{AssetsPath}{modelFile.GetFullPath()}"; if (File.Exists(path)) { File.Delete(path); } }
public void SaveTextFile(IModelFilePath modelFile, string text) { if (modelFile.GetFilePath().FileType != FileType.Text) { throw new Exception("FileType is not text"); } InitializeFolders(modelFile); string path = $"{AssetsPath}{modelFile.GetFullPath()}"; File.WriteAllText(path, text); }
public void SaveUploadedFile(HttpPostedFileBase upload, IModelFilePath modelFile) { if (!FileIsValid(upload)) { throw new Exception("Invalid HttpPostedFileBase"); } InitializeFolders(modelFile); string path = $"{AssetsPath}{modelFile.GetFullPath()}"; upload.SaveAs(path); }
public string ReadTextFile(IModelFilePath modelFile) { if (modelFile.GetFilePath().FileType != FileType.Text) { throw new Exception("FileType is not text"); } string path = $"{AssetsPath}{modelFile.GetFullPath()}"; if (!File.Exists(path)) { return(""); } return(File.ReadAllText(path)); }