Example #1
0
        /// <summary>
        ///		Compila el libro
        /// </summary>
        public bool Compile(BookModel book, string title, string description, string keyWords, string content, string pathTarget,
                            out string error)
        {
            bool   compiled = false;
            string pathTemp = Path.Combine(Path.GetTempPath(), HelperFiles.Normalize(book.Name));

            // Inicializa los argumentos de salida
            error = "";
            // Compila el libro
            try
            {
                // Compila el libro
                Compile(new LibEBook.BookFactory().Load(LibEBook.BookFactory.BookType.ePub, book.FileName, pathTemp),
                        pathTemp, title, description, keyWords, content, pathTarget);
                // Borra el directorio temporal
                HelperFiles.KillPath(pathTemp);
                // Indica que se ha compilado el libro
                compiled = true;
            }
            catch (Exception exception)
            {
                error = "Error en la compilación. " + exception.Message;
            }
            // Devuelve el valor que indica si se ha compilado correctamente
            return(compiled);
        }
 /// <summary>
 ///		Exporta los archivos
 /// </summary>
 public void Export()
 {
     using (BlockLogModel block = Logger.Default.CreateBlock(LogModel.LogType.Info, "Start copy files"))
     {
         // Elimina el directorio destino
         HelperFiles.KillPath(Options.TargetPath);
         // Copia los directorios
         CopyPath(block, Options.SourcePath, Options.TargetPath);
         // Borra los directorios vacíos
         HelperFiles.KillEmptyPaths(Options.TargetPath);
         // Log
         block.Info("End copy files");
     }
 }
        /// <summary>
        ///		Exporta los archivos
        /// </summary>
        internal void Export(Models.Deployments.DeploymentModel deployment)
        {
            using (BlockLogModel block = Manager.Logger.Default.CreateBlock(LogModel.LogType.Debug, "Comienzo de la copia de directorios"))
            {
                (NormalizedDictionary <object> parameters, string error) = GetParameters(deployment.JsonParameters);

                if (!string.IsNullOrWhiteSpace(error))
                {
                    block.Error(error);
                }
                else
                {
                    // Elimina el directorio destino
                    HelperFiles.KillPath(deployment.TargetPath);
                    // Copia los directorios
                    CopyPath(block, deployment.SourcePath, deployment.TargetPath, parameters);
                    // Borra los directorios vacíos
                    HelperFiles.KillEmptyPaths(deployment.TargetPath);
                    // Log
                    block.Debug("Fin de la copia de directorios");
                }
            }
        }