Exemplo n.º 1
0
        public ViewResult Index()
        {
            IndexViewModel model = ViewModelFactory.CreateIndexViewModel(this.PathHelper, this.TableOfContentsRepository,
                                                                         this.ApplicationSamplesRepository, this.ControlRepository, this.SampleRepository, MemoryCache.Default);

            return(View(model));
        }
        public string GenerateZip()
        {
            // Writes the all.js and all.css files to disk
            ResourceCombiner combiner   = new ResourceCombiner(this.Config);
            string           allScripts = combiner.GenerateCombinedResource(this.FileSystem.CombinedJsFiles, MemoryCache.Default, null, this.FileSystem.JsDirectory + "\\all.js");
            string           allCss     = combiner.GenerateCombinedResource(this.FileSystem.CombinedCssFiles, MemoryCache.Default, null, this.FileSystem.CssDirectory + "\\all.css");

            parser  = new LocalInstallPageParser(this.FileSystem.ProductSourcePath);
            appPath = Config.GetHttpContext().Request.ApplicationPath;
            if (!appPath.EndsWith("/"))
            {
                appPath += "/";
            }
            rootHref = "href=\"" + appPath;
            rootSrc  = "src=\"" + appPath;
            string outDir = this.GetTempDirName();

            if (Directory.Exists(outDir))
            {
                Directory.Delete(outDir, true);
            }
            string culture = this.Resources.Culture;

            Directory.CreateDirectory(outDir);
            this.DirectoryCopy(this.FileSystem.JsDirectory, Path.Combine(outDir, "js"), true);
            this.DirectoryCopy(this.FileSystem.CssDirectory, Path.Combine(outDir, "css"), true);
            //this.DirectoryCopy(this.FileSystem.IgniteUIDirectory, Path.Combine(outDir, "igniteui"), true);
            this.DirectoryCopy(this.FileSystem.ImagesDirectory, Path.Combine(outDir, "images"), true);
            this.DirectoryCopy(this.FileSystem.DataDirectory, Path.Combine(outDir, "js-data"), true, true);

            IndexViewModel model = ViewModelFactory.CreateIndexViewModel(this.PathHelper, this.TableOfContentsRepository,
                                                                         this.ApplicationSamplesRepository, this.ControlRepository, this.SampleRepository, MemoryCache.Default);

            string index         = this.IndexLocalInstall(model).Replace(rootHref, "href=\"./").Replace(rootSrc, "src=\"./");
            string indexFileName = Path.Combine(outDir, "index.html");

            parser.ChangeNavLinks(index, indexFileName);

            string showcase         = this.ShowcaseLocalInstall().Replace(rootHref, "href=\"./").Replace(rootSrc, "src=\"./");
            string showcaseFileName = Path.Combine(outDir, "application-samples.html");

            parser.ChangeNavLinks(showcase, showcaseFileName);

            string gettingStarted         = this.GettingStartedLocalInstall("getting-started").Replace("href=\"~/", rootHref).Replace(rootHref, "href=\"./").Replace(rootSrc, "src=\"./").Replace("src=\"./../igniteui/", "src=\"./igniteui/");
            string gettingStartedFileName = Path.Combine(outDir, "getting-started.html");

            parser.ChangeNavLinks(gettingStarted, gettingStartedFileName);

            this.GettingStartedLocalInstallMobile(outDir, "getting-started-mobile");

            this.CreateSamplePages(outDir, model);
            string zipFileName = this.WriteZipFile(outDir);

            Directory.Delete(outDir, true);
            return(zipFileName);
        }