@@ -0,0 +1,18 @@ | |||||
namespace Shadowsocks.WPF.Models | |||||
{ | |||||
public class Group : Shadowsocks.Models.Group | |||||
{ | |||||
/// <summary> | |||||
/// Gets or sets the URL of SIP008 online configuration delivery source. | |||||
/// </summary> | |||||
public string OnlineConfigSource { get; set; } | |||||
public Group() : this(string.Empty) | |||||
{ } | |||||
public Group(string name) : base(name) | |||||
{ | |||||
OnlineConfigSource = ""; | |||||
} | |||||
} | |||||
} |
@@ -0,0 +1,30 @@ | |||||
namespace Shadowsocks.WPF.Models | |||||
{ | |||||
public class Server : Shadowsocks.Models.Server | |||||
{ | |||||
/// <summary> | |||||
/// Gets or sets the arguments passed to the plugin process. | |||||
/// </summary> | |||||
public string PluginArgs { get; set; } | |||||
public Server() | |||||
{ | |||||
PluginArgs = ""; | |||||
} | |||||
public Server( | |||||
string name, | |||||
string uuid, | |||||
string host, | |||||
int port, | |||||
string password, | |||||
string method, | |||||
string plugin = "", | |||||
string pluginOpts = "", | |||||
string pluginArgs = "") | |||||
: base(name, uuid, host, port, password, method, plugin, pluginOpts) | |||||
{ | |||||
PluginArgs = pluginArgs; | |||||
} | |||||
} | |||||
} |
@@ -1,10 +1,7 @@ | |||||
using Shadowsocks.Interop.Settings; | using Shadowsocks.Interop.Settings; | ||||
using Shadowsocks.Models; | |||||
using Shadowsocks.Net.Settings; | using Shadowsocks.Net.Settings; | ||||
using Shadowsocks.PAC; | using Shadowsocks.PAC; | ||||
using System; | |||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Text; | |||||
namespace Shadowsocks.WPF.Models | namespace Shadowsocks.WPF.Models | ||||
{ | { | ||||
@@ -1,4 +1,4 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<!-- | <!-- | ||||
https://go.microsoft.com/fwlink/?LinkID=208121. | https://go.microsoft.com/fwlink/?LinkID=208121. | ||||
--> | --> | ||||
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<Configuration>Release</Configuration> | <Configuration>Release</Configuration> | ||||
<Platform>Any CPU</Platform> | <Platform>Any CPU</Platform> | ||||
<PublishDir>bin\Release\net5.0-windows\publish\</PublishDir> | |||||
<PublishDir>bin\Release\net5.0-windows10.0.19041.0\publish\</PublishDir> | |||||
<PublishProtocol>FileSystem</PublishProtocol> | <PublishProtocol>FileSystem</PublishProtocol> | ||||
</PropertyGroup> | </PropertyGroup> | ||||
</Project> | </Project> |
@@ -1,4 +1,4 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<!-- | <!-- | ||||
https://go.microsoft.com/fwlink/?LinkID=208121. | https://go.microsoft.com/fwlink/?LinkID=208121. | ||||
--> | --> | ||||
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<Configuration>Release</Configuration> | <Configuration>Release</Configuration> | ||||
<Platform>Any CPU</Platform> | <Platform>Any CPU</Platform> | ||||
<PublishDir>bin\Release\net5.0-windows\win-arm\publish\</PublishDir> | |||||
<PublishDir>bin\Release\net5.0-windows10.0.19041.0\win-arm\publish\</PublishDir> | |||||
<PublishProtocol>FileSystem</PublishProtocol> | <PublishProtocol>FileSystem</PublishProtocol> | ||||
<TargetFramework>net5.0-windows</TargetFramework> | <TargetFramework>net5.0-windows</TargetFramework> | ||||
<RuntimeIdentifier>win-arm</RuntimeIdentifier> | <RuntimeIdentifier>win-arm</RuntimeIdentifier> | ||||
@@ -1,4 +1,4 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<!-- | <!-- | ||||
https://go.microsoft.com/fwlink/?LinkID=208121. | https://go.microsoft.com/fwlink/?LinkID=208121. | ||||
--> | --> | ||||
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<Configuration>Release</Configuration> | <Configuration>Release</Configuration> | ||||
<Platform>Any CPU</Platform> | <Platform>Any CPU</Platform> | ||||
<PublishDir>bin\Release\net5.0-windows\win-x64\publish\</PublishDir> | |||||
<PublishDir>bin\Release\net5.0-windows10.0.19041.0\win-x64\publish\</PublishDir> | |||||
<PublishProtocol>FileSystem</PublishProtocol> | <PublishProtocol>FileSystem</PublishProtocol> | ||||
<TargetFramework>net5.0-windows</TargetFramework> | <TargetFramework>net5.0-windows</TargetFramework> | ||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier> | <RuntimeIdentifier>win-x64</RuntimeIdentifier> | ||||
@@ -1,4 +1,4 @@ | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<?xml version="1.0" encoding="utf-8"?> | |||||
<!-- | <!-- | ||||
https://go.microsoft.com/fwlink/?LinkID=208121. | https://go.microsoft.com/fwlink/?LinkID=208121. | ||||
--> | --> | ||||
@@ -6,7 +6,7 @@ https://go.microsoft.com/fwlink/?LinkID=208121. | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<Configuration>Release</Configuration> | <Configuration>Release</Configuration> | ||||
<Platform>Any CPU</Platform> | <Platform>Any CPU</Platform> | ||||
<PublishDir>bin\Release\net5.0-windows\win-x86\publish\</PublishDir> | |||||
<PublishDir>bin\Release\net5.0-windows10.0.19041.0\win-x86\publish\</PublishDir> | |||||
<PublishProtocol>FileSystem</PublishProtocol> | <PublishProtocol>FileSystem</PublishProtocol> | ||||
<TargetFramework>net5.0-windows</TargetFramework> | <TargetFramework>net5.0-windows</TargetFramework> | ||||
<RuntimeIdentifier>win-x86</RuntimeIdentifier> | <RuntimeIdentifier>win-x86</RuntimeIdentifier> | ||||
@@ -1,4 +1,4 @@ | |||||
using Shadowsocks.Models; | |||||
using Shadowsocks.WPF.Models; | |||||
using Splat; | using Splat; | ||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
@@ -1,4 +1,4 @@ | |||||
using Shadowsocks.Models; | |||||
using Shadowsocks.WPF.Models; | |||||
using System; | using System; | ||||
using System.Collections.Specialized; | using System.Collections.Specialized; | ||||
using System.Diagnostics; | using System.Diagnostics; | ||||
@@ -34,7 +34,7 @@ namespace Shadowsocks.WPF.Services | |||||
return new Sip003Plugin( | return new Sip003Plugin( | ||||
server.Plugin, | server.Plugin, | ||||
server.PluginOpts, | server.PluginOpts, | ||||
server.plugin_args, | |||||
server.PluginArgs, | |||||
server.Host, | server.Host, | ||||
server.Port, | server.Port, | ||||
showPluginOutput); | showPluginOutput); | ||||
@@ -9,6 +9,7 @@ using System.Windows; | |||||
using NLog; | using NLog; | ||||
using Shadowsocks.WPF.Localization; | using Shadowsocks.WPF.Localization; | ||||
using Shadowsocks.WPF.Models; | using Shadowsocks.WPF.Models; | ||||
using Shadowsocks.WPF.ViewModels; | |||||
using Shadowsocks.WPF.Views; | using Shadowsocks.WPF.Views; | ||||
using Splat; | using Splat; | ||||
@@ -98,6 +99,10 @@ namespace Shadowsocks.WPF.Services | |||||
{ | { | ||||
if (versionUpdatePromptWindow == null) | if (versionUpdatePromptWindow == null) | ||||
{ | { | ||||
var versionUpdatePromptView = new VersionUpdatePromptView() | |||||
{ | |||||
ViewModel = new VersionUpdatePromptViewModel(releaseObject), | |||||
}; | |||||
versionUpdatePromptWindow = new Window() | versionUpdatePromptWindow = new Window() | ||||
{ | { | ||||
Title = LocalizationProvider.GetLocalizedValue<string>("VersionUpdate"), | Title = LocalizationProvider.GetLocalizedValue<string>("VersionUpdate"), | ||||
@@ -105,7 +110,7 @@ namespace Shadowsocks.WPF.Services | |||||
Width = 640, | Width = 640, | ||||
MinHeight = 480, | MinHeight = 480, | ||||
MinWidth = 640, | MinWidth = 640, | ||||
Content = new VersionUpdatePromptView(releaseObject) | |||||
Content = versionUpdatePromptView, | |||||
}; | }; | ||||
versionUpdatePromptWindow.Closed += VersionUpdatePromptWindow_Closed; | versionUpdatePromptWindow.Closed += VersionUpdatePromptWindow_Closed; | ||||
versionUpdatePromptWindow.Show(); | versionUpdatePromptWindow.Show(); | ||||
@@ -2,13 +2,13 @@ | |||||
<PropertyGroup> | <PropertyGroup> | ||||
<OutputType>Exe</OutputType> | <OutputType>Exe</OutputType> | ||||
<TargetFramework>net5.0-windows</TargetFramework> | |||||
<TargetFramework>net5.0-windows10.0.19041.0</TargetFramework> | |||||
<UseWPF>true</UseWPF> | <UseWPF>true</UseWPF> | ||||
<ApplicationManifest>App.manifest</ApplicationManifest> | <ApplicationManifest>App.manifest</ApplicationManifest> | ||||
<Product>Shadowsocks for Windows WPF GUI</Product> | <Product>Shadowsocks for Windows WPF GUI</Product> | ||||
<Authors>Clowwindy & The Community</Authors> | <Authors>Clowwindy & The Community</Authors> | ||||
<Version>5.0.0</Version> | <Version>5.0.0</Version> | ||||
<ApplicationIcon>Assets\shadowsocks.ico</ApplicationIcon> | |||||
<ApplicationIcon>shadowsocks.ico</ApplicationIcon> | |||||
<Nullable>enable</Nullable> | <Nullable>enable</Nullable> | ||||
<Copyright>© 2020 Clowwindy & The Community</Copyright> | <Copyright>© 2020 Clowwindy & The Community</Copyright> | ||||
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile> | <PackageLicenseFile>LICENSE.txt</PackageLicenseFile> | ||||
@@ -36,7 +36,6 @@ | |||||
<None Remove="Resources\RobotoMono\RobotoMono-SemiBoldItalic.ttf" /> | <None Remove="Resources\RobotoMono\RobotoMono-SemiBoldItalic.ttf" /> | ||||
<None Remove="Resources\RobotoMono\RobotoMono-Thin.ttf" /> | <None Remove="Resources\RobotoMono\RobotoMono-Thin.ttf" /> | ||||
<None Remove="Resources\RobotoMono\RobotoMono-ThinItalic.ttf" /> | <None Remove="Resources\RobotoMono\RobotoMono-ThinItalic.ttf" /> | ||||
<None Remove="Resources\shadowsocks.ico" /> | |||||
<None Remove="Resources\ss128.pdn" /> | <None Remove="Resources\ss128.pdn" /> | ||||
<None Remove="Resources\ss32.pdn" /> | <None Remove="Resources\ss32.pdn" /> | ||||
<None Remove="Resources\ss32Fill.png" /> | <None Remove="Resources\ss32Fill.png" /> | ||||
@@ -60,6 +59,7 @@ | |||||
<PackageReference Include="ReactiveUI.WPF" Version="12.1.5" /> | <PackageReference Include="ReactiveUI.WPF" Version="12.1.5" /> | ||||
<PackageReference Include="Splat.NLog" Version="9.7.1" /> | <PackageReference Include="Splat.NLog" Version="9.7.1" /> | ||||
<PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20371.2" /> | <PackageReference Include="System.CommandLine" Version="2.0.0-beta1.20371.2" /> | ||||
<PackageReference Include="System.Reactive" Version="5.0.0" /> | |||||
<PackageReference Include="WPFLocalizeExtension" Version="3.8.0" /> | <PackageReference Include="WPFLocalizeExtension" Version="3.8.0" /> | ||||
<PackageReference Include="ZXing.Net" Version="0.16.6" /> | <PackageReference Include="ZXing.Net" Version="0.16.6" /> | ||||
</ItemGroup> | </ItemGroup> | ||||
@@ -113,7 +113,6 @@ | |||||
<Resource Include="Resources\RobotoMono\RobotoMono-SemiBoldItalic.ttf" /> | <Resource Include="Resources\RobotoMono\RobotoMono-SemiBoldItalic.ttf" /> | ||||
<Resource Include="Resources\RobotoMono\RobotoMono-Thin.ttf" /> | <Resource Include="Resources\RobotoMono\RobotoMono-Thin.ttf" /> | ||||
<Resource Include="Resources\RobotoMono\RobotoMono-ThinItalic.ttf" /> | <Resource Include="Resources\RobotoMono\RobotoMono-ThinItalic.ttf" /> | ||||
<Resource Include="Resources\shadowsocks.ico" /> | |||||
<Resource Include="Resources\ss128.pdn" /> | <Resource Include="Resources\ss128.pdn" /> | ||||
<Resource Include="Resources\ss32.pdn" /> | <Resource Include="Resources\ss32.pdn" /> | ||||
<Resource Include="Resources\ss32Fill.png" /> | <Resource Include="Resources\ss32Fill.png" /> | ||||
@@ -1,6 +1,6 @@ | |||||
using ReactiveUI; | using ReactiveUI; | ||||
using ReactiveUI.Fody.Helpers; | using ReactiveUI.Fody.Helpers; | ||||
using Shadowsocks.Models; | |||||
using Shadowsocks.WPF.Models; | |||||
using System; | using System; | ||||
using System.Collections.Generic; | using System.Collections.Generic; | ||||
using System.Drawing; | using System.Drawing; | ||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for DashboardView.xaml | /// Interaction logic for DashboardView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class DashboardView : ReactiveUserControl<DashboardViewModel> | |||||
public partial class DashboardView | |||||
{ | { | ||||
public DashboardView() | public DashboardView() | ||||
{ | { | ||||
@@ -1,4 +1,4 @@ | |||||
using ReactiveUI; | |||||
using ReactiveUI; | |||||
using Shadowsocks.WPF.ViewModels; | using Shadowsocks.WPF.ViewModels; | ||||
using System.Reactive.Disposables; | using System.Reactive.Disposables; | ||||
@@ -7,7 +7,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for ForwardProxyView.xaml | /// Interaction logic for ForwardProxyView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class ForwardProxyView : ReactiveUserControl<ForwardProxyViewModel> | |||||
public partial class ForwardProxyView | |||||
{ | { | ||||
public ForwardProxyView() | public ForwardProxyView() | ||||
{ | { | ||||
@@ -13,7 +13,7 @@ | |||||
lex:ResxLocalizationProvider.DefaultAssembly="Shadowsocks" | lex:ResxLocalizationProvider.DefaultAssembly="Shadowsocks" | ||||
lex:ResxLocalizationProvider.DefaultDictionary="Strings" | lex:ResxLocalizationProvider.DefaultDictionary="Strings" | ||||
mc:Ignorable="d" | mc:Ignorable="d" | ||||
Title="Shadowsocks" Width="800" Height="600" MinWidth="800" MinHeight="600" | |||||
Title="Shadowsocks" Width="960" Height="720" MinWidth="800" MinHeight="600" | |||||
TextElement.Foreground="{DynamicResource MaterialDesignBody}" | TextElement.Foreground="{DynamicResource MaterialDesignBody}" | ||||
TextElement.FontWeight="Regular" | TextElement.FontWeight="Regular" | ||||
TextElement.FontSize="13" | TextElement.FontSize="13" | ||||
@@ -25,7 +25,9 @@ | |||||
<Grid> | <Grid> | ||||
<TabControl Style="{StaticResource MaterialDesignNavigatilRailTabControl}"> | <TabControl Style="{StaticResource MaterialDesignNavigatilRailTabControl}"> | ||||
<TabItem x:Name="dashboardTabItem" | <TabItem x:Name="dashboardTabItem" | ||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"> | |||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}" | |||||
Height="56" | |||||
Width="56"> | |||||
<TabItem.Header> | <TabItem.Header> | ||||
<materialDesign:PackIcon | <materialDesign:PackIcon | ||||
Kind="Speedometer" | Kind="Speedometer" | ||||
@@ -34,7 +36,9 @@ | |||||
</TabItem.Header> | </TabItem.Header> | ||||
</TabItem> | </TabItem> | ||||
<TabItem x:Name="serversTabItem" | <TabItem x:Name="serversTabItem" | ||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"> | |||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}" | |||||
Height="56" | |||||
Width="56"> | |||||
<TabItem.Header> | <TabItem.Header> | ||||
<materialDesign:PackIcon | <materialDesign:PackIcon | ||||
Kind="Server" | Kind="Server" | ||||
@@ -43,7 +47,9 @@ | |||||
</TabItem.Header> | </TabItem.Header> | ||||
</TabItem> | </TabItem> | ||||
<TabItem x:Name="routingTabItem" | <TabItem x:Name="routingTabItem" | ||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"> | |||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}" | |||||
Height="56" | |||||
Width="56"> | |||||
<TabItem.Header> | <TabItem.Header> | ||||
<materialDesign:PackIcon | <materialDesign:PackIcon | ||||
Kind="RouterNetwork" | Kind="RouterNetwork" | ||||
@@ -52,7 +58,9 @@ | |||||
</TabItem.Header> | </TabItem.Header> | ||||
</TabItem> | </TabItem> | ||||
<TabItem x:Name="settingsTabItem" | <TabItem x:Name="settingsTabItem" | ||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}"> | |||||
Style="{StaticResource MaterialDesignNavigationRailTabItem}" | |||||
Height="56" | |||||
Width="56"> | |||||
<TabItem.Header> | <TabItem.Header> | ||||
<materialDesign:PackIcon | <materialDesign:PackIcon | ||||
Kind="SettingsOutline" | Kind="SettingsOutline" | ||||
@@ -7,7 +7,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for MainWindow.xaml | /// Interaction logic for MainWindow.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class MainWindow : ReactiveWindow<MainWindowViewModel> | |||||
public partial class MainWindow | |||||
{ | { | ||||
public MainWindow() | public MainWindow() | ||||
{ | { | ||||
@@ -1,4 +1,4 @@ | |||||
using ReactiveUI; | |||||
using ReactiveUI; | |||||
using Shadowsocks.WPF.ViewModels; | using Shadowsocks.WPF.ViewModels; | ||||
using System.Reactive.Disposables; | using System.Reactive.Disposables; | ||||
@@ -7,7 +7,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for OnlineConfigView.xaml | /// Interaction logic for OnlineConfigView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class OnlineConfigView : ReactiveUserControl<OnlineConfigViewModel> | |||||
public partial class OnlineConfigView | |||||
{ | { | ||||
public OnlineConfigView() | public OnlineConfigView() | ||||
{ | { | ||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for RoutingView.xaml | /// Interaction logic for RoutingView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class RoutingView : ReactiveUserControl<RoutingViewModel> | |||||
public partial class RoutingView | |||||
{ | { | ||||
public RoutingView() | public RoutingView() | ||||
{ | { | ||||
@@ -1,4 +1,4 @@ | |||||
using ReactiveUI; | |||||
using ReactiveUI; | |||||
using Shadowsocks.WPF.ViewModels; | using Shadowsocks.WPF.ViewModels; | ||||
using System.Reactive.Disposables; | using System.Reactive.Disposables; | ||||
using System.Windows.Input; | using System.Windows.Input; | ||||
@@ -8,12 +8,11 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for ServerSharingView.xaml | /// Interaction logic for ServerSharingView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class ServerSharingView : ReactiveUserControl<ServerSharingViewModel> | |||||
public partial class ServerSharingView | |||||
{ | { | ||||
public ServerSharingView() | public ServerSharingView() | ||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
ViewModel = new ServerSharingViewModel(); | |||||
this.WhenActivated(disposables => | this.WhenActivated(disposables => | ||||
{ | { | ||||
this.OneWayBind(ViewModel, | this.OneWayBind(ViewModel, | ||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for ServersView.xaml | /// Interaction logic for ServersView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class ServersView : ReactiveUserControl<ServersViewModel> | |||||
public partial class ServersView | |||||
{ | { | ||||
public ServersView() | public ServersView() | ||||
{ | { | ||||
@@ -18,7 +18,7 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for SettingsView.xaml | /// Interaction logic for SettingsView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class SettingsView : ReactiveUserControl<SettingsViewModel> | |||||
public partial class SettingsView | |||||
{ | { | ||||
public SettingsView() | public SettingsView() | ||||
{ | { | ||||
@@ -8,12 +8,11 @@ namespace Shadowsocks.WPF.Views | |||||
/// <summary> | /// <summary> | ||||
/// Interaction logic for VersionUpdatePromptView.xaml | /// Interaction logic for VersionUpdatePromptView.xaml | ||||
/// </summary> | /// </summary> | ||||
public partial class VersionUpdatePromptView : ReactiveUserControl<VersionUpdatePromptViewModel> | |||||
public partial class VersionUpdatePromptView | |||||
{ | { | ||||
public VersionUpdatePromptView(JsonElement releaseObject) | |||||
public VersionUpdatePromptView() | |||||
{ | { | ||||
InitializeComponent(); | InitializeComponent(); | ||||
ViewModel = new VersionUpdatePromptViewModel(releaseObject); | |||||
DataContext = ViewModel; // for compatibility with MdXaml | DataContext = ViewModel; // for compatibility with MdXaml | ||||
this.WhenActivated(disposables => | this.WhenActivated(disposables => | ||||
{ | { | ||||
@@ -5,61 +5,43 @@ using System.Text.Json.Serialization; | |||||
namespace Shadowsocks.Models | namespace Shadowsocks.Models | ||||
{ | { | ||||
public class Group | |||||
public class Group : IGroup<Server> | |||||
{ | { | ||||
/// <summary> | /// <summary> | ||||
/// Group name. | |||||
/// Gets or sets the group name. | |||||
/// </summary> | /// </summary> | ||||
public string Name { get; set; } | public string Name { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// UUID of the group. | |||||
/// Gets or sets the UUID of the group. | |||||
/// </summary> | /// </summary> | ||||
public Guid Id { get; set; } | public Guid Id { get; set; } | ||||
/// <summary> | |||||
/// URL of SIP008 online configuration delivery source. | |||||
/// </summary> | |||||
public string OnlineConfigSource { get; set; } | |||||
/// <summary> | |||||
/// SIP008 configuration version. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public int Version { get; set; } | public int Version { get; set; } | ||||
/// <summary> | |||||
/// A list of servers in the group. | |||||
/// </summary> | |||||
/// <inheritdoc/> | |||||
public List<Server> Servers { get; set; } | public List<Server> Servers { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Data used in bytes. | |||||
/// Gets or sets the data usage in bytes. | |||||
/// The value is fetched from SIP008 provider. | /// The value is fetched from SIP008 provider. | ||||
/// </summary> | /// </summary> | ||||
public ulong BytesUsed { get; set; } | public ulong BytesUsed { get; set; } | ||||
/// <summary> | /// <summary> | ||||
/// Data remaining to be used in bytes. | |||||
/// Gets or sets the data remaining to be used in bytes. | |||||
/// The value is fetched from SIP008 provider. | /// The value is fetched from SIP008 provider. | ||||
/// </summary> | /// </summary> | ||||
public ulong BytesRemaining { get; set; } | public ulong BytesRemaining { get; set; } | ||||
public Group() | |||||
{ | |||||
Name = ""; | |||||
Id = new Guid(); | |||||
OnlineConfigSource = ""; | |||||
Version = 1; | |||||
BytesUsed = 0UL; | |||||
BytesRemaining = 0UL; | |||||
Servers = new List<Server>(); | |||||
} | |||||
public Group() : this(string.Empty) | |||||
{ } | |||||
public Group(string name) | public Group(string name) | ||||
{ | { | ||||
Name = name; | Name = name; | ||||
Id = new Guid(); | Id = new Guid(); | ||||
OnlineConfigSource = ""; | |||||
Version = 1; | Version = 1; | ||||
BytesUsed = 0UL; | BytesUsed = 0UL; | ||||
BytesRemaining = 0UL; | BytesRemaining = 0UL; | ||||
@@ -0,0 +1,17 @@ | |||||
using System.Collections.Generic; | |||||
namespace Shadowsocks.Models | |||||
{ | |||||
public interface IGroup<T> | |||||
{ | |||||
/// <summary> | |||||
/// Gets or sets the SIP008 configuration version. | |||||
/// </summary> | |||||
public int Version { get; set; } | |||||
/// <summary> | |||||
/// Gets or sets the list of servers in the group. | |||||
/// </summary> | |||||
public List<T> Servers { get; set; } | |||||
} | |||||
} |
@@ -0,0 +1,19 @@ | |||||
using System; | |||||
using System.Text.Json.Serialization; | |||||
namespace Shadowsocks.Models | |||||
{ | |||||
public interface IServer : IEquatable<IServer> | |||||
{ | |||||
[JsonPropertyName("server")] | |||||
public string Host { get; set; } | |||||
[JsonPropertyName("server_port")] | |||||
public int Port { get; set; } | |||||
public string Password { get; set; } | |||||
public string Method { get; set; } | |||||
public string Plugin { get; set; } | |||||
public string PluginOpts { get; set; } | |||||
[JsonPropertyName("remarks")] | |||||
public string Name { get; set; } | |||||
} | |||||
} |
@@ -5,7 +5,7 @@ using System.Text.Json.Serialization; | |||||
namespace Shadowsocks.Models | namespace Shadowsocks.Models | ||||
{ | { | ||||
public class Server | |||||
public class Server : IServer | |||||
{ | { | ||||
[JsonPropertyName("server")] | [JsonPropertyName("server")] | ||||
public string Host { get; set; } | public string Host { get; set; } | ||||
@@ -52,8 +52,8 @@ namespace Shadowsocks.Models | |||||
Uuid = uuid; | Uuid = uuid; | ||||
} | } | ||||
public override bool Equals(object? obj) => obj is Server server && Uuid == server.Uuid; | |||||
public override int GetHashCode() => base.GetHashCode(); | |||||
public bool Equals(IServer? other) => other is Server anotherServer && Uuid == anotherServer.Uuid; | |||||
public override int GetHashCode() => Uuid.GetHashCode(); | |||||
public override string ToString() => Name; | public override string ToString() => Name; | ||||
/// <summary> | /// <summary> | ||||
@@ -144,10 +144,10 @@ after_build: | |||||
$ZipMinimal = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-minimal.zip" | $ZipMinimal = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-minimal.zip" | ||||
$ZipSingleExeX64 = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-portable-x64.zip" | $ZipSingleExeX64 = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-portable-x64.zip" | ||||
$ZipSingleExeX86 = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-portable-x86.zip" | $ZipSingleExeX86 = "$WorkingFolder\shadowsocks-windows-$env:APPVEYOR_BUILD_VERSION-portable-x86.zip" | ||||
7z a $ZipDev "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\$env:CONFIGURATION\netcoreapp3.1\*" | |||||
7z a $ZipMinimal "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\publish\*" | |||||
7z a $ZipSingleExeX64 "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\win-x64\publish\Shadowsocks.exe" | |||||
7z a $ZipSingleExeX86 "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\Any CPU\$env:CONFIGURATION\netcoreapp3.1\win-x86\publish\Shadowsocks.exe" | |||||
7z a $ZipDev "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\$env:CONFIGURATION\net5.0-windows10.0.19041.0\*" | |||||
7z a $ZipMinimal "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\Any CPU\$env:CONFIGURATION\net5.0-windows10.0.19041.0\publish\*" | |||||
7z a $ZipSingleExeX64 "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\Any CPU\$env:CONFIGURATION\net5.0-windows10.0.19041.0\win-x64\publish\Shadowsocks.exe" | |||||
7z a $ZipSingleExeX86 "$env:APPVEYOR_BUILD_FOLDER\Shadowsocks.WPF\bin\Any CPU\$env:CONFIGURATION\net5.0-windows10.0.19041.0\win-x86\publish\Shadowsocks.exe" | |||||
Calculate-Hash -file $ZipDev | Out-File -FilePath $HashFile -Append | Calculate-Hash -file $ZipDev | Out-File -FilePath $HashFile -Append | ||||
Calculate-Hash -file $ZipMinimal | Out-File -FilePath $HashFile -Append | Calculate-Hash -file $ZipMinimal | Out-File -FilePath $HashFile -Append | ||||
Calculate-Hash -file $ZipSingleExeX64 | Out-File -FilePath $HashFile -Append | Calculate-Hash -file $ZipSingleExeX64 | Out-File -FilePath $HashFile -Append | ||||