Exemple #1
0
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("No data directory specified.");
                return;
            }

            var workDir = new DirectoryInfo(args[0]);

            var root = Path.Combine(workDir.FullName, "root");

            if (args.Length > 1)
            {
                root = args[1];
            }
            var rootDir = new DirectoryInfo(root);

            var resDir  = workDir.GetDirectories("Resources").FirstOrDefault();
            var dataDir = workDir.GetDirectories("Data").FirstOrDefault();



            //create or recreate output folder
            if (!Directory.Exists(root))
            {
                Directory.CreateDirectory(root);
            }


            //copy all directories and files from resources to target root
            DirectoryCopy(resDir.FullName, root);

            //Create code colouring CSS file
            var codeCss     = (StyleSheets.Default as DefaultStyleSheet).GetCssFile();
            var codeCssPath = Path.Combine(root, "css", "codestyles.css");

            File.WriteAllText(codeCssPath, codeCss);

            //build content structure
            var contentRoot = new DirectoryNode(dataDir, dataDir, null);

            contentRoot.Render(rootDir);

            var siteMap = new SiteMap();

            siteMap.Build(contentRoot, "https://xbimteam.github.io/");
            using (var map = File.Create(Path.Combine(rootDir.FullName, "sitemap.xml")))
            {
                siteMap.Save(map);
                map.Close();
            }
        }
        static void Main()
        {
            //resources are 2 levels up from the build directory
            var workDir = new DirectoryInfo("..\\..");
            //actual website is 4 levels up from build directory
            var root    = "..\\..\\..\\..";
            var rootDir = new DirectoryInfo(root);

            var resDir  = workDir.GetDirectories("Resources").FirstOrDefault();
            var dataDir = workDir.GetDirectories("Data").FirstOrDefault();



            //create or recreate output folder
            if (!Directory.Exists(root))
            {
                Directory.CreateDirectory(root);
            }


            //copy all directories and files from resources to target root
            DirectoryCopy(resDir.FullName, root);

            //Create code colouring CSS file
            var codeCss     = (StyleSheets.Default as DefaultStyleSheet).GetCssFile();
            var codeCssPath = Path.Combine(root, "css", "codestyles.css");

            File.WriteAllText(codeCssPath, codeCss);

            //build content structure
            var contentRoot = new DirectoryNode(dataDir, dataDir, null);

            contentRoot.Render(rootDir);

            var siteMap = new SiteMap();

            siteMap.Build(contentRoot, "https://xbimteam.github.io/");
            using (var map = File.Create(Path.Combine(rootDir.FullName, "sitemap.xml")))
            {
                siteMap.Save(map);
                map.Close();
            }
        }