Skip to content

Commit 0734887

Browse files
committed
增加安装日志另存为文件功能
1 parent 944929d commit 0734887

File tree

6 files changed

+38
-1
lines changed

6 files changed

+38
-1
lines changed

ProxySU/MainWindow.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@
147147
<TextBlock x:Name="TextBlockProxyPassword" IsEnabled="False" Text="{DynamicResource TextBlockHostPassword}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Grid.Column="2" Grid.Row="1" ></TextBlock>
148148
<TextBox x:Name="TextBoxProxyUserName" IsEnabled="False" Text="" Margin="3" Grid.Column="1" Grid.Row="1" />
149149
<PasswordBox x:Name="PasswordBoxProxyPassword" IsEnabled="False" Password="" Margin="3" Grid.Column="3" Grid.Row="1"></PasswordBox>
150-
150+
<Button x:Name="ButtonSaveInstalledLog" Content="{DynamicResource ButtonSaveInstalledLog}" Grid.Column="4" Grid.Row="1" Grid.ColumnSpan="2" Margin="10,3,10,3" Click="ButtonSaveInstalledLog_Click"></Button>
151151
</Grid>
152152
</Grid>
153153
<Grid Grid.Row="1">

ProxySU/MainWindow.xaml.cs

+34
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
using System.Runtime.InteropServices;
2828
using System.Runtime;
2929
using System.Globalization;
30+
using Microsoft.Win32;
3031

3132
namespace ProxySU
3233
{
@@ -6988,6 +6989,7 @@ private bool SetUpNat64(SshClient client,bool set)
69886989

69896990
return true;
69906991
}
6992+
69916993
//纯ipv6主机安装脚本处理
69926994
//private void Ipv6ScriptEdit(SshClient client,string scriptFile)
69936995
//{
@@ -8070,12 +8072,44 @@ private bool DetectBBRandEnable(SshClient client)
80708072

80718073

80728074

8075+
80738076
//生成客户端配置 96--98
80748077

80758078

80768079
#endregion
80778080

8081+
//安装日志另存为...
8082+
private void ButtonSaveInstalledLog_Click(object sender, RoutedEventArgs e)
8083+
{
8084+
string logSaveName = ChooseSaveFile("Log Save as...", $"{pwdir}");
8085+
if (String.IsNullOrEmpty(logSaveName) == false)
8086+
{
8087+
using (StreamWriter sw = new StreamWriter($"{logSaveName}"))
8088+
{
8089+
sw.WriteLine($"{TextBoxMonitorCommandResults.Text}");
8090+
}
8091+
}
8092+
}
8093+
private string ChooseSaveFile(string title, string initFolder)
8094+
{
8095+
SaveFileDialog dlg = new SaveFileDialog();
8096+
dlg.Title = title;
8097+
string localTime = DateTime.Now.ToLocalTime().ToString().Replace(' ','-').Replace(':','-').Replace('/','-').Replace('\\','-');
8098+
dlg.FileName = $"{TextBoxHost.Text.Replace(':','_')}_{localTime}.txt"; // Default file name
8099+
dlg.DefaultExt = ".txt"; // Default file extension
8100+
dlg.Filter = "Text documents|*.txt"; // Filter files by extension
8101+
dlg.InitialDirectory = initFolder;
80788102

8103+
// Process save file dialog box results
8104+
if (dlg.ShowDialog() == true)
8105+
{
8106+
return dlg.FileName;
8107+
}
8108+
else
8109+
{
8110+
return null;
8111+
}
8112+
}
80798113
}
80808114

80818115
}

ProxySU/Translations/ProxySU.en-US.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<sys:String x:Key="RadioButtonProxyNoLogin">Not Login</sys:String>
2727
<sys:String x:Key="RadiobuttonProxyYesLogin">Requires Login</sys:String>
2828
<sys:String x:Key="TextBlockProxyHost">Proxy Addr:</sys:String>
29+
<sys:String x:Key="ButtonSaveInstalledLog">Save Installation Log...</sys:String>
2930
<sys:String x:Key="TextBlockSetUpProcessing">Waiting for installation and deployment</sys:String>
3031
<sys:String x:Key="TabItemHeaderSysTools">System Tools</sys:String>
3132
<sys:String x:Key="ButtonV2RayTemplateConfiguration">V2Ray Templates</sys:String>

ProxySU/Translations/ProxySU.zh-CN.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<sys:String x:Key="RadioButtonProxyNoLogin">不需登录</sys:String>
2727
<sys:String x:Key="RadiobuttonProxyYesLogin">需要登录</sys:String>
2828
<sys:String x:Key="TextBlockProxyHost">代理地址:</sys:String>
29+
<sys:String x:Key="ButtonSaveInstalledLog">安装日志另存为...</sys:String>
2930
<sys:String x:Key="TextBlockSetUpProcessing">等待安装布署</sys:String>
3031
<sys:String x:Key="TabItemHeaderSysTools">系统工具</sys:String>
3132
<sys:String x:Key="ButtonV2RayTemplateConfiguration">V2Ray模板库</sys:String>

ProxySU/Translations/ProxySU.zh-TW.xaml

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
<sys:String x:Key="RadioButtonProxyNoLogin">不需登錄</sys:String>
2727
<sys:String x:Key="RadiobuttonProxyYesLogin">需要登錄</sys:String>
2828
<sys:String x:Key="TextBlockProxyHost">代理地址:</sys:String>
29+
<sys:String x:Key="ButtonSaveInstalledLog">安裝日誌另存為...</sys:String>
2930
<sys:String x:Key="TextBlockSetUpProcessing">等待安裝佈署</sys:String>
3031
<sys:String x:Key="TabItemHeaderSysTools">系統工具</sys:String>
3132
<sys:String x:Key="ButtonV2RayTemplateConfiguration">V2Ray模板庫</sys:String>

ProxySU/bin/Beta/Beta.zip

439 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)