public void Extract(string openfile, string savedir)
        {
            // Condition savedir.
            savedir = savedir.TrimEnd('\\') + "\\";

            // Initialize the input streams.
            FileStream   fsi = new FileStream(openfile, FileMode.Open, FileAccess.Read);
            BinaryReader br  = new BinaryReader(fsi);

            // Read the table of contents.
            StuffFileEntry[] toc = new StuffFileEntry[br.ReadInt32()];
            int length_temp;

            for (int i = 0; i < toc.Length; i++)
            {
                toc[i].Length = br.ReadInt32();
                length_temp   = br.ReadInt32();
                toc[i].Path   = Encoding.ASCII.GetString(br.ReadBytes(length_temp));
                fsi.Position++;
            }

            // Reserve memory for the handler.
            FileProcessedHandler handle;

            // Start reading from our archive and writing it to individual files.
            int BUFFER_SIZE = 4096;

            byte[] buffer = new byte[BUFFER_SIZE];
            int    toread = 0;

            for (int i = 0; i < toc.Length; i++)
            {
                toread = toc[i].Length;
                FileInfo fi = new FileInfo(savedir + toc[i].Path);
                Directory.CreateDirectory(fi.DirectoryName); // Make sure the directory exists first.
                FileStream fso = new FileStream(fi.FullName, FileMode.Create, FileAccess.Write);
                while (toread > 0)
                {
                    if (toread > BUFFER_SIZE)
                    {
                        buffer  = br.ReadBytes(BUFFER_SIZE); // Fill the buffer.
                        toread -= BUFFER_SIZE;
                    }
                    else
                    {
                        buffer  = br.ReadBytes(toread); // Read what's left.
                        toread -= toread;
                    }
                    fso.Write(buffer, 0, buffer.Length); // Write the data to the file.
                    fso.Flush();
                }
                fso.Close();

                #region " Raise Event "
                handle = FileExtracted;
                if (handle != null)
                {
                    handle("Extracting...", i + 1, toc.Length);
                }
                #endregion
            }

            // Close up shop.
            br.Close();
            fsi.Close();
        }
        public void Extract(string openfile, string savedir)
        {
            // Condition savedir.
            savedir = savedir.TrimEnd('\\') + "\\";

            // Initialize the input streams.
            FileStream fsi = new FileStream(openfile, FileMode.Open, FileAccess.Read);
            BinaryReader br = new BinaryReader(fsi);

            // Read the table of contents.
            StuffFileEntry[] toc = new StuffFileEntry[br.ReadInt32()];
            int length_temp;
            for (int i = 0; i < toc.Length; i++)
            {
                toc[i].Length = br.ReadInt32();
                length_temp = br.ReadInt32();
                toc[i].Path = Encoding.ASCII.GetString(br.ReadBytes(length_temp));
                fsi.Position++;
            }

            // Reserve memory for the handler.
            FileProcessedHandler handle;

            // Start reading from our archive and writing it to individual files.
            int BUFFER_SIZE = 4096;
            byte[] buffer = new byte[BUFFER_SIZE];
            int toread = 0;
            for (int i = 0; i < toc.Length; i++)
            {
                toread = toc[i].Length;
                FileInfo fi = new FileInfo(savedir + toc[i].Path);
                Directory.CreateDirectory(fi.DirectoryName); // Make sure the directory exists first.
                FileStream fso = new FileStream(fi.FullName, FileMode.Create, FileAccess.Write);
                while (toread > 0)
                {
                    if (toread > BUFFER_SIZE)
                    {
                        buffer = br.ReadBytes(BUFFER_SIZE); // Fill the buffer.
                        toread -= BUFFER_SIZE;
                    }
                    else
                    {
                        buffer = br.ReadBytes(toread); // Read what's left.
                        toread -= toread;
                    }
                    fso.Write(buffer, 0, buffer.Length); // Write the data to the file.
                    fso.Flush();
                }
                fso.Close();

                #region " Raise Event "
                handle = FileExtracted;
                if (handle != null)
                    handle("Extracting...", i + 1, toc.Length);
                #endregion
            }

            // Close up shop.
            br.Close();
            fsi.Close();
        }