Example #1
0
        static void Main(string[] args)
        {            
            if (args.Length < 3)
            {                
                Console.WriteLine("usage:\r\nCodeDomGen schemaFile outputFile codeNamespace");
                return;
            }

            string inputFile = args[0];            
            string outputFile = args[1];
            string codeNamespace = args[2];

            var typeLoader = new XmlSchemaTypeLoader();
            typeLoader.Load(inputFile);
            UTF8Encoding encoding = new UTF8Encoding();
            FileStream strm = File.Open(outputFile, FileMode.Create);

            // TODO: NativeCodeGen will use NativeSchemaInfo to generate code.
            NativeSchemaInfo schemaInfo = new NativeSchemaInfo(typeLoader);
            NativeCodeGen codeGen = new NativeCodeGen();

            //string s = SchemaGen.Generate(typeLoader, codeNamespace, inputFile);
            string s = codeGen.Generate(schemaInfo, codeNamespace, inputFile);
            byte[] bytes = encoding.GetBytes(s);
            strm.Write(bytes, 0, bytes.Length);
        }
Example #2
0
        static void Main(string[] args)
        {
            if (args.Length < 3)
            {
                Console.WriteLine("usage:\r\nCodeDomGen schemaFile outputFile codeNamespace");
                return;
            }

            string inputFile     = args[0];
            string outputFile    = args[1];
            string codeNamespace = args[2];

            var typeLoader = new XmlSchemaTypeLoader();

            typeLoader.Load(inputFile);
            UTF8Encoding encoding = new UTF8Encoding();
            FileStream   strm     = File.Open(outputFile, FileMode.Create);

            // TODO: NativeCodeGen will use NativeSchemaInfo to generate code.
            NativeSchemaInfo schemaInfo = new NativeSchemaInfo(typeLoader);
            NativeCodeGen    codeGen    = new NativeCodeGen();

            //string s = SchemaGen.Generate(typeLoader, codeNamespace, inputFile);
            string s = codeGen.Generate(schemaInfo, codeNamespace, inputFile);

            byte[] bytes = encoding.GetBytes(s);
            strm.Write(bytes, 0, bytes.Length);
        }