Beispiel #1
0
        static void GenSchema(string infile, string outdir)
        {
            try
            {
                string text   = System.IO.File.ReadAllText(infile);
                Schema schema = Schema.Parse(text);

                var codegen = new ETPCodeGen();
                codegen.AddSchema(schema);

                codegen.GenerateCode();
                codegen.WriteTypes(outdir);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occurred. " + ex.Message);
            }
        }
Beispiel #2
0
        static void GenProtocol(string infile, string outdir)
        {
            try
            {
                // Conflicting ETP Value property
                CodeGenUtil.Instance.ReservedKeywords.Remove("value");

                var text     = System.IO.File.ReadAllText(infile);
                var protocol = Protocol.Parse(text);

                var codegen = new ETPCodeGen();
                codegen.AddProtocol(protocol);

                codegen.GenerateCode();
                codegen.WriteTypes(outdir);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception occurred. " + ex.Message);
            }
        }