Пример #1
0
        private void WriteGeneratorToFile(string fileName, Generator gen)
        {
            if (string.IsNullOrEmpty(outputDir))
                outputDir = ".";

            var filePath = Path.GetFullPath(outputDir);
            if(!fileName.EndsWith(".cs"))
                fileName = string.Format("{0}.cs", fileName);

            filePath = Path.Combine(filePath, fileName);
            File.WriteAllText(filePath, gen.ToString());
            GeneratedFiles.Add(filePath);

            Console.WriteLine("Generated '{0}'", fileName);
        }
Пример #2
0
        private void WriteGeneratorToFile(Type type, Generator gen)
        {
            if (string.IsNullOrEmpty(options.OutputDir))
                options.OutputDir = ".";

            var filePath = Path.GetFullPath(options.OutputDir);
            var fileName = string.Format("{0}.cs", type.Name);

            filePath = Path.Combine(filePath, fileName);
            File.WriteAllText(filePath, gen.ToString());
            GeneratedFiles.Add(filePath);

            Console.WriteLine("Generated '{0}'", fileName);
        }