示例#1
0
        private void ReadObjectProcessStream(StreamReader reader)
        {
            using (var jsonReader = new JsonTextReader(reader)
            {
                SupportMultipleContent = true
            })
            {
                while (jsonReader.Read())
                {
                    try
                    {
                        var result = _jsonSerializer.Deserialize <ResultObject>(jsonReader);

                        switch (result)
                        {
                        case ExceptionResultObject exceptionResult:
                            Error?.Invoke(exceptionResult);
                            break;

                        case InputReadRequest _:
                            ReadInput?.Invoke();
                            break;

                        default:
                            Dumped?.Invoke(result);
                            break;
                        }
                    }
                    catch (Exception ex)
                    {
                        Dumped?.Invoke(ResultObject.Create("Error deserializing result: " + ex.Message, DumpQuotas.Default));
                    }
                }
            }
        }
示例#2
0
        private async Task ReadProcessStream(StreamReader reader)
        {
            while (!reader.EndOfStream)
            {
                var line = await reader.ReadLineAsync().ConfigureAwait(false);

                if (line != null)
                {
                    Dumped?.Invoke(ResultObject.Create(line, DumpQuotas.Default));
                }
            }
        }
示例#3
0
 public static T Dump <T>(this T o, string?header = null, int maxDepth = DumpQuotas.DefaultMaxDepth, int maxExpandedDepth = DumpQuotas.DefaultMaxExpandedDepth, int maxEnumerableLength = DumpQuotas.DefaultMaxEnumerableLength, int maxStringLength = DumpQuotas.DefaultMaxStringLength)
 {
     Dumped?.Invoke(new DumpData(o, header, new DumpQuotas(maxDepth, maxExpandedDepth, maxEnumerableLength, maxStringLength)));
     return(o);
 }
示例#4
0
 private void OnDumped(IList <ResultObject> results) => Dumped?.Invoke(results);
示例#5
0
 public static T Dump <T>(this T o, string header = null)
 {
     Dumped?.Invoke(o, header);
     return(o);
 }
示例#6
0
 public static T Dump <T>(this T obj, string nameval = "")
 {
     Dumped?.Invoke(obj, nameval);
     return(obj);
 }
示例#7
0
 public static T Dump <T>(this T o)
 {
     Dumped?.Invoke(o, DumpTarget.Text);
     return(o);
 }
示例#8
0
 public static T DumpToPropertyGrid <T>(this T o)
 {
     Dumped?.Invoke(o, DumpTarget.PropertyGrid);
     return(o);
 }