mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-22 21:26:09 +03:00
add config files
This commit is contained in:
parent
e548affd70
commit
8199b3d9d2
@ -238,34 +238,93 @@
|
|||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
<None Include="Templates\xray\base.json" />
|
<None Include="Templates\xray\base.json">
|
||||||
<None Include="Templates\xray\caddy\base.caddyfile" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\client\00_log\00_log.json" />
|
</None>
|
||||||
<None Include="Templates\xray\client\01_api\01_api.json" />
|
<None Include="Templates\xray\caddy\base.caddyfile">
|
||||||
<None Include="Templates\xray\client\02_dns\02_dns.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\client\03_routing\03_routing.json" />
|
</None>
|
||||||
<None Include="Templates\xray\client\04_policy\04_policy.json" />
|
<None Include="Templates\xray\client\00_log\00_log.json">
|
||||||
<None Include="Templates\xray\client\05_inbounds\05_inbounds.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\client\06_outbounds\06_outbounds.json" />
|
</None>
|
||||||
<None Include="Templates\xray\client\06_outbounds\VLESS_HTTP2_TLS.json" />
|
<None Include="Templates\xray\client\01_api\01_api.json">
|
||||||
<None Include="Templates\xray\client\06_outbounds\VLESS_TCP_TLS_WS.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\client\07_transport\07_transport.json" />
|
</None>
|
||||||
<None Include="Templates\xray\client\08_stats\08_stats.json" />
|
<None Include="Templates\xray\client\02_dns\02_dns.json">
|
||||||
<None Include="Templates\xray\client\09_reverse\09_reverse.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\server\01_api\01_api.json" />
|
</None>
|
||||||
<None Include="Templates\xray\server\02_dns\02_dns.json" />
|
<None Include="Templates\xray\client\03_routing\03_routing.json">
|
||||||
<None Include="Templates\xray\server\03_routing\03_routing.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\server\04_policy\04_policy.json" />
|
</None>
|
||||||
<None Include="Templates\xray\server\05_inbounds\05_inbounds.json" />
|
<None Include="Templates\xray\client\04_policy\04_policy.json">
|
||||||
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP_TLS.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\server\05_inbounds\VLESS_TCP_XTLS.json" />
|
</None>
|
||||||
<None Include="Templates\xray\server\05_inbounds\VLESS_WS_TLS.json" />
|
<None Include="Templates\xray\client\05_inbounds\05_inbounds.json">
|
||||||
<None Include="Templates\xray\server\05_inbounds\VMESS_TCP_TLS.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\server\05_inbounds\VMESS_WS_TLS.json" />
|
</None>
|
||||||
<None Include="Templates\xray\server\06_outbounds\06_outbounds.json" />
|
<None Include="Templates\xray\client\06_outbounds\06_outbounds.json">
|
||||||
<None Include="Templates\xray\server\07_transport\07_transport.json" />
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
<None Include="Templates\xray\server\08_stats\08_stats.json" />
|
</None>
|
||||||
<None Include="Templates\xray\server\09_reverse\09_reverse.json" />
|
<None Include="Templates\xray\client\06_outbounds\VLESS_HTTP2_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\client\06_outbounds\VLESS_TCP_TLS_WS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\client\07_transport\07_transport.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\client\08_stats\08_stats.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\client\09_reverse\09_reverse.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\00_log\00_log.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\01_api\01_api.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\02_dns\02_dns.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\03_routing\03_routing.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\04_policy\04_policy.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\05_inbounds\05_inbounds.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\05_inbounds\Trojan_TCP_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\05_inbounds\VLESS_TCP_XTLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\05_inbounds\VLESS_WS_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\05_inbounds\VMESS_TCP_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\05_inbounds\VMESS_WS_TLS.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\06_outbounds\06_outbounds.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\07_transport\07_transport.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\08_stats\08_stats.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
|
<None Include="Templates\xray\server\09_reverse\09_reverse.json">
|
||||||
|
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||||
|
</None>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Include="App.config" />
|
<None Include="App.config" />
|
||||||
|
5
ProxySU_Core/Templates/xray/server/00_log/00_log.json
Normal file
5
ProxySU_Core/Templates/xray/server/00_log/00_log.json
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
{
|
||||||
|
"log": {
|
||||||
|
"loglevel": "warning"
|
||||||
|
}
|
||||||
|
}
|
@ -57,7 +57,7 @@ namespace ProxySU_Core.ViewModels.Developers
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 执行安装命令
|
/// 执行安装命令
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public abstract void Execute();
|
public abstract void Install();
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 配置系统基础环境
|
/// 配置系统基础环境
|
||||||
@ -420,7 +420,7 @@ namespace ProxySU_Core.ViewModels.Developers
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ConfigurePort(bool force = true)
|
public void ConfigurePort(bool force = true)
|
||||||
{
|
{
|
||||||
if (Parameters.Port == 80 || Parameters.Port == 443)
|
if (Parameters.Port == 80 || Parameters.Port == 443)
|
||||||
{
|
{
|
||||||
@ -429,6 +429,8 @@ namespace ProxySU_Core.ViewModels.Developers
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
SetPortFree(80);
|
||||||
|
SetPortFree(443);
|
||||||
SetPortFree(Parameters.Port);
|
SetPortFree(Parameters.Port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ namespace ProxySU_Core.ViewModels.Developers
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void Execute()
|
public override void Install()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -47,6 +47,8 @@ namespace ProxySU_Core.ViewModels.Developers
|
|||||||
|
|
||||||
EnsureSystemEnv();
|
EnsureSystemEnv();
|
||||||
|
|
||||||
|
ConfigurePort();
|
||||||
|
|
||||||
ConfigureSoftware();
|
ConfigureSoftware();
|
||||||
|
|
||||||
ConfigureIPv6();
|
ConfigureIPv6();
|
||||||
|
@ -36,5 +36,11 @@ namespace ProxySU_Core.ViewModels
|
|||||||
Notify("Settings");
|
Notify("Settings");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Notify()
|
||||||
|
{
|
||||||
|
Notify("Host");
|
||||||
|
Notify("Settings");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,82 +11,82 @@ namespace ProxySU_Core.ViewModels
|
|||||||
{
|
{
|
||||||
public class XraySettingsViewModel : BaseViewModel
|
public class XraySettingsViewModel : BaseViewModel
|
||||||
{
|
{
|
||||||
private XraySettings p;
|
public XraySettings settings;
|
||||||
|
|
||||||
public XraySettingsViewModel(XraySettings parameters)
|
public XraySettingsViewModel(XraySettings parameters)
|
||||||
{
|
{
|
||||||
this.p = parameters;
|
this.settings = parameters;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string UUID
|
public string UUID
|
||||||
{
|
{
|
||||||
get => p.UUID;
|
get => settings.UUID;
|
||||||
set => p.UUID = value;
|
set => settings.UUID = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Domain
|
public string Domain
|
||||||
{
|
{
|
||||||
get => p.Domain;
|
get => settings.Domain;
|
||||||
set => p.Domain = value;
|
set => settings.Domain = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string MaskDomain
|
public string MaskDomain
|
||||||
{
|
{
|
||||||
get => p.MaskDomain;
|
get => settings.MaskDomain;
|
||||||
set => p.MaskDomain = value;
|
set => settings.MaskDomain = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VLESS_TCP_Path
|
public string VLESS_TCP_Path
|
||||||
{
|
{
|
||||||
get => p.VLESS_TCP_Path;
|
get => settings.VLESS_TCP_Path;
|
||||||
set => p.VLESS_TCP_Path = value;
|
set => settings.VLESS_TCP_Path = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VLESS_WS_Path
|
public string VLESS_WS_Path
|
||||||
{
|
{
|
||||||
get => p.VLESS_WS_Path;
|
get => settings.VLESS_WS_Path;
|
||||||
set => p.VLESS_WS_Path = value;
|
set => settings.VLESS_WS_Path = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VMESS_TCP_Path
|
public string VMESS_TCP_Path
|
||||||
{
|
{
|
||||||
get => p.VMESS_TCP_Path;
|
get => settings.VMESS_TCP_Path;
|
||||||
set => p.VMESS_TCP_Path = value;
|
set => settings.VMESS_TCP_Path = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string VMESS_WS_Path
|
public string VMESS_WS_Path
|
||||||
{
|
{
|
||||||
get => p.VMESS_WS_Path;
|
get => settings.VMESS_WS_Path;
|
||||||
set => p.VMESS_WS_Path = value;
|
set => settings.VMESS_WS_Path = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Trojan_TCP_Path
|
public string Trojan_TCP_Path
|
||||||
{
|
{
|
||||||
get => p.Trojan_TCP_Path;
|
get => settings.Trojan_TCP_Path;
|
||||||
set => p.Trojan_TCP_Path = value;
|
set => settings.Trojan_TCP_Path = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string TrojanPassword
|
public string TrojanPassword
|
||||||
{
|
{
|
||||||
get => p.TrojanPassword;
|
get => settings.TrojanPassword;
|
||||||
set => p.TrojanPassword = value;
|
set => settings.TrojanPassword = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool Checked_VLESS_TCP
|
public bool Checked_VLESS_TCP
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return p.Types.Contains(XrayType.VLESS_TCP_TLS);
|
return settings.Types.Contains(XrayType.VLESS_TCP_TLS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
p.Types.Add(XrayType.VLESS_TCP_TLS);
|
settings.Types.Add(XrayType.VLESS_TCP_TLS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.Types.Remove(XrayType.VLESS_TCP_TLS);
|
settings.Types.Remove(XrayType.VLESS_TCP_TLS);
|
||||||
}
|
}
|
||||||
Notify("Checked_VLESS_TCP");
|
Notify("Checked_VLESS_TCP");
|
||||||
Notify("VLESS_TCP_Path_Visibility");
|
Notify("VLESS_TCP_Path_Visibility");
|
||||||
@ -97,17 +97,17 @@ namespace ProxySU_Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return p.Types.Contains(XrayType.VLESS_TCP_XTLS);
|
return settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
p.Types.Add(XrayType.VLESS_TCP_XTLS);
|
settings.Types.Add(XrayType.VLESS_TCP_XTLS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.Types.Remove(XrayType.VLESS_TCP_XTLS);
|
settings.Types.Remove(XrayType.VLESS_TCP_XTLS);
|
||||||
}
|
}
|
||||||
Notify("Checked_VLESS_XTLS");
|
Notify("Checked_VLESS_XTLS");
|
||||||
}
|
}
|
||||||
@ -117,17 +117,17 @@ namespace ProxySU_Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return p.Types.Contains(XrayType.VLESS_WS_TLS);
|
return settings.Types.Contains(XrayType.VLESS_WS_TLS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
p.Types.Add(XrayType.VLESS_WS_TLS);
|
settings.Types.Add(XrayType.VLESS_WS_TLS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.Types.Remove(XrayType.VLESS_WS_TLS);
|
settings.Types.Remove(XrayType.VLESS_WS_TLS);
|
||||||
}
|
}
|
||||||
Notify("Checked_VLESS_WS");
|
Notify("Checked_VLESS_WS");
|
||||||
Notify("VLESS_WS_Path_Visibility");
|
Notify("VLESS_WS_Path_Visibility");
|
||||||
@ -138,17 +138,17 @@ namespace ProxySU_Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return p.Types.Contains(XrayType.VMESS_TCP_TLS);
|
return settings.Types.Contains(XrayType.VMESS_TCP_TLS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
p.Types.Add(XrayType.VMESS_TCP_TLS);
|
settings.Types.Add(XrayType.VMESS_TCP_TLS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.Types.Remove(XrayType.VMESS_TCP_TLS);
|
settings.Types.Remove(XrayType.VMESS_TCP_TLS);
|
||||||
}
|
}
|
||||||
Notify("Checked_VMESS_TCP");
|
Notify("Checked_VMESS_TCP");
|
||||||
Notify("VMESS_TCP_Path_Visibility");
|
Notify("VMESS_TCP_Path_Visibility");
|
||||||
@ -159,17 +159,17 @@ namespace ProxySU_Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return p.Types.Contains(XrayType.VMESS_WS_TLS);
|
return settings.Types.Contains(XrayType.VMESS_WS_TLS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
p.Types.Add(XrayType.VMESS_WS_TLS);
|
settings.Types.Add(XrayType.VMESS_WS_TLS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.Types.Remove(XrayType.VMESS_WS_TLS);
|
settings.Types.Remove(XrayType.VMESS_WS_TLS);
|
||||||
}
|
}
|
||||||
Notify("Checked_VMESS_WS");
|
Notify("Checked_VMESS_WS");
|
||||||
Notify("VMESS_WS_Path_Visibility");
|
Notify("VMESS_WS_Path_Visibility");
|
||||||
@ -180,17 +180,17 @@ namespace ProxySU_Core.ViewModels
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return p.Types.Contains(XrayType.Trojan_TCP_TLS);
|
return settings.Types.Contains(XrayType.Trojan_TCP_TLS);
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value == true)
|
if (value == true)
|
||||||
{
|
{
|
||||||
p.Types.Add(XrayType.Trojan_TCP_TLS);
|
settings.Types.Add(XrayType.Trojan_TCP_TLS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p.Types.Remove(XrayType.Trojan_TCP_TLS);
|
settings.Types.Remove(XrayType.Trojan_TCP_TLS);
|
||||||
}
|
}
|
||||||
Notify("Checked_Trojan_TCP");
|
Notify("Checked_Trojan_TCP");
|
||||||
Notify("Trojan_TCP_Path_Visibility");
|
Notify("Trojan_TCP_Path_Visibility");
|
||||||
|
@ -101,8 +101,13 @@ namespace ProxySU_Core
|
|||||||
|
|
||||||
private void AddHost(object sender, RoutedEventArgs e)
|
private void AddHost(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var hostWindow = new RecordEditorWindow(new Record());
|
var newRecord = new Record();
|
||||||
hostWindow.ShowDialog();
|
var hostWindow = new RecordEditorWindow(newRecord);
|
||||||
|
var result = hostWindow.ShowDialog();
|
||||||
|
if (result == true)
|
||||||
|
{
|
||||||
|
Records.Add(new RecordViewModel(newRecord));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EditHost(object sender, RoutedEventArgs e)
|
private void EditHost(object sender, RoutedEventArgs e)
|
||||||
@ -110,7 +115,11 @@ namespace ProxySU_Core
|
|||||||
if (DataGrid.SelectedItem is RecordViewModel project)
|
if (DataGrid.SelectedItem is RecordViewModel project)
|
||||||
{
|
{
|
||||||
var hostWindow = new RecordEditorWindow(project.record);
|
var hostWindow = new RecordEditorWindow(project.record);
|
||||||
hostWindow.ShowDialog();
|
var result = hostWindow.ShowDialog();
|
||||||
|
if (result == true)
|
||||||
|
{
|
||||||
|
project.Notify();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,13 +139,13 @@ namespace ProxySU_Core
|
|||||||
|
|
||||||
private void Connect(object sender, RoutedEventArgs e)
|
private void Connect(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var project = DataGrid.SelectedItem as Record;
|
var project = DataGrid.SelectedItem as RecordViewModel;
|
||||||
if (project == null)
|
if (project == null)
|
||||||
{
|
{
|
||||||
DialogManager.ShowMessageAsync(this, "提示", "请选择一个服务器");
|
DialogManager.ShowMessageAsync(this, "提示", "请选择一个服务器");
|
||||||
}
|
}
|
||||||
|
|
||||||
TerminalWindow terminalWindow = new TerminalWindow(project);
|
TerminalWindow terminalWindow = new TerminalWindow(project.record);
|
||||||
terminalWindow.Show();
|
terminalWindow.Show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -315,6 +315,11 @@
|
|||||||
</GroupBox>
|
</GroupBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<Button Content="保存" Grid.Row="3" Width="120" Height="32" HorizontalAlignment="Right" Margin="0,0,20,0"></Button>
|
<Button Content="保存"
|
||||||
|
Grid.Row="3"
|
||||||
|
Width="120" Height="32"
|
||||||
|
Click="Save"
|
||||||
|
HorizontalAlignment="Right"
|
||||||
|
Margin="0,0,20,0"></Button>
|
||||||
</Grid>
|
</Grid>
|
||||||
</metro:MetroWindow>
|
</metro:MetroWindow>
|
||||||
|
@ -27,6 +27,8 @@ namespace ProxySU_Core.Views
|
|||||||
|
|
||||||
public XraySettingsViewModel Settings { get; set; }
|
public XraySettingsViewModel Settings { get; set; }
|
||||||
|
|
||||||
|
public EventHandler OnSaved;
|
||||||
|
|
||||||
public RecordEditorWindow(Record record)
|
public RecordEditorWindow(Record record)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
@ -38,5 +40,13 @@ namespace ProxySU_Core.Views
|
|||||||
Settings = new XraySettingsViewModel(record.Settings.DeepClone());
|
Settings = new XraySettingsViewModel(record.Settings.DeepClone());
|
||||||
this.DataContext = this;
|
this.DataContext = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Save(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Record.Host = Host.host;
|
||||||
|
Record.Settings = Settings.settings;
|
||||||
|
DialogResult = true;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@
|
|||||||
Foreground="LawnGreen"
|
Foreground="LawnGreen"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
FontFamily="Consolas"
|
FontFamily="Consolas"
|
||||||
|
x:Name="OutputTextBox"
|
||||||
Height="320">
|
Height="320">
|
||||||
<FlowDocument>
|
<FlowDocument>
|
||||||
<Paragraph>
|
<Paragraph>
|
||||||
|
@ -25,16 +25,18 @@ namespace ProxySU_Core
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class TerminalWindow
|
public partial class TerminalWindow
|
||||||
{
|
{
|
||||||
|
private Record Record { get; set; }
|
||||||
private readonly Terminal _vm;
|
private readonly Terminal _vm;
|
||||||
private SshClient _sshClient;
|
private SshClient _sshClient;
|
||||||
|
|
||||||
public TerminalWindow(Record project)
|
public TerminalWindow(Record record)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ResizeMode = ResizeMode.NoResize;
|
ResizeMode = ResizeMode.NoResize;
|
||||||
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||||
|
|
||||||
_vm = new Terminal(project.Host);
|
this.Record = record;
|
||||||
|
_vm = new Terminal(record.Host);
|
||||||
DataContext = _vm;
|
DataContext = _vm;
|
||||||
|
|
||||||
_vm.AddOutput("Connect ...");
|
_vm.AddOutput("Connect ...");
|
||||||
@ -106,10 +108,23 @@ namespace ProxySU_Core
|
|||||||
private void WriteShell(string outShell)
|
private void WriteShell(string outShell)
|
||||||
{
|
{
|
||||||
_vm.AddOutput(outShell);
|
_vm.AddOutput(outShell);
|
||||||
|
Dispatcher.Invoke(() =>
|
||||||
|
{
|
||||||
|
OutputTextBox.ScrollToEnd();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Install(object sender, RoutedEventArgs e)
|
private void Install(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
XrayProject project = new XrayProject(
|
||||||
|
_sshClient,
|
||||||
|
Record.Settings,
|
||||||
|
WriteShell);
|
||||||
|
|
||||||
|
Task.Factory.StartNew(() =>
|
||||||
|
{
|
||||||
|
project.Install();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user