mirror of https://github.com/2dust/v2rayN
Bug fix
parent
8361b4e4a0
commit
07156cb55c
|
@ -35,6 +35,14 @@ namespace ServiceLib.Handler
|
||||||
_client?.Dispose();
|
_client?.Dispose();
|
||||||
_client = null;
|
_client = null;
|
||||||
}
|
}
|
||||||
|
if (_config.webDavItem.dirName.IsNullOrEmpty())
|
||||||
|
{
|
||||||
|
_webDir = Global.AppName + "_backup";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_webDir = _config.webDavItem.dirName.TrimEx();
|
||||||
|
}
|
||||||
|
|
||||||
var clientParams = new WebDavClientParams
|
var clientParams = new WebDavClientParams
|
||||||
{
|
{
|
||||||
|
@ -145,6 +153,7 @@ namespace ServiceLib.Handler
|
||||||
if (!response.IsSuccessful)
|
if (!response.IsSuccessful)
|
||||||
{
|
{
|
||||||
SaveLog(response.Description);
|
SaveLog(response.Description);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
using var outputFileStream = new FileStream(fileName, FileMode.Create);
|
using var outputFileStream = new FileStream(fileName, FileMode.Create);
|
||||||
response.Stream.CopyTo(outputFileStream);
|
response.Stream.CopyTo(outputFileStream);
|
||||||
|
|
|
@ -255,5 +255,6 @@
|
||||||
public string? url { get; set; }
|
public string? url { get; set; }
|
||||||
public string? userName { get; set; }
|
public string? userName { get; set; }
|
||||||
public string? password { get; set; }
|
public string? password { get; set; }
|
||||||
|
public string? dirName { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -591,6 +591,15 @@ namespace ServiceLib.Resx {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Remote folder name (optional) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string LvWebDavDirName {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LvWebDavDirName", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 WebDav Password 的本地化字符串。
|
/// 查找类似 WebDav Password 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|
|
@ -1312,4 +1312,7 @@
|
||||||
<data name="LvWebDavCheck" xml:space="preserve">
|
<data name="LvWebDavCheck" xml:space="preserve">
|
||||||
<value>WebDav Check</value>
|
<value>WebDav Check</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LvWebDavDirName" xml:space="preserve">
|
||||||
|
<value>Remote folder name (optional)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1309,4 +1309,7 @@
|
||||||
<data name="LvWebDavUrl" xml:space="preserve">
|
<data name="LvWebDavUrl" xml:space="preserve">
|
||||||
<value>WebDav 服务器地址</value>
|
<value>WebDav 服务器地址</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LvWebDavDirName" xml:space="preserve">
|
||||||
|
<value>远程文件夹名称(可选)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -1189,4 +1189,7 @@
|
||||||
<data name="LvWebDavUrl" xml:space="preserve">
|
<data name="LvWebDavUrl" xml:space="preserve">
|
||||||
<value>WebDav 服務器地址</value>
|
<value>WebDav 服務器地址</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="LvWebDavDirName" xml:space="preserve">
|
||||||
|
<value>遠端資料夾名稱(可選)</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
|
@ -117,6 +117,11 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//exist
|
||||||
|
if (!File.Exists(fileName))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
//backup first
|
//backup first
|
||||||
var fileBackup = Utils.GetBackupPath($"backup_{DateTime.Now:yyyyMMddHHmmss}.zip");
|
var fileBackup = Utils.GetBackupPath($"backup_{DateTime.Now:yyyyMMddHHmmss}.zip");
|
||||||
|
|
|
@ -130,6 +130,7 @@
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
@ -184,9 +185,25 @@
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.LvWebDavDirName}" />
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtWebDavDirName"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="8"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
x:Name="menuWebDavCheck"
|
x:Name="menuWebDavCheck"
|
||||||
Grid.Row="3"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
|
|
|
@ -25,6 +25,8 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.url, v => v.txtWebDavUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.url, v => v.txtWebDavUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.userName, v => v.txtWebDavUserName.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.userName, v => v.txtWebDavUserName.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.password, v => v.txtWebDavPassword.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.password, v => v.txtWebDavPassword.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SelectedSource.dirName, v => v.txtWebDavDirName.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.WebDavCheckCmd, v => v.menuWebDavCheck).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.WebDavCheckCmd, v => v.menuWebDavCheck).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.RemoteBackupCmd, v => v.menuRemoteBackup).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.RemoteBackupCmd, v => v.menuRemoteBackup).DisposeWith(disposables);
|
||||||
|
|
Loading…
Reference in New Issue