mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-12 19:28:07 +00:00
Refactor stat update
This commit is contained in:
parent
35deb0c915
commit
0801c3db64
3 changed files with 35 additions and 3 deletions
|
@ -150,12 +150,17 @@ namespace v2rayN.Forms
|
||||||
{
|
{
|
||||||
scMain.Panel2Collapsed = true;
|
scMain.Panel2Collapsed = true;
|
||||||
|
|
||||||
|
if (!config.uiItem.mainLocation.IsEmpty)
|
||||||
|
{
|
||||||
|
this.Location = config.uiItem.mainLocation;
|
||||||
|
}
|
||||||
if (!config.uiItem.mainSize.IsEmpty)
|
if (!config.uiItem.mainSize.IsEmpty)
|
||||||
{
|
{
|
||||||
this.Width = config.uiItem.mainSize.Width;
|
this.Width = config.uiItem.mainSize.Width;
|
||||||
this.Height = config.uiItem.mainSize.Height;
|
this.Height = config.uiItem.mainSize.Height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
for (int k = 0; k < lvServers.Columns.Count; k++)
|
for (int k = 0; k < lvServers.Columns.Count; k++)
|
||||||
{
|
{
|
||||||
var width = ConfigHandler.GetformMainLvColWidth(ref config, ((EServerColName)k).ToString(), lvServers.Columns[k].Width);
|
var width = ConfigHandler.GetformMainLvColWidth(ref config, ((EServerColName)k).ToString(), lvServers.Columns[k].Width);
|
||||||
|
@ -165,6 +170,8 @@ namespace v2rayN.Forms
|
||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
|
config.uiItem.mainLocation = this.Location;
|
||||||
|
|
||||||
config.uiItem.mainSize = new Size(this.Width, this.Height);
|
config.uiItem.mainSize = new Size(this.Width, this.Height);
|
||||||
|
|
||||||
for (int k = 0; k < lvServers.Columns.Count; k++)
|
for (int k = 0; k < lvServers.Columns.Count; k++)
|
||||||
|
@ -1253,7 +1260,28 @@ namespace v2rayN.Forms
|
||||||
down /= (ulong)(config.statisticsFreshRate / 1000f);
|
down /= (ulong)(config.statisticsFreshRate / 1000f);
|
||||||
toolSslServerSpeed.Text = string.Format("{0}/s↑ | {1}/s↓", Utils.HumanFy(up), Utils.HumanFy(down));
|
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++)
|
for (int i = 0; i < lstVmess.Count; i++)
|
||||||
{
|
{
|
||||||
int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId);
|
int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId);
|
||||||
|
|
|
@ -1159,6 +1159,8 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
config.uiItem.mainLvColWidth.Add(name, width);
|
config.uiItem.mainLvColWidth.Add(name, width);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ToJsonFile(config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
public static int GetformMainLvColWidth(ref Config config, string name, int width)
|
public static int GetformMainLvColWidth(ref Config config, string name, int width)
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
using v2rayN.Base;
|
using v2rayN.Base;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Drawing;
|
||||||
|
|
||||||
namespace v2rayN.Mode
|
namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
|
@ -692,7 +692,9 @@ namespace v2rayN.Mode
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public System.Drawing.Size mainSize
|
public Point mainLocation { get; set; }
|
||||||
|
|
||||||
|
public Size mainSize
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue