Exemplo n.º 1
0
        private void OnOpen(object sender, EventArgs e)
        {
            if (this.openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            string path = this.openFileDialog.FileName;
            string save = Path.GetDirectoryName(path);

            save = Path.Combine(Path.Combine(Path.Combine(save, "modding"), "extracted"), Path.GetFileNameWithoutExtension(path));
            Directory.CreateDirectory(save);

            this.savePathDialog.SelectedPath = save;
            if (this.savePathDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            save = this.savePathDialog.SelectedPath;

            PackageFile package = new PackageFile();
            Stream      stream  = File.OpenRead(path);

            package.Read(stream);
            stream.Close();

            this.progressBar.Minimum = 0;
            this.progressBar.Maximum = package.Entries.Count;
            this.progressBar.Value   = 0;

            ExtractThreadInfo info = new ExtractThreadInfo();

            info.Save    = save;
            info.Path    = path;
            info.Package = package;

            this.ExtractThread = new Thread(new ParameterizedThreadStart(ExtractFiles));
            this.ExtractThread.Start(info);
            this.EnableButtons(false);
        }