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; } }
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); }); } } } }
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); } } }
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; } } }
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; } } }
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); } } } }
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); } } } } } }
public DoPathDelete(string path, PathType pathtype) { this.Path = path; this.PathType = pathtype; }
public DoPathDelete(string path, PathType pathtype) { this.Path = path; this.PathType = pathtype; }
public DoPathRename(string path, string newpath, PathType pathtype) { this.Path = path; this.NewPath = newpath; this.PathType = pathtype; }