mirror of https://github.com/2dust/v2rayN
Refactor stat update
parent
35deb0c915
commit
0801c3db64
|
@ -150,12 +150,17 @@ namespace v2rayN.Forms
|
|||
{
|
||||
scMain.Panel2Collapsed = true;
|
||||
|
||||
if (!config.uiItem.mainLocation.IsEmpty)
|
||||
{
|
||||
this.Location = config.uiItem.mainLocation;
|
||||
}
|
||||
if (!config.uiItem.mainSize.IsEmpty)
|
||||
{
|
||||
this.Width = config.uiItem.mainSize.Width;
|
||||
this.Height = config.uiItem.mainSize.Height;
|
||||
}
|
||||
|
||||
|
||||
for (int k = 0; k < lvServers.Columns.Count; k++)
|
||||
{
|
||||
var width = ConfigHandler.GetformMainLvColWidth(ref config, ((EServerColName)k).ToString(), lvServers.Columns[k].Width);
|
||||
|
@ -165,6 +170,8 @@ namespace v2rayN.Forms
|
|||
|
||||
private void StorageUI()
|
||||
{
|
||||
config.uiItem.mainLocation = this.Location;
|
||||
|
||||
config.uiItem.mainSize = new Size(this.Width, this.Height);
|
||||
|
||||
for (int k = 0; k < lvServers.Columns.Count; k++)
|
||||
|
@ -1253,7 +1260,28 @@ namespace v2rayN.Forms
|
|||
down /= (ulong)(config.statisticsFreshRate / 1000f);
|
||||
toolSslServerSpeed.Text = string.Format("{0}/s↑ | {1}/s↓", Utils.HumanFy(up), Utils.HumanFy(down));
|
||||
|
||||
List<string[]> datas = new List<string[]>();
|
||||
foreach (var it in statistics)
|
||||
{
|
||||
int index = lstVmess.FindIndex(item => item.indexId == it.itemId);
|
||||
if (index < 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
lvServers.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
lvServers.BeginUpdate();
|
||||
|
||||
lvServers.Items[index].SubItems["todayDown"].Text = Utils.HumanFy(it.todayDown);
|
||||
lvServers.Items[index].SubItems["todayUp"].Text = Utils.HumanFy(it.todayUp);
|
||||
lvServers.Items[index].SubItems["totalDown"].Text = Utils.HumanFy(it.totalDown);
|
||||
lvServers.Items[index].SubItems["totalUp"].Text = Utils.HumanFy(it.totalUp);
|
||||
|
||||
lvServers.EndUpdate();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < lstVmess.Count; i++)
|
||||
{
|
||||
int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId);
|
||||
|
|
|
@ -1159,6 +1159,8 @@ namespace v2rayN.Handler
|
|||
{
|
||||
config.uiItem.mainLvColWidth.Add(name, width);
|
||||
}
|
||||
|
||||
ToJsonFile(config);
|
||||
return 0;
|
||||
}
|
||||
public static int GetformMainLvColWidth(ref Config config, string name, int width)
|
||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
|||
using System.Windows.Forms;
|
||||
using v2rayN.Base;
|
||||
using System.Linq;
|
||||
|
||||
using System.Drawing;
|
||||
|
||||
namespace v2rayN.Mode
|
||||
{
|
||||
|
@ -692,7 +692,9 @@ namespace v2rayN.Mode
|
|||
get; set;
|
||||
}
|
||||
|
||||
public System.Drawing.Size mainSize
|
||||
public Point mainLocation { get; set; }
|
||||
|
||||
public Size mainSize
|
||||
{
|
||||
get; set;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue