diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml
index e70ad229d..ab05fa5a7 100644
--- a/.github/workflows/CI.yaml
+++ b/.github/workflows/CI.yaml
@@ -56,7 +56,10 @@ jobs:
- name: Build
shell: pwsh
- run: .\build.ps1
+ run: |
+ .\build.ps1
+ .\build.WinUI.ps1 x64
+ .\build.WinUI.ps1 arm64
- name: Upload
uses: actions/upload-artifact@v3
@@ -64,6 +67,18 @@ jobs:
name: ${{ env.ProjectName }}
path: ${{ env.ProjectName }}\bin\${{ env.Configuration }}\${{ env.NET_TFM }}\generic\publish\
+ - name: Upload WinUI x64
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ env.ProjectName }}.WinUI.x64
+ path: ${{ env.ProjectName }}.WinUI\bin\x64\${{ env.Configuration }}\${{ env.NET_TFM }}\win-x64\publish\
+
+ - name: Upload WinUI arm64
+ uses: actions/upload-artifact@v3
+ with:
+ name: ${{ env.ProjectName }}.WinUI.arm64
+ path: ${{ env.ProjectName }}.WinUI\bin\arm64\${{ env.Configuration }}\${{ env.NET_TFM }}\win-arm64\publish\
+
nuget:
needs: [test, check_format]
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
@@ -102,6 +117,16 @@ jobs:
name: ${{ env.ProjectName }}
path: ${{ env.ProjectName }}
+ - uses: actions/download-artifact@v3
+ with:
+ name: ${{ env.ProjectName }}.WinUI.x64
+ path: ${{ env.ProjectName }}.WinUI.x64
+
+ - uses: actions/download-artifact@v3
+ with:
+ name: ${{ env.ProjectName }}.WinUI.arm64
+ path: ${{ env.ProjectName }}.WinUI.arm64
+
- name: Get tag
id: tag
uses: dawidd6/action-get-tag@v1
@@ -114,6 +139,20 @@ jobs:
7z a -mx9 "$zip_path" ${{ env.ProjectName }}
echo "GENERIC_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+ - name: Package WinUI x64
+ shell: pwsh
+ run: |
+ $zip_path = "builtfiles/$env:ProjectName-${{ steps.tag.outputs.tag }}-x64.7z"
+ 7z a -mx9 "$zip_path" ${{ env.ProjectName }}.WinUI.x64
+ echo "X64_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
+ - name: Package WinUI arm64
+ shell: pwsh
+ run: |
+ $zip_path = "builtfiles/$env:ProjectName-${{ steps.tag.outputs.tag }}-arm64.7z"
+ 7z a -mx9 "$zip_path" ${{ env.ProjectName }}.WinUI.arm64
+ echo "ARM64_SHA256=$((Get-FileHash $zip_path -Algorithm SHA256).Hash)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
+
- name: Create a new GitHub release
uses: ncipollo/release-action@v1
with:
@@ -126,3 +165,5 @@ jobs:
| Filename | SHA-256 |
| :- | :- |
| ${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}.7z | ${{ env.GENERIC_SHA256 }} |
+ | ${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-x64.7z | ${{ env.X64_SHA256 }} |
+ | ${{ env.ProjectName }}-${{ steps.tag.outputs.tag }}-arm64.7z | ${{ env.ARM64_SHA256 }} |
diff --git a/NatTypeTester.WinUI/Extensions/ContentDialogExtensions.cs b/NatTypeTester.WinUI/Extensions/ContentDialogExtensions.cs
index ff852d7fb..889a140ec 100644
--- a/NatTypeTester.WinUI/Extensions/ContentDialogExtensions.cs
+++ b/NatTypeTester.WinUI/Extensions/ContentDialogExtensions.cs
@@ -4,13 +4,21 @@ internal static class ContentDialogExtensions
{
public static async ValueTask HandleExceptionWithContentDialogAsync(this Exception ex, XamlRoot root)
{
+ ResourceLoader resourceLoader = ResourceLoader.GetForViewIndependentUse();
ContentDialog dialog = new();
try
{
dialog.XamlRoot = root;
dialog.Title = nameof(NatTypeTester);
- dialog.Content = ex.Message;
- dialog.PrimaryButtonText = @"OK";
+
+ string content = resourceLoader.GetString(ex.Message);
+ if (string.IsNullOrEmpty(content))
+ {
+ content = ex.Message;
+ }
+ dialog.Content = content;
+
+ dialog.PrimaryButtonText = resourceLoader.GetString(@"OK");
await dialog.ShowAsync();
}
diff --git a/NatTypeTester.WinUI/MainWindow.xaml.cs b/NatTypeTester.WinUI/MainWindow.xaml.cs
index a296edc78..d499d64cb 100644
--- a/NatTypeTester.WinUI/MainWindow.xaml.cs
+++ b/NatTypeTester.WinUI/MainWindow.xaml.cs
@@ -9,7 +9,7 @@ public MainWindow()
Title = nameof(NatTypeTester);
ExtendsContentIntoTitleBar = true;
- AppWindow.Resize(new SizeInt32(500, 590));
+ AppWindow.Resize(new SizeInt32(500, 560));
AppWindow.SetIcon(@"Assets\icon.ico");
// CenterScreen
diff --git a/NatTypeTester.WinUI/NatTypeTesterModule.cs b/NatTypeTester.WinUI/NatTypeTesterModule.cs
index b8f9db0a6..5b01a5b3e 100644
--- a/NatTypeTester.WinUI/NatTypeTesterModule.cs
+++ b/NatTypeTester.WinUI/NatTypeTesterModule.cs
@@ -20,6 +20,7 @@
global using Volo.Abp.Autofac;
global using Volo.Abp.DependencyInjection;
global using Volo.Abp.Modularity;
+global using Windows.ApplicationModel.Resources;
global using Windows.Graphics;
global using Windows.System;
diff --git a/NatTypeTester.WinUI/Strings/en-US/Resources.resw b/NatTypeTester.WinUI/Strings/en-US/Resources.resw
new file mode 100644
index 000000000..0117c7385
--- /dev/null
+++ b/NatTypeTester.WinUI/Strings/en-US/Resources.resw
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ Binding test
+
+
+ Filtering behavior
+
+
+ Local end
+
+
+ Any
+
+
+ Mapping behavior
+
+
+ Don't use Proxy
+
+
+ OK
+
+
+ Password
+
+
+ Proxy
+
+
+ Server
+
+
+ Username
+
+
+ Public end
+
+
+ NAT type
+
+
+ This protocol is obsoleted and may not be suitable for modern routers or NAT.
+
+
+ STUN Server
+
+
+ SOCKS5
+
+
+ Test
+
+
+ Unknown proxy address
+
+
+ Wrong STUN Server!
+
+
\ No newline at end of file
diff --git a/NatTypeTester.WinUI/Strings/zh-CN/Resources.resw b/NatTypeTester.WinUI/Strings/zh-CN/Resources.resw
new file mode 100644
index 000000000..788130b7c
--- /dev/null
+++ b/NatTypeTester.WinUI/Strings/zh-CN/Resources.resw
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 绑定测试
+
+
+ 过滤行为
+
+
+ 本地地址
+
+
+ 任意地址
+
+
+ 映射行为
+
+
+ 不使用代理
+
+
+ 确定
+
+
+ 密码
+
+
+ 代理设置
+
+
+ 服务器
+
+
+ 用户名
+
+
+ 公网地址
+
+
+ NAT 类型
+
+
+ 该协议已过时,可能不适用于现代路由器或 NAT。
+
+
+ STUN 服务器
+
+
+ SOCKS5 代理
+
+
+ 测试
+
+
+ 代理服务器地址输入有误!
+
+
+ STUN 服务器输入有误!
+
+
\ No newline at end of file
diff --git a/NatTypeTester.WinUI/Views/MainPage.xaml b/NatTypeTester.WinUI/Views/MainPage.xaml
index acad7f369..ae5fff215 100644
--- a/NatTypeTester.WinUI/Views/MainPage.xaml
+++ b/NatTypeTester.WinUI/Views/MainPage.xaml
@@ -9,7 +9,7 @@
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
-
+
-
+
diff --git a/NatTypeTester.WinUI/Views/MainPage.xaml.cs b/NatTypeTester.WinUI/Views/MainPage.xaml.cs
index e57374c1b..a75792c4a 100644
--- a/NatTypeTester.WinUI/Views/MainPage.xaml.cs
+++ b/NatTypeTester.WinUI/Views/MainPage.xaml.cs
@@ -53,6 +53,7 @@ public MainPage()
NavigationView.SelectedItem = NavigationView.MenuItems.OfType().First();
ViewModel.LoadStunServer();
+ ServersComboBox.SelectedIndex = 0;
});
}
}
diff --git a/NatTypeTester.WinUI/Views/RFC3489Page.xaml b/NatTypeTester.WinUI/Views/RFC3489Page.xaml
index f2d62e53f..abdfbc95f 100644
--- a/NatTypeTester.WinUI/Views/RFC3489Page.xaml
+++ b/NatTypeTester.WinUI/Views/RFC3489Page.xaml
@@ -7,27 +7,28 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
-
+
-
-
- 0.0.0.0:0
- [::]:0
-
-
+
+
-
+
+
+
+
+
diff --git a/NatTypeTester.WinUI/Views/RFC3489Page.xaml.cs b/NatTypeTester.WinUI/Views/RFC3489Page.xaml.cs
index 443dd2142..d609a4652 100644
--- a/NatTypeTester.WinUI/Views/RFC3489Page.xaml.cs
+++ b/NatTypeTester.WinUI/Views/RFC3489Page.xaml.cs
@@ -15,16 +15,7 @@ public RFC3489Page(RFC3489ViewModel viewModel)
this.Bind(ViewModel, vm => vm.Result3489.LocalEndPoint, v => v.LocalEndComboBox.Text).DisposeWith(d);
- LocalEndComboBox.Events().TextSubmitted.Subscribe(parameter =>
- {
- if (ViewModel.Result3489.LocalEndPoint is not null)
- {
- return;
- }
-
- LocalEndComboBox.Text = string.Empty;
- parameter.args.Handled = true;
- }).DisposeWith(d);
+ LocalEndComboBox.Events().LostFocus.Subscribe(_ => LocalEndComboBox.Text = ViewModel.Result3489.LocalEndPoint?.ToString()).DisposeWith(d);
this.OneWayBind(ViewModel, vm => vm.Result3489.PublicEndPoint, v => v.PublicEndTextBox.Text).DisposeWith(d);
diff --git a/NatTypeTester.WinUI/Views/RFC5780Page.xaml b/NatTypeTester.WinUI/Views/RFC5780Page.xaml
index f497c5632..4a5e48ac0 100644
--- a/NatTypeTester.WinUI/Views/RFC5780Page.xaml
+++ b/NatTypeTester.WinUI/Views/RFC5780Page.xaml
@@ -7,45 +7,40 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
-
-
-
-
-
-
-
-
-
-
-
-
- 0.0.0.0:0
- [::]:0
-
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/NatTypeTester.WinUI/Views/RFC5780Page.xaml.cs b/NatTypeTester.WinUI/Views/RFC5780Page.xaml.cs
index 3fd739a48..6282a8701 100644
--- a/NatTypeTester.WinUI/Views/RFC5780Page.xaml.cs
+++ b/NatTypeTester.WinUI/Views/RFC5780Page.xaml.cs
@@ -23,16 +23,7 @@ public RFC5780Page(RFC5780ViewModel viewModel)
this.Bind(ViewModel, vm => vm.Result5389.LocalEndPoint, v => v.LocalAddressComboBox.Text).DisposeWith(d);
- LocalAddressComboBox.Events().TextSubmitted.Subscribe(parameter =>
- {
- if (ViewModel.Result5389.LocalEndPoint is not null)
- {
- return;
- }
-
- LocalAddressComboBox.Text = string.Empty;
- parameter.args.Handled = true;
- }).DisposeWith(d);
+ LocalAddressComboBox.Events().LostFocus.Subscribe(_ => LocalAddressComboBox.Text = ViewModel.Result5389.LocalEndPoint?.ToString()).DisposeWith(d);
this.OneWayBind(ViewModel, vm => vm.Result5389.PublicEndPoint, v => v.MappingAddressTextBox.Text).DisposeWith(d);
diff --git a/NatTypeTester.WinUI/Views/SettingPage.xaml b/NatTypeTester.WinUI/Views/SettingPage.xaml
index 8dc507816..a1cf52921 100644
--- a/NatTypeTester.WinUI/Views/SettingPage.xaml
+++ b/NatTypeTester.WinUI/Views/SettingPage.xaml
@@ -9,9 +9,9 @@
-
-
-
+
+
+
@@ -23,20 +23,20 @@
+ x:Name="ProxyServerTextBox"
+ x:Uid="ProxyServerTextBox"
+ Grid.Row="0"
+ Margin="0,5" IsReadOnly="False" />
+ x:Name="ProxyUsernameTextBox"
+ x:Uid="ProxyUsernameTextBox"
+ Grid.Row="1"
+ Margin="0,5" IsReadOnly="False" />
+ x:Name="ProxyPasswordTextBox"
+ x:Uid="ProxyPasswordTextBox"
+ Grid.Row="2"
+ Margin="0,5" />
diff --git a/NatTypeTester/MainWindow.xaml.cs b/NatTypeTester/MainWindow.xaml.cs
index 13768799f..eeac5ce8d 100644
--- a/NatTypeTester/MainWindow.xaml.cs
+++ b/NatTypeTester/MainWindow.xaml.cs
@@ -31,7 +31,7 @@ public MainWindow(MainWindowViewModel viewModel, IServiceProvider serviceProvide
#endregion
- this.Bind(ViewModel, vm => vm.Router, v => v.RoutedViewHost.Router).DisposeWith(d);
+ this.OneWayBind(ViewModel, vm => vm.Router, v => v.RoutedViewHost.Router).DisposeWith(d);
NavigationView.Events().SelectionChanged
.Subscribe(parameter =>
diff --git a/NatTypeTester/NatTypeTester.csproj b/NatTypeTester/NatTypeTester.csproj
index 518c08f0d..d17f63a7a 100644
--- a/NatTypeTester/NatTypeTester.csproj
+++ b/NatTypeTester/NatTypeTester.csproj
@@ -6,7 +6,7 @@
net8.0-windows10.0.22621.0
WinExe
true
- 7.0.0
+ 8.0.0
icon.ico
diff --git a/README.md b/README.md
index 5fcdb2f06..8cebe9ce3 100644
--- a/README.md
+++ b/README.md
@@ -21,9 +21,6 @@ Stun.Net | [![NuGet.org](https://img.shields.io/nuget/v/Stun.Net.svg?logo=nuget)
- [x] TCP
- [x] TLS-over-TCP
-## Preview
-![](pic/1.png)
-
## RFC3489
diff --git a/STUN/STUN.csproj b/STUN/STUN.csproj
index e1e9b9081..bfb54b38d 100644
--- a/STUN/STUN.csproj
+++ b/STUN/STUN.csproj
@@ -11,10 +11,15 @@
https://github.com/HMBSbige/NatTypeTester
https://github.com/HMBSbige/NatTypeTester
stun;nat;rfc3489;rfc5389;rfc5780;rfc8489
- 7.0.0
+ 8.0.0
Stun.Net
+ README.md
+
+
+
+
diff --git a/build.WinUI.ps1 b/build.WinUI.ps1
new file mode 100644
index 000000000..5aeea7185
--- /dev/null
+++ b/build.WinUI.ps1
@@ -0,0 +1,19 @@
+param([string]$platform = 'x64')
+$ErrorActionPreference = 'Stop'
+
+dotnet --info
+
+$proj = 'NatTypeTester.WinUI'
+$net_tfm = 'net8.0-windows10.0.22621.0'
+$configuration = 'Release'
+$proj_path = "$PSScriptRoot\$proj\$proj.csproj"
+
+$rid = "win-$platform"
+Write-Host "Building $rid"
+
+$publishDir = "$PSScriptRoot\$proj\bin\$platform\$configuration\$net_tfm\$rid\publish"
+
+Remove-Item $publishDir -Recurse -Force -Confirm:$false -ErrorAction Ignore
+
+dotnet publish -c $configuration -f $net_tfm -p:Platform=$platform -r $rid --self-contained $proj_path
+if ($LASTEXITCODE) { exit $LASTEXITCODE }
diff --git a/pic/1.png b/pic/1.png
deleted file mode 100644
index 110ba5ad9..000000000
Binary files a/pic/1.png and /dev/null differ