Пример #1
0
        private void openDirectoryToolStripMenuItem_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);
                }
            }
        }
Пример #2
0
        private void openDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = _currentDir;

            if (lstDirectory.SelectedItems.Count == 1)
            {
                var      item = lstDirectory.SelectedItems[0];
                FileType type = (FileType)item.Tag;

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

            if (_connectClient.Value.FrmRs != null)
            {
                _connectClient.Send(new DoShellExecute {
                    Command = $"cd \"{path}\""
                });
                _connectClient.Value.FrmRs.Focus();
            }
            else
            {
                FrmRemoteShell frmRS = new FrmRemoteShell(_connectClient);
                frmRS.Show();
                _connectClient.Send(new DoShellExecute {
                    Command = $"cd \"{path}\""
                });
            }
        }
Пример #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];
                    if (item.SubItems[0].Text != ".." && item.Tag.ToString() == "dir")
                    {
                        if (path.EndsWith(@"\"))
                        {
                            path += item.SubItems[0].Text;
                        }
                        else
                        {
                            path += @"\" + item.SubItems[0].Text;
                        }
                    }
                }

                if (_connectClient.Value.FrmRs != null)
                {
                    new Core.Packets.ServerPackets.ShellCommand(string.Format("cd \"{0}\"", path)).Execute(_connectClient);
                    _connectClient.Value.FrmRs.Focus();
                }
                else
                {
                    FrmRemoteShell frmRS = new FrmRemoteShell(_connectClient);
                    frmRS.Show();
                    new Core.Packets.ServerPackets.ShellCommand(string.Format("cd \"{0}\"", path)).Execute(_connectClient);
                }
            }
        }
Пример #4
0
 private void remoteShellToolStripMenuItem_Click(object sender, EventArgs e)
 {
     foreach (Client c in GetSelectedClients())
     {
         FrmRemoteShell frmRs = FrmRemoteShell.CreateNewOrGetExisting(c);
         frmRs.Show();
         frmRs.Focus();
     }
 }
Пример #5
0
        /// <summary>
        /// Creates a new remote shell form for the client or gets the current open form, if there exists one already.
        /// </summary>
        /// <param name="client">The client used for the remote shell form.</param>
        /// <returns>
        /// Returns a new remote shell form for the client if there is none currently open, otherwise creates a new one.
        /// </returns>
        public static FrmRemoteShell CreateNewOrGetExisting(Client client)
        {
            if (OpenedForms.ContainsKey(client))
            {
                return(OpenedForms[client]);
            }
            FrmRemoteShell f = new FrmRemoteShell(client);

            f.Disposed += (sender, args) => OpenedForms.Remove(client);
            OpenedForms.Add(client, f);
            return(f);
        }
Пример #6
0
 private void ctxtRemoteShell_Click(object sender, EventArgs e)
 {
     foreach (Client c in GetSelectedClients())
     {
         if (c.Value.FrmRs != null)
         {
             c.Value.FrmRs.Focus();
             return;
         }
         FrmRemoteShell frmRS = new FrmRemoteShell(c);
         frmRS.Show();
     }
 }
Пример #7
0
 private void ctxtRemoteShell_Click(object sender, EventArgs e)
 {
     if (lstClients.SelectedItems.Count != 0)
     {
         Client c = (Client)lstClients.SelectedItems[0].Tag;
         if (c.Value.FrmRs != null)
         {
             c.Value.FrmRs.Focus();
             return;
         }
         FrmRemoteShell frmRS = new FrmRemoteShell(c);
         frmRS.Show();
     }
 }
Пример #8
0
        private void openDirectoryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string path = _currentDir;

            if (lstDirectory.SelectedItems.Count == 1)
            {
                var      item = lstDirectory.SelectedItems[0];
                FileType type = (FileType)item.Tag;

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

            FrmRemoteShell frmRs = FrmRemoteShell.CreateNewOrGetExisting(_connectClient);

            frmRs.Show();
            frmRs.Focus();
            frmRs.RemoteShellHandler.SendCommand($"cd \"{path}\"");
        }
Пример #9
0
 private void ctxtRemoteShell_Click(object sender, EventArgs e)
 {
     foreach (Client c in GetSelectedClients())
     {
         if (c.Value.FrmRs != null)
         {
             c.Value.FrmRs.Focus();
             return;
         }
         FrmRemoteShell frmRS = new FrmRemoteShell(c);
         frmRS.Show();
     }
 }
Пример #10
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);
                }
            }
        }
Пример #11
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];
                    if (item.SubItems[0].Text != ".." && item.Tag.ToString() == "dir")
                    {
                        if (path.EndsWith(@"\"))
                            path += item.SubItems[0].Text;
                        else
                            path += @"\" + item.SubItems[0].Text;
                    }
                }

                if (_connectClient.Value.FrmRs != null)
                {
                    new Core.Packets.ServerPackets.ShellCommand(string.Format("cd \"{0}\"", path)).Execute(_connectClient);
                    _connectClient.Value.FrmRs.Focus();
                }
                else
                {
                    FrmRemoteShell frmRS = new FrmRemoteShell(_connectClient);
                    frmRS.Show();
                    new Core.Packets.ServerPackets.ShellCommand(string.Format("cd \"{0}\"", path)).Execute(_connectClient);
                }
            }
        }
Пример #12
0
 private void ctxtRemoteShell_Click(object sender, EventArgs e)
 {
     if (lstClients.SelectedItems.Count != 0)
     {
         Client c = (Client) lstClients.SelectedItems[0].Tag;
         if (c.Value.FrmRs != null)
         {
             c.Value.FrmRs.Focus();
             return;
         }
         FrmRemoteShell frmRS = new FrmRemoteShell(c);
         frmRS.Show();
     }
 }