private void MENU1(object sender, EventArgs e) { Form3 f = new Form3(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text), view.getsetListView.SelectedItems[0].Tag.ToString(), "copy"); f.ThrowEvent += (senderio, args, st, delo) => { OnkoZakrito(st, delo); }; f.ShowDialog(); }
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 ZippedFolder(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) { } }
public void addLevel(string name) { if (myPath.Length == 0) { myPath += name; return; } //myPath += @"\" + name; myPath = FileMethods.Combine(myPath, name); }
public void Visit(FileMethods f) { string wat = f.getMytTxt(); wat = encrypt(wat); var someStream = FileMethods.create(f.myFullPath() + "_encrypted"); byte[] info = new UTF8Encoding(true).GetBytes(wat); someStream.Write(info, 0, info.Length); FileMethods.delete(f.myFullPath()); }
public void Visit(FileMethods f) { myNum = -myNum; string wat = f.getMytTxt(); wat = encryption(wat); var someStream = FileMethods.create(f.myFullPath().Remove(f.myFullPath().Length - 10, 10)); byte[] info = new UTF8Encoding(true).GetBytes(wat); someStream.Write(info, 0, info.Length); FileMethods.delete(f.myFullPath()); }
private void MENU10(object sender, EventArgs e) { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { FileMethods m = new FileMethods(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); m.Accept(visitor); } else { FolderMethods m = new FolderMethods(FolderMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); m.Accept(visitor); } }
public static void CopyDir(string FromDir, string ToDir) { FolderMethods.CreateDirectory(ToDir); foreach (string s1 in new FolderMethods(FromDir).Get_Files_In_Selected_Folder()) { string s2 = ToDir + "\\" + new FolderMethods(s1.ToString()).GetNameWithoutPath(); FileMethods.copy(s1, s2, true); } foreach (string s in FolderMethods.GetDirectories(FromDir)) { CopyDir(s, ToDir + "\\" + new FolderMethods(s.ToString()).GetNameWithoutPath()); } }
protected void OnkoZakrito(string s, string dela) { if (dela == "copy") { try { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { FileMethods.copy(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text), FileMethods.Combine(s, view.getsetListView.SelectedItems[0].Text), true); } else { // directory } } catch (Exception e) { } return; } if (dela == "replace") { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { FileMethods.move(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text), FileMethods.Combine(s, view.getsetListView.SelectedItems[0].Text)); } else { FolderMethods.move(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text), s); } return; } if (dela == "rename") { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "directory") { FolderMethods.move(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text), FileMethods.Combine(view.getsetFi, s)); view.renewList(); return; } FileMethods.delete(FileMethods.Combine(view.getsetFi, s)); string h = view.getsetListView.SelectedItems[0].Text; int ind = h.IndexOf('.'); h = h.Substring(ind); FileMethods.move(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text), FileMethods.Combine(view.getsetFi, s + h)); view.renewList(); } }
private void changedVsyoTaki(object sender, EventArgs e) { view.clearListView2(); if (view.getsetListView.SelectedItems.Count == 0) { return; } if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { FileMethods f = new FileMethods(view.getsetFi + @"\" + view.getsetListView.SelectedItems[0].Name); ListViewItem lvi = new ListViewItem(); lvi.Text = "Расширение : " + f.myType(); view.addItemToLW2(lvi); } }
private void decryptClickedRealize(object sender, EventArgs e) { if (view.getsetListView.SelectedItems.Count > 0) { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { FileMethods m = new FileMethods(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); CesarEncrypt.setKey(int.Parse(view.getsetEncryptTExtBox)); m.Accept(CesarEncrypt); } else { FolderMethods m = new FolderMethods(FolderMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); CesarEncrypt.setKey(int.Parse(view.getsetEncryptTExtBox)); m.Accept(CesarEncrypt); } } }
public void InsertZipToDir(string newway) { try { FolderMethods.DeleteDirectory("ExtractData"); } catch { } FolderMethods.CreateDirectory("ExtractData"); int ZipPlace = path.IndexOf(".archive.zip\\"); string ArchiveWay = path.Substring(ZipPlace + 13); string path1 = path.Substring(0, ZipPlace + 12); using (ZipFile zip = ZipFile.Read(path1)) { if (path[path.Length - 1] == '/') { ArchiveWay = ArchiveWay.Remove(ArchiveWay.Length - 1, 1) + "\\"; foreach (ZipEntry e in zip) { if (e.FileName.Contains(ArchiveWay.Replace('\\', '/')) && e.FileName.IndexOf(ArchiveWay.Replace('\\', '/')) == 0) { e.Extract("ExtractData", ExtractExistingFileAction.DoNotOverwrite); } } FolderMethods.CopyDir("ExtractData\\" + ArchiveWay, newway + '\\' + ArchiveWay); FolderMethods.DeleteDirectory("ExtractData"); } else { foreach (ZipEntry e in zip) { if (e.FileName == ArchiveWay.Replace('\\', '/')) { e.Extract("ExtractData", ExtractExistingFileAction.DoNotOverwrite); } } FileMethods.copy("ExtractData\\" + ArchiveWay, newway, false); FolderMethods.DeleteDirectory("ExtractData"); } } }
private void MENU2(object sender, EventArgs e) { if (view.getsetFi.Contains(".zip")) { new ZippedFile(view.getsetFi).Delete(view.getsetListView.SelectedItems[0].Text); } else { if (view.getsetListView.SelectedItems[0].Tag.ToString() == "file") { FileMethods.delete(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); } else { FolderMethods.DeleteDirectory(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); } } view.renewList(); }
public void Visit(FileMethods f) { string hashed = MD5.CreateMD5(f.myFullPath()); MessageBox.Show(hashed); }
public override void createFile() { FileMethods.create(path + "\\newFile.txt"); }
private void MENU9(object sender, EventArgs e) { Form8 form = new Form8(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text)); form.ShowDialog(); }
protected void arcOneFile(string fullNamefrom, string fullNameto) { FileMethods.archiveFile(fullNamefrom, fullNameto); }