Exemple #1
0
        /// <summary>
        /// Copies the Default stuff to the new Directory.
        /// </summary>
        /// <param name="to">To copy to</param>
        private static void CopyDefault(string to)
        {
            //Copy all the Basic stuff in:
            string newBasePath = Path.Combine(to, WorkSpace.BASE_DIR);

            if (!Directory.Exists(newBasePath) ||
                Directory.EnumerateFileSystemEntries(newBasePath).Empty())
            {
                DirCopy.PlainCopy(WorkSpace.BASE_DIR, newBasePath);
            }

            //Copy all Libs stuff:
            string newLibsPath = Path.Combine(to, WorkSpace.LIBS_DIR);

            if (!Directory.Exists(newLibsPath) ||
                Directory.EnumerateFileSystemEntries(newLibsPath).Empty())
            {
                DirCopy.PlainCopy(WorkSpace.LIBS_DIR, newLibsPath);
            }

            //Copy all DataType stuff:
            string newDataTypesPath = Path.Combine(to, WorkSpace.DATA_TYPES_DIR);

            if (!Directory.Exists(newDataTypesPath) ||
                Directory.EnumerateFileSystemEntries(newDataTypesPath).Empty())
            {
                DirCopy.PlainCopy(WorkSpace.DATA_TYPES_DIR, newDataTypesPath);
            }
        }
Exemple #2
0
        private void CopyContent(string childPagesFolder, string outputFolder)
        {
            var contentSourceFolder = Path.Combine(childPagesFolder, "content");

            if (!Directory.Exists(contentSourceFolder))
            {
                return;
            }

            var contentOutputFolder = Path.Combine(outputFolder, "content");

            DirCopy.Copy(contentSourceFolder, contentOutputFolder);
        }
        /// <summary>
        /// Saves the Current state to the disc.
        /// </summary>
        public bool SaveToDisc()
        {
            var toSave = GenerateClass();

            if (toSave == null)
            {
                return(false);
            }

            var savePath = Path.Combine(WorkSpace.DIR, WorkSpace.CREATED_DIR);

            savePath = Path.Combine(savePath, toSave.DisplayName);

            if (Directory.Exists(savePath))
            {
                return(false);
            }
            Singleton <NodeLoader> .Instance.saveToFolder(toSave, savePath);

            //Now save the depencies to the depencies.zip.
            var tmpSaveFolder = Path.Combine(savePath, "dependencies");

            Directory.CreateDirectory(tmpSaveFolder);
            this._nodes
            .Select(n => n.Class)
            .Where(n => n.UserCreated && n != toSave)
            .Distinct()
            .ForEach(c =>
            {
                var nodeDir = Path.Combine(tmpSaveFolder, c.Name);
                Directory.CreateDirectory(nodeDir);
                DirCopy.PlainCopy(c.NodePath, nodeDir);
            });

            //Generate the Zip file from that directory:
            if (!Directory.EnumerateFileSystemEntries(tmpSaveFolder).Empty())
            {
                var zipPath = Path.Combine(savePath, "dependencies.zip");
                ZipFile.CreateFromDirectory(tmpSaveFolder, zipPath, CompressionLevel.NoCompression, false);
            }

            Directory.Delete(tmpSaveFolder, true);
            return(true);
        }
Exemple #4
0
        private void CreateSite(ExpandoObject startingModel)
        {
            CreateOutputDirectory();

            var configuration = XDocument.Load(_parameters.TemplateConfigurationFile);

            var model = CreateModel(configuration, startingModel);

            if (_parameters.HandleDirectories)
            {
                DirCopy.Copy(_parameters.TemplateAssetsFolder, _parameters.OutputAssetsFolder);
            }

            if (_parameters.CopyOutputFile)
            {
                var template = File.ReadAllText(_parameters.TemplateLayoutFile);
                var result   = GenerateOutput(model, template, _parameters.TemplateRoot);

                File.WriteAllText(_parameters.OutputHtmlPage, result);
            }
        }
Exemple #5
0
        /// <summary>
        /// Copies the content of the libs folder to the destination.
        /// </summary>
        /// <param name="destination"></param>
        protected void CopyLibs(string destination)
        {
            string path = Path.Combine(WorkSpace.DIR, WorkSpace.LIBS_DIR);

            DirCopy.DirectoryCopy(path, destination, true);
        }
Exemple #6
0
 /// <summary>
 /// Copies the Node-Dependencies
 /// </summary>
 /// <param name="destination">To copy to</param>
 /// <param name="nodes">To use.</param>
 protected void CopyNodes(string destination, Node[] nodes)
 {
     nodes.ForEach(n => DirCopy.DirectoryCopy(n, destination));
 }