コード例 #1
0
ファイル: Program.cs プロジェクト: andri-ys/SharpTL
        public static void Compile(CompileArgs args)
        {
            Console.WriteLine("Compiling...");
            string source = File.ReadAllText(args.Source);
            string compiled;

            switch (args.SourceType)
            {
            case SchemaSourceType.TL:
                compiled = TLSchemaCompiler.CompileFromTL(source, args.Namespace);
                break;

            case SchemaSourceType.JSON:
                compiled = TLSchemaCompiler.CompileFromJson(source, args.Namespace);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            File.WriteAllText(args.Destination, compiled);
            Console.WriteLine("Compilation done successfully.");
        }
コード例 #2
0
        public void Should_compile_TL_schema()
        {
            string sharpTLSchemaCode = TLSchemaCompiler.CompileFromJson(GetTestTLJsonSchema(), "SharpTL.TestNamespace");

            sharpTLSchemaCode.Should().NotBeNullOrEmpty();
        }