Esempio n. 1
0
        private static void WriteAssemblyInitializer(Context context, string directory)
        {
            var outputFile = Path.Combine(directory, "WasmWranglerAssemblyInitializer.g.cs");

            Console.WriteLine($"Wrting AssemblyInitializer => {outputFile}");

            var output = new OutputBuffer();

            output.AppendLine("// <auto-generated />");
            output.AppendLine("#nullable enable");

            GenerateAssemblyInitializer(context, output, directory);

            File.WriteAllText(outputFile, output.ToString());
        }
Esempio n. 2
0
        private static void WriteBinding(Context context, string inputFile)
        {
            var outputFile = Path.Combine(Path.GetDirectoryName(inputFile) !, Path.GetFileNameWithoutExtension(inputFile) + ".g.cs");

            Console.WriteLine($"{inputFile} => {outputFile}");

            var syntaxTree = CSharpSyntaxTree.ParseText(File.ReadAllText(inputFile));

            var output = new OutputBuffer();

            output.AppendLine("// <auto-generated />");
            output.AppendLine("#nullable enable");

            GenerateSyntaxNodes(context, output, syntaxTree.GetRoot().ChildNodes());

            File.WriteAllText(outputFile, output.ToString());
        }