diff --git a/ProxySU_Core/ProxySU_Core.csproj b/ProxySU_Core/ProxySU_Core.csproj
index 1daf4c3..0ead6f4 100644
--- a/ProxySU_Core/ProxySU_Core.csproj
+++ b/ProxySU_Core/ProxySU_Core.csproj
@@ -201,6 +201,9 @@
+
+ ClientInfoWindow.xaml
+
MainWindow.xaml
@@ -342,6 +345,10 @@
MSBuild:Compile
Designer
+
+ Designer
+ MSBuild:Compile
+
MSBuild:Compile
Designer
diff --git a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
index 3bf4ef3..1df53d4 100644
--- a/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
+++ b/ProxySU_Core/ViewModels/XraySettingsViewModel.cs
@@ -76,7 +76,9 @@ namespace ProxySU_Core.ViewModels
{
if (value == true)
{
- settings.Types.Add(XrayType.VLESS_TCP_TLS);
+ if (!settings.Types.Contains(XrayType.VLESS_TCP_TLS))
+ settings.Types.Add(XrayType.VLESS_TCP_TLS);
+
}
else
{
@@ -97,7 +99,8 @@ namespace ProxySU_Core.ViewModels
{
if (value == true)
{
- settings.Types.Add(XrayType.VLESS_TCP_XTLS);
+ if (!settings.Types.Contains(XrayType.VLESS_TCP_XTLS))
+ settings.Types.Add(XrayType.VLESS_TCP_XTLS);
}
else
{
@@ -117,7 +120,8 @@ namespace ProxySU_Core.ViewModels
{
if (value == true)
{
- settings.Types.Add(XrayType.VLESS_WS_TLS);
+ if (!settings.Types.Contains(XrayType.VLESS_WS_TLS))
+ settings.Types.Add(XrayType.VLESS_WS_TLS);
}
else
{
@@ -138,7 +142,8 @@ namespace ProxySU_Core.ViewModels
{
if (value == true)
{
- settings.Types.Add(XrayType.VMESS_TCP_TLS);
+ if (!settings.Types.Contains(XrayType.VMESS_TCP_TLS))
+ settings.Types.Add(XrayType.VMESS_TCP_TLS);
}
else
{
@@ -159,7 +164,8 @@ namespace ProxySU_Core.ViewModels
{
if (value == true)
{
- settings.Types.Add(XrayType.VMESS_WS_TLS);
+ if (!settings.Types.Contains(XrayType.VMESS_WS_TLS))
+ settings.Types.Add(XrayType.VMESS_WS_TLS);
}
else
{
@@ -180,7 +186,8 @@ namespace ProxySU_Core.ViewModels
{
if (value == true)
{
- settings.Types.Add(XrayType.Trojan_TCP_TLS);
+ if (!settings.Types.Contains(XrayType.Trojan_TCP_TLS))
+ settings.Types.Add(XrayType.Trojan_TCP_TLS);
}
else
{
diff --git a/ProxySU_Core/Views/ClientInfoWindow.xaml b/ProxySU_Core/Views/ClientInfoWindow.xaml
new file mode 100644
index 0000000..5e01deb
--- /dev/null
+++ b/ProxySU_Core/Views/ClientInfoWindow.xaml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ProxySU_Core/Views/ClientInfoWindow.xaml.cs b/ProxySU_Core/Views/ClientInfoWindow.xaml.cs
new file mode 100644
index 0000000..00a0f5d
--- /dev/null
+++ b/ProxySU_Core/Views/ClientInfoWindow.xaml.cs
@@ -0,0 +1,32 @@
+using ProxySU_Core.Models;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace ProxySU_Core.Views
+{
+ ///
+ /// ClientInfoWindow.xaml 的交互逻辑
+ ///
+ public partial class ClientInfoWindow
+ {
+ Record Record { get; set; }
+ public ClientInfoWindow(Record record)
+ {
+ InitializeComponent();
+ this.Record = record;
+
+ DataContext = this.Record;
+ }
+ }
+}
diff --git a/ProxySU_Core/Views/MainWindow.xaml b/ProxySU_Core/Views/MainWindow.xaml
index 22e7029..4860593 100644
--- a/ProxySU_Core/Views/MainWindow.xaml
+++ b/ProxySU_Core/Views/MainWindow.xaml
@@ -96,6 +96,7 @@
+
diff --git a/ProxySU_Core/Views/MainWindow.xaml.cs b/ProxySU_Core/Views/MainWindow.xaml.cs
index ddd59fd..1f8a29f 100644
--- a/ProxySU_Core/Views/MainWindow.xaml.cs
+++ b/ProxySU_Core/Views/MainWindow.xaml.cs
@@ -1,5 +1,6 @@
using MahApps.Metro.Controls.Dialogs;
using Newtonsoft.Json;
+using Newtonsoft.Json.Serialization;
using ProxySU_Core.Models;
using ProxySU_Core.ViewModels;
using ProxySU_Core.ViewModels.Developers;
@@ -56,6 +57,20 @@ namespace ProxySU_Core
DataContext = this;
}
+ private void SaveRecord()
+ {
+ var recordList = Records.Select(x => x.record);
+ var json = JsonConvert.SerializeObject(recordList,
+ Formatting.Indented,
+ new JsonSerializerSettings
+ {
+ ContractResolver = new CamelCasePropertyNamesContractResolver()
+ });
+ if (File.Exists("Data\\Record.json"))
+ {
+ File.WriteAllText("Data\\Record.json", json, Encoding.UTF8);
+ }
+ }
private void LaunchGitHubSite(object sender, RoutedEventArgs e)
{
@@ -107,6 +122,7 @@ namespace ProxySU_Core
if (result == true)
{
Records.Add(new RecordViewModel(newRecord));
+ SaveRecord();
}
}
@@ -119,10 +135,20 @@ namespace ProxySU_Core
if (result == true)
{
project.Notify();
+ SaveRecord();
}
}
}
+ private void ShowClientInfo(object sender, RoutedEventArgs e)
+ {
+ if (DataGrid.SelectedItem is RecordViewModel project)
+ {
+ var dialog = new ClientInfoWindow(project.record);
+ dialog.ShowDialog();
+ }
+ }
+
private void DeleteHost(object sender, RoutedEventArgs e)
{