Skip to content

Commit

Permalink
Update icon.
Browse files Browse the repository at this point in the history
  • Loading branch information
kingcean committed Nov 30, 2024
1 parent 50cb123 commit d478a46
Show file tree
Hide file tree
Showing 14 changed files with 119 additions and 53 deletions.
2 changes: 2 additions & 0 deletions Common/Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
<UseWinUI>true</UseWinUI>
<Description>Some advanced visual controls and utilities for Windows app.</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ApplicationIcon>Logo.ico</ApplicationIcon>
<PackageIcon>logo.png</PackageIcon>
<PackageTags>ui tiles lwa</PackageTags>
</PropertyGroup>
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions Console/Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<Description>The console utilities and rich user interface console.</Description>
<PackageProjectUrl>https://github.com/nuscien/trivial/wiki/console</PackageProjectUrl>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<ApplicationIcon>Logo.ico</ApplicationIcon>
<PackageIcon>cmd.png</PackageIcon>
<PackageIconUrl>https://github.com/nuscien/trivial/raw/master/Materials/logo.png</PackageIconUrl>
<PackageTags>console</PackageTags>
Expand Down
Binary file added Console/Logo.ico
Binary file not shown.
2 changes: 1 addition & 1 deletion Debugger/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ internal static void AddKeyValuePairs(BaseJsonValueNode json, UIElementCollectio
kindElement.Value = InternalResource.Number;
if (json is IJsonValueNode<long> l)
{
kindElement.Value = l.Value <= JsonIntegerNode.MaxSafeInteger && l.Value >= JsonIntegerNode.MinSafeInteger ? "Integer" : "Integer (unsafe)";
kindElement.Value = l.Value <= JsonIntegerNode.MaxSafeInteger && l.Value >= JsonIntegerNode.MinSafeInteger ? InternalResource.Integer : $"{InternalResource.Integer} ({InternalResource.Unsafe})";
AddKeyValuePair(panel, InternalResource.Value, l.Value.ToString());
AddLocaleString(panel, l.Value);
}
Expand Down
18 changes: 18 additions & 0 deletions Debugger/InternalResource.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Debugger/InternalResource.en.resx
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,10 @@
<data name="False" xml:space="preserve">
<value>False</value>
</data>
<data name="Unsafe" xml:space="preserve">
<value>Unsafe</value>
</data>
<data name="Copy" xml:space="preserve">
<value>Copy</value>
</data>
</root>
6 changes: 6 additions & 0 deletions Debugger/InternalResource.resx
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,10 @@
<data name="False" xml:space="preserve">
<value>False</value>
</data>
<data name="Unsafe" xml:space="preserve">
<value>Unsafe</value>
</data>
<data name="Copy" xml:space="preserve">
<value>Copy</value>
</data>
</root>
6 changes: 6 additions & 0 deletions Debugger/InternalResource.zh-Hans.resx
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,10 @@
<data name="False" xml:space="preserve">
<value>假</value>
</data>
<data name="Unsafe" xml:space="preserve">
<value>不安全</value>
</data>
<data name="Copy" xml:space="preserve">
<value>复制</value>
</data>
</root>
75 changes: 75 additions & 0 deletions Debugger/JsonDebuggerVisualizer.cs
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);
}
51 changes: 0 additions & 51 deletions Debugger/JsonObjectNodeDebuggerVisualizer.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Debugger/JsonViewer.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ColumnDefinition x:Name="DetailsColumn" Width="3*" />
</Grid.ColumnDefinitions>
<TreeView x:Name="DocumentTree" Background="Transparent" Margin="1,32,6,1" SelectedItemChanged="DocumentTree_SelectedItemChanged" />
<Button Content="$self" Height="30" Margin="1,1,6,1" VerticalAlignment="Top" HorizontalContentAlignment="Left" Click="Button_Click"/>
<Button Content="$ (root)" Height="30" Margin="1,1,6,1" VerticalAlignment="Top" HorizontalContentAlignment="Left" Click="Button_Click" Padding="8,1,8,1"/>
<ScrollViewer HorizontalScrollBarVisibility="Disabled" VerticalScrollBarVisibility="Visible" Padding="1" Grid.Column="1" >
<StackPanel x:Name="DetailsPanel" Orientation="Vertical" />
</ScrollViewer>
Expand Down
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" PrivateAssets="All" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
<PackageVersion Include="Microsoft.VisualStudio.DebuggerVisualizers" Version="17.6.1032901" />
<PackageVersion Include="Microsoft.VisualStudio.Extensibility" Version="17.12.2051" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.6.241114003" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.26100.1742" />
<PackageVersion Include="Trivial" Version="9.0.0-preview7" />
Expand Down
1 change: 1 addition & 0 deletions Web/Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageId>Trivial.Web</PackageId>
<Description>A library for web API.</Description>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<PackageIcon>web.png</PackageIcon>
<PackageIconUrl>https://github.com/nuscien/trivial/raw/master/Materials/logo.png</PackageIconUrl>
<PackageTags>web mvc</PackageTags>
Expand Down

0 comments on commit d478a46

Please sign in to comment.