private void CopyProjectContent(String outDir, EdityProject edityProject) { foreach (var file in edityProject.AdditionalContent.Concat(new string[] { "AutoUploads" })) { var physicalPath = NormalizePath(file); if (permissions.AllowOutputCopy(this, file, physicalPath)) { if (File.Exists(physicalPath)) { copyFileIfNotExists(file, physicalPath, safePathCombine(outDir, file)); } else if (Directory.Exists(physicalPath)) { foreach (var dirFile in Directory.EnumerateFiles(physicalPath, "*", SearchOption.AllDirectories)) { var relativePath = dirFile.Substring(physicalPath.Length); copyFileIfNotExists(relativePath, dirFile, safePathCombine(outDir, file, relativePath)); } } } } if (next != null) { next.CopyProjectContent(outDir, edityProject); } }
public void MergeCompilers() { EdityProject project1 = new EdityProject(); project1.Compilers.Add(new CompilerDefinition() { Type = CompilerTypes.Html, Extension = ".html", }); EdityProject project2 = new EdityProject(); project2.Compilers.Add(new CompilerDefinition() { Type = CompilerTypes.Html, Extension = ".html" }); project2.Compilers.Add(new CompilerDefinition() { Type = CompilerTypes.Html, Extension = ".print.html" }); project2.Compilers.Add(new CompilerDefinition() { Type = CompilerTypes.Json, Extension = ".search.json", }); EdityProject project3 = new EdityProject(); project2.merge(project1); project3.merge(project2); Assert.True(project3.Compilers.Count == 3); }
private EdityProject loadProject() { EdityProject project = null; String physicalFilePath = NormalizePath(projectFilePath); if (permissions.AllowRead(this, projectFilePath, physicalFilePath)) { if (File.Exists(physicalFilePath)) { String projectStr = ""; using (var reader = new StreamReader(File.Open(physicalFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))) { projectStr = reader.ReadToEnd(); } project = JsonConvert.DeserializeObject <EdityProject>(projectStr); } } //Merge in all projects if (next != null) { var nextProject = next.Project; if (nextProject != null) { if (project == null) { project = nextProject; } else { project.merge(nextProject); } } } return(project); }