예제 #1
0
 public void Process(Assembly assembly, ICodeFileManager manager)
 {
     var txtPath = manager.AddFile("test.txt", CodeFileType.Content);
     File.WriteAllText(txtPath, "just some content "+ string.Join(", ", assembly.GetTypes().Select(s => s.FullName)));
     var csPath = manager.AddFile("testCompilation.cs", CodeFileType.Compilation);
     File.WriteAllText(csPath, @"
     public enum SomeOtherEnum
     {
     A,
     B,
     C
     }");
 }
예제 #2
0
        public void Process(Assembly assembly, ICodeFileManager manager)
        {
            var compilationPath = manager.AddFile("GeneratedClass1.cs", CodeFileType.Compilation);
            var typeNames = string.Join(",", assembly.ExportedTypes.Select(s => s.FullName));

            File.WriteAllText(compilationPath, string.Format(@"
            // {0}
            public class GeneratedClass1 {{

            }}
            ", typeNames));

            var contentPath = manager.AddFile("GeneratedContent1.txt", CodeFileType.Content);

            File.WriteAllText(contentPath, string.Format(@"{0} {1}", typeNames, DateTime.Now.ToString("F")));
        }