protected void CopyBtn_Click(object sender, EventArgs e) { var upath = Session["UserPath"] as string; foreach (RepeaterItem item in FileRepeater.Items) { try { var cb = item.Controls[0].Controls[3] as CheckBox; var a = item.Controls[0].Controls[0] as System.Web.UI.DataBoundLiteralControl; var html = a.Text; var split = html.Split(new string[] { "title=" }, StringSplitOptions.None); var title = split[1].Replace("'", "").Replace(">\r\n", "").TrimStart(' ').TrimEnd(' '); var ext = Path.GetExtension(title); if (cb.Checked) { if (!CopyList.Contains(new KeyValuePair <string, string>(upath, title))) { CopyList.Add(new KeyValuePair <string, string>(upath, title)); } ; } } catch { } } UpdateAll(); }
private void UpdateSortedSet() { foreach (var bufferItem in _service.GetBufferedHistory()) { _sortedSet.Add(bufferItem); } CopyList = _sortedSet.Select(r => r).ToList(); FirstItem = CopyList.Count > 0 ? CopyList.First(): new BufferItem(); if (CopyList.Contains(_sortedSet.First())) { CopyList.Remove(_sortedSet.First()); } }
//SUPER BUTTON********************************* protected void SuperButton_Click(object sender, EventArgs e) { var u = UserPath = Session["UserPath"] as string; var args = SuperButtonArg.Text.Split(','); var command = args[0]; var target = args[1].Replace("\r\n", "").TrimStart(' ').TrimEnd(' '); var go = 0; switch (command) { case "cut": if (!CutList.Contains(new KeyValuePair <string, string>(Upath, target))) { CutList.Add(new KeyValuePair <string, string>(Upath, target)); } CutBtn_Click(this, new EventArgs()); break; case "copy": if (!CopyList.Contains(new KeyValuePair <string, string>(Upath, target))) { CopyList.Add(new KeyValuePair <string, string>(Upath, target)); } CopyBtn_Click(this, new EventArgs()); break; case "paste": PasteContent(target); break; case "inputaccept": InputModal.Style.Clear(); InputModal.Style.Add("display", "none"); var name = RenameInputBox.Text; //find file and rename it target = Session["Rename"] as string; if (Path.GetExtension(target) == "") { RenameDir(target, name); } else { RenameFile(target, name); } UpdateAllPanels(); break; case "rename": InputModal.Style.Clear(); InputModal.Style.Add("display", "inline-block"); Session["Rename"] = target; RenameInputBox.Text = target; RenameInputBox.Focus(); UpdateAllPanels(); break; case "delete": if (Path.GetExtension(target) == "") { DeleteDir(target); } else { DeleteFile(target); } DeleteBtn_Click(this, new EventArgs()); break; case "New Folder": var newpath = Server.MapPath(UserPath) + "New Folder"; Directory.CreateDirectory(newpath); break; default: break; } var aa = Session["UserPath"] as string; UpdateFileLists(aa); UpdateAllPanels(); }