mirror of https://github.com/2dust/v2rayN
some improvements
parent
dee5613f2f
commit
b7a6004830
|
@ -21,7 +21,7 @@ namespace v2rayN.Handler
|
|||
_config = config;
|
||||
}
|
||||
|
||||
public SpeedtestHandler(ref Config config, ref V2rayHandler v2rayHandler, List<VmessItem> selecteds, string actionType, Action<string, string> update)
|
||||
public SpeedtestHandler(ref Config config, V2rayHandler v2rayHandler, List<VmessItem> selecteds, ESpeedActionType actionType, Action<string, string> update)
|
||||
{
|
||||
_config = config;
|
||||
_v2rayHandler = v2rayHandler;
|
||||
|
@ -40,19 +40,19 @@ namespace v2rayN.Handler
|
|||
});
|
||||
}
|
||||
|
||||
if (actionType == "ping")
|
||||
if (actionType == ESpeedActionType.Ping)
|
||||
{
|
||||
Task.Run(() => RunPing());
|
||||
}
|
||||
if (actionType == "tcping")
|
||||
else if (actionType == ESpeedActionType.Tcping)
|
||||
{
|
||||
Task.Run(() => RunTcping());
|
||||
}
|
||||
else if (actionType == "realping")
|
||||
else if (actionType == ESpeedActionType.Realping)
|
||||
{
|
||||
Task.Run(() => RunRealPing());
|
||||
}
|
||||
else if (actionType == "speedtest")
|
||||
else if (actionType == ESpeedActionType.Speedtest)
|
||||
{
|
||||
Task.Run(() => RunSpeedTest());
|
||||
}
|
||||
|
|
|
@ -182,7 +182,7 @@ namespace v2rayN.Handler
|
|||
string url = config.subItem[k - 1].url.TrimEx();
|
||||
string userAgent = config.subItem[k - 1].userAgent.TrimEx();
|
||||
string groupId = config.subItem[k - 1].groupId.TrimEx();
|
||||
string hashCode = $"{k}->";
|
||||
string hashCode = $"{k}){config.subItem[k - 1].remarks}->";
|
||||
if (config.subItem[k - 1].enabled == false)
|
||||
{
|
||||
continue;
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace v2rayN.Handler
|
|||
class V2rayHandler
|
||||
{
|
||||
private static string v2rayConfigRes = Global.v2rayConfigFileName;
|
||||
private List<string> lstV2ray;
|
||||
private List<string> lstCore;
|
||||
private string coreUrl;
|
||||
private string coreArguments;
|
||||
public event ProcessDelegate ProcessEvent;
|
||||
|
@ -106,7 +106,7 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else
|
||||
{
|
||||
foreach (string vName in lstV2ray)
|
||||
foreach (string vName in lstCore)
|
||||
{
|
||||
Process[] existing = Process.GetProcessesByName(vName);
|
||||
foreach (Process p in existing)
|
||||
|
@ -163,12 +163,10 @@ namespace v2rayN.Handler
|
|||
}
|
||||
}
|
||||
|
||||
private string V2rayFindexe()
|
||||
private string V2rayFindexe(List<string> lstCoreTemp)
|
||||
{
|
||||
//查找v2ray文件是否存在
|
||||
string fileName = string.Empty;
|
||||
//lstV2ray.Reverse();
|
||||
foreach (string name in lstV2ray)
|
||||
foreach (string name in lstCoreTemp)
|
||||
{
|
||||
string vName = string.Format("{0}.exe", name);
|
||||
vName = Utils.GetPath(vName);
|
||||
|
@ -195,7 +193,7 @@ namespace v2rayN.Handler
|
|||
|
||||
try
|
||||
{
|
||||
string fileName = V2rayFindexe();
|
||||
string fileName = V2rayFindexe(lstCore);
|
||||
if (fileName == "") return;
|
||||
|
||||
Process p = new Process
|
||||
|
@ -249,7 +247,8 @@ namespace v2rayN.Handler
|
|||
|
||||
try
|
||||
{
|
||||
string fileName = V2rayFindexe();
|
||||
coreUrl = Global.xrayCoreUrl;
|
||||
string fileName = V2rayFindexe(new List<string> { "xray" });
|
||||
if (fileName == "") return -1;
|
||||
|
||||
Process p = new Process
|
||||
|
@ -336,7 +335,7 @@ namespace v2rayN.Handler
|
|||
|
||||
if (coreType == ECoreType.v2fly)
|
||||
{
|
||||
lstV2ray = new List<string>
|
||||
lstCore = new List<string>
|
||||
{
|
||||
"wv2ray",
|
||||
"v2ray"
|
||||
|
@ -346,7 +345,7 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else if (coreType == ECoreType.Xray)
|
||||
{
|
||||
lstV2ray = new List<string>
|
||||
lstCore = new List<string>
|
||||
{
|
||||
"xray"
|
||||
};
|
||||
|
@ -355,7 +354,7 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else if (coreType == ECoreType.clash)
|
||||
{
|
||||
lstV2ray = new List<string>
|
||||
lstCore = new List<string>
|
||||
{
|
||||
"clash-windows-amd64",
|
||||
"clash-windows-386",
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
namespace v2rayN.Mode
|
||||
{
|
||||
public enum ESpeedActionType
|
||||
{
|
||||
Ping,
|
||||
Tcping,
|
||||
Realping,
|
||||
Speedtest
|
||||
}
|
||||
}
|
|
@ -199,6 +199,7 @@
|
|||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Handler\SysProxyHandle.cs" />
|
||||
<Compile Include="Mode\ESpeedActionType.cs" />
|
||||
<Compile Include="Mode\EGlobalHotkey.cs" />
|
||||
<Compile Include="Mode\ECoreType.cs" />
|
||||
<Compile Include="Mode\ESysProxyType.cs" />
|
||||
|
|
Loading…
Reference in New Issue