Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b4bf455b4 | ||
|
|
ddd3739ed9 | ||
|
|
1c95c5861c | ||
|
|
fd6fa1c622 | ||
|
|
6809a77a41 | ||
|
|
7a913ee38f | ||
|
|
cca330829a | ||
|
|
e2f5c76d91 | ||
|
|
26bf7c149c |
@@ -98,7 +98,7 @@
|
||||
public static readonly List<string> fingerprints = new List<string> { "chrome", "firefox", "safari", "randomized", "" };
|
||||
public static readonly List<string> allowInsecures = new List<string> { "true", "false", "" };
|
||||
public static readonly List<string> domainStrategy4Freedoms = new List<string> { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
||||
public static readonly List<string> Languages = new List<string> { "zh-Hans", "en" };
|
||||
public static readonly List<string> Languages = new List<string> { "zh-Hans", "en" ,"fa-Ir" };
|
||||
public static readonly List<string> alpns = new List<string> { "h2", "http/1.1", "h2,http/1.1", "" };
|
||||
public static readonly List<string> LogLevel = new List<string> { "debug", "info", "warning", "error", "none" };
|
||||
public static readonly List<string> InboundTags = new List<string> { "socks", "http", "socks2", "http2" };
|
||||
|
||||
@@ -11,9 +11,9 @@ namespace v2rayN.Handler
|
||||
/// </summary>
|
||||
class CoreHandler
|
||||
{
|
||||
private static string coreCConfigRes = Global.coreConfigFileName;
|
||||
private CoreInfo coreInfo;
|
||||
private int processId = 0;
|
||||
private static string _coreCConfigRes = Global.coreConfigFileName;
|
||||
private CoreInfo _coreInfo;
|
||||
private int _processId = 0;
|
||||
private Process _process;
|
||||
Action<bool, string> _updateFunc;
|
||||
|
||||
@@ -38,7 +38,7 @@ namespace v2rayN.Handler
|
||||
ShowMsg(false, ResUI.CheckServerSettings);
|
||||
return;
|
||||
}
|
||||
string fileName = Utils.GetConfigPath(coreCConfigRes);
|
||||
string fileName = Utils.GetConfigPath(_coreCConfigRes);
|
||||
if (CoreConfigHandler.GenerateClientConfig(node, fileName, out string msg, out string content) != 0)
|
||||
{
|
||||
ShowMsg(false, msg);
|
||||
@@ -62,7 +62,7 @@ namespace v2rayN.Handler
|
||||
};
|
||||
if (CoreConfigHandler.GenerateClientConfig(itemSocks, null, out string msg2, out string configStr) == 0)
|
||||
{
|
||||
processId = CoreStartViaString(configStr);
|
||||
_processId = CoreStartViaString(configStr);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,17 +96,17 @@ namespace v2rayN.Handler
|
||||
}
|
||||
else
|
||||
{
|
||||
if (coreInfo == null || coreInfo.coreExes == null)
|
||||
if (_coreInfo == null || _coreInfo.coreExes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (string vName in coreInfo.coreExes)
|
||||
foreach (string vName in _coreInfo.coreExes)
|
||||
{
|
||||
Process[] existing = Process.GetProcessesByName(vName);
|
||||
foreach (Process p in existing)
|
||||
{
|
||||
string path = p.MainModule.FileName;
|
||||
if (path == $"{Utils.GetBinPath(vName, coreInfo.coreType)}.exe")
|
||||
if (path == $"{Utils.GetBinPath(vName, _coreInfo.coreType)}.exe")
|
||||
{
|
||||
KillProcess(p);
|
||||
}
|
||||
@@ -114,10 +114,10 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
if (processId > 0)
|
||||
if (_processId > 0)
|
||||
{
|
||||
CoreStopPid(processId);
|
||||
processId = 0;
|
||||
CoreStopPid(_processId);
|
||||
_processId = 0;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,10 +140,10 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
private string CoreFindexe(List<string> lstCoreTemp)
|
||||
private string CoreFindexe(CoreInfo coreInfo)
|
||||
{
|
||||
string fileName = string.Empty;
|
||||
foreach (string name in lstCoreTemp)
|
||||
foreach (string name in coreInfo.coreExes)
|
||||
{
|
||||
string vName = $"{name}.exe";
|
||||
vName = Utils.GetBinPath(vName, coreInfo.coreType);
|
||||
@@ -155,7 +155,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
if (Utils.IsNullOrEmpty(fileName))
|
||||
{
|
||||
string msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.coreType), string.Join(", ", lstCoreTemp.ToArray()), coreInfo.coreUrl);
|
||||
string msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.coreType), string.Join(", ", coreInfo.coreExes.ToArray()), coreInfo.coreUrl);
|
||||
ShowMsg(false, msg);
|
||||
}
|
||||
return fileName;
|
||||
@@ -167,7 +167,7 @@ namespace v2rayN.Handler
|
||||
|
||||
try
|
||||
{
|
||||
string fileName = CoreFindexe(coreInfo.coreExes);
|
||||
string fileName = CoreFindexe(_coreInfo);
|
||||
if (fileName == "") return;
|
||||
|
||||
Process p = new Process
|
||||
@@ -175,7 +175,7 @@ namespace v2rayN.Handler
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = fileName,
|
||||
Arguments = coreInfo.arguments,
|
||||
Arguments = _coreInfo.arguments,
|
||||
WorkingDirectory = Utils.GetConfigPath(),
|
||||
UseShellExecute = false,
|
||||
RedirectStandardOutput = node.displayLog,
|
||||
@@ -224,7 +224,8 @@ namespace v2rayN.Handler
|
||||
|
||||
try
|
||||
{
|
||||
string fileName = CoreFindexe(new List<string> { "xray", "wxray", "wv2ray", "v2ray" });
|
||||
var coreInfo = LazyConfig.Instance.GetCoreInfo(ECoreType.Xray);
|
||||
string fileName = CoreFindexe(coreInfo);
|
||||
if (fileName == "") return -1;
|
||||
|
||||
Process p = new Process
|
||||
@@ -305,9 +306,9 @@ namespace v2rayN.Handler
|
||||
}
|
||||
var coreType = LazyConfig.Instance.GetCoreType(node, node.configType);
|
||||
|
||||
coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
|
||||
_coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
|
||||
|
||||
if (coreInfo == null)
|
||||
if (_coreInfo == null)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
get; set;
|
||||
}
|
||||
|
||||
public bool autoRun { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 启用实时网速和流量统计
|
||||
/// </summary>
|
||||
@@ -124,9 +126,9 @@
|
||||
}
|
||||
public string systemProxyAdvancedProtocol { get; set; }
|
||||
|
||||
public int autoUpdateInterval { get; set; } = 0;
|
||||
public int autoUpdateInterval { get; set; } = 10;
|
||||
|
||||
public int autoUpdateSubInterval { get; set; } = 0;
|
||||
public int autoUpdateSubInterval { get; set; } = 10;
|
||||
|
||||
public bool checkPreReleaseUpdate { get; set; } = false;
|
||||
|
||||
@@ -135,7 +137,7 @@
|
||||
get; set;
|
||||
}
|
||||
|
||||
public int trayMenuServersLimit { get; set; }
|
||||
public int trayMenuServersLimit { get; set; } = 20;
|
||||
|
||||
public bool autoHideStartup { get; set; }
|
||||
|
||||
|
||||
1063
v2rayN/v2rayN/Resx/ResUI.fa-Ir.resx
Normal file
1063
v2rayN/v2rayN/Resx/ResUI.fa-Ir.resx
Normal file
File diff suppressed because it is too large
Load Diff
@@ -597,13 +597,21 @@ namespace v2rayN
|
||||
{
|
||||
try
|
||||
{
|
||||
string exePath = GetExePath();
|
||||
RegWriteValue(Global.AutoRunRegPath, Global.AutoRunName, run ? $"\"{exePath}\"" : "");
|
||||
var autoRunName = $"{Global.AutoRunName}_{GetMD5(StartupPath())}";
|
||||
|
||||
//delete first
|
||||
RegWriteValue(Global.AutoRunRegPath, autoRunName, "");
|
||||
|
||||
if (run)
|
||||
{
|
||||
string exePath = $"\"{GetExePath()}\"";
|
||||
RegWriteValue(Global.AutoRunRegPath, autoRunName, exePath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -58,6 +58,7 @@ namespace v2rayN.ViewModels
|
||||
SaveServer();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
private void SaveServer()
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace v2rayN.ViewModels
|
||||
SaveServer();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
private void SaveServer()
|
||||
|
||||
@@ -125,7 +125,7 @@ namespace v2rayN.ViewModels
|
||||
#endregion
|
||||
|
||||
#region UI
|
||||
AutoRun = Utils.IsAutoRun();
|
||||
AutoRun = _config.autoRun;
|
||||
EnableStatistics = _config.enableStatistics;
|
||||
StatisticsFreshRate = _config.statisticsFreshRate;
|
||||
KeepOlderDedupl = _config.keepOlderDedupl;
|
||||
@@ -161,6 +161,8 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
SaveSetting();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
private void InitCoreType()
|
||||
@@ -280,6 +282,7 @@ namespace v2rayN.ViewModels
|
||||
|
||||
//UI
|
||||
Utils.SetAutoRun(AutoRun);
|
||||
_config.autoRun = AutoRun;
|
||||
_config.enableStatistics = EnableStatistics;
|
||||
_config.statisticsFreshRate = StatisticsFreshRate;
|
||||
if (_config.statisticsFreshRate > 100 || _config.statisticsFreshRate < 1)
|
||||
|
||||
@@ -61,6 +61,7 @@ namespace v2rayN.ViewModels
|
||||
SaveRules();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
private void SaveRules()
|
||||
{
|
||||
|
||||
@@ -115,6 +115,8 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
SaveRouting();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
public void RefreshRulesItems()
|
||||
|
||||
@@ -113,6 +113,8 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
SaveRouting();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
#region locked
|
||||
|
||||
@@ -41,6 +41,8 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
SaveSub();
|
||||
});
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
private void SaveSub()
|
||||
{
|
||||
|
||||
@@ -5,6 +5,7 @@ using ReactiveUI;
|
||||
using ReactiveUI.Fody.Helpers;
|
||||
using Splat;
|
||||
using System.Reactive;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using v2rayN.Base;
|
||||
using v2rayN.Handler;
|
||||
@@ -30,7 +31,7 @@ namespace v2rayN.ViewModels
|
||||
public ReactiveCommand<Unit, Unit> SubShareCmd { get; }
|
||||
public bool IsModified { get; set; }
|
||||
|
||||
public SubSettingViewModel()
|
||||
public SubSettingViewModel(Window view)
|
||||
{
|
||||
_config = LazyConfig.Instance.GetConfig();
|
||||
_noticeHandler = Locator.Current.GetService<NoticeHandler>();
|
||||
@@ -59,6 +60,8 @@ namespace v2rayN.ViewModels
|
||||
{
|
||||
SubShare();
|
||||
}, canEditRemove);
|
||||
|
||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
public void RefreshSubItems()
|
||||
|
||||
@@ -49,6 +49,8 @@ namespace v2rayN.Views
|
||||
txtGlobalHotkey4.KeyDown += TxtGlobalHotkey_KeyDown;
|
||||
|
||||
BindingData(-1);
|
||||
|
||||
Utils.SetDarkBorder(this, _config.uiItem.colorModeDark);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace v2rayN.Views
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
ViewModel = new SubSettingViewModel();
|
||||
ViewModel = new SubSettingViewModel(this);
|
||||
lstSubscription.MouseDoubleClick += LstSubscription_MouseDoubleClick;
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||
<Copyright>Copyright © 2017-2023 (GPLv3)</Copyright>
|
||||
<FileVersion>6.0</FileVersion>
|
||||
<FileVersion>6.1</FileVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -96,6 +96,9 @@
|
||||
<EmbeddedResource Update="Resx\ResUI.zh-Hans.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Update="Resx\ResUI.fa-Ir.resx">
|
||||
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user