Merge pull request #1 from 2dust/master

Merge from 2dust/v2rayN
This commit is contained in:
Tony 2020-06-30 17:42:33 +08:00 committed by GitHub
commit 4785ebcf39
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 50 additions and 19 deletions

View file

@ -7,4 +7,4 @@
### Requirements ### Requirements
- Microsoft [.NET Framework 4.6](https://docs.microsoft.com/zh-cn/dotnet/framework/install/guide-for-developers) or higher - Microsoft [.NET Framework 4.6](https://docs.microsoft.com/zh-cn/dotnet/framework/install/guide-for-developers) or higher
- Project V core [https://github.com/v2ray/v2ray-core/releases](https://github.com/v2ray/v2ray-core/releases) - Project V core [https://github.com/v2fly/v2ray-core/releases](https://github.com/v2fly/v2ray-core/releases)

View file

@ -1298,7 +1298,16 @@ namespace v2rayN.Forms
try try
{ {
string fileName = Utils.GetPath(downloadHandle.DownloadFileName); string fileName = Utils.GetPath(downloadHandle.DownloadFileName);
Process process = Process.Start("v2rayUpgrade.exe", "\"" + fileName + "\""); Process process = new Process
{
StartInfo = new ProcessStartInfo
{
FileName = "v2rayUpgrade.exe",
Arguments = "\"" + fileName + "\"",
WorkingDirectory = Utils.StartupPath()
}
};
process.Start();
if (process.Id > 0) if (process.Id > 0)
{ {
menuExit_Click(null, null); menuExit_Click(null, null);

View file

@ -6,7 +6,7 @@ namespace v2rayN
#region #region
public const string v2rayWebsiteUrl = @"https://www.v2ray.com/"; public const string v2rayWebsiteUrl = @"https://www.v2fly.org/";
public const string AboutUrl = @"https://github.com/2dust/v2rayN"; public const string AboutUrl = @"https://github.com/2dust/v2rayN";
public const string UpdateUrl = AboutUrl + @"/releases"; public const string UpdateUrl = AboutUrl + @"/releases";

View file

@ -54,8 +54,8 @@ namespace v2rayN.Handler
private readonly string nLatestUrl = "https://github.com/2dust/v2rayN/releases/latest"; private readonly string nLatestUrl = "https://github.com/2dust/v2rayN/releases/latest";
private const string nUrl = "https://github.com/2dust/v2rayN/releases/download/{0}/v2rayN.zip"; private const string nUrl = "https://github.com/2dust/v2rayN/releases/download/{0}/v2rayN.zip";
private readonly string coreLatestUrl = "https://github.com/v2ray/v2ray-core/releases/latest"; private readonly string coreLatestUrl = "https://github.com/v2fly/v2ray-core/releases/latest";
private const string coreUrl = "https://github.com/v2ray/v2ray-core/releases/download/{0}/v2ray-windows-{1}.zip"; private const string coreUrl = "https://github.com/v2fly/v2ray-core/releases/download/{0}/v2ray-windows-{1}.zip";
public async void CheckUpdateAsync(string type) public async void CheckUpdateAsync(string type)
{ {
@ -101,7 +101,7 @@ namespace v2rayN.Handler
string filePath = Utils.GetPath("V2ray.exe"); string filePath = Utils.GetPath("V2ray.exe");
if (!File.Exists(filePath)) if (!File.Exists(filePath))
{ {
string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2ray/v2ray-core/releases"); string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2fly/v2ray-core/releases");
//ShowMsg(true, msg); //ShowMsg(true, msg);
return ""; return "";
} }

View file

@ -190,7 +190,7 @@ namespace v2rayN.Handler
_updateFunc(testCounter, args.GetException().Message); _updateFunc(testCounter, args.GetException().Message);
}; };
var timeout = 12; var timeout = 10;
foreach (int itemIndex in _selecteds) foreach (int itemIndex in _selecteds)
{ {
if (itemIndex >= _config.vmess.Count) if (itemIndex >= _config.vmess.Count)

View file

@ -1266,22 +1266,44 @@ namespace v2rayN.Handler
result = Utils.Base64Decode(result); result = Utils.Base64Decode(result);
} }
string[] arr1 = result.Split('@'); //密码中可能包含“@”,所以从后往前搜索
if (arr1.Length != 2) int indexAddressAndPort = result.LastIndexOf("@");
if (indexAddressAndPort < 0)
{ {
return null; return null;
} }
string[] arr21 = arr1[0].Split(':'); string addressAndPort = result.Substring(indexAddressAndPort + 1);
//string[] arr22 = arr1[1].Split(':'); string securityAndId = result.Substring(0, indexAddressAndPort);
int indexPort = arr1[1].LastIndexOf(":");
if (arr21.Length != 2 || indexPort < 0) //IPv6地址中包含“:”,所以从后往前搜索
int indexPort = addressAndPort.LastIndexOf(":");
if (indexPort < 0)
{ {
return null; return null;
} }
vmessItem.address = arr1[1].Substring(0, indexPort);
vmessItem.port = Utils.ToInt(arr1[1].Substring(indexPort + 1, arr1[1].Length - (indexPort + 1))); //加密方式中不包含“:”,所以从前往后搜索
vmessItem.security = arr21[0]; int indexId = securityAndId.IndexOf(":");
vmessItem.id = arr21[1]; if (indexId < 0)
{
return null;
}
string address = addressAndPort.Substring(0, indexPort);
string port = addressAndPort.Substring(indexPort + 1);
string security = securityAndId.Substring(0, indexId);
string id = securityAndId.Substring(indexId + 1);
//所有字段均不能为空
if (address.Length == 0 || port.Length == 0 || security.Length == 0 || id.Length == 0)
{
return null;
}
vmessItem.address = address;
vmessItem.port = Utils.ToInt(port);
vmessItem.security = security;
vmessItem.id = id;
} }
else if (result.StartsWith(Global.socksProtocol)) else if (result.StartsWith(Global.socksProtocol))
{ {

View file

@ -174,7 +174,7 @@ namespace v2rayN.Handler
} }
if (Utils.IsNullOrEmpty(fileName)) if (Utils.IsNullOrEmpty(fileName))
{ {
string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2ray/v2ray-core/releases"); string msg = string.Format(UIRes.I18N("NotFoundCore"), @"https://github.com/v2fly/v2ray-core/releases");
ShowMsg(false, msg); ShowMsg(false, msg);
} }
return fileName; return fileName;

View file

@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
// 方法是按如下所示使用“*”: // 方法是按如下所示使用“*”:
//[assembly: AssemblyVersion("1.0.*")] //[assembly: AssemblyVersion("1.0.*")]
//[assembly: AssemblyVersion("1.0.0")] //[assembly: AssemblyVersion("1.0.0")]
[assembly: AssemblyFileVersion("3.17")] [assembly: AssemblyFileVersion("3.19")]