1
0
Fork 0
mirror of https://github.com/proxysu/ProxySU.git synced 2025-04-03 05:43:36 +03:00

增加安装日志另存为文件功能

This commit is contained in:
ProxySU 2020-10-26 12:50:35 +08:00
parent 944929d162
commit 0734887044
6 changed files with 38 additions and 1 deletions

View file

@ -147,7 +147,7 @@
<TextBlock x:Name="TextBlockProxyPassword" IsEnabled="False" Text="{DynamicResource TextBlockHostPassword}" HorizontalAlignment="Right" VerticalAlignment="Center" Margin="5" Grid.Column="2" Grid.Row="1" ></TextBlock>
<TextBox x:Name="TextBoxProxyUserName" IsEnabled="False" Text="" Margin="3" Grid.Column="1" Grid.Row="1" />
<PasswordBox x:Name="PasswordBoxProxyPassword" IsEnabled="False" Password="" Margin="3" Grid.Column="3" Grid.Row="1"></PasswordBox>
<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>
</Grid>
</Grid>
<Grid Grid.Row="1">

View file

@ -27,6 +27,7 @@ using System.Net.Sockets;
using System.Runtime.InteropServices;
using System.Runtime;
using System.Globalization;
using Microsoft.Win32;
namespace ProxySU
{
@ -6988,6 +6989,7 @@ namespace ProxySU
return true;
}
//纯ipv6主机安装脚本处理
//private void Ipv6ScriptEdit(SshClient client,string scriptFile)
//{
@ -8070,12 +8072,44 @@ namespace ProxySU
//生成客户端配置 96--98
#endregion
//安装日志另存为...
private void ButtonSaveInstalledLog_Click(object sender, RoutedEventArgs e)
{
string logSaveName = ChooseSaveFile("Log Save as...", $"{pwdir}");
if (String.IsNullOrEmpty(logSaveName) == false)
{
using (StreamWriter sw = new StreamWriter($"{logSaveName}"))
{
sw.WriteLine($"{TextBoxMonitorCommandResults.Text}");
}
}
}
private string ChooseSaveFile(string title, string initFolder)
{
SaveFileDialog dlg = new SaveFileDialog();
dlg.Title = title;
string localTime = DateTime.Now.ToLocalTime().ToString().Replace(' ','-').Replace(':','-').Replace('/','-').Replace('\\','-');
dlg.FileName = $"{TextBoxHost.Text.Replace(':','_')}_{localTime}.txt"; // Default file name
dlg.DefaultExt = ".txt"; // Default file extension
dlg.Filter = "Text documents|*.txt"; // Filter files by extension
dlg.InitialDirectory = initFolder;
// Process save file dialog box results
if (dlg.ShowDialog() == true)
{
return dlg.FileName;
}
else
{
return null;
}
}
}
}

View file

@ -26,6 +26,7 @@
<sys:String x:Key="RadioButtonProxyNoLogin">Not Login</sys:String>
<sys:String x:Key="RadiobuttonProxyYesLogin">Requires Login</sys:String>
<sys:String x:Key="TextBlockProxyHost">Proxy Addr:</sys:String>
<sys:String x:Key="ButtonSaveInstalledLog">Save Installation Log...</sys:String>
<sys:String x:Key="TextBlockSetUpProcessing">Waiting for installation and deployment</sys:String>
<sys:String x:Key="TabItemHeaderSysTools">System Tools</sys:String>
<sys:String x:Key="ButtonV2RayTemplateConfiguration">V2Ray Templates</sys:String>

View file

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

View file

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

Binary file not shown.