public FilePathEmbedded(FileTypeSymbol fileType, FilePathEmbedded cloneFrom) //Usefull for Email Attachments when combined with WeekFileReference { this.FileType = fileType; this.Suffix = cloneFrom.Suffix; this.Hash = cloneFrom.Hash; this.FileLength = cloneFrom.FileLength; this.fileName = cloneFrom.FileName; }
public static PrintLineEntity CreateLine(Entity referred, FilePathEmbedded file) { return(new PrintLineEntity { Referred = referred.ToLite(), State = PrintLineState.ReadyToPrint, File = file, }.Save()); }
public static FilePathEmbedded SaveFile(this FilePathEmbedded efp) { var alg = efp.FileType.GetAlgorithm(); alg.ValidateFile(efp); alg.SaveFile(efp); efp.BinaryFile = null !; return(efp); }
public static void DeleteFileOnCommit(this FilePathEmbedded efp) { Transaction.PostRealCommit += dic => { efp.FileType.GetAlgorithm().DeleteFiles(new List <IFilePath> { efp }); }; }
public static EmailMessageEntity WithAttachment(this EmailMessageEntity email, FilePathEmbedded filePath, string?contentId = null) { email.Attachments.Add(new EmailAttachmentEmbedded { ContentId = contentId ?? Guid.NewGuid().ToString(), File = filePath, }); return(email); }
public FileStreamResult DownloadFilePathEmbedded(string fileTypeKey, string suffix, string fileName) { var fileType = SymbolLogic <FileTypeSymbol> .ToSymbol(fileTypeKey); var virtualFile = new FilePathEmbedded(fileType) { Suffix = suffix, FileName = fileName, }; return(GetFileStreamResult(virtualFile.OpenRead(), virtualFile.FileName)); }
public HttpResponseMessage DownloadFilePathEmbedded(string fileTypeKey, string suffix, string fileName) { var fileType = SymbolLogic <FileTypeSymbol> .ToSymbol(fileTypeKey); var virtualFile = new FilePathEmbedded(fileType) { Suffix = suffix, FileName = fileName, }; return(GetHttpReponseMessage(virtualFile.OpenRead(), virtualFile.FileName)); }
public FileResult DownloadEmbedded(Lite <FileTypeSymbol> lite, string suffix, string fileName) { var virtualFile = new FilePathEmbedded(lite.Retrieve()) { Suffix = suffix, FileName = fileName }; var pair = FileTypeLogic.FileTypes.GetOrThrow(lite.Retrieve()).GetPrefixPair(virtualFile); var fullPhysicalPath = Path.Combine(pair.PhysicalPrefix, suffix); return(new FilePathResult(fullPhysicalPath, MimeMapping.GetMimeMapping(fullPhysicalPath)) { FileDownloadName = fileName }); }
public static WebImage WebImage(this FilePathEmbedded efp, FileTypeSymbol fileType) { return(WebImageExpression.Evaluate(efp, fileType)); }
public static WebDownload WebDownload(this FilePathEmbedded fp) { return(WebDownloadExpression.Evaluate(fp)); }
public static Stream OpenRead(this FilePathEmbedded efp) { return(efp.FileType.GetAlgorithm().OpenRead(efp)); }
public static WebDownload WebDownload(this FilePathEmbedded fp, FileTypeSymbol fileType) { return(WebDownloadExpression.Evaluate(fp, fileType)); }
public static byte[] GetByteArray(this FilePathEmbedded efp) { return(efp.BinaryFile ?? efp.FileType.GetAlgorithm().ReadAllBytes(efp)); }
static PrefixPair CalculatePrefixPair(this FilePathEmbedded efp) { using (new EntityCache(EntityCacheType.ForceNew)) return(efp.FileType.GetAlgorithm().GetPrefixPair(efp)); }
public static WebImage?WebImage(this FilePathEmbedded fp) => As.Expression(() => fp == null ? null ! : new WebImage {
public static FilePathEmbedded SaveFile(this FilePathEmbedded efp) { efp.FileType.GetAlgorithm().SaveFile(efp); efp.BinaryFile = null; return(efp); }
public static WebImage?WebImage(this FilePathEmbedded fp) { return(WebImageExpression.Evaluate(fp)); }