コード例 #1
0
        public static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                PrintUsage();
                return;
            }

            string packetSchemaPath = args[0];
            string outputType       = args[1];
            string output           = args[2];

            Generator generator;

            switch (outputType)
            {
            case "markdown":
                generator = new MarkdownGenerator(output);
                break;

            case "csharp":
            {
                if (args.Length < 4)
                {
                    PrintUsage();
                    return;
                }
                string configurationFileName = args[3];
                generator = new CSharpGenerator(output, configurationFileName);
            }
            break;

            default:
                PrintUsage();
                return;
            }

            // Load the schema
            var    schemaLoader = new SchemaLoader(Path.GetDirectoryName(packetSchemaPath));
            Schema packetSchema = schemaLoader.Load(packetSchemaPath);

            // Generate output from the schema.
            generator.Generate(packetSchema);
        }
コード例 #2
0
        public static void Main(string[] args)
        {
            var options = new Options();

            if (!Parser.Default.ParseArgumentsStrict(args, options))
            {
                return;
            }

            Generator generator;

            switch (options.Type)
            {
            case GeneratorType.MarkDown:
                generator = new MarkdownGenerator(options.Output);
                break;

            case GeneratorType.CSharp:
                if (options.ConfigurationFile == null)
                {
                    Console.Error.WriteLine("ERROR: When type is CSharp, a configuration file is required.");
                    Console.Error.WriteLine(options.Usage());
                    return;
                }

                generator = new CSharpGenerator(options.Output, options.ConfigurationFile);
                break;

            case GeneratorType.Validation:
                generator = new ValidationDocumentGenerator(options.Output);
                break;

            default:
                return;
            }

            // Load the schema
            var    schemaLoader = new SchemaLoader(Path.GetDirectoryName(options.PacketSchema));
            Schema packetSchema = schemaLoader.Load(options.PacketSchema);

            // Generate output from the schema.
            generator.Generate(packetSchema);
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                PrintUsage();
                return;
            }

            string packetSchemaPath = args[0];
            string outputType = args[1];
            string output = args[2];

            Generator generator;

            switch (outputType)
            {
                case "markdown":
                    generator = new MarkdownGenerator(output);
                    break;
                case "csharp":
                    {
                        if (args.Length < 4)
                        {
                            PrintUsage();
                            return;
                        }
                        string configurationFileName = args[3];
                        generator = new CSharpGenerator(output, configurationFileName);
                    }
                    break;
                default:
                    PrintUsage();
                    return;
            }

            // Load the schema
            var schemaLoader = new SchemaLoader(Path.GetDirectoryName(packetSchemaPath));
            Schema packetSchema = schemaLoader.Load(packetSchemaPath);

            // Generate output from the schema.
            generator.Generate(packetSchema);
        }
コード例 #4
0
        public static void Main(string[] args)
        {
            var options = new Options();
            if (!Parser.Default.ParseArgumentsStrict(args, options))
            {
                return;
            }

            Generator generator;

            switch (options.Type)
            {
                case GeneratorType.MarkDown:
                    generator = new MarkdownGenerator(options.Output);
                    break;
                case GeneratorType.CSharp:
                    if (options.ConfigurationFile == null)
                    {
                        Console.Error.WriteLine("ERROR: When type is CSharp, a configuration file is required.");
                        Console.Error.WriteLine(options.Usage());
                        return;
                    }

                    generator = new CSharpGenerator(options.Output, options.ConfigurationFile);
                    break;
                case GeneratorType.Validation:
                    generator = new ValidationDocumentGenerator(options.Output);
                    break;
                default:
                    return;
            }

            // Load the schema
            var schemaLoader = new SchemaLoader(Path.GetDirectoryName(options.PacketSchema));
            Schema packetSchema = schemaLoader.Load(options.PacketSchema);

            // Generate output from the schema.
            generator.Generate(packetSchema);
        }