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