-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
119 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
using Microsoft.VisualStudio.DebuggerVisualizers; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Runtime.InteropServices.ComTypes; | ||
using System.Text; | ||
using System.Text.Json; | ||
using System.Text.RegularExpressions; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using Trivial.Collection; | ||
using Trivial.Data; | ||
using Trivial.Diagnostics; | ||
using Trivial.Reflection; | ||
using Trivial.Text; | ||
|
||
#if NETFRAMEWORK | ||
[assembly: System.Diagnostics.DebuggerVisualizer( | ||
typeof(JsonDebuggerVisualizer), | ||
typeof(JsonObjectSource), | ||
Target = typeof(JsonObjectNode), | ||
Description = "JSON object node visualizer")] | ||
[assembly: System.Diagnostics.DebuggerVisualizer( | ||
typeof(JsonDebuggerVisualizer), | ||
typeof(JsonObjectSource), | ||
Target = typeof(JsonArrayNode), | ||
Description = "JSON array node visualizer")] | ||
#endif | ||
|
||
namespace Trivial.Diagnostics; | ||
|
||
#if NETFRAMEWORK | ||
/// <summary> | ||
/// The Visual Studio debugger visualizer for JSON. | ||
/// </summary> | ||
internal class JsonDebuggerVisualizer : DialogDebuggerVisualizer | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the JsonDebuggerVisualizer class. | ||
/// </summary> | ||
public JsonDebuggerVisualizer() | ||
: base(FormatterPolicy.Json) | ||
{ | ||
} | ||
|
||
/// <inheritdoc /> | ||
protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider) | ||
{ | ||
//var data = (objectProvider as IVisualizerObjectProvider3)?.GetObject<JsonObjectNode>(); | ||
var data = (objectProvider as IVisualizerObjectProvider3)?.GetObject<JsonObjectNode>(); | ||
var form = new JsonViewerWindow(); | ||
form.Set(data); | ||
form.ShowDialog(); | ||
} | ||
} | ||
#endif | ||
|
||
/// <summary> | ||
/// The visualizer object source for JSON. | ||
/// </summary> | ||
internal class JsonObjectSource : VisualizerObjectSource | ||
{ | ||
/// <inheritdoc/> | ||
public override void GetData(object target, Stream outgoingData) | ||
{ | ||
var o = target as BaseJsonValueNode; | ||
var writer = new Utf8JsonWriter(outgoingData); | ||
o.WriteTo(writer); | ||
} | ||
|
||
/// <inheritdoc/> | ||
public override object CreateReplacementObject(object target, Stream incomingData) | ||
=> JsonSerializer.Deserialize<BaseJsonValueNode>(incomingData); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters