Esempio n. 1
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         if (listView1.SelectedItems[0].Tag.ToString() == "dir")
         {
             RPFLib.Common.Directory directory = new RPFLib.Common.Directory();
             foreach (RPFLib.Common.fileSystemObject entry in masterlist)
             {
                 if (entry.Name == listView1.SelectedItems[0].Text)
                 {
                     directory = entry as RPFLib.Common.Directory;
                 }
             }
             listView1.Items.Clear();
             buildlist(directory);
             //addBreadCrumb(directory);
         }
         else
         {
             RPFLib.Common.File file = new RPFLib.Common.File();
             foreach (RPFLib.Common.fileSystemObject entry in masterlist)
             {
                 if (entry.Name == listView1.SelectedItems[0].Text)
                 {
                     file = entry as RPFLib.Common.File;
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public void BrowseHier(RPFLib.Common.Directory dir, RPFLib.Common.Directory rDir)
 {
     foreach (RPFLib.Common.fileSystemObject d in dir)
     {
         if (d.IsDirectory)
         {
             BrowseHier(d as RPFLib.Common.Directory, rDir);
             System.IO.Directory.CreateDirectory(extrPath + "\\" + rDir.Name + "\\" + d.FullName.Replace(rDir.FullName + "\\", ""));
         }
         else
         {
             currentCount++;
             RPFLib.Common.File file = d as RPFLib.Common.File;
             byte[]             data = file.GetData(false);
             if (!(System.IO.Directory.Exists(extrPath + "\\" + rDir.Name + "\\" + file.FullName.Replace(rDir.FullName + "\\", "").Replace(file.Name, ""))))
             {
                 System.IO.Directory.CreateDirectory(extrPath + "\\" + rDir.Name + "\\" + file.FullName.Replace(rDir.FullName + "\\", "").Replace(file.Name, ""));
             }
             System.IO.File.WriteAllBytes(extrPath + "\\" + rDir.Name + "\\" + file.FullName.Replace(rDir.FullName + "\\", ""), data);
         }
     }
 }
Esempio n. 3
0
        private void Add(RPFLib.Common.Directory fsDirectory, byte[] data)
        {
            FileEntry newFileEntry = new FileEntry(_rpfFile.TOC);

            _rpfFile.TOC.Add(newFileEntry as TOCEntry);

            var file = new Common.File();

            file._dataLoad   = getCustom => LoadData(newFileEntry, getCustom);
            file._dataStore  = setdata => StoreData(newFileEntry, setdata);
            file._dataCustom = () => newFileEntry.CustomData != null;
            file.d1          = () => newFileEntry.getSize();
            file._Index      = nIndex => newFileEntry.setIndex(nIndex);
            file._delete     = () => newFileEntry.Delete();

            file.CompressedSize  = newFileEntry.SizeInArchive;
            file.IsCompressed    = newFileEntry.IsCompressed;
            file.Name            = GetName(newFileEntry);
            file.IsResource      = newFileEntry.IsResourceFile;
            file.ParentDirectory = fsDirectory;
            fsDirectory.AddObject(file);

            newFileEntry.SetCustomData(data);
        }
Esempio n. 4
0
        private void BuildFSDirectory(DirectoryEntry dirEntry, RPFLib.Common.Directory fsDirectory)
        {
            try
            {
                fsDirectory.Name = GetName(dirEntry);
                for (int i = 0; i < dirEntry.ContentEntryCount; i++)
                {
                    TOCEntry entry = _rpfFile.TOC[dirEntry.ContentEntryIndex + i];
                    if (entry.IsDirectory)
                    {
                        var subdirEntry = entry as DirectoryEntry;
                        var dir         = new RPFLib.Common.Directory();
                        dir._Contentcount   = nCount => subdirEntry.setContentcount(nCount);
                        dir._ContentIndex   = ContentIndex => subdirEntry.setContentIndex(ContentIndex);
                        dir._Index          = NewContentIndex => subdirEntry.setNewContentIndex(NewContentIndex);
                        dir.nameHash        = (uint)subdirEntry.NameOffset;
                        dir.ParentDirectory = fsDirectory;
                        dir.Attributes      = "Folder";
                        BuildFSDirectory(entry as DirectoryEntry, dir);
                        fsDirectory.AddObject(dir);
                    }
                    else
                    {
                        var fileEntry = entry as FileEntry;
                        var file      = new Common.File();
                        file._dataLoad   = getCustom => LoadData(fileEntry, getCustom);
                        file._dataStore  = data => StoreData(fileEntry, data);
                        file._dataCustom = () => fileEntry.CustomData != null;
                        file.d1          = () => fileEntry.getSize();
                        file._Index      = nIndex => fileEntry.setIndex(nIndex);
                        file._delete     = () => fileEntry.Delete();

                        file.CompressedSize  = fileEntry.SizeInArchive;
                        file.IsCompressed    = fileEntry.IsCompressed;
                        file.nameHash        = (uint)fileEntry.NameOffset;
                        file.Name            = GetName(fileEntry);
                        file.IsResource      = fileEntry.IsResourceFile;
                        file.resourcetype    = (int)fileEntry.ResourceType;//Convert.ToString((ResourceType)fileEntry.ResourceType);
                        file.ParentDirectory = fsDirectory;

                        StringBuilder attributes = new StringBuilder();
                        if (file.IsResource)
                        {
                            attributes.Append(string.Format("Resource [Version {0}", fileEntry.ResourceType));
                            if (file.IsCompressed)
                            {
                                attributes.Append(", Compressed");
                            }
                            attributes.Append("]");
                        }
                        else if (file.IsCompressed)
                        {
                            attributes.Append("Compressed");
                        }
                        else
                        {
                            attributes.Append("None");
                        }
                        file.Attributes = attributes.ToString();
                        fsDirectory.AddObject(file);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Esempio n. 5
0
        private void BuildFSDirectory(DirectoryEntry dirEntry, RPFLib.Common.Directory fsDirectory)
        {
            try
            {
                fsDirectory.Name = GetName(dirEntry);
                for (int i = 0; i < dirEntry.ContentEntryCount; i++)
                {

                    TOCEntry entry = _rpfFile.TOC[dirEntry.ContentEntryIndex + i];
                    if (entry.IsDirectory)
                    {
                        var subdirEntry = entry as DirectoryEntry;
                        var dir = new RPFLib.Common.Directory();
                        dir._Contentcount = nCount => subdirEntry.setContentcount(nCount);
                        dir._ContentIndex = ContentIndex => subdirEntry.setContentIndex(ContentIndex);
                        dir._Index = NewContentIndex => subdirEntry.setNewContentIndex(NewContentIndex);
                        dir.Attributes = "Folder";
                        //dir.entryNum = dirEntry.ContentEntryIndex + i;
                        dir.ParentDirectory = fsDirectory;
                        BuildFSDirectory(entry as DirectoryEntry, dir);
                        fsDirectory.AddObject(dir);
                    }
                    else
                    {
                        var fileEntry = entry as FileEntry;
                        var file = new Common.File();
                        file._dataLoad = getCustom => LoadData(fileEntry, getCustom);
                        file._dataStore = data => StoreData(fileEntry, data);
                        file._dataCustom = () => fileEntry.CustomData != null;
                        file.d1 = () => fileEntry.getSize();
                        file._Index = nIndex => fileEntry.setIndex(nIndex);
                        file._delete = () => fileEntry.Delete();

                        //file.entryNum = dirEntry.ContentEntryIndex + i;
                        file.CompressedSize = fileEntry.SizeInArchive;
                        file.IsCompressed = fileEntry.IsCompressed;
                        file.Name = GetName(fileEntry);
                        //file.Size = fileEntry.Size;
                        file.IsResource = fileEntry.IsResourceFile;
                        file.ParentDirectory = fsDirectory;
                        StringBuilder attributes = new StringBuilder();
                        if (file.IsResource)
                        {
                            attributes.Append(string.Format("Resource [Version {0}", fileEntry.ResourceType));
                            if (file.IsCompressed)
                            {
                                attributes.Append("Compressed");
                            }
                            attributes.Append("]");
                        }
                        else if (file.IsCompressed)
                        {
                            attributes.Append("Compressed");
                        }
                        else
                            attributes.Append("None");
                        fsDirectory.AddObject(file);
                    }
                }
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message + Environment.NewLine + ex.StackTrace);
            }
        }
Esempio n. 6
0
 private void listView1_DoubleClick(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count == 1)
     {
         if (listView1.SelectedItems[0].Tag.ToString() == "dir")
         {
             RPFLib.Common.Directory directory = new RPFLib.Common.Directory();
             foreach (RPFLib.Common.fileSystemObject entry in masterlist)
             {
                 if (entry.Name == listView1.SelectedItems[0].Text)
                 {
                     directory = entry as RPFLib.Common.Directory;
                 }
             }
             listView1.Items.Clear();
             buildlist(directory);
             //addBreadCrumb(directory);
         }
         else
         {
             RPFLib.Common.File file = new RPFLib.Common.File();
             foreach (RPFLib.Common.fileSystemObject entry in masterlist)
             {
                 if (entry.Name == listView1.SelectedItems[0].Text)
                 {
                     file = entry as RPFLib.Common.File;
                 }
             }
         }
     }
 }
Esempio n. 7
0
        private void backgroundWorker4_DoWork(object sender, DoWorkEventArgs e)
        {
            if (backButton.GetCurrentParent().InvokeRequired)
                backButton.GetCurrentParent().Invoke((MethodInvoker)(() => backButton.Enabled = false));
            else
                backButton.Enabled = false;
            if (extrButton.GetCurrentParent().InvokeRequired)
                extrButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrButton.Enabled = false));
            else
                extrButton.Enabled = false;
            if (extrAllButton.GetCurrentParent().InvokeRequired)
                extrAllButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrAllButton.Enabled = false));
            else
                extrAllButton.Enabled = false;
            if (uncompressButton.GetCurrentParent().InvokeRequired)
                uncompressButton.GetCurrentParent().Invoke((MethodInvoker)(() => uncompressButton.Enabled = false));
            else
                uncompressButton.Enabled = false;

            using (var sfrm = new FolderBrowserDialog())
            {
                int countOfItems = 0;
                if (listView1.InvokeRequired)
                    listView1.Invoke((MethodInvoker)(() => countOfItems = listView1.SelectedItems.Count));
                else
                    countOfItems = listView1.SelectedItems.Count;
                if(countOfItems == 1)
                {
                    bool isDir = false;
                    foreach (RPFLib.Common.fileSystemObject fEntry in masterlist)
                    {
                        string fSelectedString = "";
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)(() =>
                            {
                                fSelectedString = listView1.SelectedItems[0].Text;
                            }));
                        }
                        else
                        {
                            fSelectedString = listView1.SelectedItems[0].Text;
                        }
                        if (fEntry.Name == fSelectedString)
                        {
                            isDir = fEntry.IsDirectory;
                        }
                    }
                    if (!(isDir))
                    {
                        DialogResult testthing = DialogResult.None;
                        if (this.InvokeRequired)
                            this.Invoke((MethodInvoker)(() => testthing = sfrm.ShowDialog(this)));
                        else
                            testthing = sfrm.ShowDialog(this);
                        if (testthing == DialogResult.OK)
                        {
                            List<fileSystemObject> objectList = new List<fileSystemObject>();
                            if (!(System.IO.Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted")))
                            {
                                System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted");
                            }

                            RPFLib.Common.File file = new RPFLib.Common.File();
                            foreach (RPFLib.Common.fileSystemObject entry in masterlist)
                            {
                                string selectedString = "";
                                if (this.InvokeRequired)
                                {
                                    this.Invoke((MethodInvoker)(() =>
                                    {
                                        selectedString = listView1.SelectedItems[0].Text;
                                    }));
                                }
                                else
                                {
                                    selectedString = listView1.SelectedItems[0].Text;
                                }
                                if (entry.Name == selectedString && !(entry.IsDirectory))
                                {
                                    file = entry as RPFLib.Common.File;
                                    byte[] data = file.GetData(false);
                                    System.IO.File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\" + file.Name, data);
                                    ProcessStartInfo startInfo = new ProcessStartInfo("RSCUnpacker.exe");
                                    startInfo.Arguments = "\"" + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\" + file.Name + "\" -Xbox360";
                                    startInfo.UseShellExecute = false;
                                    startInfo.CreateNoWindow = true;
                                    Process Extractor = Process.Start(startInfo);
                                    Extractor.WaitForExit();
                                    System.IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\" + file.Name);
                                    System.IO.DirectoryInfo myDir = new System.IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\");
                                    foreach (System.IO.FileInfo myFile in myDir.GetFiles())
                                    {
                                        if (System.IO.File.Exists(sfrm.SelectedPath + "\\" + myFile.Name))
                                        {
                                            System.IO.File.Delete(sfrm.SelectedPath + "\\" + myFile.Name);
                                        }
                                        myFile.MoveTo(sfrm.SelectedPath + "\\" + myFile.Name);
                                    }
                                }
                                else
                                {

                                }
                            }
                        }
                    }

                    }
                }
            if (backButton.GetCurrentParent().InvokeRequired)
                backButton.GetCurrentParent().Invoke((MethodInvoker)(() => backButton.Enabled = true));
            else
                backButton.Enabled = true;
            if (extrButton.GetCurrentParent().InvokeRequired)
                extrButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrButton.Enabled = true));
            else
                extrButton.Enabled = true;
            if (extrAllButton.GetCurrentParent().InvokeRequired)
                extrAllButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrAllButton.Enabled = true));
            else
                extrAllButton.Enabled = true;
            if (uncompressButton.GetCurrentParent().InvokeRequired)
                uncompressButton.GetCurrentParent().Invoke((MethodInvoker)(() => uncompressButton.Enabled = true));
            else
                uncompressButton.Enabled = true;
        }
Esempio n. 8
0
        private void Add(RPFLib.Common.Directory fsDirectory, byte[] data)
        {
            FileEntry newFileEntry = new FileEntry(_rpfFile.TOC);
            _rpfFile.TOC.Add(newFileEntry as TOCEntry);

            var file = new Common.File();
            file._dataLoad = getCustom => LoadData(newFileEntry, getCustom);
            file._dataStore = setdata => StoreData(newFileEntry, setdata);
            file._dataCustom = () => newFileEntry.CustomData != null;
            file.d1 = () => newFileEntry.getSize();
            file._Index = nIndex => newFileEntry.setIndex(nIndex);
            file._delete = () => newFileEntry.Delete();

            file.CompressedSize = newFileEntry.SizeInArchive;
            file.IsCompressed = newFileEntry.IsCompressed;
            file.Name = GetName(newFileEntry);
            file.IsResource = newFileEntry.IsResourceFile;
            file.ParentDirectory = fsDirectory;
            fsDirectory.AddObject(file);

            newFileEntry.SetCustomData(data);
        }
Esempio n. 9
0
        private void backgroundWorker4_DoWork(object sender, DoWorkEventArgs e)
        {
            if (backButton.GetCurrentParent().InvokeRequired)
            {
                backButton.GetCurrentParent().Invoke((MethodInvoker)(() => backButton.Enabled = false));
            }
            else
            {
                backButton.Enabled = false;
            }
            if (extrButton.GetCurrentParent().InvokeRequired)
            {
                extrButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrButton.Enabled = false));
            }
            else
            {
                extrButton.Enabled = false;
            }
            if (extrAllButton.GetCurrentParent().InvokeRequired)
            {
                extrAllButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrAllButton.Enabled = false));
            }
            else
            {
                extrAllButton.Enabled = false;
            }
            if (uncompressButton.GetCurrentParent().InvokeRequired)
            {
                uncompressButton.GetCurrentParent().Invoke((MethodInvoker)(() => uncompressButton.Enabled = false));
            }
            else
            {
                uncompressButton.Enabled = false;
            }

            using (var sfrm = new FolderBrowserDialog())
            {
                int countOfItems = 0;
                if (listView1.InvokeRequired)
                {
                    listView1.Invoke((MethodInvoker)(() => countOfItems = listView1.SelectedItems.Count));
                }
                else
                {
                    countOfItems = listView1.SelectedItems.Count;
                }
                if (countOfItems == 1)
                {
                    bool isDir = false;
                    foreach (RPFLib.Common.fileSystemObject fEntry in masterlist)
                    {
                        string fSelectedString = "";
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)(() =>
                            {
                                fSelectedString = listView1.SelectedItems[0].Text;
                            }));
                        }
                        else
                        {
                            fSelectedString = listView1.SelectedItems[0].Text;
                        }
                        if (fEntry.Name == fSelectedString)
                        {
                            isDir = fEntry.IsDirectory;
                        }
                    }
                    if (!(isDir))
                    {
                        DialogResult testthing = DialogResult.None;
                        if (this.InvokeRequired)
                        {
                            this.Invoke((MethodInvoker)(() => testthing = sfrm.ShowDialog(this)));
                        }
                        else
                        {
                            testthing = sfrm.ShowDialog(this);
                        }
                        if (testthing == DialogResult.OK)
                        {
                            List <fileSystemObject> objectList = new List <fileSystemObject>();
                            if (!(System.IO.Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted")))
                            {
                                System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted");
                            }

                            RPFLib.Common.File file = new RPFLib.Common.File();
                            foreach (RPFLib.Common.fileSystemObject entry in masterlist)
                            {
                                string selectedString = "";
                                if (this.InvokeRequired)
                                {
                                    this.Invoke((MethodInvoker)(() =>
                                    {
                                        selectedString = listView1.SelectedItems[0].Text;
                                    }));
                                }
                                else
                                {
                                    selectedString = listView1.SelectedItems[0].Text;
                                }
                                if (entry.Name == selectedString && !(entry.IsDirectory))
                                {
                                    file = entry as RPFLib.Common.File;
                                    byte[] data = file.GetData(false);
                                    System.IO.File.WriteAllBytes(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\" + file.Name, data);
                                    ProcessStartInfo startInfo = new ProcessStartInfo("RSCUnpacker.exe");
                                    startInfo.Arguments       = "\"" + Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\" + file.Name + "\" -Xbox360";
                                    startInfo.UseShellExecute = false;
                                    startInfo.CreateNoWindow  = true;
                                    Process Extractor = Process.Start(startInfo);
                                    Extractor.WaitForExit();
                                    System.IO.File.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\" + file.Name);
                                    System.IO.DirectoryInfo myDir = new System.IO.DirectoryInfo(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\Reditec\\RDR Explorer\\extracted\\");
                                    foreach (System.IO.FileInfo myFile in myDir.GetFiles())
                                    {
                                        if (System.IO.File.Exists(sfrm.SelectedPath + "\\" + myFile.Name))
                                        {
                                            System.IO.File.Delete(sfrm.SelectedPath + "\\" + myFile.Name);
                                        }
                                        myFile.MoveTo(sfrm.SelectedPath + "\\" + myFile.Name);
                                    }
                                }
                                else
                                {
                                }
                            }
                        }
                    }
                }
            }
            if (backButton.GetCurrentParent().InvokeRequired)
            {
                backButton.GetCurrentParent().Invoke((MethodInvoker)(() => backButton.Enabled = true));
            }
            else
            {
                backButton.Enabled = true;
            }
            if (extrButton.GetCurrentParent().InvokeRequired)
            {
                extrButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrButton.Enabled = true));
            }
            else
            {
                extrButton.Enabled = true;
            }
            if (extrAllButton.GetCurrentParent().InvokeRequired)
            {
                extrAllButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrAllButton.Enabled = true));
            }
            else
            {
                extrAllButton.Enabled = true;
            }
            if (uncompressButton.GetCurrentParent().InvokeRequired)
            {
                uncompressButton.GetCurrentParent().Invoke((MethodInvoker)(() => uncompressButton.Enabled = true));
            }
            else
            {
                uncompressButton.Enabled = true;
            }
        }
Esempio n. 10
0
        private void backgroundWorker3_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (backButton.GetCurrentParent().InvokeRequired)
                {
                    backButton.GetCurrentParent().Invoke((MethodInvoker)(() => backButton.Enabled = false));
                }
                else
                {
                    backButton.Enabled = false;
                }
                if (extrButton.GetCurrentParent().InvokeRequired)
                {
                    extrButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrButton.Enabled = false));
                }
                else
                {
                    extrButton.Enabled = false;
                }
                if (extrAllButton.GetCurrentParent().InvokeRequired)
                {
                    extrAllButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrAllButton.Enabled = false));
                }
                else
                {
                    extrAllButton.Enabled = false;
                }
                if (uncompressButton.GetCurrentParent().InvokeRequired)
                {
                    uncompressButton.GetCurrentParent().Invoke((MethodInvoker)(() => uncompressButton.Enabled = false));
                }
                else
                {
                    uncompressButton.Enabled = false;
                }
                using (FolderBrowserDialog sfrm = new FolderBrowserDialog())
                {
                    DialogResult testthing = DialogResult.None;
                    if (this.InvokeRequired)
                    {
                        this.Invoke((MethodInvoker)(() => testthing = sfrm.ShowDialog(this)));
                    }
                    else
                    {
                        testthing = sfrm.ShowDialog(this);
                    }
                    if (testthing == DialogResult.OK)
                    {
                        extrPath     = sfrm.SelectedPath;
                        countOfFiles = 0;
                        Task taskA = Task.Factory.StartNew(() =>
                        {
                            foreach (RPFLib.Common.fileSystemObject entry in masterlist)
                            {
                                if (entry.IsDirectory)
                                {
                                    RPFLib.Common.Directory dir = entry as RPFLib.Common.Directory;
                                    CountFilesInHier(dir);
                                }
                                else
                                {
                                    countOfFiles++;
                                }
                            }
                        });
                        taskA.Wait();

                        if (toolStripProgressBar1.GetCurrentParent().InvokeRequired)
                        {
                            toolStripProgressBar1.GetCurrentParent().Invoke((MethodInvoker)(() =>
                            {
                                timer1.Enabled = true;
                                timer1.Start();
                            }));
                        }
                        else
                        {
                            timer1.Enabled = true;
                            timer1.Start();
                        }

                        Task taskB = Task.Factory.StartNew(() =>
                        {
                            foreach (RPFLib.Common.fileSystemObject entry in masterlist)
                            {
                                if (entry.IsDirectory)
                                {
                                    RPFLib.Common.Directory dir = entry as RPFLib.Common.Directory;
                                    System.IO.Directory.CreateDirectory(extrPath + "\\" + dir.Name);
                                    BrowseHier(dir, dir);
                                }
                                else
                                {
                                    RPFLib.Common.File file = entry as RPFLib.Common.File;
                                    byte[] data             = file.GetData(false);
                                    System.IO.File.WriteAllBytes(sfrm.SelectedPath + "\\" + file.Name, data);
                                }
                            }
                        });
                        taskB.Wait();

                        if (toolStripProgressBar1.GetCurrentParent().InvokeRequired)
                        {
                            toolStripProgressBar1.GetCurrentParent().Invoke((MethodInvoker)(() =>
                            {
                                timer1.Stop();
                                timer1.Enabled = false;
                                toolStripProgressBar1.Value = 0;
                            }));
                        }
                        else
                        {
                            timer1.Stop();
                            timer1.Enabled = false;
                            toolStripProgressBar1.Value = 0;
                        }
                    }
                }
                if (backButton.GetCurrentParent().InvokeRequired)
                {
                    backButton.GetCurrentParent().Invoke((MethodInvoker)(() => backButton.Enabled = true));
                }
                else
                {
                    backButton.Enabled = true;
                }
                if (extrButton.GetCurrentParent().InvokeRequired)
                {
                    extrButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrButton.Enabled = true));
                }
                else
                {
                    extrButton.Enabled = true;
                }
                if (extrAllButton.GetCurrentParent().InvokeRequired)
                {
                    extrAllButton.GetCurrentParent().Invoke((MethodInvoker)(() => extrAllButton.Enabled = true));
                }
                else
                {
                    extrAllButton.Enabled = true;
                }
                if (uncompressButton.GetCurrentParent().InvokeRequired)
                {
                    uncompressButton.GetCurrentParent().Invoke((MethodInvoker)(() => uncompressButton.Enabled = true));
                }
                else
                {
                    uncompressButton.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                Application.Exit();
            }
        }