Exemplo n.º 1
0
        private void RenderProject(RenderContext context, Project p)
        {
            string rootPath = context.Path;

            if (!rootPath.EndsWith("\\"))
                rootPath += "\\";

            ViewDataDictionary viewData = new ViewDataDictionary();

            viewData["Project"] = p;

            IEnumerable<string> codeFiles = Directory.EnumerateFiles(rootPath, "*." + p.Language, SearchOption.AllDirectories);
            IEnumerable<string> contentFiles = Directory.EnumerateFiles(rootPath, "*.*", SearchOption.AllDirectories).Where(x => !x.EndsWith("proj", StringComparison.InvariantCultureIgnoreCase)).Except(codeFiles);

            viewData["CodeFiles"] = codeFiles.Select(x => x.Substring(rootPath.Length));
            viewData["ContentFiles"] = contentFiles.Select(x => x.Substring(rootPath.Length));

            for (int i = 0; i < p.Versions.Length; i++)
            {
                viewData["Version"] = p.Versions[i];

                RenderFile(Path.Combine(rootPath, p.GetProjectFileName(i)), "~/views/" + context.Name + "/Project.cshtml", viewData);
            }
        }
Exemplo n.º 2
0
 private void RenderSolutionProject(StreamWriter w, Project p, Solution s, string rootPath)
 {
     w.Write("Project(\"");
     w.Write(p.TypeGuid.ToString("B"));
     w.Write("\") = \"");
     w.Write(p.Name);
     w.Write("\", \"");
     w.Write(Path.Combine(p.Name, p.GetProjectFileName(s.Version)));
     w.Write("\", \"");
     w.Write(p.ProjectGuid.ToString("B"));
     w.WriteLine("\"");
     w.WriteLine("ProjectSection(WebsiteProperties) = preProject");
     w.WriteLine(@"Debug.AspNetCompiler.Debug = ""True""");
     w.WriteLine(@"Release.AspNetCompiler.Release = ""False""");
     w.WriteLine("EndProjectSection");
     w.WriteLine("EndProject");
 }