mirror of
https://github.com/2dust/v2rayN.git
synced 2025-05-03 13:48:52 +00:00
fix bugs
This commit is contained in:
parent
35f6cd3d9c
commit
09702b9bde
4 changed files with 37 additions and 77 deletions
|
@ -273,7 +273,7 @@ namespace v2rayN.Forms
|
|||
/// </summary>
|
||||
private void RefreshServersView()
|
||||
{
|
||||
int index = lvServers.SelectedIndices.Count > 0 ? lvServers.SelectedIndices[0] : -1;
|
||||
int index = GetLvSelectedIndex(false);
|
||||
|
||||
lvServers.BeginUpdate();
|
||||
lvServers.Items.Clear();
|
||||
|
@ -281,29 +281,12 @@ namespace v2rayN.Forms
|
|||
for (int k = 0; k < lstVmess.Count; k++)
|
||||
{
|
||||
string def = string.Empty;
|
||||
string totalUp = string.Empty,
|
||||
totalDown = string.Empty,
|
||||
todayUp = string.Empty,
|
||||
todayDown = string.Empty;
|
||||
|
||||
VmessItem item = lstVmess[k];
|
||||
if (config.IsActiveNode(item))
|
||||
{
|
||||
def = "√";
|
||||
}
|
||||
|
||||
bool stats = statistics != null && statistics.Enable;
|
||||
if (stats)
|
||||
{
|
||||
ServerStatItem sItem = statistics.Statistic.Find(item_ => item_.itemId == item.indexId);
|
||||
if (sItem != null)
|
||||
{
|
||||
totalUp = Utils.HumanFy(sItem.totalUp);
|
||||
totalDown = Utils.HumanFy(sItem.totalDown);
|
||||
todayUp = Utils.HumanFy(sItem.todayUp);
|
||||
todayDown = Utils.HumanFy(sItem.todayDown);
|
||||
}
|
||||
}
|
||||
ListViewItem lvItem = new ListViewItem(def);
|
||||
Utils.AddSubItem(lvItem, EServerColName.configType.ToString(), (item.configType).ToString());
|
||||
Utils.AddSubItem(lvItem, EServerColName.remarks.ToString(), item.remarks);
|
||||
|
@ -314,8 +297,22 @@ namespace v2rayN.Forms
|
|||
Utils.AddSubItem(lvItem, EServerColName.streamSecurity.ToString(), item.streamSecurity);
|
||||
Utils.AddSubItem(lvItem, EServerColName.subRemarks.ToString(), item.GetSubRemarks(config));
|
||||
Utils.AddSubItem(lvItem, EServerColName.testResult.ToString(), item.testResult);
|
||||
if (stats)
|
||||
|
||||
if (statistics != null && statistics.Enable)
|
||||
{
|
||||
string totalUp = string.Empty,
|
||||
totalDown = string.Empty,
|
||||
todayUp = string.Empty,
|
||||
todayDown = string.Empty;
|
||||
ServerStatItem sItem = statistics.Statistic.Find(item_ => item_.itemId == item.indexId);
|
||||
if (sItem != null)
|
||||
{
|
||||
totalUp = Utils.HumanFy(sItem.totalUp);
|
||||
totalDown = Utils.HumanFy(sItem.totalDown);
|
||||
todayUp = Utils.HumanFy(sItem.todayUp);
|
||||
todayDown = Utils.HumanFy(sItem.todayDown);
|
||||
}
|
||||
|
||||
Utils.AddSubItem(lvItem, EServerColName.todayDown.ToString(), todayDown);
|
||||
Utils.AddSubItem(lvItem, EServerColName.todayUp.ToString(), todayUp);
|
||||
Utils.AddSubItem(lvItem, EServerColName.totalDown.ToString(), totalDown);
|
||||
|
@ -417,22 +414,6 @@ namespace v2rayN.Forms
|
|||
|
||||
private void lvServers_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
int index = -1;
|
||||
try
|
||||
{
|
||||
if (lvServers.SelectedIndices.Count > 0)
|
||||
{
|
||||
index = lvServers.SelectedIndices[0];
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
//qrCodeControl.showQRCode(index, config);
|
||||
}
|
||||
|
||||
private void ssMain_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
|
||||
|
@ -603,17 +584,7 @@ namespace v2rayN.Forms
|
|||
|
||||
private void lvServers_Click(object sender, EventArgs e)
|
||||
{
|
||||
int index = -1;
|
||||
try
|
||||
{
|
||||
if (lvServers.SelectedIndices.Count > 0)
|
||||
{
|
||||
index = lvServers.SelectedIndices[0];
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
int index = GetLvSelectedIndex(false);
|
||||
if (index < 0)
|
||||
{
|
||||
return;
|
||||
|
@ -966,15 +937,18 @@ namespace v2rayN.Forms
|
|||
/// 取得ListView选中的行
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private int GetLvSelectedIndex()
|
||||
private int GetLvSelectedIndex(bool show = true)
|
||||
{
|
||||
int index = -1;
|
||||
lstSelecteds.Clear();
|
||||
try
|
||||
{
|
||||
if (lvServers.SelectedIndices.Count <= 0)
|
||||
{
|
||||
if (show)
|
||||
{
|
||||
UI.Show(ResUI.PleaseSelectServer);
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
|
@ -1190,11 +1164,13 @@ namespace v2rayN.Forms
|
|||
this.ShowInTaskbar = true;
|
||||
//this.notifyIcon1.Visible = false;
|
||||
this.txtMsgBox.ScrollToCaret();
|
||||
//if (config.index >= 0 && config.index < lvServers.Items.Count)
|
||||
//{
|
||||
// lvServers.Items[config.index].Selected = true;
|
||||
// lvServers.EnsureVisible(config.index); // workaround
|
||||
//}
|
||||
|
||||
int index = GetLvSelectedIndex(false);
|
||||
if (index >= 0 && index < lvServers.Items.Count && lvServers.Items.Count > 0)
|
||||
{
|
||||
lvServers.Items[index].Selected = true;
|
||||
lvServers.EnsureVisible(index); // workaround
|
||||
}
|
||||
|
||||
SetVisibleCore(true);
|
||||
}
|
||||
|
@ -1273,26 +1249,6 @@ namespace v2rayN.Forms
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
for (int i = 0; i < lstVmess.Count; i++)
|
||||
{
|
||||
int index = statistics.FindIndex(item_ => item_.itemId == lstVmess[i].indexId);
|
||||
if (index != -1)
|
||||
{
|
||||
lvServers.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
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.EndUpdate();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@ namespace v2rayN.Handler
|
|||
class ConfigHandler
|
||||
{
|
||||
private static string configRes = Global.ConfigFileName;
|
||||
private static object objLock = new object();
|
||||
private static readonly object objLock = new object();
|
||||
|
||||
#region ConfigHandler
|
||||
|
||||
|
|
|
@ -109,6 +109,10 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else
|
||||
{
|
||||
if (coreInfo == null || coreInfo.coreExes == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
foreach (string vName in coreInfo.coreExes)
|
||||
{
|
||||
Process[] existing = Process.GetProcessesByName(vName);
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace v2rayN.Tool
|
|||
memory.ActivateOptions();
|
||||
hierarchy.Root.AddAppender(memory);
|
||||
|
||||
hierarchy.Root.Level = Level.Info;
|
||||
hierarchy.Root.Level = Level.Debug;
|
||||
hierarchy.Configured = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue