mirror of
https://github.com/2dust/v2rayN.git
synced 2026-03-01 21:53:06 +00:00
Compare commits
3 commits
f500d2b9f4
...
02a13ce028
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
02a13ce028 | ||
|
|
7884853098 | ||
|
|
e122ea8146 |
11 changed files with 64 additions and 30 deletions
|
|
@ -73,5 +73,19 @@ namespace ServiceLib.Common
|
|||
{
|
||||
return _dbAsync.Table<T>();
|
||||
}
|
||||
|
||||
public async Task DisposeDbConnectionAsync()
|
||||
{
|
||||
await Task.Factory.StartNew(() =>
|
||||
{
|
||||
_db?.Close();
|
||||
_db?.Dispose();
|
||||
_db = null;
|
||||
|
||||
_dbAsync?.GetConnection()?.Close();
|
||||
_dbAsync?.GetConnection()?.Dispose();
|
||||
_dbAsync = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -327,9 +327,10 @@ namespace ServiceLib.Handler
|
|||
{
|
||||
return null;
|
||||
}
|
||||
try { proc?.Kill(true); } catch { }
|
||||
try { proc?.Close(); } catch { }
|
||||
try { proc?.Dispose(); } catch { }
|
||||
try { proc?.Kill(true); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
|
||||
try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
|
||||
try { proc?.Close(); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
|
||||
try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
|
||||
|
||||
await Task.Delay(100);
|
||||
return null;
|
||||
|
|
|
|||
|
|
@ -141,7 +141,21 @@ namespace ServiceLib.ViewModels
|
|||
var result = await CreateZipFileFromDirectory(fileBackup);
|
||||
if (result)
|
||||
{
|
||||
Locator.Current.GetService<MainWindowViewModel>()?.UpgradeApp(fileName);
|
||||
var service = Locator.Current.GetService<MainWindowViewModel>();
|
||||
await service?.MyAppExitAsync(true);
|
||||
await SQLiteHelper.Instance.DisposeDbConnectionAsync();
|
||||
|
||||
var toPath = Utils.GetConfigPath();
|
||||
FileManager.ZipExtractToFile(fileName, toPath, "");
|
||||
|
||||
if (Utils.IsWindows())
|
||||
{
|
||||
service?.RebootAsAdmin(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
service?.Shutdown();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -343,6 +343,11 @@ namespace ServiceLib.ViewModels
|
|||
_updateView?.Invoke(EViewAction.ShowHideWindow, blShow);
|
||||
}
|
||||
|
||||
public void Shutdown()
|
||||
{
|
||||
_updateView?.Invoke(EViewAction.Shutdown, null);
|
||||
}
|
||||
|
||||
#endregion Actions
|
||||
|
||||
#region Servers && Groups
|
||||
|
|
@ -509,7 +514,7 @@ namespace ServiceLib.ViewModels
|
|||
}
|
||||
}
|
||||
|
||||
public async Task RebootAsAdmin()
|
||||
public async Task RebootAsAdmin(bool blAdmin = true)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -519,7 +524,7 @@ namespace ServiceLib.ViewModels
|
|||
Arguments = Global.RebootAs,
|
||||
WorkingDirectory = Utils.StartupPath(),
|
||||
FileName = Utils.GetExePath().AppendQuotes(),
|
||||
Verb = "runas",
|
||||
Verb = blAdmin ? "runas" : null,
|
||||
};
|
||||
Process.Start(startInfo);
|
||||
await MyAppExitAsync(false);
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@
|
|||
Grid.Column="0"
|
||||
Margin="8"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding IsSelected}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@
|
|||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
||||
|
|
@ -102,7 +102,7 @@
|
|||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
|
|
|||
|
|
@ -705,7 +705,7 @@
|
|||
x:Name="txtExtra"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
MinLines="6"
|
||||
Style="{StaticResource MyOutlinedTextBox}"
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@
|
|||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin8}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
IsChecked="{Binding IsSelected}" />
|
||||
<TextBlock
|
||||
Grid.Column="1"
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@
|
|||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
|
||||
|
|
@ -107,7 +107,7 @@
|
|||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
|
||||
|
|
@ -125,7 +125,7 @@
|
|||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
|
||||
|
|
@ -142,7 +142,7 @@
|
|||
Grid.Row="4"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
|
||||
|
|
@ -159,7 +159,7 @@
|
|||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
IsReadOnly="True"
|
||||
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
Width="300"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource DefTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
|
|
@ -181,7 +181,7 @@
|
|||
Grid.Column="1"
|
||||
Width="600"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource DefTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
|
|
@ -199,7 +199,7 @@
|
|||
Grid.Column="1"
|
||||
Width="600"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource DefTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
|
|
@ -228,7 +228,7 @@
|
|||
Grid.Column="1"
|
||||
Width="600"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource DefTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
|
|
|
|||
|
|
@ -92,7 +92,7 @@
|
|||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
Grid.Row="2"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}"
|
||||
|
|
@ -131,7 +131,7 @@
|
|||
x:Name="txtMoreUrl"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
|
||||
AcceptsReturn="True"
|
||||
MinLines="4"
|
||||
|
|
@ -162,7 +162,7 @@
|
|||
x:Name="txtAutoUpdateInterval"
|
||||
Width="100"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
|
||||
AcceptsReturn="True"
|
||||
DockPanel.Dock="Right"
|
||||
|
|
@ -188,7 +188,7 @@
|
|||
Grid.Row="5"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
|
@ -220,7 +220,7 @@
|
|||
Grid.Row="7"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}"
|
||||
|
|
@ -240,7 +240,7 @@
|
|||
Width="100"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
||||
|
|
@ -256,7 +256,7 @@
|
|||
Grid.Row="9"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
|
@ -273,7 +273,7 @@
|
|||
Grid.Row="10"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}" />
|
||||
|
|
@ -308,7 +308,7 @@
|
|||
Grid.Row="12"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Top"
|
||||
VerticalAlignment="Center"
|
||||
AcceptsReturn="True"
|
||||
Style="{StaticResource MyOutlinedTextBox}"
|
||||
TextWrapping="Wrap" />
|
||||
|
|
|
|||
Loading…
Reference in a new issue