| 1 | cycrow | 1 | #pragma once
 | 
        
           |  |  | 2 |   | 
        
           |  |  | 3 | using namespace System;
 | 
        
           |  |  | 4 | using namespace System::ComponentModel;
 | 
        
           |  |  | 5 | using namespace System::Collections;
 | 
        
           |  |  | 6 | using namespace System::Windows::Forms;
 | 
        
           |  |  | 7 | using namespace System::Data;
 | 
        
           |  |  | 8 | using namespace System::Drawing;
 | 
        
           |  |  | 9 |   | 
        
           |  |  | 10 | #include <spk.h>
 | 
        
           |  |  | 11 |   | 
        
           |  |  | 12 | enum {ADDSTATUS_READ, ADDSTATUS_ADD, ADDSTATUS_SAVE, ADDSTATUS_REMOVE};
 | 
        
           |  |  | 13 |   | 
        
           |  |  | 14 | typedef struct SAddFile {
 | 
        
           |  |  | 15 | 	CyString sFile;
 | 
        
           |  |  | 16 | 	CyString sDir;
 | 
        
           |  |  | 17 | 	int		 iType;
 | 
        
           |  |  | 18 | 	int		 iGame;
 | 
        
           |  |  | 19 | } SAddFile;
 | 
        
           |  |  | 20 |   | 
        
           |  |  | 21 | namespace SpkExplorer {
 | 
        
           |  |  | 22 |   | 
        
           |  |  | 23 | 	/// <summary>
 | 
        
           |  |  | 24 | 	/// Summary for AddDialog
 | 
        
           |  |  | 25 | 	///
 | 
        
           |  |  | 26 | 	/// WARNING: If you change the name of this class, you will need to change the
 | 
        
           |  |  | 27 | 	///          'Resource File Name' property for the managed resource compiler tool
 | 
        
           |  |  | 28 | 	///          associated with all .resx files this class depends on.  Otherwise,
 | 
        
           |  |  | 29 | 	///          the designers will not be able to interact properly with localized
 | 
        
           |  |  | 30 | 	///          resources associated with this form.
 | 
        
           |  |  | 31 | 	/// </summary>
 | 
        
           |  |  | 32 | 	public ref class AddDialog : public System::Windows::Forms::Form
 | 
        
           |  |  | 33 | 	{
 | 
        
           |  |  | 34 | 	public:
 | 
        
           |  |  | 35 | 		AddDialog(CBaseFile *p, CMultiSpkFile *package)
 | 
        
           |  |  | 36 | 		{
 | 
        
           |  |  | 37 | 			this->Init();
 | 
        
           |  |  | 38 |   | 
        
           |  |  | 39 | 			m_pPackage = p;
 | 
        
           |  |  | 40 | 			m_pMultiPackage = package;
 | 
        
           |  |  | 41 | 		}
 | 
        
           |  |  | 42 |   | 
        
           |  |  | 43 | 		void Init()
 | 
        
           |  |  | 44 | 		{
 | 
        
           |  |  | 45 | 			InitializeComponent();
 | 
        
           |  |  | 46 |   | 
        
           |  |  | 47 | 			m_iStatus = ADDSTATUS_READ;
 | 
        
           |  |  | 48 |   | 
        
           |  |  | 49 | 			m_bRemove = false;
 | 
        
           |  |  | 50 | 			m_pMultiPackage = NULL;
 | 
        
           |  |  | 51 | 			m_pPackage = NULL;
 | 
        
           |  |  | 52 | 			m_lFiles = new CLinkList<SAddFile>;
 | 
        
           |  |  | 53 |   | 
        
           |  |  | 54 | 			m_bUpdatedPackage = false;
 | 
        
           |  |  | 55 |   | 
        
           |  |  | 56 | 			backgroundWorker1->DoWork += gcnew DoWorkEventHandler( this, &AddDialog::Background_DoWork );
 | 
        
           |  |  | 57 | 			backgroundWorker1->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler( this, &AddDialog::Background_Finished );
 | 
        
           |  |  | 58 | 		}
 | 
        
           |  |  | 59 |   | 
        
           |  |  | 60 | 		void SetRemove() 
 | 
        
           |  |  | 61 | 		{ 
 | 
        
           |  |  | 62 | 			this->Text = "Removing Files";
 | 
        
           |  |  | 63 | 			m_bRemove = true; 
 | 
        
           |  |  | 64 | 		}
 | 
        
           |  |  | 65 |   | 
        
           |  |  | 66 | 		void AddFile(System::String ^file, System::String ^dir, int type, int game);
 | 
        
           |  |  | 67 | 		void AddFileArray(cli::array<System::String ^> ^list, System::String ^dir, int type, int game);
 | 
        
           |  |  | 68 | 		void AddFileList(ArrayList ^list, System::String ^dir, int type, int game);
 | 
        
           |  |  | 69 |   | 
        
           |  |  | 70 | 		bool AnyFiles() { return !m_lFiles->empty(); }
 | 
        
           |  |  | 71 |   | 
        
           |  |  | 72 | 	protected:
 | 
        
           |  |  | 73 | 		/// <summary>
 | 
        
           |  |  | 74 | 		/// Clean up any resources being used.
 | 
        
           |  |  | 75 | 		/// </summary>
 | 
        
           |  |  | 76 | 		~AddDialog()
 | 
        
           |  |  | 77 | 		{
 | 
        
           |  |  | 78 | 			delete m_lFiles;
 | 
        
           |  |  | 79 | 			if (components)
 | 
        
           |  |  | 80 | 			{
 | 
        
           |  |  | 81 | 				delete components;
 | 
        
           |  |  | 82 | 			}
 | 
        
           |  |  | 83 | 		}
 | 
        
           |  |  | 84 | 	private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
 | 
        
           |  |  | 85 | 	protected: 
 | 
        
           |  |  | 86 |   | 
        
           |  |  | 87 | 	private:
 | 
        
           |  |  | 88 | 		bool			 m_bRemove;
 | 
        
           |  |  | 89 | 		bool			 m_bUpdatedPackage;
 | 
        
           |  |  | 90 | 		int				 m_iStatus;
 | 
        
           |  |  | 91 | 		CBaseFile		*m_pPackage;
 | 
        
           |  |  | 92 | 		CLinkList<SAddFile> *m_lFiles;
 | 
        
           |  |  | 93 | 		CMultiSpkFile	*m_pMultiPackage;
 | 
        
           |  |  | 94 | 	private: System::Windows::Forms::Label^  label1;
 | 
        
           |  |  | 95 | 	private: System::Windows::Forms::Label^  LabFile;
 | 
        
           |  |  | 96 |   | 
        
           |  |  | 97 | 	private: System::Windows::Forms::ProgressBar^  progressBar1;
 | 
        
           |  |  | 98 |   | 
        
           |  |  | 99 | 		void Background_DoWork(System::Object ^Sender, DoWorkEventArgs ^E);
 | 
        
           |  |  | 100 | 		void Background_Finished(System::Object ^Sender, RunWorkerCompletedEventArgs ^E);
 | 
        
           |  |  | 101 |   | 
        
           |  |  | 102 | 		/// <summary>
 | 
        
           |  |  | 103 | 		/// Required designer variable.
 | 
        
           |  |  | 104 | 		/// </summary>
 | 
        
           |  |  | 105 | 		System::ComponentModel::Container ^components;
 | 
        
           |  |  | 106 |   | 
        
           |  |  | 107 | #pragma region Windows Form Designer generated code
 | 
        
           |  |  | 108 | 		/// <summary>
 | 
        
           |  |  | 109 | 		/// Required method for Designer support - do not modify
 | 
        
           |  |  | 110 | 		/// the contents of this method with the code editor.
 | 
        
           |  |  | 111 | 		/// </summary>
 | 
        
           |  |  | 112 | 		void InitializeComponent(void)
 | 
        
           |  |  | 113 | 		{
 | 
        
           |  |  | 114 | 			this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
 | 
        
           |  |  | 115 | 			this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
 | 
        
           |  |  | 116 | 			this->label1 = (gcnew System::Windows::Forms::Label());
 | 
        
           |  |  | 117 | 			this->LabFile = (gcnew System::Windows::Forms::Label());
 | 
        
           |  |  | 118 | 			this->SuspendLayout();
 | 
        
           |  |  | 119 | 			// 
 | 
        
           |  |  | 120 | 			// progressBar1
 | 
        
           |  |  | 121 | 			// 
 | 
        
           |  |  | 122 | 			this->progressBar1->Location = System::Drawing::Point(16, 40);
 | 
        
           |  |  | 123 | 			this->progressBar1->Name = L"progressBar1";
 | 
        
           |  |  | 124 | 			this->progressBar1->Size = System::Drawing::Size(446, 23);
 | 
        
           |  |  | 125 | 			this->progressBar1->TabIndex = 0;
 | 
        
           |  |  | 126 | 			// 
 | 
        
           |  |  | 127 | 			// label1
 | 
        
           |  |  | 128 | 			// 
 | 
        
           |  |  | 129 | 			this->label1->AutoSize = true;
 | 
        
           |  |  | 130 | 			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
 | 
        
           |  |  | 131 | 				static_cast<System::Byte>(0)));
 | 
        
           |  |  | 132 | 			this->label1->Location = System::Drawing::Point(12, 9);
 | 
        
           |  |  | 133 | 			this->label1->Name = L"label1";
 | 
        
           |  |  | 134 | 			this->label1->Size = System::Drawing::Size(43, 20);
 | 
        
           |  |  | 135 | 			this->label1->TabIndex = 1;
 | 
        
           |  |  | 136 | 			this->label1->Text = L"File:";
 | 
        
           |  |  | 137 | 			// 
 | 
        
           |  |  | 138 | 			// LabFile
 | 
        
           |  |  | 139 | 			// 
 | 
        
           |  |  | 140 | 			this->LabFile->AutoSize = true;
 | 
        
           |  |  | 141 | 			this->LabFile->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
 | 
        
           |  |  | 142 | 				static_cast<System::Byte>(0)));
 | 
        
           |  |  | 143 | 			this->LabFile->Location = System::Drawing::Point(61, 9);
 | 
        
           |  |  | 144 | 			this->LabFile->Name = L"LabFile";
 | 
        
           |  |  | 145 | 			this->LabFile->Size = System::Drawing::Size(69, 20);
 | 
        
           |  |  | 146 | 			this->LabFile->TabIndex = 2;
 | 
        
           |  |  | 147 | 			this->LabFile->Text = L"filename";
 | 
        
           |  |  | 148 | 			// 
 | 
        
           |  |  | 149 | 			// AddDialog
 | 
        
           |  |  | 150 | 			// 
 | 
        
           |  |  | 151 | 			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
 | 
        
           |  |  | 152 | 			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
 | 
        
           |  |  | 153 | 			this->ClientSize = System::Drawing::Size(474, 73);
 | 
        
           |  |  | 154 | 			this->ControlBox = false;
 | 
        
           |  |  | 155 | 			this->Controls->Add(this->LabFile);
 | 
        
           |  |  | 156 | 			this->Controls->Add(this->label1);
 | 
        
           |  |  | 157 | 			this->Controls->Add(this->progressBar1);
 | 
        
           |  |  | 158 | 			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog;
 | 
        
           |  |  | 159 | 			this->Name = L"AddDialog";
 | 
        
           |  |  | 160 | 			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
 | 
        
           |  |  | 161 | 			this->Text = L"Adding Files";
 | 
        
           |  |  | 162 | 			this->Load += gcnew System::EventHandler(this, &AddDialog::AddDialog_Load);
 | 
        
           |  |  | 163 | 			this->ResumeLayout(false);
 | 
        
           |  |  | 164 | 			this->PerformLayout();
 | 
        
           |  |  | 165 |   | 
        
           |  |  | 166 | 		}
 | 
        
           |  |  | 167 | #pragma endregion
 | 
        
           |  |  | 168 | 	private: System::Void AddDialog_Load(System::Object^  sender, System::EventArgs^  e) {
 | 
        
           |  |  | 169 | 				 this->backgroundWorker1->RunWorkerAsync();
 | 
        
           |  |  | 170 | 			 }
 | 
        
           |  |  | 171 | 	};
 | 
        
           |  |  | 172 | }
 |