private void updateTheMenu(object sender, EventArgs e) { if (view.getsetFi == "" || view.getsetFi.Length <= 2) { view.getsetListView.Items.Clear(); var drives = FolderMethods.getDrInfo(); foreach (var i in drives) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 2; lvi.Text = i.Name; lvi.Tag = "directory"; view.getsetListView.Items.Add(lvi); } view.obnullFi(); view.getsetRichTextBox1("DISKS"); view.getWatcher.Path = @"\"; view.getWatcher.Filter = "*.*"; return; } try { if (view.getsetFi.Contains(".zip")) { foldrrrr = new ZipFolder(view.getsetFi); List <string> asss = new List <string>(); try { asss = foldrrrr.GetAllFiles(); } catch (Exception e1) { } view.getsetListView.Clear(); foreach (string i in asss) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 3; lvi.Text = i; lvi.Tag = "file"; view.getsetListView.Items.Add(lvi); } return; } view.getsetListView.Items.Clear(); FolderMethods.UpdateDirectories(view.getsetListView.Items, view.getsetFi); FileMethods.UpdateFiles(view.getsetListView.Items, view.getsetFi); view.getsetRichTextBox1(view.getsetFi); view.getWatcher.Path = view.getsetFi; view.getWatcher.Filter = "*.*"; } catch (Exception) { } }
private void openFile(object sender, EventArgs e) { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { if ((view.getsetFi + "\\" + view.getsetListView.SelectedItems[0].Text).Contains(".zip")) { foldrrrr = new ZipFolder(view.getsetFi + "\\" + view.getsetListView.SelectedItems[0].Text); List <string> asss = new List <string>(); try { if (view.getsetListView.SelectedItems[0].Text.Last() == 'p') { asss = foldrrrr.GetAllFiles(); } else { } // asss = foldrrrr.GetLevelFiles(1, view.getsetFi + "\\" + view.getsetListView.SelectedItems[0].Text); } catch (Exception e1) { } view.AdLevelPath(view.getsetListView.SelectedItems[0].Text); view.getsetListView.Clear(); foreach (string i in asss) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 3; lvi.Text = i; lvi.Tag = "file"; view.getsetListView.Items.Add(lvi); } } try { if ((view.getsetFi + "\\" + view.getsetListView.SelectedItems[0].Text).Contains(".zip\\")) { ZipFile.OpenZipFile(view.getsetFi, view.getsetListView.SelectedItems[0].Text); } } catch (Exception wer) { } startFileButton(this, e); return; } string toAdd = view.getsetListView.SelectedItems[0].Text; view.AdLevelPath(toAdd); view.renewList(); }
private void SearchFilesByInput(object sender, EventArgs e) { string pred = view.getsetRichTextBox3; if (pred == "") { view.renewList(); return; } string reg = ""; for (int i = 0; i < pred.Length; i++) { if (pred[i] == '*') { reg += "(.*)*"; continue; } if (pred[i] == '?') { reg += "?"; continue; } reg += pred[i]; } List <DirectoryInfo> allDir = fin(view.getsetFi); List <FileInfo> allFiles = finfA(view.getsetFi); List <DirectoryInfo> iFound = new List <DirectoryInfo>(); List <FileInfo> iFoundFile = new List <FileInfo>(); List <string> govno = new List <string>(); foreach (DirectoryInfo i in allDir) { if (i.Name.Contains(".zip")) { govno.Add(i.FullName); } } foreach (FileInfo i in allFiles) { if (i.Name.Contains(".zip")) { govno.Add(i.FullName); } } iFound = allDir.FindAll((item) => { return(Regex.Match(item.Name, reg).Success); }); iFoundFile = allFiles.FindAll((item) => { return(Regex.Match(item.Name, reg).Success); }); view.getsetListView.Items.Clear(); List <string> resultgovno = new List <string>(); foreach (string i in govno) { foldrrrr = new ZipFolder(i); try { List <string> asss = foldrrrr.GetAllFiles(); resultgovno.AddRange(asss); } catch (Exception e1) { } } List <string> ans = new List <string>(); foreach (string i in resultgovno) { if (Regex.Match(i, reg).Success) { ans.Add(i); } } foreach (string i in ans) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 3; lvi.Text = i; lvi.Tag = "directory"; view.getsetListView.Items.Add(lvi); } foreach (DirectoryInfo i in iFound) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 1; lvi.Text = i.Name; lvi.Tag = "directory"; view.getsetListView.Items.Add(lvi); } foreach (FileInfo i in iFoundFile) { ListViewItem lvi = new ListViewItem(); lvi.ImageIndex = 0; lvi.Text = i.Name; lvi.Tag = "file"; view.getsetListView.Items.Add(lvi); } view.getsetRichTextBox1(view.getsetFi); view.getWatcher.Path = view.getsetFi; view.getWatcher.Filter = "*.*"; }