Example #1
0
        public static ResultLogObjectWriter GetConverterObjects(ToolFileConverterBase converter, byte[] inputData)
        {
            var result = new ResultLogObjectWriter();

            using (var input = new MemoryStream(inputData))
            {
                converter.Convert(input, result, OptionallyEmittedData.None);
            }

            return(result);
        }
Example #2
0
        public static string GetConverterJson(ToolFileConverterBase converter, byte[] inputData)
        {
            using (var input = new MemoryStream(inputData))
            {
                using (var output = new StringWriter())
                {
                    var json = new JsonTextWriter(output);
                    json.Formatting  = Newtonsoft.Json.Formatting.Indented;
                    json.CloseOutput = false;
                    using (var outputWriter = new ResultLogJsonWriter(json))
                    {
                        converter.Convert(input, outputWriter, LoggingOptions.None);
                    }

                    return(output.ToString());
                }
            }
        }