mirror of
				https://github.com/2dust/v2rayN.git
				synced 2025-10-30 12:02:53 +00:00 
			
		
		
		
	Merge branch 'master' into master
This commit is contained in:
		
						commit
						ecfadf8a23
					
				
					 12 changed files with 84 additions and 14 deletions
				
			
		|  | @ -32,7 +32,7 @@ namespace v2rayN.Handler | ||||||
|                 sort = 0 |                 sort = 0 | ||||||
|             }; |             }; | ||||||
|             _lstProfileEx.Add(profileEx); |             _lstProfileEx.Add(profileEx); | ||||||
|             SqliteHelper.Instance.Replace(profileEx); |             //SqliteHelper.Instance.Replace(profileEx); | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         public void ClearAll() |         public void ClearAll() | ||||||
|  | @ -45,7 +45,11 @@ namespace v2rayN.Handler | ||||||
|         { |         { | ||||||
|             try |             try | ||||||
|             { |             { | ||||||
|                 SqliteHelper.Instance.UpdateAll(_lstProfileEx); |                 foreach (var item in _lstProfileEx) | ||||||
|  |                 { | ||||||
|  |                     SqliteHelper.Instance.Replace(item); | ||||||
|  |                 } | ||||||
|  |                 //SqliteHelper.Instance.UpdateAll(_lstProfileEx); | ||||||
|             } |             } | ||||||
|             catch (Exception ex) |             catch (Exception ex) | ||||||
|             { |             { | ||||||
|  |  | ||||||
|  | @ -273,6 +273,7 @@ namespace v2rayN.Handler | ||||||
|         public static ProfileItem? ImportFromClipboardConfig(string clipboardData, out string msg) |         public static ProfileItem? ImportFromClipboardConfig(string clipboardData, out string msg) | ||||||
|         { |         { | ||||||
|             msg = string.Empty; |             msg = string.Empty; | ||||||
|  | 
 | ||||||
|             ProfileItem profileItem = new();   |             ProfileItem profileItem = new();   | ||||||
| 
 | 
 | ||||||
|             try |             try | ||||||
|  |  | ||||||
|  | @ -3,6 +3,7 @@ using System.IO; | ||||||
| using System.Reactive.Linq; | using System.Reactive.Linq; | ||||||
| using v2rayN.Handler; | using v2rayN.Handler; | ||||||
| using v2rayN.Mode; | using v2rayN.Mode; | ||||||
|  | using v2rayN.Resx; | ||||||
| 
 | 
 | ||||||
| namespace v2rayN.Base | namespace v2rayN.Base | ||||||
| { | { | ||||||
|  | @ -60,6 +61,7 @@ namespace v2rayN.Base | ||||||
|                 { |                 { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|  |                 CoreStartTest(); | ||||||
|                 CoreStart(); |                 CoreStart(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  | @ -101,6 +103,7 @@ namespace v2rayN.Base | ||||||
|             configStr = configStr.Replace("$stack$", $"{_config.tunModeItem.stack}"); |             configStr = configStr.Replace("$stack$", $"{_config.tunModeItem.stack}"); | ||||||
| 
 | 
 | ||||||
|             //logs |             //logs | ||||||
|  |             configStr = configStr.Replace("$log_disabled$", $"aaa{(!_config.tunModeItem.enabledLog).ToString().ToLower()}"); | ||||||
|             if (_config.tunModeItem.showWindow) |             if (_config.tunModeItem.showWindow) | ||||||
|             { |             { | ||||||
|                 configStr = configStr.Replace("$log_output$", $""); |                 configStr = configStr.Replace("$log_output$", $""); | ||||||
|  | @ -225,7 +228,8 @@ namespace v2rayN.Base | ||||||
|             } |             } | ||||||
|             if (Utils.IsNullOrEmpty(fileName)) |             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; |             return fileName; | ||||||
|         } |         } | ||||||
|  | @ -235,7 +239,7 @@ namespace v2rayN.Base | ||||||
|             try |             try | ||||||
|             { |             { | ||||||
|                 string fileName = CoreFindexe(); |                 string fileName = CoreFindexe(); | ||||||
|                 if (fileName == "") |                 if (Utils.IsNullOrEmpty(fileName)) | ||||||
|                 { |                 { | ||||||
|                     return; |                     return; | ||||||
|                 } |                 } | ||||||
|  | @ -293,5 +297,47 @@ namespace v2rayN.Base | ||||||
|                 Utils.SaveLog(ex.Message, ex); |                 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 enableTun { get; set; } | ||||||
|         public bool showWindow { get; set; } |         public bool showWindow { get; set; } | ||||||
|  |         public bool enabledLog { get; set; } | ||||||
|         public bool strictRoute { get; set; } |         public bool strictRoute { get; set; } | ||||||
|         public string stack { get; set; } |         public string stack { get; set; } | ||||||
|         public int mtu { get; set; } |         public int mtu { get; set; } | ||||||
|  |  | ||||||
							
								
								
									
										4
									
								
								v2rayN/v2rayN/Resx/ResUI.Designer.cs
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								v2rayN/v2rayN/Resx/ResUI.Designer.cs
									
									
									
										generated
									
									
									
								
							|  | @ -2564,7 +2564,7 @@ namespace v2rayN.Resx { | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         ///   查找类似 Record local logs 的本地化字符串。 |         ///   查找类似 Enable Log 的本地化字符串。 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         public static string TbSettingsLogEnabled { |         public static string TbSettingsLogEnabled { | ||||||
|             get { |             get { | ||||||
|  | @ -3068,7 +3068,7 @@ namespace v2rayN.Resx { | ||||||
|         } |         } | ||||||
|          |          | ||||||
|         /// <summary> |         /// <summary> | ||||||
|         ///   查找类似 *QUIC securty 的本地化字符串。 |         ///   查找类似 *QUIC security 的本地化字符串。 | ||||||
|         /// </summary> |         /// </summary> | ||||||
|         public static string TransportRequestHostTip4 { |         public static string TransportRequestHostTip4 { | ||||||
|             get { |             get { | ||||||
|  |  | ||||||
|  | @ -815,7 +815,7 @@ | ||||||
|     <value>Keep older when deduplication</value> |     <value>Keep older when deduplication</value> | ||||||
|   </data> |   </data> | ||||||
|   <data name="TbSettingsLogEnabled" xml:space="preserve"> |   <data name="TbSettingsLogEnabled" xml:space="preserve"> | ||||||
|     <value>Record local logs</value> |     <value>Enable Log</value> | ||||||
|   </data> |   </data> | ||||||
|   <data name="TbSettingsLogLevel" xml:space="preserve"> |   <data name="TbSettingsLogLevel" xml:space="preserve"> | ||||||
|     <value>Log Level</value> |     <value>Log Level</value> | ||||||
|  |  | ||||||
|  | @ -815,7 +815,7 @@ | ||||||
|     <value>去重时保留序号较小的项</value> |     <value>去重时保留序号较小的项</value> | ||||||
|   </data> |   </data> | ||||||
|   <data name="TbSettingsLogEnabled" xml:space="preserve"> |   <data name="TbSettingsLogEnabled" xml:space="preserve"> | ||||||
|     <value>记录本地日志(默认关闭)</value> |     <value>启用日志(默认关闭)</value> | ||||||
|   </data> |   </data> | ||||||
|   <data name="TbSettingsLogLevel" xml:space="preserve"> |   <data name="TbSettingsLogLevel" xml:space="preserve"> | ||||||
|     <value>日志等级</value> |     <value>日志等级</value> | ||||||
|  |  | ||||||
|  | @ -1,6 +1,6 @@ | ||||||
| { | { | ||||||
|   "log": { |   "log": { | ||||||
|     "disabled": false, |     "disabled": $log_disabled$, | ||||||
|     "level": "debug", |     "level": "debug", | ||||||
|     $log_output$ |     $log_output$ | ||||||
|     "timestamp": true |     "timestamp": true | ||||||
|  |  | ||||||
|  | @ -75,6 +75,7 @@ namespace v2rayN.ViewModels | ||||||
| 
 | 
 | ||||||
|         #region Tun mode |         #region Tun mode | ||||||
|         [Reactive] public bool TunShowWindow { get; set; } |         [Reactive] public bool TunShowWindow { get; set; } | ||||||
|  |         [Reactive] public bool TunEnabledLog { get; set; } | ||||||
|         [Reactive] public bool TunStrictRoute { get; set; } |         [Reactive] public bool TunStrictRoute { get; set; } | ||||||
|         [Reactive] public string TunStack { get; set; } |         [Reactive] public string TunStack { get; set; } | ||||||
|         [Reactive] public int TunMtu { get; set; } |         [Reactive] public int TunMtu { get; set; } | ||||||
|  | @ -168,6 +169,7 @@ namespace v2rayN.ViewModels | ||||||
|             #region Tun mode |             #region Tun mode | ||||||
| 
 | 
 | ||||||
|             TunShowWindow = _config.tunModeItem.showWindow; |             TunShowWindow = _config.tunModeItem.showWindow; | ||||||
|  |             TunEnabledLog = _config.tunModeItem.enabledLog; | ||||||
|             TunStrictRoute = _config.tunModeItem.strictRoute; |             TunStrictRoute = _config.tunModeItem.strictRoute; | ||||||
|             TunStack = _config.tunModeItem.stack; |             TunStack = _config.tunModeItem.stack; | ||||||
|             TunMtu = _config.tunModeItem.mtu; |             TunMtu = _config.tunModeItem.mtu; | ||||||
|  | @ -340,6 +342,7 @@ namespace v2rayN.ViewModels | ||||||
| 
 | 
 | ||||||
|             //tun mode |             //tun mode | ||||||
|             _config.tunModeItem.showWindow = TunShowWindow; |             _config.tunModeItem.showWindow = TunShowWindow; | ||||||
|  |             _config.tunModeItem.enabledLog = TunEnabledLog; | ||||||
|             _config.tunModeItem.strictRoute = TunStrictRoute; |             _config.tunModeItem.strictRoute = TunStrictRoute; | ||||||
|             _config.tunModeItem.stack = TunStack; |             _config.tunModeItem.stack = TunStack; | ||||||
|             _config.tunModeItem.mtu = TunMtu; |             _config.tunModeItem.mtu = TunMtu; | ||||||
|  |  | ||||||
|  | @ -816,7 +816,7 @@ | ||||||
|                         </Grid.ColumnDefinitions> |                         </Grid.ColumnDefinitions> | ||||||
| 
 | 
 | ||||||
|                         <TextBlock |                         <TextBlock | ||||||
|                             Grid.Row="1" |                             Grid.Row="0" | ||||||
|                             Grid.Column="0" |                             Grid.Column="0" | ||||||
|                             Margin="{StaticResource SettingItemMargin}" |                             Margin="{StaticResource SettingItemMargin}" | ||||||
|                             VerticalAlignment="Center" |                             VerticalAlignment="Center" | ||||||
|  | @ -824,6 +824,20 @@ | ||||||
|                             Text="{x:Static resx:ResUI.TbSettingsTunModeShowWindow}" /> |                             Text="{x:Static resx:ResUI.TbSettingsTunModeShowWindow}" /> | ||||||
|                         <ToggleButton |                         <ToggleButton | ||||||
|                             x:Name="togShowWindow" |                             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.Row="1" | ||||||
|                             Grid.Column="1" |                             Grid.Column="1" | ||||||
|                             Margin="{StaticResource SettingItemMargin}" |                             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.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.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables); | ||||||
|                 this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).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); |                 this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 2dust
						2dust