diff --git a/v2rayN/v2rayN/Base/ListViewFlickerFree.cs b/v2rayN/v2rayN/Base/ListViewFlickerFree.cs
index 6785959b..a113a7bc 100644
--- a/v2rayN/v2rayN/Base/ListViewFlickerFree.cs
+++ b/v2rayN/v2rayN/Base/ListViewFlickerFree.cs
@@ -18,37 +18,31 @@ namespace v2rayN.Base
{
try
{
- int count = this.Columns.Count;
- int MaxWidth = 0;
+ this.SuspendLayout();
Graphics graphics = this.CreateGraphics();
- Font font = this.Font;
- ListViewItemCollection items = this.Items;
-
- string str;
- int width;
+ // 原生 ColumnHeaderAutoResizeStyle.ColumnContent 将忽略列头宽度
this.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize);
- for (int i = 0; i < count; i++)
+ for (int i = 0; i < this.Columns.Count; i++)
{
- str = this.Columns[i].Text;
- MaxWidth = this.Columns[i].Width;
+ ColumnHeader c = this.Columns[i];
+ int cWidth = c.Width;
+ string MaxStr = "";
+ Font font = this.Items[0].SubItems[0].Font;
- foreach (ListViewItem item in items)
+ foreach (ListViewItem item in this.Items)
{
- str = item.SubItems[i].Text;
- width = (int)graphics.MeasureString(str, font).Width;
- if (width > MaxWidth)
- {
- MaxWidth = width;
- }
+ // 整行视作相同字形,不单独计算每个单元格
+ font = item.SubItems[i].Font;
+ string str = item.SubItems[i].Text;
+ if (str.Length > MaxStr.Length) // 未考虑非等宽问题
+ MaxStr = str;
}
- if (i == 0)
- {
- this.Columns[i].Width = MaxWidth;
- }
- this.Columns[i].Width = MaxWidth;
+ int strWidth = (int)graphics.MeasureString(MaxStr, font).Width;
+ c.Width = System.Math.Max(cWidth, strWidth);
}
+ this.ResumeLayout();
}
catch { }
}
diff --git a/v2rayN/v2rayN/Forms/MainForm.Designer.cs b/v2rayN/v2rayN/Forms/MainForm.Designer.cs
index 1b0bacb5..21a65886 100644
--- a/v2rayN/v2rayN/Forms/MainForm.Designer.cs
+++ b/v2rayN/v2rayN/Forms/MainForm.Designer.cs
@@ -61,8 +61,8 @@
this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem();
this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem();
- this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton();
+ this.qrCodeControl = new v2rayN.Forms.QRCodeControl();
this.notifyMain = new System.Windows.Forms.NotifyIcon(this.components);
this.cmsMain = new System.Windows.Forms.ContextMenuStrip(this.components);
this.menuSysAgentMode = new System.Windows.Forms.ToolStripMenuItem();
@@ -102,6 +102,7 @@
this.tsbSub = new System.Windows.Forms.ToolStripDropDownButton();
this.tsbSubSetting = new System.Windows.Forms.ToolStripMenuItem();
this.tsbSubUpdate = new System.Windows.Forms.ToolStripMenuItem();
+ this.tsbQRCodeSwitch = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator8 = new System.Windows.Forms.ToolStripSeparator();
this.tsbOptionSetting = new System.Windows.Forms.ToolStripButton();
this.toolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
@@ -148,6 +149,7 @@
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.qrCodeControl);
+ this.splitContainer1.TabStop = false;
this.splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(this.splitContainer1_SplitterMoved);
//
// lvServers
@@ -369,11 +371,6 @@
resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent");
this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click);
//
- // qrCodeControl
- //
- resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
- this.qrCodeControl.Name = "qrCodeControl";
- //
// tsbServer
//
this.tsbServer.DropDown = this.cmsLv;
@@ -381,6 +378,11 @@
resources.ApplyResources(this.tsbServer, "tsbServer");
this.tsbServer.Name = "tsbServer";
//
+ // qrCodeControl
+ //
+ resources.ApplyResources(this.qrCodeControl, "qrCodeControl");
+ this.qrCodeControl.Name = "qrCodeControl";
+ //
// notifyMain
//
this.notifyMain.ContextMenuStrip = this.cmsMain;
@@ -619,6 +621,7 @@
this.tsbServer,
this.toolStripSeparator4,
this.tsbSub,
+ this.tsbQRCodeSwitch,
this.toolStripSeparator8,
this.tsbOptionSetting,
this.toolStripSeparator5,
@@ -632,6 +635,7 @@
this.tsbClose});
resources.ApplyResources(this.tsMain, "tsMain");
this.tsMain.Name = "tsMain";
+ this.tsMain.TabStop = true;
//
// toolStripSeparator4
//
@@ -659,6 +663,15 @@
resources.ApplyResources(this.tsbSubUpdate, "tsbSubUpdate");
this.tsbSubUpdate.Click += new System.EventHandler(this.tsbSubUpdate_Click);
//
+ // tsbQRCodeSwitch
+ //
+ this.tsbQRCodeSwitch.CheckOnClick = true;
+ this.tsbQRCodeSwitch.ForeColor = System.Drawing.Color.Black;
+ this.tsbQRCodeSwitch.Image = global::v2rayN.Properties.Resources.qr_code;
+ resources.ApplyResources(this.tsbQRCodeSwitch, "tsbQRCodeSwitch");
+ this.tsbQRCodeSwitch.Name = "tsbQRCodeSwitch";
+ this.tsbQRCodeSwitch.CheckedChanged += new System.EventHandler(this.tsbQRCodeSwitch_CheckedChanged);
+ //
// toolStripSeparator8
//
this.toolStripSeparator8.Name = "toolStripSeparator8";
@@ -922,6 +935,7 @@
private System.Windows.Forms.ToolStripMenuItem menuKeepPACNothing;
private System.Windows.Forms.ToolStripMenuItem tsbTestMe;
private System.Windows.Forms.ToolStripButton tsbReload;
+ private System.Windows.Forms.ToolStripButton tsbQRCodeSwitch;
}
}
diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs
index d8375be7..371e836b 100644
--- a/v2rayN/v2rayN/Forms/MainForm.cs
+++ b/v2rayN/v2rayN/Forms/MainForm.cs
@@ -46,10 +46,20 @@ namespace v2rayN.Forms
private void MainForm_Load(object sender, EventArgs e)
{
+ splitContainer1.Panel2Collapsed = true;
+
ConfigHandler.LoadConfig(ref config);
v2rayHandler = new V2rayHandler();
v2rayHandler.ProcessEvent += v2rayHandler_ProcessEvent;
+ if(!config.formMainSize.IsEmpty) {
+ this.Left = config.formMainSize.X;
+ this.Top = config.formMainSize.Y;
+ this.Width = config.formMainSize.Width;
+ this.Height = config.formMainSize.Height;
+ }
+ this.WindowState = config.windowState;
+
if (config.enableStatistics)
{
statistics = new StatisticsHandler(config, UpdateStatisticsHandler);
@@ -73,7 +83,6 @@ namespace v2rayN.Forms
{
InitServersView();
RefreshServers();
- lvServers.AutoResizeColumns();
LoadV2ray();
@@ -85,6 +94,10 @@ namespace v2rayN.Forms
{
if (e.CloseReason == CloseReason.UserClosing)
{
+ if (this.WindowState != FormWindowState.Maximized)
+ config.formMainSize = new Rectangle(this.Left, this.Top, this.Width, this.Height);
+ config.windowState = this.WindowState;
+
e.Cancel = true;
HideForm();
return;
@@ -136,6 +149,7 @@ namespace v2rayN.Forms
private void RefreshServers()
{
RefreshServersView();
+ lvServers.AutoResizeColumns();
RefreshServersMenu();
}
@@ -144,6 +158,7 @@ namespace v2rayN.Forms
///
private void InitServersView()
{
+ lvServers.BeginUpdate();
lvServers.Items.Clear();
lvServers.GridLines = true;
@@ -170,6 +185,7 @@ namespace v2rayN.Forms
lvServers.Columns.Add(UIRes.I18N("LvTotalDownloadDataAmount"), 70, HorizontalAlignment.Left);
lvServers.Columns.Add(UIRes.I18N("LvTotalUploadDataAmount"), 70, HorizontalAlignment.Left);
}
+ lvServers.EndUpdate();
}
///
@@ -177,6 +193,7 @@ namespace v2rayN.Forms
///
private void RefreshServersView()
{
+ lvServers.BeginUpdate();
lvServers.Items.Clear();
for (int k = 0; k < config.vmess.Count; k++)
@@ -241,6 +258,8 @@ namespace v2rayN.Forms
if (lvItem != null) lvServers.Items.Add(lvItem);
}
+ lvServers.EnsureVisible(config.index);
+ lvServers.EndUpdate();
//if (lvServers.Items.Count > 0)
//{
@@ -970,7 +989,6 @@ namespace v2rayN.Forms
private void menuExit_Click(object sender, EventArgs e)
{
-
this.Visible = false;
this.Close();
@@ -980,12 +998,13 @@ namespace v2rayN.Forms
private void ShowForm()
{
+ this.ShowInTaskbar = true;
+ //this.WindowState = config.windowState;
this.Show();
- this.WindowState = FormWindowState.Normal;
this.Activate();
//this.notifyIcon1.Visible = false;
- this.ShowInTaskbar = true;
this.txtMsgBox.ScrollToCaret();
+ lvServers.EnsureVisible(config.index); // workaround
SetVisibleCore(true);
}
@@ -1024,11 +1043,7 @@ namespace v2rayN.Forms
{
lvServers.Invoke((MethodInvoker)delegate
{
- lvServers.SuspendLayout();
-
SetTestResult(index, msg);
-
- lvServers.ResumeLayout();
});
}
@@ -1048,14 +1063,14 @@ namespace v2rayN.Forms
{
lvServers.Invoke((MethodInvoker)delegate
{
- lvServers.SuspendLayout();
+ lvServers.BeginUpdate();
lvServers.Items[i].SubItems["todayDown"].Text = Utils.HumanFy(statistics[index].todayDown);
lvServers.Items[i].SubItems["todayUp"].Text = Utils.HumanFy(statistics[index].todayUp);
lvServers.Items[i].SubItems["totalDown"].Text = Utils.HumanFy(statistics[index].totalDown);
lvServers.Items[i].SubItems["totalUp"].Text = Utils.HumanFy(statistics[index].totalUp);
- lvServers.ResumeLayout();
+ lvServers.EndUpdate();
});
}
}
@@ -1209,7 +1224,7 @@ namespace v2rayN.Forms
{
if (args.Success)
{
- AppendText(false, UIRes.I18N("MsgParsingV2rayCoreSuccessfully"));
+ AppendText(false, string.Format(UIRes.I18N("MsgParsingSuccessfully"), "v2rayN"));
string url = args.Msg;
this.Invoke((MethodInvoker)(delegate
@@ -1267,7 +1282,7 @@ namespace v2rayN.Forms
{
if (args.Success)
{
- AppendText(false, UIRes.I18N("MsgParsingV2rayCoreSuccessfully"));
+ AppendText(false, string.Format(UIRes.I18N("MsgParsingSuccessfully"), "v2rayCore"));
string url = args.Msg;
this.Invoke((MethodInvoker)(delegate
@@ -1532,5 +1547,11 @@ namespace v2rayN.Forms
SpeedtestHandler statistics = new SpeedtestHandler(ref config, ref v2rayHandler, lvSelecteds, "", UpdateSpeedtestHandler);
return statistics.RunAvailabilityCheck();
}
+
+ private void tsbQRCodeSwitch_CheckedChanged(object sender, EventArgs e)
+ {
+ bool bShow = tsbQRCodeSwitch.Checked;
+ splitContainer1.Panel2Collapsed = !bShow;
+ }
}
}
diff --git a/v2rayN/v2rayN/Forms/MainForm.resx b/v2rayN/v2rayN/Forms/MainForm.resx
index c7d5562d..ed31de23 100644
--- a/v2rayN/v2rayN/Forms/MainForm.resx
+++ b/v2rayN/v2rayN/Forms/MainForm.resx
@@ -297,7 +297,7 @@
ImageAboveText
- 356, 578
+ 356, 556
cmsLv
@@ -333,7 +333,7 @@
- 1
+ 0
lvServers
@@ -369,7 +369,7 @@
256, 331
- 0
+ 2
qrCodeControl
@@ -405,7 +405,7 @@
686
- 2
+ 0
splitContainer1
@@ -543,7 +543,7 @@
952, 351
- 2
+ 0
Servers list
@@ -579,7 +579,7 @@
946, 134
- 2
+ 3
txtMsgBox
@@ -678,7 +678,7 @@
946, 22
- 7
+ 0
statusStrip1
@@ -705,7 +705,7 @@
952, 176
- 4
+ 3
Informations
@@ -732,7 +732,7 @@
952, 10
- 5
+ 2
panel1
@@ -753,13 +753,13 @@
6, 56
- 180, 22
+ 125, 22
Settings
- 180, 22
+ 125, 22
Updates
@@ -776,6 +776,21 @@
ImageAboveText
+
+ Magenta
+
+
+ 65, 53
+
+
+ QR Code
+
+
+ BottomCenter
+
+
+ ImageAboveText
+
6, 56
@@ -945,7 +960,7 @@
952, 56
- 6
+ 1
tsMain
@@ -1343,6 +1358,12 @@
System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ tsbQRCodeSwitch
+
+
+ System.Windows.Forms.ToolStripButton, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
toolStripSeparator8
diff --git a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx
index 40c9e458..21164412 100644
--- a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx
+++ b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx
@@ -431,13 +431,13 @@
- iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAE3SURBVFhH7ZaBDQIhDEVvBEdwBDfQDXQER3AD3cARdAPd
- QDfSDbQvuSb1AicFjJrwkxcN0FIolOuamv5VE2E+gLaPayWchEcE+hhTXVPhIoQmDcFYbKpoJtwEdX4X
- jgIrXfTwnzb6dBw22BaJVdjJmWQs1/SdBRtE0U5cBXW2oSFRO0HtSEeW2FZ1wsq9sjuRdTDVAXnNuWLY
- 6JnAl0sYa/Q5q1dhq35ci+Bkq2HJvbZpxGeybAAuw4Fq+cnW1wPITgHFYxvBUw+qHEIL1yq1vDKhVlH3
- NQwF4JkcFRWiUAB7IVW2FFPO3YqlgPd+LJf02e8Fdi3rMdIAcLDuf9UpeT0IS0G/hvhPm305vSl7EQFY
- B6zCvozvYGzRM8zEoeg5TPZwDaGvpHQni1yzSxbXPW9q+hF13ROHuJnQcjbhtQAAAABJRU5ErkJggg==
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wwAADsMBx2+oZAAAATdJREFUWEftloENAiEMRW8ER3AEN9ANdARHcAPdwBF0A91AN9INtC+5JvUCJwWM
+ mvCTFw3QUiiU65qa/lUTYT6Ato9rJZyERwT6GFNdU+EihCYNwVhsqmgm3AR1fheOAitd9PCfNvp0HDbY
+ FolV2MmZZCzX9J0FG0TRTlwFdbahIVE7Qe1IR5bYVnXCyr2yO5F1MNUBec25YtjomcCXSxhr9DmrV2Gr
+ flyL4GSrYcm9tmnEZ7JsAC7DgWr5ydbXA8hOAcVjG8FTD6ocQgvXKrW8MqFWUfc1DAXgmRwVFaJQAHsh
+ VbYUU87diqWA934sl/TZ7wV2Lesx0gBwsO5/1Sl5PQhLQb+G+E+bfTm9KXsRAVgHrMK+jO9gbNEzzMSh
+ 6DlM9nANoa+kdCeLXLNLFtc9b2r6EXXdE4e4mdByNuG1AAAAAElFTkSuQmCC
@@ -499,9 +499,9 @@
- iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
- YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAySURBVFhH7c6xDQAgCEVBRnVTHU2ZABuMxV3yOvJDAAA/
- GqfZVG6X8mg1dfUAAPBQxAZd0SJruVXHWwAAAABJRU5ErkJggg==
+ iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
+ wwAADsMBx2+oZAAAADJJREFUWEftzrENACAIRUFGdVMdTZkAG4zFXfI68kMAAD8ap9lUbpfyaDV19QAA
+ 8FDEBl3RImu5VcdbAAAAAElFTkSuQmCC
@@ -510,4 +510,7 @@
关闭窗口
+
+ 分享
+
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs b/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs
index 5d0a2624..ca405968 100644
--- a/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs
+++ b/v2rayN/v2rayN/Forms/QRCodeControl.Designer.cs
@@ -31,7 +31,6 @@
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(QRCodeControl));
this.txtUrl = new System.Windows.Forms.TextBox();
this.picQRCode = new System.Windows.Forms.PictureBox();
- this.chkShow = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.picQRCode)).BeginInit();
this.SuspendLayout();
//
@@ -47,20 +46,12 @@
this.picQRCode.Name = "picQRCode";
this.picQRCode.TabStop = false;
//
- // chkShow
- //
- resources.ApplyResources(this.chkShow, "chkShow");
- this.chkShow.Name = "chkShow";
- this.chkShow.UseVisualStyleBackColor = true;
- this.chkShow.CheckedChanged += new System.EventHandler(this.chkShow_CheckedChanged);
- //
// QRCodeControl
//
resources.ApplyResources(this, "$this");
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.picQRCode);
this.Controls.Add(this.txtUrl);
- this.Controls.Add(this.chkShow);
this.Name = "QRCodeControl";
this.Load += new System.EventHandler(this.QRCodeControl_Load);
((System.ComponentModel.ISupportInitialize)(this.picQRCode)).EndInit();
@@ -73,6 +64,5 @@
private System.Windows.Forms.TextBox txtUrl;
private System.Windows.Forms.PictureBox picQRCode;
- private System.Windows.Forms.CheckBox chkShow;
}
}
diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.cs b/v2rayN/v2rayN/Forms/QRCodeControl.cs
index 3b2bd3bd..02d59b48 100644
--- a/v2rayN/v2rayN/Forms/QRCodeControl.cs
+++ b/v2rayN/v2rayN/Forms/QRCodeControl.cs
@@ -12,7 +12,6 @@ namespace v2rayN.Forms
}
private void QRCodeControl_Load(object sender, System.EventArgs e)
{
- chkShow_CheckedChanged(null, null);
txtUrl.MouseUp += txtUrl_MouseUp;
}
@@ -36,12 +35,5 @@ namespace v2rayN.Forms
picQRCode.Image = QRCodeHelper.GetQRCode(url);
}
}
-
- private void chkShow_CheckedChanged(object sender, System.EventArgs e)
- {
- picQRCode.Visible =
- txtUrl.Visible = chkShow.Checked;
- }
-
}
}
diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.resx b/v2rayN/v2rayN/Forms/QRCodeControl.resx
index d4e9e4a4..a6ceff05 100644
--- a/v2rayN/v2rayN/Forms/QRCodeControl.resx
+++ b/v2rayN/v2rayN/Forms/QRCodeControl.resx
@@ -117,60 +117,15 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
-
- 6, 12
-
-
- True
-
-
- QRCodeControl
-
-
- 356, 441
-
-
- True
-
-
- Top
-
-
- 0, 0
-
-
- 356, 16
-
-
- 25
-
-
- Sharing panel
-
-
- Fill
-
-
- 0, 16
-
-
- 356, 355
-
-
- Zoom
-
-
- 24
-
Bottom
+
0, 371
+
True
@@ -180,4 +135,58 @@
0
+
+ txtUrl
+
+
+ System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 1
+
+
+ Fill
+
+
+ 0, 0
+
+
+ 356, 371
+
+
+ Zoom
+
+
+ 24
+
+
+ picQRCode
+
+
+ System.Windows.Forms.PictureBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
+
+
+ True
+
+
+ 6, 12
+
+
+ 356, 441
+
+
+ QRCodeControl
+
+
+ System.Windows.Forms.UserControl, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx b/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx
index 991ed0d0..1af7de15 100644
--- a/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx
+++ b/v2rayN/v2rayN/Forms/QRCodeControl.zh-Hans.resx
@@ -117,7 +117,4 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
- 显示分享内容
-
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Handler/DownloadHandle.cs b/v2rayN/v2rayN/Handler/DownloadHandle.cs
index 19630bf7..b4958bfe 100644
--- a/v2rayN/v2rayN/Handler/DownloadHandle.cs
+++ b/v2rayN/v2rayN/Handler/DownloadHandle.cs
@@ -235,27 +235,12 @@ namespace v2rayN.Handler
{
if (UpdateCompleted != null)
{
- if (e.Cancelled)
- {
- ((WebClientEx)sender).Dispose();
- TimeSpan ts = (DateTime.Now - totalDatetime);
- string speed = string.Format("<{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
- UpdateCompleted(this, new ResultEventArgs(true, speed));
- return;
- }
+ if (e.Error != null) throw e.Error;
- if (e.Error == null
- || Utils.IsNullOrEmpty(e.Error.ToString()))
- {
-
- TimeSpan ts = (DateTime.Now - totalDatetime);
- string speed = string.Format("{0} M/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
- UpdateCompleted(this, new ResultEventArgs(true, speed));
- }
- else
- {
- throw e.Error;
- }
+ ((WebClientEx)sender).Dispose();
+ TimeSpan ts = (DateTime.Now - totalDatetime);
+ string speed = string.Format("<{0} MB/s", (totalBytesToReceive / ts.TotalMilliseconds / 1000).ToString("#0.##"));
+ UpdateCompleted(this, new ResultEventArgs(true, speed));
}
}
catch (Exception ex)
diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs
index 24baa514..32556e05 100644
--- a/v2rayN/v2rayN/Mode/Config.cs
+++ b/v2rayN/v2rayN/Mode/Config.cs
@@ -36,6 +36,17 @@ namespace v2rayN.Mode
get; set;
}
+ ///
+ /// 主窗口的大小和位置
+ ///
+ public System.Drawing.Rectangle formMainSize
+ {
+ get; set;
+ }
+ public System.Windows.Forms.FormWindowState windowState
+ {
+ get; set;
+ }
///
/// 活动配置序号
///
diff --git a/v2rayN/v2rayN/Properties/Resources.Designer.cs b/v2rayN/v2rayN/Properties/Resources.Designer.cs
index fb420525..3a699ebb 100644
--- a/v2rayN/v2rayN/Properties/Resources.Designer.cs
+++ b/v2rayN/v2rayN/Properties/Resources.Designer.cs
@@ -177,6 +177,16 @@ namespace v2rayN.Properties {
}
}
+ ///
+ /// 查找 System.Drawing.Bitmap 类型的本地化资源。
+ ///
+ internal static System.Drawing.Bitmap qr_code {
+ get {
+ object obj = ResourceManager.GetObject("qr-code", resourceCulture);
+ return ((System.Drawing.Bitmap)(obj));
+ }
+ }
+
///
/// 查找 System.Drawing.Bitmap 类型的本地化资源。
///
diff --git a/v2rayN/v2rayN/Properties/Resources.resx b/v2rayN/v2rayN/Properties/Resources.resx
index 38dc1d7e..8078ee80 100644
--- a/v2rayN/v2rayN/Properties/Resources.resx
+++ b/v2rayN/v2rayN/Properties/Resources.resx
@@ -118,52 +118,55 @@
System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\resources\privoxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
..\Resources\about.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\abp.js.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\resources\checkupdate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\minimize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\Resources\notify.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\option.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\pac.txt.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\resources\privoxy_conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312
-
-
- ..\resources\privoxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- ..\resources\promotion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
..\Resources\restart.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
- ..\Resources\server.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\resources\sub.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
-
-
- ..\resources\sysproxy64.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
..\resources\sysproxy.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ ..\resources\sub.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\server.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\notify.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\resources\checkupdate.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\resources\promotion.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\resources\sysproxy64.exe.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\resources\privoxy_conf.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;gb2312
+
+
+ ..\Resources\minimize.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\pac.txt.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\resources\help.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
+
+ ..\Resources\abp.js.gz;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ..\Resources\qr-code.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a
+
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Resources/qr-code.png b/v2rayN/v2rayN/Resources/qr-code.png
new file mode 100644
index 00000000..f901bb69
Binary files /dev/null and b/v2rayN/v2rayN/Resources/qr-code.png differ
diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs
index b176221a..b5b956d6 100644
--- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs
+++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs
@@ -475,11 +475,11 @@ namespace v2rayN.Resx {
}
///
- /// 查找类似 Resolve V2ray successfully 的本地化字符串。
+ /// 查找类似 Resolve {0} successfully 的本地化字符串。
///
- internal static string MsgParsingV2rayCoreSuccessfully {
+ internal static string MsgParsingSuccessfully {
get {
- return ResourceManager.GetString("MsgParsingV2rayCoreSuccessfully", resourceCulture);
+ return ResourceManager.GetString("MsgParsingSuccessfully", resourceCulture);
}
}
diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx
index 87150298..50d37abe 100644
--- a/v2rayN/v2rayN/Resx/ResUI.resx
+++ b/v2rayN/v2rayN/Resx/ResUI.resx
@@ -255,8 +255,8 @@
PAC update succeeded
-
- Resolve V2ray successfully
+
+ Resolve {0} successfully
Simplify PAC Success
diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
index 6f2797d8..4b312497 100644
--- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
@@ -255,8 +255,8 @@
PAC更新成功
-
- 解析V2ray成功
+
+ 解析{0}成功
简化PAC成功
diff --git a/v2rayN/v2rayN/Tool/Utils.cs b/v2rayN/v2rayN/Tool/Utils.cs
index 64fe2775..09c023de 100644
--- a/v2rayN/v2rayN/Tool/Utils.cs
+++ b/v2rayN/v2rayN/Tool/Utils.cs
@@ -285,14 +285,14 @@ namespace v2rayN
if (GBs > 0)
{
// multi GB
- ulong TBs = GBs / factor;
+ /*ulong TBs = GBs / factor;
if (TBs > 0)
{
// 你是魔鬼吗? 用这么多流量
result = TBs + GBs % factor / (factor + 0.0);
unit = "TB";
return;
- }
+ }*/
result = GBs + MBs % factor / (factor + 0.0);
unit = "GB";
return;