Subversion Repositories spk

Rev

Rev 128 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#pragma once

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

enum {WORKER_NONE, WORKER_READ, WORKER_UNCOMPRESS, WORKER_WRITE};
#include <spk.h>

namespace SpkExplorer {

        /// <summary>
        /// Summary for ExtractDialog
        ///
        /// WARNING: If you change the name of this class, you will need to change the
        ///          'Resource File Name' property for the managed resource compiler tool
        ///          associated with all .resx files this class depends on.  Otherwise,
        ///          the designers will not be able to interact properly with localized
        ///          resources associated with this form.
        /// </summary>
        public ref class ExtractDialog : public System::Windows::Forms::Form
        {
        public:
                ExtractDialog(CLinkList<C_File> *list, System::String ^dir, CBaseFile *p, int game, CPackages *packages)
                {
                        this->Init(dir);
                        m_pPackage = p;
                        _pPackages = packages;
                        m_pList = list;
                        m_iGame = game;
                }
                ExtractDialog(CLinkList<SMultiSpkFile> *list, System::String ^dir, CMultiSpkFile *p, CPackages *packages)
                {
                        this->Init(dir);
                        m_pMultiPackage = p;
                        m_pMultiList = list;
                        _pPackages = packages;
                }

                int ExtractedCount()
                {
                        return m_iExtractCount;
                }
                void Init(String ^dir)
                {
                        InitializeComponent();

                        backgroundWorker1->DoWork += gcnew DoWorkEventHandler( this, &ExtractDialog::Background_DoWork );
                        backgroundWorker1->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler( this, &ExtractDialog::Background_Finished );

                        m_iExtractCount = 0;
                        m_pWorkingPackage = NULL;
                        m_pPackage = NULL;
                        m_pList = NULL;
                        m_pMultiPackage = NULL;
                        m_pMultiList = NULL;
                        m_pFailedList = new Utils::WStringList;
                        m_sFailed = L"";
                        m_iCount = 0;
                        m_sToDir = dir;
                        m_bOK = true;
                        m_pWorkingFile = NULL;
                        m_iWorkingStatus = WORKER_NONE;
                        m_iUncompressSize = 0;
                        m_pUncompressData = 0;

                        m_bYesToAll = m_bNoToAll = m_bCancel = false;
                }

                bool OK() { return m_bOK; }
                bool Canceled() { return m_bCancel; }

        protected:
                void Background_DoWork(System::Object ^Sender, DoWorkEventArgs ^E);
                void Background_Finished(System::Object ^Sender, RunWorkerCompletedEventArgs ^E);
                void UpdateDisplay();
                void StartWork(int status);
                void Finished();
                bool CheckExists(System::String ^file);
                void DoNextFile();

                CLinkList<C_File>               *m_pList;
                CBaseFile                               *m_pPackage;
                CPackages                               *_pPackages;
                CLinkList<SMultiSpkFile>        *m_pMultiList;
                CMultiSpkFile                   *m_pMultiPackage;
                C_File                                  *m_pWorkingFile;
                SMultiSpkFile                   *m_pWorkingPackage;
                int                                              m_iWorkingStatus;
                int                                              m_iCount;
                System::String                  ^m_sFailed;
                Utils::WStringList              *m_pFailedList;
                unsigned char                   *m_pUncompressData;
                long                                     m_iUncompressSize;
                int                                              m_iExtractCount;
                int                                              m_iGame;

                bool                                     m_bNoToAll;
                bool                                     m_bYesToAll;
                bool                                     m_bCancel;

        private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
        protected: 
                bool                             m_bOK;
                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~ExtractDialog()
                {
                        delete m_pFailedList;
                        if (components)
                        {
                                delete components;
                        }
                }
        private: System::Windows::Forms::Label^  label1;
        protected: 
        private: System::Windows::Forms::Label^  LabFilename;
        private: System::Windows::Forms::Label^  label2;
        private: System::Windows::Forms::Label^  LabSize;
        private: System::Windows::Forms::ProgressBar^  progressBar1;

        private: System::Windows::Forms::Label^  label3;
        private: System::Windows::Forms::Label^  LabStatus;
                         System::String         ^m_sToDir;

        private:
                void Start();

                /// <summary>
                /// Required designer variable.
                /// </summary>
                System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
                /// <summary>
                /// Required method for Designer support - do not modify
                /// the contents of this method with the code editor.
                /// </summary>
                void InitializeComponent(void)
                {
                        System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(ExtractDialog::typeid));
                        this->label1 = (gcnew System::Windows::Forms::Label());
                        this->LabFilename = (gcnew System::Windows::Forms::Label());
                        this->label2 = (gcnew System::Windows::Forms::Label());
                        this->LabSize = (gcnew System::Windows::Forms::Label());
                        this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
                        this->label3 = (gcnew System::Windows::Forms::Label());
                        this->LabStatus = (gcnew System::Windows::Forms::Label());
                        this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
                        this->SuspendLayout();
                        // 
                        // label1
                        // 
                        this->label1->AutoSize = true;
                        this->label1->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->label1->Location = System::Drawing::Point(12, 9);
                        this->label1->Name = L"label1";
                        this->label1->Size = System::Drawing::Size(36, 16);
                        this->label1->TabIndex = 0;
                        this->label1->Text = L"File:";
                        // 
                        // LabFilename
                        // 
                        this->LabFilename->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
                        this->LabFilename->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->LabFilename->Location = System::Drawing::Point(80, 9);
                        this->LabFilename->Name = L"LabFilename";
                        this->LabFilename->RightToLeft = System::Windows::Forms::RightToLeft::No;
                        this->LabFilename->Size = System::Drawing::Size(450, 43);
                        this->LabFilename->TabIndex = 1;
                        this->LabFilename->Text = L"filename";
                        this->LabFilename->UseWaitCursor = true;
                        this->LabFilename->Click += gcnew System::EventHandler(this, &ExtractDialog::LabFilename_Click);
                        // 
                        // label2
                        // 
                        this->label2->AutoSize = true;
                        this->label2->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->label2->Location = System::Drawing::Point(12, 52);
                        this->label2->Name = L"label2";
                        this->label2->Size = System::Drawing::Size(40, 16);
                        this->label2->TabIndex = 2;
                        this->label2->Text = L"Size:";
                        // 
                        // LabSize
                        // 
                        this->LabSize->AutoSize = true;
                        this->LabSize->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->LabSize->Location = System::Drawing::Point(80, 52);
                        this->LabSize->Name = L"LabSize";
                        this->LabSize->Size = System::Drawing::Size(57, 16);
                        this->LabSize->TabIndex = 3;
                        this->LabSize->Text = L"filename";
                        // 
                        // progressBar1
                        // 
                        this->progressBar1->Location = System::Drawing::Point(12, 97);
                        this->progressBar1->Name = L"progressBar1";
                        this->progressBar1->Size = System::Drawing::Size(518, 32);
                        this->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
                        this->progressBar1->TabIndex = 4;
                        // 
                        // label3
                        // 
                        this->label3->AutoSize = true;
                        this->label3->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->label3->Location = System::Drawing::Point(12, 73);
                        this->label3->Name = L"label3";
                        this->label3->Size = System::Drawing::Size(47, 16);
                        this->label3->TabIndex = 5;
                        this->label3->Text = L"Status";
                        // 
                        // LabStatus
                        // 
                        this->LabStatus->AutoSize = true;
                        this->LabStatus->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->LabStatus->Location = System::Drawing::Point(80, 72);
                        this->LabStatus->Name = L"LabStatus";
                        this->LabStatus->Size = System::Drawing::Size(57, 16);
                        this->LabStatus->TabIndex = 6;
                        this->LabStatus->Text = L"filename";
                        // 
                        // ExtractDialog
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(542, 135);
                        this->ControlBox = false;
                        this->Controls->Add(this->LabStatus);
                        this->Controls->Add(this->label3);
                        this->Controls->Add(this->progressBar1);
                        this->Controls->Add(this->LabSize);
                        this->Controls->Add(this->label2);
                        this->Controls->Add(this->LabFilename);
                        this->Controls->Add(this->label1);
                        this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
                        this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
                        this->Name = L"ExtractDialog";
                        this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
                        this->Text = L"Extracting";
                        this->Load += gcnew System::EventHandler(this, &ExtractDialog::ExtractDialog_Load);
                        this->ResumeLayout(false);
                        this->PerformLayout();

                }
#pragma endregion
        private: System::Void ExtractDialog_Load(System::Object^  sender, System::EventArgs^  e) {
                                 this->Start();
                         }
        private: System::Void LabFilename_Click(System::Object^  sender, System::EventArgs^  e) {
                         }
};
}