コード例 #1
0
        public static void WriteFile(
            string assemblyPath,
            string[] assemblyReferences,
            string[] embeddedResourcesSources,
            bool linkerEnabled,
            string outputPath)
        {
            var embeddedContent = EmbeddedResourcesProcessor.ExtractEmbeddedResources(
                embeddedResourcesSources, Path.GetDirectoryName(outputPath));
            var bootJsonText = GetBootJsonContent(
                Path.GetFileName(assemblyPath),
                GetAssemblyEntryPoint(assemblyPath),
                assemblyReferences,
                embeddedContent,
                linkerEnabled);
            var normalizedOutputPath = Path.GetFullPath(outputPath);

            Console.WriteLine("Writing boot data to: " + normalizedOutputPath);
            File.WriteAllText(normalizedOutputPath, bootJsonText);
        }
コード例 #2
0
ファイル: IndexHtmlWriter.cs プロジェクト: zuohd/Blazor
        public static void UpdateIndex(
            string path,
            string assemblyPath,
            IEnumerable <string> assemblyReferences,
            IEnumerable <string> embeddedResourcesSources,
            bool linkerEnabled,
            string outputPath)
        {
            var template = GetTemplate(path);

            if (template == null)
            {
                return;
            }
            var assemblyName    = Path.GetFileNameWithoutExtension(assemblyPath);
            var entryPoint      = GetAssemblyEntryPoint(assemblyPath);
            var embeddedContent = EmbeddedResourcesProcessor.ExtractEmbeddedResources(
                embeddedResourcesSources, Path.GetDirectoryName(outputPath));
            var updatedContent       = GetIndexHtmlContents(template, assemblyName, entryPoint, assemblyReferences, embeddedContent, linkerEnabled);
            var normalizedOutputPath = Normalize(outputPath);

            Console.WriteLine("Writing index to: " + normalizedOutputPath);
            File.WriteAllText(normalizedOutputPath, updatedContent);
        }