/// <summary> /// Procesa el informe interpretado /// </summary> private void RenderFile(string fileParsed, string fileName) { foreach (DeploymentModel.ReportFormat format in Deployment.ReportFormatTypes) { try { switch (format) { case DeploymentModel.ReportFormat.Xml: HelperFiles.CopyFile(fileParsed, ChangeExtension(fileParsed, ".xml")); break; case DeploymentModel.ReportFormat.Html: if (!ExistsFormat(DeploymentModel.ReportFormat.HtmlConverted, Deployment.ReportFormatTypes)) { HelperFiles.CopyFile(fileParsed, ChangeExtension(fileParsed, ".html")); } break; case DeploymentModel.ReportFormat.HtmlConverted: new LibReports.Renderer.Html.RendererHTML().Render(ChangeExtension(fileParsed, ".html"), fileParsed); break; case DeploymentModel.ReportFormat.Pdf: new LibReports.Renderer.PDF.RendererPdf().Render(ChangeExtension(fileParsed, ".pdf"), fileParsed); break; } } catch (Exception exception) { RaiseEvent(fileName, $"Error when render file {fileName} to format {format.ToString()}. {exception.Message}", 0, 0, true); } } }
/// <summary> /// Sube un archivo /// </summary> internal void UploadFile(string fileName) { if (!IsUrl(Manager.UrlDownload)) { HelperFiles.CopyFile(fileName, GetFileName(System.IO.Path.GetFileName(fileName), true)); } else { UploadFile(Manager.UrlDownload.GetUrl(), fileName); } }
/// <summary> /// Copia los archivos del proyecto que no precisan compilación /// </summary> internal override void Process() { foreach (FileTargetModel file in Data.Files) { if (MustCopy(file)) { string fileName = file.GetFullFileName(Processor); // Crea el directorio destino HelperFiles.MakePath(System.IO.Path.GetDirectoryName(fileName)); // Copia el archivo HelperFiles.CopyFile(file.File.FullFileName, fileName); } } }
/// <summary> /// Copia las imágenes de un libro /// </summary> private void CopyImages(Book book, string pathTemp, string pathTarget) { foreach (PageFile file in book.Files) { if (!file.FileName.IsEmpty() && IsImage(file.FileName)) { string fileNameTarget = Path.Combine(pathTarget, RemoveFirstPath(file.FileName)); // Crea el directorio destino HelperFiles.MakePath(Path.GetDirectoryName(fileNameTarget)); // Copia el archivo HelperFiles.CopyFile(Path.Combine(pathTemp, file.FileName), fileNameTarget); } } }
/// <summary> /// Copia un archivo /// </summary> private void CopyFile(string fileSource, string fileTarget) { HelperFiles.KillFile(fileTarget); HelperFiles.CopyFile(fileSource, fileTarget); }