Subversion Repositories spk

Rev

Rev 1 | 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;

#include <spk.h>

enum {ADDSTATUS_READ, ADDSTATUS_ADD, ADDSTATUS_SAVE, ADDSTATUS_REMOVE};

typedef struct SAddFile {
        Utils::WString sFile;
        Utils::WString sDir;
        int              iType;
        int              iGame;
} SAddFile;

namespace SpkExplorer {

        /// <summary>
        /// Summary for AddDialog
        ///
        /// 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 AddDialog : public System::Windows::Forms::Form
        {
        public:
                AddDialog(CBaseFile *p, CMultiSpkFile *package)
                {
                        this->Init();

                        m_pPackage = p;
                        m_pMultiPackage = package;
                }

                void Init()
                {
                        InitializeComponent();

                        m_iStatus = ADDSTATUS_READ;

                        m_bRemove = false;
                        m_pMultiPackage = NULL;
                        m_pPackage = NULL;
                        m_lFiles = new CLinkList<SAddFile>;

                        m_bUpdatedPackage = false;

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

                void SetRemove() 
                { 
                        this->Text = "Removing Files";
                        m_bRemove = true; 
                }

                void AddFile(System::String ^file, System::String ^dir, int type, int game);
                void AddFileArray(cli::array<System::String ^> ^list, System::String ^dir, int type, int game);
                void AddFileList(ArrayList ^list, System::String ^dir, int type, int game);

                bool AnyFiles() { return !m_lFiles->empty(); }

        protected:
                /// <summary>
                /// Clean up any resources being used.
                /// </summary>
                ~AddDialog()
                {
                        delete m_lFiles;
                        if (components)
                        {
                                delete components;
                        }
                }
        private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
        protected: 

        private:
                bool                     m_bRemove;
                bool                     m_bUpdatedPackage;
                int                              m_iStatus;
                CBaseFile               *m_pPackage;
                CLinkList<SAddFile> *m_lFiles;
                CMultiSpkFile   *m_pMultiPackage;
        private: System::Windows::Forms::Label^  label1;
        private: System::Windows::Forms::Label^  LabFile;

        private: System::Windows::Forms::ProgressBar^  progressBar1;

                void Background_DoWork(System::Object ^Sender, DoWorkEventArgs ^E);
                void Background_Finished(System::Object ^Sender, RunWorkerCompletedEventArgs ^E);

                /// <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)
                {
                        this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
                        this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
                        this->label1 = (gcnew System::Windows::Forms::Label());
                        this->LabFile = (gcnew System::Windows::Forms::Label());
                        this->SuspendLayout();
                        // 
                        // progressBar1
                        // 
                        this->progressBar1->Location = System::Drawing::Point(16, 40);
                        this->progressBar1->Name = L"progressBar1";
                        this->progressBar1->Size = System::Drawing::Size(446, 23);
                        this->progressBar1->TabIndex = 0;
                        // 
                        // label1
                        // 
                        this->label1->AutoSize = true;
                        this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, 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(43, 20);
                        this->label1->TabIndex = 1;
                        this->label1->Text = L"File:";
                        // 
                        // LabFile
                        // 
                        this->LabFile->AutoSize = true;
                        this->LabFile->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
                                static_cast<System::Byte>(0)));
                        this->LabFile->Location = System::Drawing::Point(61, 9);
                        this->LabFile->Name = L"LabFile";
                        this->LabFile->Size = System::Drawing::Size(69, 20);
                        this->LabFile->TabIndex = 2;
                        this->LabFile->Text = L"filename";
                        // 
                        // AddDialog
                        // 
                        this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
                        this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
                        this->ClientSize = System::Drawing::Size(474, 73);
                        this->ControlBox = false;
                        this->Controls->Add(this->LabFile);
                        this->Controls->Add(this->label1);
                        this->Controls->Add(this->progressBar1);
                        this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
                        this->Name = L"AddDialog";
                        this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
                        this->Text = L"Adding Files";
                        this->Load += gcnew System::EventHandler(this, &AddDialog::AddDialog_Load);
                        this->ResumeLayout(false);
                        this->PerformLayout();

                }
#pragma endregion
        private: System::Void AddDialog_Load(System::Object^  sender, System::EventArgs^  e) {
                                 this->backgroundWorker1->RunWorkerAsync();
                         }
        };
}