Skip to content

Commit

Permalink
chore: 更新 License 页面,添加 Source 链接
Browse files Browse the repository at this point in the history
  • Loading branch information
KiyanYang committed Feb 15, 2023
1 parent 6f6dd91 commit 88445a5
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 30 deletions.
3 changes: 2 additions & 1 deletion DotVast.HashTool.WinUI/DotVast.HashTool.WinUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@
<PackageReference Include="CryptoBase" Version="1.7.2" />
<PackageReference Include="DotVast.Toolkit.StringResource" Version="0.4.0" />
<PackageReference Include="HashLib4CSharp" Version="1.5.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="7.0.1" />
<PackageReference Include="Microsoft.Extensions.Http" Version="7.0.0" />
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.2.230118.102" />
<PackageReference Include="Serilog" Version="2.12.0" />
<PackageReference Include="Serilog.Extensions.Hosting" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
<PackageReference Include="WinUIEx" Version="2.1.0" />
Expand Down
8 changes: 0 additions & 8 deletions DotVast.HashTool.WinUI/Enums/LicenseType.cs

This file was deleted.

2 changes: 1 addition & 1 deletion DotVast.HashTool.WinUI/Models/LicenseInfo.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
namespace DotVast.HashTool.WinUI.Models;

public readonly record struct LicenseInfo(string Name, string License, string Url);
public readonly record struct LicenseInfo(string Name, string License, string Url, string SourceLink);
55 changes: 36 additions & 19 deletions DotVast.HashTool.WinUI/ViewModels/LicensesViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,45 @@
using DotVast.HashTool.WinUI.Enums;
using DotVast.HashTool.WinUI.Models;

namespace DotVast.HashTool.WinUI.ViewModels;

public sealed partial class LicensesViewModel : ObservableRecipient
{
public LicenseInfo[] Licenses
public LicenseInfo[] Licenses { get; } = new LicenseInfo[]
{
get;
} = new LicenseInfo[]
{
new("CommunityToolkit.MVVM", LicenseType.MIT, "https://licenses.nuget.org/MIT"),
new("CommunityToolkit.WinUI.UI", LicenseType.MIT, "https://licenses.nuget.org/MIT"),
new("CommunityToolkit.WinUI.UI.Behaviors", LicenseType.MIT, "https://licenses.nuget.org/MIT"),
new("CommunityToolkit.WinUI.UI.Controls.Markdown",LicenseType.MIT, "https://licenses.nuget.org/MIT"),
new("CryptoBase", LicenseType.MIT, "https://github.com/HMBSbige/CryptoBase/blob/1.7.2/LICENSE"),
new("DotVast.Toolkit.StringResource", LicenseType.MIT, "https://github.com/KiyanYang/DotVast.Toolkit.StringResource/blob/main/LICENSE.txt"),
new("HashLib4CSharp", LicenseType.MIT, "https://www.nuget.org/packages/HashLib4CSharp/1.5.0/license"),
new("Microsoft.Extensions.Hosting", LicenseType.MIT, "https://licenses.nuget.org/MIT"),
new("Microsoft.Extensions.Http", LicenseType.MIT, "https://licenses.nuget.org/MIT"),
new("Microsoft.WindowsAppSDK", LicenseType.Unknown, "https://www.nuget.org/packages/Microsoft.WindowsAppSDK/1.1.5/license"),
new("Serilog.Extensions.Hosting", LicenseType.Apache_2_0, "https://licenses.nuget.org/Apache-2.0"),
new("Serilog.Sinks.File", LicenseType.Apache_2_0, "https://licenses.nuget.org/Apache-2.0"),
new("WinUIEx", LicenseType.Apache_2_0, "https://licenses.nuget.org/Apache-2.0"),
new("QuickXorHash.cs", LicenseType.MIT, "https://gist.github.com/rgregg/c07a91964300315c6c3e77f7b5b861e4"),
new("CommunityToolkit.Mvvm", License.MIT, NugetLicenseUrl.MIT, "https://www.nuget.org/packages/CommunityToolkit.Mvvm"),
new("CommunityToolkit.WinUI.UI", License.MIT, NugetLicenseUrl.MIT, "https://www.nuget.org/packages/CommunityToolkit.WinUI.UI"),
new("CommunityToolkit.WinUI.UI.Behaviors", License.MIT, NugetLicenseUrl.MIT,"https://www.nuget.org/packages/CommunityToolkit.WinUI.UI.Behaviors"),
new("CommunityToolkit.WinUI.UI.Controls.Markdown",License.MIT, NugetLicenseUrl.MIT,"https://www.nuget.org/packages/CommunityToolkit.WinUI.UI.Controls.Markdown"),

new("CryptoBase", License.MIT, NugetLicenseUrl.MIT,"https://www.nuget.org/packages/CryptoBase"),

new("DotVast.Toolkit.StringResource", License.MIT, NugetLicenseUrl.MIT, "https://www.nuget.org/packages/DotVast.Toolkit.StringResource"),

new("HashLib4CSharp", License.MIT, "https://www.nuget.org/packages/HashLib4CSharp/1.5.0/License","https://www.nuget.org/packages/HashLib4CSharp"),

new("Microsoft.Extensions.Hosting", License.MIT, NugetLicenseUrl.MIT,"https://www.nuget.org/packages/Microsoft.Extensions.Hosting"),
new("Microsoft.Extensions.Http", License.MIT, NugetLicenseUrl.MIT,"https://www.nuget.org/packages/Microsoft.Extensions.Http"),
new("Microsoft.WindowsAppSDK", License.Unknown, "https://www.nuget.org/packages/Microsoft.WindowsAppSDK/1.2.230118.102/License","https://www.nuget.org/packages/Microsoft.WindowsAppSDK"),

new("Serilog", License.Apache_2_0, NugetLicenseUrl.Apache_2_0,"https://www.nuget.org/packages/Serilog"),
new("Serilog.Extensions.Hosting", License.Apache_2_0, NugetLicenseUrl.Apache_2_0,"https://www.nuget.org/packages/Serilog.Extensions.Hosting"),
new("Serilog.Sinks.File", License.Apache_2_0, NugetLicenseUrl.Apache_2_0,"https://www.nuget.org/packages/Serilog.Sinks.File"),

new("WinUIEx", License.Apache_2_0, NugetLicenseUrl.Apache_2_0,"https://www.nuget.org/packages/WinUIEx"),

new("QuickXorHash.cs", License.MIT, "https://gist.github.com/rgregg/c07a91964300315c6c3e77f7b5b861e4","https://gist.github.com/rgregg/c07a91964300315c6c3e77f7b5b861e4"),
};
}

static file class License
{
public static readonly string Unknown = "License";
public static readonly string Apache_2_0 = "Apache License 2.0";
public static readonly string MIT = "MIT License";
}

static file class NugetLicenseUrl
{
public static readonly string Apache_2_0 = "https://licenses.nuget.org/Apache-2.0";
public static readonly string MIT = "https://licenses.nuget.org/MIT";
}
9 changes: 8 additions & 1 deletion DotVast.HashTool.WinUI/Views/LicensesPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
<Grid Style="{StaticResource CardGridStyle}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="Auto" MinWidth="120" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock
Grid.Column="0"
Expand All @@ -20,8 +21,14 @@
<HyperlinkButton
Grid.Column="1"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Content="{x:Bind License}"
NavigateUri="{x:Bind Url}" />
<HyperlinkButton
Grid.Column="2"
VerticalAlignment="Center"
Content="Source"
NavigateUri="{x:Bind SourceLink}" />
</Grid>
</DataTemplate>
</Page.Resources>
Expand Down

0 comments on commit 88445a5

Please sign in to comment.