Beispiel #1
0
        /* extracts .7z files */
        private void ExtractSevZFiles(string FilePath)
        {
            FileManipulation FileMan = new FileManipulation();

               string PathStub = "";
               PathStub = FileMan.RenameDirectory(PathStub);
               string FinalPath = FilePath + PathStub;

               // SevenZipFile ZipExtract = new SevenZipFile()
        }
Beispiel #2
0
        /* extracts .zip files */
        private void ExtractZipFiles(string FilePath)
        {
            FileManipulation FileMover = new FileManipulation();

               string PathStub =  "";
               PathStub = FileMover.RenameDirectory(PathStub);

               FileInfo FileInPath = new FileInfo(FilePath); // used to get the name and directory of the target file

               string FinalPath = FileInPath.DirectoryName + @"\" + FileInPath.Name + PathStub ; // the directory of the target file
                                                                                             // the name + the stub of the target file
                                                                                            // used to create a new directory with the file

               ZipFile.ExtractToDirectory(FilePath, FinalPath);

               ExtractedDirectories.Add(FinalPath);
        }
Beispiel #3
0
        /* extracts .rar files */
        private void ExtractRarFiles(string FilePath)
        {
            FileManipulation FileMover = new FileManipulation(); // used to obtain and set various values based on the working directory

               string PathStub = "";
               PathStub = FileMover.RenameDirectory(PathStub); //  PathStub = "_Extracted"

               string FullPath = FilePath + PathStub; // the file path with the new name ( target directory )

               RarArchive ExtractorRar = RarArchive.Open(FilePath); // open an extractor to begin extracting files

               //extracts and moves files
               foreach (RarArchiveEntry entry in ExtractorRar.Entries)
               {
             string NewDirectory = Path.Combine(FullPath, entry.FilePath); // creates the path for a New target directory
             entry.WriteToDirectory(NewDirectory);  //move the fiels oto the newely created directory
               }

               ExtractedDirectories.Add(FullPath); // creates a list of extracted directories so we can move them all to a single folder.
        }