コード例 #1
0
ファイル: Program.cs プロジェクト: BeRo1985/LevelEditor
        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);
        }
コード例 #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);
        }
コード例 #3
0
ファイル: NativeCodeGen.cs プロジェクト: JanDeHud/LevelEditor
 // Generates 'native' C++ code from the info.
 public string Generate(NativeSchemaInfo info, string codeNamespace, string inputFile)
 {
     StringBuilder sb = new StringBuilder();
     GenerateFileProlog(sb, codeNamespace, inputFile);
     GenerateFunctionDefinitions(sb, info.NativeClasses);
     GenerateFunctionRegistration(sb, info.NativeClasses);
     GenerateFileEpilog(sb, codeNamespace);
     return sb.ToString();
 }
コード例 #4
0
        // Generates 'native' C++ code from the info.
        public string Generate(NativeSchemaInfo info, string codeNamespace, string inputFile)
        {
            StringBuilder sb = new StringBuilder();

            GenerateFileProlog(sb, codeNamespace, inputFile);
            GenerateFunctionDefinitions(sb, info.NativeClasses);
            GenerateFunctionRegistration(sb, info.NativeClasses);
            GenerateFileEpilog(sb, codeNamespace);
            return(sb.ToString());
        }