Exemplo n.º 1
0
        private void lstDirectory_DoubleClick(object sender, EventArgs e)
        {
            if (_connectClient != null && _connectClient.Value != null && lstDirectory.SelectedItems.Count > 0)
            {
                PathType type = (PathType)lstDirectory.SelectedItems[0].Tag;

                switch (type)
                {
                case PathType.Back:
                    if (!_connectClient.Value.LastDirectorySeen)
                    {
                        return;
                    }

                    _currentDir = Path.GetFullPath(Path.Combine(_currentDir, @"..\"));
                    break;

                case PathType.Directory:
                    if (!_connectClient.Value.LastDirectorySeen)
                    {
                        return;
                    }

                    _currentDir = GetAbsolutePath(lstDirectory.SelectedItems[0].SubItems[0].Text);
                    break;
                }

                new Core.Packets.ServerPackets.GetDirectory(_currentDir).Execute(_connectClient);
                _connectClient.Value.LastDirectorySeen = false;
            }
        }
Exemplo n.º 2
0
        private void ctxtDownload_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem files in lstDirectory.SelectedItems)
            {
                PathType type = (PathType)files.Tag;

                if (type == PathType.File)
                {
                    string path = GetAbsolutePath(files.SubItems[0].Text);

                    int ID = new Random().Next(0, int.MaxValue) + files.Index;

                    if (_connectClient != null)
                    {
                        new Core.Packets.ServerPackets.DoDownloadFile(path, ID).Execute(_connectClient);

                        this.Invoke((MethodInvoker) delegate
                        {
                            ListViewItem lvi =
                                new ListViewItem(new string[] { ID.ToString(), "Downloading...", files.SubItems[0].Text });
                            lstTransfers.Items.Add(lvi);
                        });
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void ctxtOpenDirectory_Click(object sender, EventArgs e)
        {
            if (_connectClient != null)
            {
                string path = _currentDir;
                if (lstDirectory.SelectedItems.Count == 1)
                {
                    var      item = lstDirectory.SelectedItems[0];
                    PathType type = (PathType)item.Tag;

                    if (type == PathType.Directory)
                    {
                        path = GetAbsolutePath(item.SubItems[0].Text);
                    }
                }

                if (_connectClient.Value.FrmRs != null)
                {
                    new Core.Packets.ServerPackets.DoShellExecute(string.Format("cd \"{0}\"", path)).Execute(_connectClient);
                    _connectClient.Value.FrmRs.Focus();
                }
                else
                {
                    FrmRemoteShell frmRS = new FrmRemoteShell(_connectClient);
                    frmRS.Show();
                    new Core.Packets.ServerPackets.DoShellExecute(string.Format("cd \"{0}\"", path)).Execute(_connectClient);
                }
            }
        }
Exemplo n.º 4
0
        private void ctxtDelete_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem files in lstDirectory.SelectedItems)
            {
                PathType type = (PathType)files.Tag;

                switch (type)
                {
                case PathType.Directory:
                case PathType.File:
                    string path = GetAbsolutePath(files.SubItems[0].Text);
                    string text = string.Format("Are you sure you want to delete this {0}?", type);

                    if (MessageBox.Show(text, "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                        DialogResult.Yes)
                    {
                        if (_connectClient != null)
                        {
                            new Core.Packets.ServerPackets.DoPathDelete(path, type).Execute(_connectClient);
                        }
                    }
                    break;
                }
            }
        }
Exemplo n.º 5
0
        private void ctxtRename_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem files in lstDirectory.SelectedItems)
            {
                PathType type = (PathType)files.Tag;

                switch (type)
                {
                case PathType.Directory:
                case PathType.File:
                    string path    = GetAbsolutePath(files.SubItems[0].Text);
                    string newName = files.SubItems[0].Text;

                    if (InputBox.Show("New name", "Enter new name:", ref newName) == DialogResult.OK)
                    {
                        newName = GetAbsolutePath(newName);

                        if (_connectClient != null)
                        {
                            new Core.Packets.ServerPackets.DoPathRename(path, newName, type).Execute(_connectClient);
                        }
                    }
                    break;
                }
            }
        }
Exemplo n.º 6
0
        private void ctxtExecute_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem files in lstDirectory.SelectedItems)
            {
                PathType type = (PathType)files.Tag;

                if (type == PathType.File)
                {
                    string path = GetAbsolutePath(files.SubItems[0].Text);

                    if (_connectClient != null)
                    {
                        new Core.Packets.ServerPackets.DoProcessStart(path).Execute(_connectClient);
                    }
                }
            }
        }
Exemplo n.º 7
0
        private void ctxtAddToAutostart_Click(object sender, EventArgs e)
        {
            foreach (ListViewItem files in lstDirectory.SelectedItems)
            {
                PathType type = (PathType)files.Tag;

                if (type == PathType.File)
                {
                    string path = GetAbsolutePath(files.SubItems[0].Text);

                    using (var frm = new FrmAddToAutostart(path))
                    {
                        if (frm.ShowDialog() == DialogResult.OK)
                        {
                            if (_connectClient != null)
                            {
                                new Core.Packets.ServerPackets.DoStartupItemAdd(AutostartItem.Name, AutostartItem.Path,
                                                                                AutostartItem.Type).Execute(_connectClient);
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 8
0
 public DoPathDelete(string path, PathType pathtype)
 {
     this.Path = path;
     this.PathType = pathtype;
 }
Exemplo n.º 9
0
 public DoPathDelete(string path, PathType pathtype)
 {
     this.Path     = path;
     this.PathType = pathtype;
 }
Exemplo n.º 10
0
 public DoPathRename(string path, string newpath, PathType pathtype)
 {
     this.Path     = path;
     this.NewPath  = newpath;
     this.PathType = pathtype;
 }