Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c29ccf76d5 | ||
|
|
5907bf388c | ||
|
|
54adaffb92 | ||
|
|
3bc7812e1a | ||
|
|
16cd9706f9 | ||
|
|
839d07870c |
@@ -41,7 +41,12 @@ namespace v2rayN.Forms
|
||||
|
||||
private void MainForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
ConfigHandler.LoadConfig(ref config);
|
||||
if (ConfigHandler.LoadConfig(ref config) != 0)
|
||||
{
|
||||
UI.ShowWarning($"Loading GUI configuration file is abnormal,please restart the application{Environment.NewLine}加载GUI配置文件异常,请重启应用");
|
||||
Environment.Exit(0);
|
||||
return;
|
||||
}
|
||||
ConfigHandler.InitBuiltinRouting(ref config);
|
||||
MainFormHandler.Instance.BackupGuiNConfig(config, true);
|
||||
v2rayHandler = new V2rayHandler();
|
||||
@@ -573,13 +578,11 @@ namespace v2rayN.Forms
|
||||
{
|
||||
return;
|
||||
}
|
||||
for (int k = lvSelecteds.Count - 1; k >= 0; k--)
|
||||
{
|
||||
ConfigHandler.RemoveServer(ref config, lvSelecteds[k]);
|
||||
}
|
||||
|
||||
ConfigHandler.RemoveServer(ref config, lvSelecteds);
|
||||
|
||||
RefreshServers();
|
||||
LoadV2ray();
|
||||
|
||||
}
|
||||
|
||||
private void menuRemoveDuplicateServer_Click(object sender, EventArgs e)
|
||||
|
||||
30
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
30
v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
generated
@@ -101,33 +101,32 @@
|
||||
//
|
||||
// btnClose
|
||||
//
|
||||
resources.ApplyResources(this.btnClose, "btnClose");
|
||||
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
resources.ApplyResources(this.btnClose, "btnClose");
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.UseVisualStyleBackColor = true;
|
||||
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
||||
//
|
||||
// tabControl1
|
||||
//
|
||||
resources.ApplyResources(this.tabControl1, "tabControl1");
|
||||
this.tabControl1.Controls.Add(this.tabPage1);
|
||||
this.tabControl1.Controls.Add(this.tabPage2);
|
||||
this.tabControl1.Controls.Add(this.tabPage6);
|
||||
this.tabControl1.Controls.Add(this.tabPage7);
|
||||
this.tabControl1.Controls.Add(this.tabPage3);
|
||||
resources.ApplyResources(this.tabControl1, "tabControl1");
|
||||
this.tabControl1.Name = "tabControl1";
|
||||
this.tabControl1.SelectedIndex = 0;
|
||||
//
|
||||
// tabPage1
|
||||
//
|
||||
resources.ApplyResources(this.tabPage1, "tabPage1");
|
||||
this.tabPage1.Controls.Add(this.groupBox1);
|
||||
resources.ApplyResources(this.tabPage1, "tabPage1");
|
||||
this.tabPage1.Name = "tabPage1";
|
||||
this.tabPage1.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox1
|
||||
//
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Controls.Add(this.chkdefAllowInsecure);
|
||||
this.groupBox1.Controls.Add(this.chksniffingEnabled2);
|
||||
this.groupBox1.Controls.Add(this.chksniffingEnabled);
|
||||
@@ -145,6 +144,7 @@
|
||||
this.groupBox1.Controls.Add(this.label5);
|
||||
this.groupBox1.Controls.Add(this.txtlocalPort);
|
||||
this.groupBox1.Controls.Add(this.label2);
|
||||
resources.ApplyResources(this.groupBox1, "groupBox1");
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.TabStop = false;
|
||||
//
|
||||
@@ -187,12 +187,12 @@
|
||||
//
|
||||
// cmbprotocol2
|
||||
//
|
||||
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
|
||||
this.cmbprotocol2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbprotocol2.FormattingEnabled = true;
|
||||
this.cmbprotocol2.Items.AddRange(new object[] {
|
||||
resources.GetString("cmbprotocol2.Items"),
|
||||
resources.GetString("cmbprotocol2.Items1")});
|
||||
resources.ApplyResources(this.cmbprotocol2, "cmbprotocol2");
|
||||
this.cmbprotocol2.Name = "cmbprotocol2";
|
||||
//
|
||||
// label3
|
||||
@@ -207,8 +207,8 @@
|
||||
//
|
||||
// cmbprotocol
|
||||
//
|
||||
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
|
||||
this.cmbprotocol.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
resources.ApplyResources(this.cmbprotocol, "cmbprotocol");
|
||||
this.cmbprotocol.FormattingEnabled = true;
|
||||
this.cmbprotocol.Items.AddRange(new object[] {
|
||||
resources.GetString("cmbprotocol.Items"),
|
||||
@@ -234,7 +234,6 @@
|
||||
//
|
||||
// cmbloglevel
|
||||
//
|
||||
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
|
||||
this.cmbloglevel.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbloglevel.FormattingEnabled = true;
|
||||
this.cmbloglevel.Items.AddRange(new object[] {
|
||||
@@ -243,6 +242,7 @@
|
||||
resources.GetString("cmbloglevel.Items2"),
|
||||
resources.GetString("cmbloglevel.Items3"),
|
||||
resources.GetString("cmbloglevel.Items4")});
|
||||
resources.ApplyResources(this.cmbloglevel, "cmbloglevel");
|
||||
this.cmbloglevel.Name = "cmbloglevel";
|
||||
//
|
||||
// label5
|
||||
@@ -262,10 +262,10 @@
|
||||
//
|
||||
// tabPage2
|
||||
//
|
||||
resources.ApplyResources(this.tabPage2, "tabPage2");
|
||||
this.tabPage2.Controls.Add(this.linkDnsObjectDoc);
|
||||
this.tabPage2.Controls.Add(this.txtremoteDNS);
|
||||
this.tabPage2.Controls.Add(this.label14);
|
||||
resources.ApplyResources(this.tabPage2, "tabPage2");
|
||||
this.tabPage2.Name = "tabPage2";
|
||||
this.tabPage2.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -288,7 +288,6 @@
|
||||
//
|
||||
// tabPage6
|
||||
//
|
||||
resources.ApplyResources(this.tabPage6, "tabPage6");
|
||||
this.tabPage6.Controls.Add(this.chkKcpcongestion);
|
||||
this.tabPage6.Controls.Add(this.txtKcpwriteBufferSize);
|
||||
this.tabPage6.Controls.Add(this.label10);
|
||||
@@ -302,6 +301,7 @@
|
||||
this.tabPage6.Controls.Add(this.label7);
|
||||
this.tabPage6.Controls.Add(this.txtKcpmtu);
|
||||
this.tabPage6.Controls.Add(this.label6);
|
||||
resources.ApplyResources(this.tabPage6, "tabPage6");
|
||||
this.tabPage6.Name = "tabPage6";
|
||||
this.tabPage6.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -373,7 +373,6 @@
|
||||
//
|
||||
// tabPage7
|
||||
//
|
||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||
this.tabPage7.Controls.Add(this.txtautoUpdateInterval);
|
||||
this.tabPage7.Controls.Add(this.label15);
|
||||
this.tabPage7.Controls.Add(this.chkIgnoreGeoUpdateCore);
|
||||
@@ -385,6 +384,7 @@
|
||||
this.tabPage7.Controls.Add(this.chkEnableStatistics);
|
||||
this.tabPage7.Controls.Add(this.chkAllowLANConn);
|
||||
this.tabPage7.Controls.Add(this.chkAutoRun);
|
||||
resources.ApplyResources(this.tabPage7, "tabPage7");
|
||||
this.tabPage7.Name = "tabPage7";
|
||||
this.tabPage7.UseVisualStyleBackColor = true;
|
||||
//
|
||||
@@ -406,12 +406,12 @@
|
||||
//
|
||||
// cmbCoreType
|
||||
//
|
||||
resources.ApplyResources(this.cmbCoreType, "cmbCoreType");
|
||||
this.cmbCoreType.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cmbCoreType.FormattingEnabled = true;
|
||||
this.cmbCoreType.Items.AddRange(new object[] {
|
||||
resources.GetString("cmbCoreType.Items"),
|
||||
resources.GetString("cmbCoreType.Items1")});
|
||||
resources.ApplyResources(this.cmbCoreType, "cmbCoreType");
|
||||
this.cmbCoreType.Name = "cmbCoreType";
|
||||
//
|
||||
// label4
|
||||
@@ -427,9 +427,9 @@
|
||||
//
|
||||
// cbFreshrate
|
||||
//
|
||||
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
|
||||
this.cbFreshrate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.cbFreshrate.FormattingEnabled = true;
|
||||
resources.ApplyResources(this.cbFreshrate, "cbFreshrate");
|
||||
this.cbFreshrate.Name = "cbFreshrate";
|
||||
//
|
||||
// lbFreshrate
|
||||
@@ -457,17 +457,17 @@
|
||||
//
|
||||
// tabPage3
|
||||
//
|
||||
resources.ApplyResources(this.tabPage3, "tabPage3");
|
||||
this.tabPage3.Controls.Add(this.groupBox2);
|
||||
resources.ApplyResources(this.tabPage3, "tabPage3");
|
||||
this.tabPage3.Name = "tabPage3";
|
||||
this.tabPage3.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// groupBox2
|
||||
//
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.Controls.Add(this.label13);
|
||||
this.groupBox2.Controls.Add(this.label12);
|
||||
this.groupBox2.Controls.Add(this.txtsystemProxyExceptions);
|
||||
resources.ApplyResources(this.groupBox2, "groupBox2");
|
||||
this.groupBox2.Name = "groupBox2";
|
||||
this.groupBox2.TabStop = false;
|
||||
//
|
||||
@@ -488,9 +488,9 @@
|
||||
//
|
||||
// panel2
|
||||
//
|
||||
resources.ApplyResources(this.panel2, "panel2");
|
||||
this.panel2.Controls.Add(this.btnClose);
|
||||
this.panel2.Controls.Add(this.btnOK);
|
||||
resources.ApplyResources(this.panel2, "panel2");
|
||||
this.panel2.Name = "panel2";
|
||||
//
|
||||
// btnOK
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -121,90 +121,15 @@
|
||||
<value>取消(&C)</value>
|
||||
</data>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
<data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>662, 469</value>
|
||||
</data>
|
||||
<data name="tabPage1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage1.Text" xml:space="preserve">
|
||||
<value> Core:基础设置 </value>
|
||||
</data>
|
||||
<data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage2.Text" xml:space="preserve">
|
||||
<value> Core:DNS设置 </value>
|
||||
</data>
|
||||
<data name="tabPage6.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage6.Text" xml:space="preserve">
|
||||
<value> Core:KCP设置 </value>
|
||||
</data>
|
||||
<data name="txtautoUpdateInterval.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>255, 156</value>
|
||||
</data>
|
||||
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>191, 12</value>
|
||||
</data>
|
||||
<data name="label15.Text" xml:space="preserve">
|
||||
<value>自动更新Geo文件的间隔(单位分钟)</value>
|
||||
</data>
|
||||
<data name="chkIgnoreGeoUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>150, 16</value>
|
||||
</data>
|
||||
<data name="chkIgnoreGeoUpdateCore.Text" xml:space="preserve">
|
||||
<value>更新Core时忽略Geo文件</value>
|
||||
</data>
|
||||
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>53, 12</value>
|
||||
</data>
|
||||
<data name="label4.Text" xml:space="preserve">
|
||||
<value>Core类型</value>
|
||||
</data>
|
||||
<data name="chkKeepOlderDedupl.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>156, 16</value>
|
||||
</data>
|
||||
<data name="chkKeepOlderDedupl.Text" xml:space="preserve">
|
||||
<value>去重时保留序号较小的项</value>
|
||||
</data>
|
||||
<data name="lbFreshrate.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>77, 12</value>
|
||||
</data>
|
||||
<data name="lbFreshrate.Text" xml:space="preserve">
|
||||
<value>统计刷新频率</value>
|
||||
</data>
|
||||
<data name="chkEnableStatistics.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>372, 16</value>
|
||||
</data>
|
||||
<data name="chkEnableStatistics.Text" xml:space="preserve">
|
||||
<value>启用统计(实时网速显示和使用流量显示,需要重启v2rayN客户端)</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 16</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||
<value>允许来自局域网的连接</value>
|
||||
</data>
|
||||
<data name="chkAutoRun.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>180, 16</value>
|
||||
</data>
|
||||
<data name="chkAutoRun.Text" xml:space="preserve">
|
||||
<value>开机自动启动(可能会不成功)</value>
|
||||
</data>
|
||||
<data name="tabPage7.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage7.Text" xml:space="preserve">
|
||||
<value> v2rayN设置 </value>
|
||||
</data>
|
||||
<data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage3.Text" xml:space="preserve">
|
||||
<value> 系统代理设置 </value>
|
||||
</data>
|
||||
<data name="tabControl1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>662, 469</value>
|
||||
</data>
|
||||
<data name="groupBox1.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>648, 437</value>
|
||||
</data>
|
||||
@@ -280,6 +205,12 @@
|
||||
<data name="label2.Text" xml:space="preserve">
|
||||
<value>本地监听端口</value>
|
||||
</data>
|
||||
<data name="tabPage2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage2.Text" xml:space="preserve">
|
||||
<value> Core:DNS设置 </value>
|
||||
</data>
|
||||
<data name="linkDnsObjectDoc.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>161, 12</value>
|
||||
</data>
|
||||
@@ -292,6 +223,75 @@
|
||||
<data name="label14.Text" xml:space="preserve">
|
||||
<value>自定义DNS(可多个,用逗号(,)隔开)</value>
|
||||
</data>
|
||||
<data name="tabPage6.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage6.Text" xml:space="preserve">
|
||||
<value> Core:KCP设置 </value>
|
||||
</data>
|
||||
<data name="tabPage7.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage7.Text" xml:space="preserve">
|
||||
<value> v2rayN设置 </value>
|
||||
</data>
|
||||
<data name="txtautoUpdateInterval.Location" type="System.Drawing.Point, System.Drawing">
|
||||
<value>255, 156</value>
|
||||
</data>
|
||||
<data name="label15.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>191, 12</value>
|
||||
</data>
|
||||
<data name="label15.Text" xml:space="preserve">
|
||||
<value>自动更新Geo文件的间隔(单位小时)</value>
|
||||
</data>
|
||||
<data name="chkIgnoreGeoUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>150, 16</value>
|
||||
</data>
|
||||
<data name="chkIgnoreGeoUpdateCore.Text" xml:space="preserve">
|
||||
<value>更新Core时忽略Geo文件</value>
|
||||
</data>
|
||||
<data name="label4.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>53, 12</value>
|
||||
</data>
|
||||
<data name="label4.Text" xml:space="preserve">
|
||||
<value>Core类型</value>
|
||||
</data>
|
||||
<data name="chkKeepOlderDedupl.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>156, 16</value>
|
||||
</data>
|
||||
<data name="chkKeepOlderDedupl.Text" xml:space="preserve">
|
||||
<value>去重时保留序号较小的项</value>
|
||||
</data>
|
||||
<data name="lbFreshrate.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>77, 12</value>
|
||||
</data>
|
||||
<data name="lbFreshrate.Text" xml:space="preserve">
|
||||
<value>统计刷新频率</value>
|
||||
</data>
|
||||
<data name="chkEnableStatistics.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>372, 16</value>
|
||||
</data>
|
||||
<data name="chkEnableStatistics.Text" xml:space="preserve">
|
||||
<value>启用统计(实时网速显示和使用流量显示,需要重启v2rayN客户端)</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>144, 16</value>
|
||||
</data>
|
||||
<data name="chkAllowLANConn.Text" xml:space="preserve">
|
||||
<value>允许来自局域网的连接</value>
|
||||
</data>
|
||||
<data name="chkAutoRun.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>180, 16</value>
|
||||
</data>
|
||||
<data name="chkAutoRun.Text" xml:space="preserve">
|
||||
<value>开机自动启动(可能会不成功)</value>
|
||||
</data>
|
||||
<data name="tabPage3.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
<data name="tabPage3.Text" xml:space="preserve">
|
||||
<value> 系统代理设置 </value>
|
||||
</data>
|
||||
<data name="groupBox2.Size" type="System.Drawing.Size, System.Drawing">
|
||||
<value>654, 443</value>
|
||||
</data>
|
||||
|
||||
@@ -32,6 +32,15 @@ namespace v2rayN.Handler
|
||||
//转成Json
|
||||
config = Utils.FromJson<Config>(result);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (File.Exists(Utils.GetPath(configRes)))
|
||||
{
|
||||
Utils.SaveLog("LoadConfig Exception");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new Config
|
||||
@@ -227,19 +236,27 @@ namespace v2rayN.Handler
|
||||
/// <param name="config"></param>
|
||||
/// <param name="index"></param>
|
||||
/// <returns></returns>
|
||||
public static int RemoveServer(ref Config config, int index)
|
||||
public static int RemoveServer(ref Config config, List<int> indexs)
|
||||
{
|
||||
if (index < 0 || index > config.vmess.Count - 1)
|
||||
var itemId = config.getItemId();
|
||||
|
||||
for (int k = indexs.Count - 1; k >= 0; k--)
|
||||
{
|
||||
return -1;
|
||||
var index = indexs[k];
|
||||
if (index < 0 || index > config.vmess.Count - 1)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
config.vmess.RemoveAt(index);
|
||||
}
|
||||
|
||||
//删除
|
||||
config.vmess.RemoveAt(index);
|
||||
|
||||
|
||||
//移除的是活动的
|
||||
if (config.index.Equals(index))
|
||||
var index_ = config.vmess.FindIndex(it => it.getItemId() == itemId);
|
||||
if (index_ >= 0)
|
||||
{
|
||||
config.index = index_;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (config.vmess.Count > 0)
|
||||
{
|
||||
@@ -249,13 +266,8 @@ namespace v2rayN.Handler
|
||||
{
|
||||
config.index = -1;
|
||||
}
|
||||
Global.reloadV2ray = true;
|
||||
}
|
||||
else if (index < config.index)//移除活动之前的
|
||||
{
|
||||
config.index--;
|
||||
Global.reloadV2ray = true;
|
||||
}
|
||||
Global.reloadV2ray = true;
|
||||
|
||||
ToJsonFile(config);
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace v2rayN.Handler
|
||||
}
|
||||
return ws;
|
||||
}
|
||||
|
||||
|
||||
void ws_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
|
||||
{
|
||||
if (UpdateCompleted != null)
|
||||
@@ -108,7 +108,7 @@ namespace v2rayN.Handler
|
||||
if (e.Error == null
|
||||
|| Utils.IsNullOrEmpty(e.Error.ToString()))
|
||||
{
|
||||
|
||||
((WebClientEx)sender).Dispose();
|
||||
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||
string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.0"));
|
||||
UpdateCompleted(this, new ResultEventArgs(true, speed.PadLeft(8, ' ')));
|
||||
@@ -189,5 +189,34 @@ namespace v2rayN.Handler
|
||||
}
|
||||
}
|
||||
|
||||
public WebClientEx DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout)
|
||||
{
|
||||
WebClientEx ws = new WebClientEx();
|
||||
try
|
||||
{
|
||||
Utils.SetSecurityProtocol();
|
||||
UpdateCompleted?.Invoke(this, new ResultEventArgs(false, UIRes.I18N("Downloading")));
|
||||
|
||||
progressPercentage = -1;
|
||||
totalBytesToReceive = 0;
|
||||
|
||||
DownloadTimeout = downloadTimeout;
|
||||
if (webProxy != null)
|
||||
{
|
||||
ws.Proxy = webProxy;
|
||||
}
|
||||
|
||||
ws.DownloadProgressChanged += ws_DownloadProgressChanged;
|
||||
ws.DownloadDataCompleted += ws_DownloadFileCompleted;
|
||||
ws.DownloadDataAsync(new Uri(url));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Utils.SaveLog(ex.Message, ex);
|
||||
|
||||
Error?.Invoke(this, new ErrorEventArgs(ex));
|
||||
}
|
||||
return ws;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace v2rayN.Handler
|
||||
Utils.SaveLog("geoip" + msg);
|
||||
});
|
||||
|
||||
Thread.Sleep(60000 * config.autoUpdateInterval);
|
||||
Thread.Sleep(1000 * 3600 * config.autoUpdateInterval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,11 +220,12 @@ namespace v2rayN.Handler
|
||||
int httpPort = _config.GetLocalPort("speedtest");
|
||||
|
||||
WebProxy webProxy = new WebProxy(Global.Loopback, httpPort + itemIndex);
|
||||
var ws = downloadHandle2.DownloadFileAsync(url, webProxy, timeout - 2);
|
||||
var ws = downloadHandle2.DownloadDataAsync(url, webProxy, timeout - 2);
|
||||
|
||||
Thread.Sleep(1000 * timeout);
|
||||
|
||||
ws.CancelAsync();
|
||||
ws.Dispose();
|
||||
|
||||
Thread.Sleep(1000 * 2);
|
||||
}
|
||||
|
||||
@@ -32,4 +32,4 @@ using System.Runtime.InteropServices;
|
||||
// 方法是按如下所示使用“*”:
|
||||
//[assembly: AssemblyVersion("1.0.*")]
|
||||
//[assembly: AssemblyVersion("1.0.0")]
|
||||
[assembly: AssemblyFileVersion("4.22")]
|
||||
[assembly: AssemblyFileVersion("4.24")]
|
||||
|
||||
@@ -47,8 +47,9 @@ namespace v2rayN
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -69,8 +70,9 @@ namespace v2rayN
|
||||
result = reader.ReadToEnd();
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -108,8 +110,9 @@ namespace v2rayN
|
||||
Formatting.Indented,
|
||||
new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -141,8 +144,9 @@ namespace v2rayN
|
||||
}
|
||||
result = 0;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
result = -1;
|
||||
}
|
||||
return result;
|
||||
@@ -155,8 +159,10 @@ namespace v2rayN
|
||||
JObject obj = JObject.Parse(strJson);
|
||||
return obj;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -182,8 +188,9 @@ namespace v2rayN
|
||||
return string.Join(",", lst.ToArray());
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -199,8 +206,9 @@ namespace v2rayN
|
||||
str = str.Replace(Environment.NewLine, "");
|
||||
return new List<string>(str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return new List<string>();
|
||||
}
|
||||
}
|
||||
@@ -265,8 +273,9 @@ namespace v2rayN
|
||||
{
|
||||
return Convert.ToInt32(obj);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -277,8 +286,9 @@ namespace v2rayN
|
||||
{
|
||||
return (obj == null ? string.Empty : obj.ToString());
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -395,8 +405,9 @@ namespace v2rayN
|
||||
int var1 = ToInt(oText);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -538,8 +549,9 @@ namespace v2rayN
|
||||
string exePath = GetExePath();
|
||||
RegWriteValue(autoRunRegPath, autoRunName, run ? $"\"{exePath}\"" : "");
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -558,8 +570,9 @@ namespace v2rayN
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -608,8 +621,9 @@ namespace v2rayN
|
||||
return value;
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -633,8 +647,9 @@ namespace v2rayN
|
||||
regKey?.SetValue(name, value);
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -674,8 +689,9 @@ namespace v2rayN
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return -1;
|
||||
}
|
||||
return roundtripTime;
|
||||
@@ -697,8 +713,9 @@ namespace v2rayN
|
||||
lstIPAddress.Add(ipa.ToString());
|
||||
}
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return lstIPAddress;
|
||||
}
|
||||
@@ -729,8 +746,9 @@ namespace v2rayN
|
||||
FileVersionInfo.GetVersionInfo(location).FileVersion.ToString(),
|
||||
File.GetLastWriteTime(location).ToString("yyyy/MM/dd"));
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
@@ -773,8 +791,9 @@ namespace v2rayN
|
||||
}
|
||||
return strData;
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return strData;
|
||||
}
|
||||
@@ -804,8 +823,9 @@ namespace v2rayN
|
||||
{
|
||||
return Guid.NewGuid().ToString("D");
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
@@ -823,8 +843,9 @@ namespace v2rayN
|
||||
//WindowsBuiltInRole可以枚举出很多权限,例如系统用户、User、Guest等等
|
||||
return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
|
||||
}
|
||||
catch
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -963,7 +984,10 @@ namespace v2rayN
|
||||
}
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
catch (Exception ex)
|
||||
{
|
||||
SaveLog(ex.Message, ex);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user