コード例 #1
0
 static void Main(string[] args)
 {
     try
     {
         Environment.ExitCode = (int)ReturnCode.EXIT_SUCCESS;
         var appArguments = new AppArguments();
         appArguments.LoadArguments(args);
         ReturnCode retCode;
         if (!appArguments.ValidateArguments(out retCode))
         {
             Environment.ExitCode = (int)retCode;
             return;
         }
         SchemaGenerator.GenerateSchema(appArguments);
     }
     catch (SchemaGenerationException e)
     {
         // Visual Studio parseable format
         Console.WriteLine("Dasher.Schema.Generation.exe : error: " + "Error generating schema for " + e.TargetType + ": " + e.Message);
         Environment.ExitCode = (int)ReturnCode.EXIT_ERROR;
     }
     catch (Exception e)
     {
         // Visual Studio parseable format
         Console.WriteLine("Dasher.Schema.Generation.exe : error: " + e.ToString());
         Environment.ExitCode = (int)ReturnCode.EXIT_ERROR;
     }
 }
コード例 #2
0
        public static void GenerateSchema(AppArguments args)
        {
            var assembly     = Assembly.LoadFrom(args.TargetPath);
            var walker       = new AssemblyWalker(args.IncludedDependencies, args.ExcludedDependencies);
            var assemblyInfo = walker.GetDasherAssemblyInfo(assembly);

            // Write to the project (ie source) dir and also the target (ie bin) dir. This ensures the manifest is checked into source control but is also
            // can be bundled with the application if needed.
            WriteToManifest(assemblyInfo,
                            args.TargetDir, args.OutputFileName, args.RootElementTag, args.SerialisableTypeElementTag,
                            args.SerialisableTypesSectionTag, args.DeserialisableTypesSectionTag);
            WriteToManifest(assemblyInfo,
                            args.ProjectDir, args.OutputFileName, args.RootElementTag, args.SerialisableTypeElementTag,
                            args.SerialisableTypesSectionTag, args.DeserialisableTypesSectionTag);
        }