private void buttonMove_Click(object sender, EventArgs e) { if (listViewDocs.SelectedItems.Count != 0) { List <VDirs> fullPaths = new List <VDirs>(); fullPaths.Add(new VDirs(-1, "No directory", -1, "<<No directory>>")); getAllFullPath(treeViewDirs.Nodes[7], ref fullPaths); Files selectedFile = ((Files)listViewDocs.SelectedItems[0].Tag); VDirs[] fullPathsArray = fullPaths.ToArray(); VDirs selectedVdir = null; if (selectedFile.Vdir != null) { foreach (VDirs currentVdir in fullPathsArray) { if (currentVdir.Id.ToString().Equals(selectedFile.Vdir)) { selectedVdir = currentVdir; break; } } } MoveFilesToDir mftdw = new MoveFilesToDir(fullPathsArray, (selectedVdir == null ? fullPathsArray[0] : selectedVdir)); if (mftdw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dbm.moveFileToDir(selectedFile.Id, mftdw.NewDirId); listViewRefresh(); } } }
//this should really check everything about the board - regen hits and replay everything. public static void DoDebug(Level l, bool show = false, bool validateBoard = false) { if (validateBoard) { if (show) { ShowSeg(l); ShowHit(l); Show(l); } //always validate segs. uint lastIndex = 0; foreach (var seg in l.Segs) { if (seg.Len == 0) { WL("Bada"); } if (show) { WL(seg.ToString()); } if (lastIndex == 0) { lastIndex = seg.Index; continue; } if (seg.Index < lastIndex) { //in preparation for well-spaced indexes, this should be > last rather than ==last+1 WL("Badb"); } lastIndex = seg.Index; } Seg lastSeg = null; foreach (var seg in l.Segs) { if (lastSeg != null) { if ((HDirs.Contains(lastSeg.Dir) && !VDirs.Contains(seg.Dir)) || (VDirs.Contains(lastSeg.Dir) && !HDirs.Contains(seg.Dir))) { WL("Badc"); } } lastSeg = seg; } //recalculate the entire board and segs. var fakeRows = new Dictionary <(int, int), Seg>(); var fakeHits = new Dictionary <(int, int), List <Seg> >(); for (var yy = 0; yy < l.Height; yy++) { for (var xx = 0; xx < l.Width; xx++) { fakeHits[(xx, yy)] = new List <Seg>();
// Build up the Custom dirs. private void generateCustomVDirs() { VDirs allVDirs = dbm.getVDirs(); treeViewDirs.Nodes[7].Nodes.Clear(); foreach (VDirs actualItem in allVDirs.Subdirs) { TreeNode tn = new TreeNode(actualItem.Name, generateCustomVDirsRecursive(actualItem)); tn.Tag = actualItem; treeViewDirs.Nodes[7].Nodes.Add(tn); } }
private void renameDirToolStripMenuItem_Click(object sender, EventArgs e) { VDirs selected = (VDirs)treeViewDirs.SelectedNode.Tag; RenameVDir rvdw = new RenameVDir(selected.Name); if (rvdw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dbm.renameVdirs(selected.Id, rvdw.NewName); } generateCustomVDirs(); }
// Get full paths in recursive mode. private void getAllFullPath(TreeNode tn, ref List <VDirs> fullPaths) { if (tn != null) { foreach (TreeNode tni in tn.Nodes) { VDirs tmp = (VDirs)tni.Tag; tmp.FullPath = tni.FullPath; fullPaths.Add(tmp); getAllFullPath(tni, ref fullPaths); } } }
// Build up the Custom dirs. (children) private TreeNode[] generateCustomVDirsRecursive(VDirs actualPack) { if (actualPack != null) { TreeNode[] tn = new TreeNode[actualPack.Subdirs.Count]; int actIndex = 0; foreach (VDirs actualItem in actualPack.Subdirs) { TreeNode tnsub = new TreeNode(actualItem.Name, generateCustomVDirsRecursive(actualItem)); tnsub.Tag = actualItem; tn[actIndex] = tnsub; actIndex++; } return(tn); } return(null); }
private void deleteDirToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode rn = FindRootNode(treeViewDirs.SelectedNode); if (treeViewDirs.SelectedNode.Tag != null && !treeViewDirs.SelectedNode.Tag.Equals("") && rn.Index == 7) { VDirs vds = (VDirs)treeViewDirs.SelectedNode.Tag; if (MessageBox.Show("Are you sure you want to delete this and the sub directories?", "Delete confirmation", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes) { dbm.removeVdirs(vds.Id); generateCustomVDirs(); } } else { MessageBox.Show("This item can't be deleted!"); } }
private void moveDirToolStripMenuItem_Click(object sender, EventArgs e) { List <VDirs> fullPaths = new List <VDirs>(); fullPaths.Add(new VDirs(-1, treeViewDirs.Nodes[7].Text, -1, treeViewDirs.Nodes[7].FullPath)); getAllFullPath(treeViewDirs.Nodes[7], ref fullPaths); VDirs vds = (VDirs)treeViewDirs.SelectedNode.Tag; vds.FullPath = treeViewDirs.SelectedNode.FullPath; MoveVDirs mvdw = new MoveVDirs(fullPaths.ToArray(), vds.FullPath); if (mvdw.ShowDialog() == System.Windows.Forms.DialogResult.OK) { dbm.moveVdirs(vds.Id, mvdw.NewMainId); generateCustomVDirs(); } }