示例#1
0
文件: TestHelper.cs 项目: Tkachov/sdf
        internal static SDF StreamParseString(string s, Schema schema = null)
        {
            var fn = MakeTempFile(s);

            try {
                return(schema == null ?
                       StreamingParser.Parse(fn) :
                       StreamingParser.ParseAndValidateSchema(fn, schema));
            } finally {
                DeleteTempFile(fn);
            }
        }
示例#2
0
文件: Program.cs 项目: Tkachov/sdf
        private static void ReadInputWithStreamingAndValidateBySchema(string[] args)
        {
            if (args.Length != REQUIRED_ARGUMENTS_LENGTH_IS_TWO)
            {
                Console.Out.WriteLine("Usage: Console <input SDF> <schema SDF>");
                return;
            }

            var schema = new Schema(args[INPUT_SDF_SCHEMA_FILENAME_ARGUMENT_INDEX]);
            var data   = StreamingParser.ParseAndValidateSchema(args[INPUT_SDF_FILENAME_ARGUMENT_INDEX], schema);

            Printer.Print(data);
        }