1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-21 20:56:08 +03:00
This commit is contained in:
nuxt-autumn 2021-05-16 09:12:47 +08:00
parent 5e1e9e90cf
commit 3b79a7ca44
17 changed files with 300 additions and 183 deletions

View File

@ -1,23 +1,32 @@
using System;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
namespace ProxySuper.Core.Services
{
public class Base64
public class Utils
{
public static string Encode(string plainText)
public static string Base64Encode(string plainText)
{
var plainTextBytes = System.Text.Encoding.UTF8.GetBytes(plainText);
return System.Convert.ToBase64String(plainTextBytes);
}
public static string Decode(string base64EncodedData)
public static string Base64Decode(string base64EncodedData)
{
var base64EncodedBytes = System.Convert.FromBase64String(base64EncodedData);
return System.Text.Encoding.UTF8.GetString(base64EncodedBytes);
}
public static T DeepClone<T>(T obj) where T : class
{
var serialized = JsonConvert.SerializeObject(obj);
return JsonConvert.DeserializeObject<T>(serialized);
}
}
}

View File

@ -6,8 +6,6 @@ using System.Threading.Tasks;
namespace ProxySuper.Core.Models.Hosts
{
public class Host
{

View File

@ -6,26 +6,26 @@ using System.Threading.Tasks;
namespace ProxySuper.Core.Models.Projects
{
public interface IProjectSettings
public class IProjectSettings
{
/// <summary>
/// 端口
/// </summary>
int Port { get; set; }
public virtual int Port { get; set; }
/// <summary>
/// 域名
/// </summary>
string Domain { get; set; }
public virtual string Domain { get; set; }
/// <summary>
/// 额外需要开放的端口
/// </summary>
List<int> FreePorts { get; }
public virtual List<int> FreePorts { get; }
/// <summary>
/// 类型
/// </summary>
ProjectType Type { get; set; }
public virtual ProjectType Type { get; set; }
}
}

View File

@ -8,7 +8,7 @@ namespace ProxySuper.Core.Models.Projects
{
public class TrojanGoSettings : IProjectSettings
{
public List<int> FreePorts
public override List<int> FreePorts
{
get
{
@ -16,17 +16,17 @@ namespace ProxySuper.Core.Models.Projects
}
}
public ProjectType Type { get; set; } = ProjectType.TrojanGo;
public override ProjectType Type { get; set; } = ProjectType.TrojanGo;
/// <summary>
/// 域名
/// </summary>
public string Domain { get; set; }
public override string Domain { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
public override int Port { get; set; }
/// <summary>
/// 密码

View File

@ -8,7 +8,7 @@ namespace ProxySuper.Core.Models.Projects
{
public partial class XraySettings : IProjectSettings
{
public List<int> FreePorts
public override List<int> FreePorts
{
get
{
@ -21,23 +21,23 @@ namespace ProxySuper.Core.Models.Projects
}
}
public ProjectType Type { get; set; } = ProjectType.Xray;
public override ProjectType Type { get; set; } = ProjectType.Xray;
/// <summary>
/// 端口
/// </summary>
public override int Port { get; set; }
/// <summary>
/// 域名
/// </summary>
public override string Domain { get; set; }
/// <summary>
/// UUID
/// </summary>
public string UUID { get; set; }
/// <summary>
/// 端口
/// </summary>
public int Port { get; set; }
/// <summary>
/// 域名
/// </summary>
public string Domain { get; set; }
/// <summary>
/// 伪装域名
/// </summary>
@ -46,7 +46,7 @@ namespace ProxySuper.Core.Models.Projects
/// <summary>
/// 安装类型
/// </summary>
public List<XrayType> Types { get; set; }
public List<XrayType> Types { get; set; } = new List<XrayType>();
/// <summary>
/// 根据xray类型获取路径

View File

@ -1,7 +1,12 @@
using Newtonsoft.Json;
using MvvmCross;
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using ProxySuper.Core.ViewModels;
using System;
using System.Collections.Generic;
using System.Linq;
@ -10,19 +15,46 @@ using System.Threading.Tasks;
namespace ProxySuper.Core.Models
{
public class Record
public class Record : MvxViewModel
{
[JsonProperty("id")]
public string Id { get; set; }
[JsonProperty("host")]
public Host Host { get; set; }
[JsonProperty("settings")]
public dynamic Settings { get; set; }
public XraySettings XraySettings { get; set; }
[JsonProperty("trojanGoSettings")]
public TrojanGoSettings TrojanGoSettings { get; set; }
public string Type
[JsonIgnore]
public ProjectType Type
{
get
{
return Settings.type ?? "Xray";
if (XraySettings != null) return ProjectType.Xray;
return ProjectType.TrojanGo;
}
}
public IMvxCommand NavToEditorCommand => new MvxAsyncCommand(NavigateToEditor);
public async Task NavigateToEditor()
{
var nav = Mvx.IoCProvider.Resolve<IMvxNavigationService>();
if (Type == ProjectType.Xray)
{
var result = await nav.Navigate<XrayEditorViewModel, Record, Record>(this);
if (result == null) return;
this.Host = result.Host;
this.XraySettings = result.XraySettings;
await RaisePropertyChanged("Host");
}
}
}

View File

@ -77,7 +77,7 @@
<Compile Include="Models\Projects\XrayType.cs" />
<Compile Include="Models\Record.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\Base64.cs" />
<Compile Include="Helpers\Utils.cs" />
<Compile Include="Services\ProjectBase.cs" />
<Compile Include="Services\ShareLink.cs" />
<Compile Include="Services\TrojanGoConfigBuilder.cs" />

View File

@ -41,7 +41,7 @@ namespace ProxySuper.Core.Services
var _server = settings.Domain;
var _port = settings.ShadowSocksPort;
var base64URL = Base64.Encode($"{_method}:{_password}@{_server}:{_port}");
var base64URL = Utils.Base64Encode($"{_method}:{_password}@{_server}:{_port}");
return "ss://" + base64URL + "#ShadowSocks";
}
@ -88,7 +88,7 @@ namespace ProxySuper.Core.Services
return string.Empty;
}
var base64Url = Base64.Encode(JsonConvert.SerializeObject(vmess));
var base64Url = Utils.Base64Encode(JsonConvert.SerializeObject(vmess));
return $"vmess://" + base64Url;
}

View File

@ -1,7 +1,10 @@
using MvvmCross.Navigation;
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using Newtonsoft.Json;
using ProxySuper.Core.Models;
using ProxySuper.Core.Models.Hosts;
using ProxySuper.Core.Models.Projects;
using System;
using System.Collections.Generic;
using System.IO;
@ -26,14 +29,32 @@ namespace ProxySuper.Core.ViewModels
var json = File.ReadAllText("Data/Record.json");
var records = JsonConvert.DeserializeObject<List<Record>>(json);
this.Records = new MvxObservableCollection<Record>();
records.ForEach(item =>
{
if (string.IsNullOrEmpty(item.Id))
{
item.Id = Guid.NewGuid().ToString();
}
this.Records.Add(item);
});
}
public MvxObservableCollection<Record> Records { get; set; }
public IMvxCommand AddXrayCommand => new MvxAsyncCommand(AddXrayRecord);
public async Task AddXrayRecord()
{
Record record = new Record();
record.Id = Guid.NewGuid().ToString();
record.Host = new Host();
record.XraySettings = new XraySettings();
var result = await _navigationService.Navigate<XrayEditorViewModel, Record, Record>(record);
if (result == null) return;
Records.Add(result);
}
}
}

View File

@ -1,4 +1,6 @@
using MvvmCross.Commands;
using MvvmCross;
using MvvmCross.Commands;
using MvvmCross.Navigation;
using MvvmCross.ViewModels;
using Newtonsoft.Json;
using ProxySuper.Core.Models;
@ -15,21 +17,42 @@ using System.Windows.Input;
namespace ProxySuper.Core.ViewModels
{
public partial class XrayEditorViewModel : MvxViewModel<Record>
public partial class XrayEditorViewModel : MvxViewModel<Record, Record>
{
public XrayEditorViewModel()
private IMvxNavigationService _navigationService;
public XrayEditorViewModel(IMvxNavigationService mvxNavigationService)
{
_navigationService = mvxNavigationService;
_randomUuid = new MvxCommand(() => GetUuid());
SaveCommand = new MvxCommand(() => Save());
}
public string Id { get; set; }
public Host Host { get; set; }
public XraySettings Settings { get; set; }
public IMvxCommand SaveCommand { get; }
public override void Prepare(Record parameter)
{
Host = parameter.Host;
Settings = JsonConvert.DeserializeObject<XraySettings>(JsonConvert.SerializeObject(parameter.Settings));
var record = Utils.DeepClone(parameter);
Id = record.Id;
Host = record.Host;
Settings = record.XraySettings;
}
public void Save()
{
var result = new Record()
{
Id = Id,
Host = Host,
XraySettings = Settings,
};
_navigationService.Close(this, result);
}
}

View File

@ -45,26 +45,26 @@
<Label Content="{DynamicResource HostTag}" Grid.Row="0" Grid.Column="0" />
<TextBox Grid.Row="0" Grid.Column="1"
Width="180"
Width="170"
Text="{Binding Host.Tag}"
VerticalContentAlignment="Center" />
<Label Content="{DynamicResource HostAddress}" Grid.Row="1" Grid.Column="0" />
<TextBox Grid.Row="1" Grid.Column="1"
Width="180"
Width="170"
Text="{Binding Host.Address}"
VerticalContentAlignment="Center" />
<Label Content="{DynamicResource HostUserName}" Grid.Row="2" Grid.Column="0" />
<TextBox Grid.Row="2" Grid.Column="1"
Width="180"
Width="170"
Text="{Binding Host.UserName}"
VerticalContentAlignment="Center" />
<Label Content="{DynamicResource HostPassword}" Grid.Row="3" Grid.Column="0" />
<TextBox Grid.Row="3" Grid.Column="1"
Width="180"
Width="170"
Text="{Binding Host.Password}"
VerticalContentAlignment="Center" />

View File

@ -10,164 +10,165 @@
<UserControl.Resources>
<convert:VisibleConverter x:Key="VisibleConverter" />
</UserControl.Resources>
<StackPanel Orientation="Horizontal">
<StackPanel Width="220">
<!--XTLS-->
<CheckBox Margin="0,10,0,0"
<!--XTLS-->
<CheckBox Margin="0,10,0,0"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=Checked_VLESS_TCP_XTLS}">
<Label Content="{DynamicResource VlessXtlsDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
IsChecked="{Binding Path=Checked_VLESS_TCP_XTLS}">
<Label Content="{DynamicResource VlessXtlsDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<!--TCP-->
<CheckBox Margin="0,15,0,0"
<!--TCP-->
<CheckBox Margin="0,15,0,0"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=Checked_VLESS_TCP}">
<Label Content="{DynamicResource VlessTcpDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<Label Content="{DynamicResource VlessTcpDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<!--WebSocket-->
<CheckBox Margin="0,15,0,0"
<!--WebSocket-->
<CheckBox Margin="0,15,0,0"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=Checked_VLESS_WS}">
<Label Content="{DynamicResource VlessWsDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<Label Content="{DynamicResource VlessWsDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<!--mKCP-->
<CheckBox Margin="0,15,0,0"
<!--mKCP-->
<CheckBox Margin="0,15,0,0"
VerticalContentAlignment="Center"
Foreground="LimeGreen"
IsChecked="{Binding Path=Checked_VLESS_KCP}">
<Label Content="{DynamicResource VlessKcpDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<Label Content="{DynamicResource VlessKcpDesc}" FontSize="13" Foreground="LimeGreen" />
</CheckBox>
<!--TCP-->
<!--<CheckBox Content="VMESS over TCP with TLS&#x0a;不推荐"
<!--TCP-->
<!--<CheckBox Content="VMESS over TCP with TLS&#x0a;不推荐"
Margin="0,15,0,0"
FontSize="13"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Checked_VMESS_TCP}" />-->
<!--WebSocket-->
<CheckBox Margin="0,15,0,0"
<!--WebSocket-->
<CheckBox Margin="0,15,0,0"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=Checked_VMESS_WS}">
<Label Content="{DynamicResource VmessWsDesc}" FontSize="13" Foreground="Blue" />
</CheckBox>
<Label Content="{DynamicResource VmessWsDesc}" FontSize="13" Foreground="Blue" />
</CheckBox>
<!--mKCP-->
<CheckBox Margin="0,15,0,0"
<!--mKCP-->
<CheckBox Margin="0,15,0,0"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=Checked_VMESS_KCP}">
<Label Foreground="Blue" FontSize="13" Content="{DynamicResource VmessKcpDesc}" />
</CheckBox>
<Label Foreground="Blue" FontSize="13" Content="{DynamicResource VmessKcpDesc}" />
</CheckBox>
<!--ss-->
<CheckBox Margin="0,15,0,0"
<!--ss-->
<CheckBox Margin="0,15,0,0"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=CheckedShadowSocks}">
<Label Content="{DynamicResource SSDesc}" FontSize="13" Foreground="Fuchsia" />
</CheckBox>
<Label Content="{DynamicResource SSDesc}" FontSize="13" Foreground="Fuchsia" />
</CheckBox>
<!--Trojan-->
<CheckBox Margin="0,15,0,0"
<!--Trojan-->
<CheckBox Margin="0,15,0,0"
Foreground="CadetBlue"
VerticalContentAlignment="Center"
IsChecked="{Binding Path=Checked_Trojan_TCP}">
<Label Content="{DynamicResource TrojanDesc}" FontSize="13" Foreground="CadetBlue" />
</CheckBox>
<Label Content="{DynamicResource TrojanDesc}" FontSize="13" Foreground="CadetBlue" />
</CheckBox>
<!--gRPC-->
<!--<CheckBox Content="VLESS gRPC&#x0a;基于http2多路复用。"
<!--gRPC-->
<!--<CheckBox Content="VLESS gRPC&#x0a;基于http2多路复用。"
Margin="0,15,0,0"
Grid.Column="0"
Style="{StaticResource MahApps.Styles.CheckBox}"
IsChecked="{Binding Path=Checked_VLESS_gRPC}"/>-->
</StackPanel>
</StackPanel>
<!--************************** 参数 **************************-->
<StackPanel Width="auto">
<StackPanel>
<!--Domain-->
<StackPanel Margin="40,15,0,0"
<!--Domain-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal">
<Label Content="{DynamicResource XrayDomain}" Width="120" />
<TextBox Text="{Binding Path=Domain}" Width="200" />
</StackPanel>
<Label Content="{DynamicResource XrayDomain}" Width="120" />
<TextBox Text="{Binding Path=Domain}" Width="200" />
</StackPanel>
<!--Mask Domain-->
<StackPanel Margin="40,15,0,0"
<!--Mask Domain-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal">
<Label Content="{DynamicResource XrayMarkDomain}" Width="120" />
<TextBox Text="{Binding Path=MaskDomain}" Width="200" />
</StackPanel>
<Label Content="{DynamicResource XrayMarkDomain}" Width="120" />
<TextBox Text="{Binding Path=MaskDomain}" Width="200" />
</StackPanel>
<!--UUID-->
<StackPanel Margin="40,10,0,0"
<!--UUID-->
<StackPanel Margin="30,10,0,0"
Orientation="Horizontal">
<Label Content="{DynamicResource XrayUUID}" Width="120" />
<Label Content="{DynamicResource XrayUUID}" Width="120" />
<TextBox Text="{Binding Path=UUID}"
<TextBox Text="{Binding Path=UUID}"
Width="200" />
<Button Margin="5,0,0,0"
<Button Margin="5,0,0,0"
Padding="12,3"
Command="{Binding Path=RandomUuid}"
Content="{DynamicResource Random}" />
</StackPanel>
</StackPanel>
<!--WebSocket Path-->
<StackPanel Margin="40,15,0,0"
<!--WebSocket Path-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VLESS_WS,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource VlessWsPath}" Foreground="LimeGreen" Width="120" />
<TextBox Text="{Binding Path=VLESS_WS_Path}"
<Label Content="{DynamicResource VlessWsPath}" Foreground="LimeGreen" Width="120" />
<TextBox Text="{Binding Path=VLESS_WS_Path}"
Width="200" />
</StackPanel>
</StackPanel>
<!--seed-->
<StackPanel Margin="40,15,0,0"
<!--seed-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VLESS_KCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource VlessKcpSeed}" Foreground="LimeGreen" Width="120" />
<TextBox Text="{Binding Path=VLESS_KCP_Seed}" Width="200" />
</StackPanel>
<Label Content="{DynamicResource VlessKcpSeed}" Foreground="LimeGreen" Width="120" />
<TextBox Text="{Binding Path=VLESS_KCP_Seed}" Width="200" />
</StackPanel>
<!--kcp type-->
<StackPanel Margin="40,15,0,0"
<!--kcp type-->
<StackPanel Margin="30,15,0,0"
Visibility="{
Binding Path=Checked_VLESS_KCP,
Converter={StaticResource VisibleConverter}
}" Orientation="Horizontal">
<Label Content="{DynamicResource VlessKcpType}" Foreground="LimeGreen" Width="120" />
<ComboBox Width="200"
<Label Content="{DynamicResource VlessKcpType}" Foreground="LimeGreen" Width="120" />
<ComboBox Width="200"
ItemsSource="{Binding Path=KcpTypes}"
SelectedValue="{Binding VLESS_KCP_Type,Mode=TwoWay}">
</ComboBox>
</StackPanel>
</ComboBox>
</StackPanel>
<!--kcp port-->
<StackPanel Margin="40,15,0,0"
<!--kcp port-->
<StackPanel Margin="30,15,0,0"
Visibility="{
Binding Path=Checked_VLESS_KCP,
Converter={StaticResource VisibleConverter}
}"
Orientation="Horizontal">
<Label Content="{DynamicResource VlessKcpPort}" Width="120" Foreground="LimeGreen" />
<TextBox Text="{Binding Path=VLESS_KCP_Port}" Width="200" />
</StackPanel>
<Label Content="{DynamicResource VlessKcpPort}" Width="120" Foreground="LimeGreen" />
<TextBox Text="{Binding Path=VLESS_KCP_Port}" Width="200" />
</StackPanel>
<!--gRPC Port-->
<!--<StackPanel Margin="40,15,0,0"
<!--gRPC Port-->
<!--<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VLESS_gRPC,
@ -180,8 +181,8 @@
<TextBox Text="{Binding Path=VLESS_gRPC_ServiceName}" Width="120" />
</StackPanel>-->
<!--Tcp Path-->
<!--<StackPanel Margin="40,15,0,0"
<!--Tcp Path-->
<!--<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VMESS_TCP,
@ -193,101 +194,102 @@
Width="200" />
</StackPanel>-->
<!--WebSocket Path-->
<StackPanel Margin="40,15,0,0"
<!--WebSocket Path-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VMESS_WS,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource VmessWsPath}" Foreground="Blue" Width="120" />
<TextBox Text="{Binding Path=VMESS_WS_Path}"
<Label Content="{DynamicResource VmessWsPath}" Foreground="Blue" Width="120" />
<TextBox Text="{Binding Path=VMESS_WS_Path}"
VerticalAlignment="Bottom"
Width="200" />
</StackPanel>
</StackPanel>
<!--seed-->
<StackPanel Margin="40,15,0,0"
<!--seed-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VMESS_KCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource VmessKcpSeed}" Foreground="Blue" Width="120" />
<TextBox Text="{Binding Path=VMESS_KCP_Seed}" Width="200" />
</StackPanel>
<Label Content="{DynamicResource VmessKcpSeed}" Foreground="Blue" Width="120" />
<TextBox Text="{Binding Path=VMESS_KCP_Seed}" Width="200" />
</StackPanel>
<!--kcp type-->
<StackPanel Margin="40,15,0,0"
<!--kcp type-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VMESS_KCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource VmessKcpType}" Foreground="Blue" Width="120" VerticalAlignment="Bottom"/>
<ComboBox Width="200"
<Label Content="{DynamicResource VmessKcpType}" Foreground="Blue" Width="120" VerticalAlignment="Bottom"/>
<ComboBox Width="200"
VerticalAlignment="Bottom"
ItemsSource="{Binding Path=KcpTypes}"
SelectedValue="{Binding VMESS_KCP_Type,Mode=TwoWay}">
</ComboBox>
</StackPanel>
</ComboBox>
</StackPanel>
<!--kcp port-->
<StackPanel Margin="40,15,0,0"
<!--kcp port-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_VMESS_KCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource VmessKcpPort}" Foreground="Blue" Width="120" />
<TextBox Text="{Binding Path=VMESS_KCP_Port}" Width="200" />
</StackPanel>
<Label Content="{DynamicResource VmessKcpPort}" Foreground="Blue" Width="120" />
<TextBox Text="{Binding Path=VMESS_KCP_Port}" Width="200" />
</StackPanel>
<!--ss密码-->
<StackPanel Margin="40,15,0,0"
<!--ss密码-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=CheckedShadowSocks,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource SSPassword}" Foreground="Fuchsia" Width="120" />
<TextBox Text="{Binding Path=ShadowSocksPassword}"
<Label Content="{DynamicResource SSPassword}" Foreground="Fuchsia" Width="120" />
<TextBox Text="{Binding Path=ShadowSocksPassword}"
Width="200"/>
</StackPanel>
</StackPanel>
<!--ss加密方式-->
<StackPanel Margin="40,15,0,0"
<!--ss加密方式-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=CheckedShadowSocks,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource SSMethods}" Foreground="Fuchsia" Width="120" />
<ComboBox Width="200"
<Label Content="{DynamicResource SSMethods}" Foreground="Fuchsia" Width="120" />
<ComboBox Width="200"
ItemsSource="{Binding ShadowSocksMethods}"
SelectedValue="{Binding ShadowSocksMethod}">
</ComboBox>
</StackPanel>
</ComboBox>
</StackPanel>
<!--Trojan密码-->
<StackPanel Margin="40,15,0,0"
<!--Trojan密码-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal"
Visibility="{
Binding Path=Checked_Trojan_TCP,
Converter={StaticResource VisibleConverter}
}">
<Label Content="{DynamicResource TrojanPassword}" Foreground="CadetBlue" Width="120" />
<TextBox Text="{Binding Path=TrojanPassword}"
<Label Content="{DynamicResource TrojanPassword}" Foreground="CadetBlue" Width="120" />
<TextBox Text="{Binding Path=TrojanPassword}"
Width="200" />
</StackPanel>
</StackPanel>
<!--xray prot-->
<StackPanel Margin="40,15,0,0"
<!--xray prot-->
<StackPanel Margin="30,15,0,0"
Orientation="Horizontal">
<Label Content="{DynamicResource XrayPort}" Foreground="Gray" Width="120" />
<TextBox Text="{Binding Path=Port}" Width="120" />
<Label Content="{DynamicResource XrayPortDefault}" Foreground="Red" />
<Label Content="{DynamicResource XrayPort}" Foreground="Gray" Width="120" />
<TextBox Text="{Binding Path=Port}" Width="120" />
<Label Content="{DynamicResource XrayPortDefault}" Foreground="Red" />
</StackPanel>
</StackPanel>
</StackPanel>
</StackPanel>
</UserControl>

View File

@ -2,6 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!--common-->
<sys:String x:Key="Random">Random</sys:String>
<sys:String x:Key="Save">Save</sys:String>
<!--Main Menu-->
<sys:String x:Key="MainMenuAddHost">Add Host</sys:String>
<sys:String x:Key="MainMenuActions">Actions</sys:String>
@ -49,7 +53,6 @@
<!--Xray-->
<sys:String x:Key="Random">Random</sys:String>
<sys:String x:Key="VlessXtlsDesc" xml:space="preserve">VLESS over TCP With XTLS&#x0a;Preferred</sys:String>
<sys:String x:Key="VlessTcpDesc" xml:space="preserve">VLESS over TCP with TLS&#x0a;XTLS is Preferred</sys:String>
<sys:String x:Key="VlessWsDesc" xml:space="preserve">VLESS over WS with TLS&#x0a;Support CDN</sys:String>

View File

@ -2,6 +2,10 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="clr-namespace:System;assembly=mscorlib">
<!--common-->
<sys:String x:Key="Random">随机</sys:String>
<sys:String x:Key="Save">保存</sys:String>
<!--Main Menu-->
<sys:String x:Key="MainMenuAddHost">添加主机</sys:String>
<sys:String x:Key="MainMenuActions">操作</sys:String>
@ -48,7 +52,6 @@
<sys:String x:Key="ProxyTypeSocks5">Socks5</sys:String>
<!--Xray-->
<sys:String x:Key="Random">随机</sys:String>
<sys:String x:Key="VlessXtlsDesc" xml:space="preserve">VLESS Over TCP With XTLS&#x0a;性能数倍,首选方式。</sys:String>
<sys:String x:Key="VlessTcpDesc" xml:space="preserve">VLESS over TCP with TLS&#x0a;仍推荐XTLS。</sys:String>
<sys:String x:Key="VlessWsDesc" xml:space="preserve">VLESS over WS with TLS&#x0a;推荐支持CDN。</sys:String>

View File

@ -15,7 +15,7 @@
<Menu Background="White" Grid.Row="0" BorderThickness="0,0,0,2" BorderBrush="#eee">
<MenuItem Header="{DynamicResource MainMenuAddHost}" Padding="10,3">
<MenuItem Padding="0,5" Header="Xray"></MenuItem>
<MenuItem Padding="0,5" Header="Xray" Command="{Binding AddXrayCommand}"></MenuItem>
<MenuItem Padding="0,5" Header="Trojan-Go"></MenuItem>
<MenuItem Padding="0,5" Header="NaiveProxy"></MenuItem>
</MenuItem>
@ -65,14 +65,14 @@
<DataGridTemplateColumn Header="{DynamicResource MainDataGridColumnAction}" Width="400">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ItemContainerTemplate>
<StackPanel Orientation="Horizontal">
<Button Click="NavToEditor"
Margin="5,0"
Padding="12,3"
Content="{DynamicResource MainDataGridColumnActionInstall}" />
<Button Click="NavToEditor"
<Button Command="{Binding NavToEditorCommand}"
Margin="5,0"
Padding="12,3"
Content="{DynamicResource MainDataGridColumnActionEdit}" />
@ -82,7 +82,7 @@
Padding="12,3"
Content="{DynamicResource MainDataGridColumnActionDelete}" />
</StackPanel>
</DataTemplate>
</ItemContainerTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>

View File

@ -28,7 +28,7 @@ namespace ProxySuper.WPF.Views
var navSrv = Mvx.IoCProvider.Resolve<IMvxNavigationService>();
var vm = ViewModel as HomeViewModel;
navSrv.Navigate<XrayEditorViewModel, Record>(vm.Records[0]);
navSrv.Navigate<XrayEditorViewModel, Record, Record>(vm.Records[0]);
}
}
}

View File

@ -11,13 +11,13 @@
Icon="/Resources/ProxySU.ico"
BorderThickness="0,1,0,0"
BorderBrush="#EEE"
Title="XrayEditorView" Height="600" Width="1000">
Title="XrayEditorView" Height="610" Width="1015">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="320" />
<ColumnDefinition Width="310" />
<ColumnDefinition Width="1" />
<ColumnDefinition Width="auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<StackPanel Grid.Column="0" Margin="10">
@ -27,7 +27,33 @@
<StackPanel Grid.Column="1" Background="#EEE"></StackPanel>
<StackPanel Grid.Column="2">
<ctrl:XraySettingsControl />
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="500" />
<RowDefinition Height="80" />
</Grid.RowDefinitions>
<ScrollViewer Name="scroll"
Padding="10"
Height="500"
Grid.Row="0"
HorizontalScrollBarVisibility="Auto"
VerticalScrollBarVisibility="Auto" >
<ctrl:XraySettingsControl />
</ScrollViewer>
<Border Grid.Row="1"
BorderBrush="#eee"
BorderThickness="0,1,0,0">
<Button Content="{DynamicResource Save}"
Command="{Binding SaveCommand}"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Height="30"
Width="100"
Margin="40,0" />
</Border>
</Grid>
</StackPanel>
</Grid>
</views:MvxWindow>