mirror of https://github.com/2dust/v2rayN
Merge branch 'master' into master
commit
ecfadf8a23
|
@ -32,7 +32,7 @@ namespace v2rayN.Handler
|
|||
sort = 0
|
||||
};
|
||||
_lstProfileEx.Add(profileEx);
|
||||
SqliteHelper.Instance.Replace(profileEx);
|
||||
//SqliteHelper.Instance.Replace(profileEx);
|
||||
}
|
||||
|
||||
public void ClearAll()
|
||||
|
@ -45,7 +45,11 @@ namespace v2rayN.Handler
|
|||
{
|
||||
try
|
||||
{
|
||||
SqliteHelper.Instance.UpdateAll(_lstProfileEx);
|
||||
foreach (var item in _lstProfileEx)
|
||||
{
|
||||
SqliteHelper.Instance.Replace(item);
|
||||
}
|
||||
//SqliteHelper.Instance.UpdateAll(_lstProfileEx);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -273,6 +273,7 @@ namespace v2rayN.Handler
|
|||
public static ProfileItem? ImportFromClipboardConfig(string clipboardData, out string msg)
|
||||
{
|
||||
msg = string.Empty;
|
||||
|
||||
ProfileItem profileItem = new();
|
||||
|
||||
try
|
||||
|
|
|
@ -3,6 +3,7 @@ using System.IO;
|
|||
using System.Reactive.Linq;
|
||||
using v2rayN.Handler;
|
||||
using v2rayN.Mode;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Base
|
||||
{
|
||||
|
@ -60,6 +61,7 @@ namespace v2rayN.Base
|
|||
{
|
||||
return;
|
||||
}
|
||||
CoreStartTest();
|
||||
CoreStart();
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +103,7 @@ namespace v2rayN.Base
|
|||
configStr = configStr.Replace("$stack$", $"{_config.tunModeItem.stack}");
|
||||
|
||||
//logs
|
||||
configStr = configStr.Replace("$log_disabled$", $"aaa{(!_config.tunModeItem.enabledLog).ToString().ToLower()}");
|
||||
if (_config.tunModeItem.showWindow)
|
||||
{
|
||||
configStr = configStr.Replace("$log_output$", $"");
|
||||
|
@ -225,7 +228,8 @@ namespace v2rayN.Base
|
|||
}
|
||||
if (Utils.IsNullOrEmpty(fileName))
|
||||
{
|
||||
|
||||
string msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.coreType), string.Join(", ", coreInfo.coreExes.ToArray()), coreInfo.coreUrl);
|
||||
Utils.SaveLog(msg);
|
||||
}
|
||||
return fileName;
|
||||
}
|
||||
|
@ -235,7 +239,7 @@ namespace v2rayN.Base
|
|||
try
|
||||
{
|
||||
string fileName = CoreFindexe();
|
||||
if (fileName == "")
|
||||
if (Utils.IsNullOrEmpty(fileName))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -293,5 +297,47 @@ namespace v2rayN.Base
|
|||
Utils.SaveLog(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
private int CoreStartTest()
|
||||
{
|
||||
Utils.SaveLog("Tun mode configuration file test start");
|
||||
try
|
||||
{
|
||||
string fileName = CoreFindexe();
|
||||
if (fileName == "")
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
Process p = new Process
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = fileName,
|
||||
Arguments = $"run -c \"{Utils.GetConfigPath(_tunConfigName)}\"",
|
||||
WorkingDirectory = Utils.GetConfigPath(),
|
||||
UseShellExecute = false,
|
||||
CreateNoWindow = true,
|
||||
RedirectStandardError = true,
|
||||
Verb = "runas",
|
||||
}
|
||||
};
|
||||
p.Start();
|
||||
if (p.WaitForExit(2000))
|
||||
{
|
||||
throw new Exception(p.StandardError.ReadToEnd());
|
||||
}
|
||||
KillProcess(p);
|
||||
return 0;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
return -1;
|
||||
}
|
||||
finally
|
||||
{
|
||||
Utils.SaveLog("Tun mode configuration file test end");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -160,6 +160,7 @@ namespace v2rayN.Mode
|
|||
{
|
||||
public bool enableTun { get; set; }
|
||||
public bool showWindow { get; set; }
|
||||
public bool enabledLog { get; set; }
|
||||
public bool strictRoute { get; set; }
|
||||
public string stack { get; set; }
|
||||
public int mtu { get; set; }
|
||||
|
|
|
@ -2564,7 +2564,7 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Record local logs 的本地化字符串。
|
||||
/// 查找类似 Enable Log 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbSettingsLogEnabled {
|
||||
get {
|
||||
|
@ -3068,7 +3068,7 @@ namespace v2rayN.Resx {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 *QUIC securty 的本地化字符串。
|
||||
/// 查找类似 *QUIC security 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TransportRequestHostTip4 {
|
||||
get {
|
||||
|
|
|
@ -815,7 +815,7 @@
|
|||
<value>Keep older when deduplication</value>
|
||||
</data>
|
||||
<data name="TbSettingsLogEnabled" xml:space="preserve">
|
||||
<value>Record local logs</value>
|
||||
<value>Enable Log</value>
|
||||
</data>
|
||||
<data name="TbSettingsLogLevel" xml:space="preserve">
|
||||
<value>Log Level</value>
|
||||
|
|
|
@ -815,7 +815,7 @@
|
|||
<value>去重时保留序号较小的项</value>
|
||||
</data>
|
||||
<data name="TbSettingsLogEnabled" xml:space="preserve">
|
||||
<value>记录本地日志(默认关闭)</value>
|
||||
<value>启用日志(默认关闭)</value>
|
||||
</data>
|
||||
<data name="TbSettingsLogLevel" xml:space="preserve">
|
||||
<value>日志等级</value>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"log": {
|
||||
"disabled": false,
|
||||
"disabled": $log_disabled$,
|
||||
"level": "debug",
|
||||
$log_output$
|
||||
"timestamp": true
|
||||
|
|
|
@ -75,6 +75,7 @@ namespace v2rayN.ViewModels
|
|||
|
||||
#region Tun mode
|
||||
[Reactive] public bool TunShowWindow { get; set; }
|
||||
[Reactive] public bool TunEnabledLog { get; set; }
|
||||
[Reactive] public bool TunStrictRoute { get; set; }
|
||||
[Reactive] public string TunStack { get; set; }
|
||||
[Reactive] public int TunMtu { get; set; }
|
||||
|
@ -168,6 +169,7 @@ namespace v2rayN.ViewModels
|
|||
#region Tun mode
|
||||
|
||||
TunShowWindow = _config.tunModeItem.showWindow;
|
||||
TunEnabledLog = _config.tunModeItem.enabledLog;
|
||||
TunStrictRoute = _config.tunModeItem.strictRoute;
|
||||
TunStack = _config.tunModeItem.stack;
|
||||
TunMtu = _config.tunModeItem.mtu;
|
||||
|
@ -340,6 +342,7 @@ namespace v2rayN.ViewModels
|
|||
|
||||
//tun mode
|
||||
_config.tunModeItem.showWindow = TunShowWindow;
|
||||
_config.tunModeItem.enabledLog = TunEnabledLog;
|
||||
_config.tunModeItem.strictRoute = TunStrictRoute;
|
||||
_config.tunModeItem.stack = TunStack;
|
||||
_config.tunModeItem.mtu = TunMtu;
|
||||
|
|
|
@ -816,7 +816,7 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Row="0"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
|
@ -824,6 +824,20 @@
|
|||
Text="{x:Static resx:ResUI.TbSettingsTunModeShowWindow}" />
|
||||
<ToggleButton
|
||||
x:Name="togShowWindow"
|
||||
Grid.Row="0"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
HorizontalAlignment="Left" />
|
||||
|
||||
<TextBlock
|
||||
Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSettingsLogEnabled}" />
|
||||
<ToggleButton
|
||||
x:Name="togEnabledLog"
|
||||
Grid.Row="1"
|
||||
Grid.Column="1"
|
||||
Margin="{StaticResource SettingItemMargin}"
|
||||
|
|
|
@ -172,6 +172,7 @@ namespace v2rayN.Views
|
|||
|
||||
|
||||
this.Bind(ViewModel, vm => vm.TunShowWindow, v => v.togShowWindow.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunEnabledLog, v => v.togEnabledLog.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
||||
|
|
Loading…
Reference in New Issue