示例#1
0
        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();
        }
示例#2
0
        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) { }
        }
示例#3
0
 public void addLevel(string name)
 {
     if (myPath.Length == 0)
     {
         myPath += name;
         return;
     }
     //myPath += @"\" + name;
     myPath = FileMethods.Combine(myPath, name);
 }
示例#4
0
        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());
        }
示例#5
0
        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());
        }
示例#6
0
 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);
     }
 }
示例#7
0
        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());
            }
        }
示例#8
0
        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();
            }
        }
示例#9
0
 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);
     }
 }
示例#10
0
 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);
         }
     }
 }
示例#11
0
        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");
                }
            }
        }
示例#12
0
 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();
 }
示例#13
0
        public void Visit(FileMethods f)
        {
            string hashed = MD5.CreateMD5(f.myFullPath());

            MessageBox.Show(hashed);
        }
示例#14
0
 public override void createFile()
 {
     FileMethods.create(path + "\\newFile.txt");
 }
示例#15
0
        private void MENU9(object sender, EventArgs e)
        {
            Form8 form = new Form8(FileMethods.Combine(view.getsetFi, view.getsetListView.SelectedItems[0].Text));

            form.ShowDialog();
        }
示例#16
0
 protected void arcOneFile(string fullNamefrom, string fullNameto)
 {
     FileMethods.archiveFile(fullNamefrom, fullNameto);
 }