Subversion Repositories spk

Rev

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

Rev Author Line No. Line
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
enum {WORKER_NONE, WORKER_READ, WORKER_UNCOMPRESS, WORKER_WRITE};
11
#include <spk.h>
12
 
13
namespace SpkExplorer {
14
 
15
	/// <summary>
16
	/// Summary for ExtractDialog
17
	///
18
	/// WARNING: If you change the name of this class, you will need to change the
19
	///          'Resource File Name' property for the managed resource compiler tool
20
	///          associated with all .resx files this class depends on.  Otherwise,
21
	///          the designers will not be able to interact properly with localized
22
	///          resources associated with this form.
23
	/// </summary>
24
	public ref class ExtractDialog : public System::Windows::Forms::Form
25
	{
26
	public:
128 cycrow 27
		ExtractDialog(CLinkList<C_File> *list, System::String ^dir, CBaseFile *p, int game, CPackages *packages)
1 cycrow 28
		{
29
			this->Init(dir);
30
			m_pPackage = p;
128 cycrow 31
			_pPackages = packages;
1 cycrow 32
			m_pList = list;
33
			m_iGame = game;
34
		}
128 cycrow 35
		ExtractDialog(CLinkList<SMultiSpkFile> *list, System::String ^dir, CMultiSpkFile *p, CPackages *packages)
1 cycrow 36
		{
37
			this->Init(dir);
38
			m_pMultiPackage = p;
39
			m_pMultiList = list;
128 cycrow 40
			_pPackages = packages;
1 cycrow 41
		}
42
 
43
		int ExtractedCount()
44
		{
45
			return m_iExtractCount;
46
		}
47
		void Init(String ^dir)
48
		{
49
			InitializeComponent();
50
 
51
			backgroundWorker1->DoWork += gcnew DoWorkEventHandler( this, &ExtractDialog::Background_DoWork );
52
			backgroundWorker1->RunWorkerCompleted += gcnew RunWorkerCompletedEventHandler( this, &ExtractDialog::Background_Finished );
53
 
54
			m_iExtractCount = 0;
55
			m_pWorkingPackage = NULL;
56
			m_pPackage = NULL;
57
			m_pList = NULL;
58
			m_pMultiPackage = NULL;
59
			m_pMultiList = NULL;
219 cycrow 60
			m_pFailedList = new Utils::WStringList;
61
			m_sFailed = L"";
1 cycrow 62
			m_iCount = 0;
63
			m_sToDir = dir;
64
			m_bOK = true;
65
			m_pWorkingFile = NULL;
66
			m_iWorkingStatus = WORKER_NONE;
67
			m_iUncompressSize = 0;
68
			m_pUncompressData = 0;
69
 
70
			m_bYesToAll = m_bNoToAll = m_bCancel = false;
71
		}
72
 
73
		bool OK() { return m_bOK; }
74
		bool Canceled() { return m_bCancel; }
75
 
76
	protected:
77
		void Background_DoWork(System::Object ^Sender, DoWorkEventArgs ^E);
78
		void Background_Finished(System::Object ^Sender, RunWorkerCompletedEventArgs ^E);
79
		void UpdateDisplay();
80
		void StartWork(int status);
81
		void Finished();
82
		bool CheckExists(System::String ^file);
83
		void DoNextFile();
84
 
85
		CLinkList<C_File>		*m_pList;
86
		CBaseFile				*m_pPackage;
128 cycrow 87
		CPackages				*_pPackages;
1 cycrow 88
		CLinkList<SMultiSpkFile>	*m_pMultiList;
89
		CMultiSpkFile			*m_pMultiPackage;
90
		C_File					*m_pWorkingFile;
91
		SMultiSpkFile			*m_pWorkingPackage;
92
		int						 m_iWorkingStatus;
93
		int						 m_iCount;
94
		System::String			^m_sFailed;
219 cycrow 95
		Utils::WStringList		*m_pFailedList;
1 cycrow 96
		unsigned char			*m_pUncompressData;
97
		long					 m_iUncompressSize;
98
		int						 m_iExtractCount;
99
		int						 m_iGame;
100
 
101
		bool					 m_bNoToAll;
102
		bool					 m_bYesToAll;
103
		bool					 m_bCancel;
104
 
105
	private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
106
	protected: 
107
		bool				 m_bOK;
108
		/// <summary>
109
		/// Clean up any resources being used.
110
		/// </summary>
111
		~ExtractDialog()
112
		{
113
			delete m_pFailedList;
114
			if (components)
115
			{
116
				delete components;
117
			}
118
		}
119
	private: System::Windows::Forms::Label^  label1;
120
	protected: 
121
	private: System::Windows::Forms::Label^  LabFilename;
122
	private: System::Windows::Forms::Label^  label2;
123
	private: System::Windows::Forms::Label^  LabSize;
124
	private: System::Windows::Forms::ProgressBar^  progressBar1;
125
 
126
	private: System::Windows::Forms::Label^  label3;
127
	private: System::Windows::Forms::Label^  LabStatus;
128
			 System::String		^m_sToDir;
129
 
130
	private:
131
		void Start();
132
 
133
		/// <summary>
134
		/// Required designer variable.
135
		/// </summary>
136
		System::ComponentModel::Container ^components;
137
 
138
#pragma region Windows Form Designer generated code
139
		/// <summary>
140
		/// Required method for Designer support - do not modify
141
		/// the contents of this method with the code editor.
142
		/// </summary>
143
		void InitializeComponent(void)
144
		{
145
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(ExtractDialog::typeid));
146
			this->label1 = (gcnew System::Windows::Forms::Label());
147
			this->LabFilename = (gcnew System::Windows::Forms::Label());
148
			this->label2 = (gcnew System::Windows::Forms::Label());
149
			this->LabSize = (gcnew System::Windows::Forms::Label());
150
			this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
151
			this->label3 = (gcnew System::Windows::Forms::Label());
152
			this->LabStatus = (gcnew System::Windows::Forms::Label());
153
			this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
154
			this->SuspendLayout();
155
			// 
156
			// label1
157
			// 
158
			this->label1->AutoSize = true;
159
			this->label1->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
160
				static_cast<System::Byte>(0)));
161
			this->label1->Location = System::Drawing::Point(12, 9);
162
			this->label1->Name = L"label1";
163
			this->label1->Size = System::Drawing::Size(36, 16);
164
			this->label1->TabIndex = 0;
165
			this->label1->Text = L"File:";
166
			// 
167
			// LabFilename
168
			// 
169
			this->LabFilename->FlatStyle = System::Windows::Forms::FlatStyle::Popup;
170
			this->LabFilename->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
171
				static_cast<System::Byte>(0)));
172
			this->LabFilename->Location = System::Drawing::Point(80, 9);
173
			this->LabFilename->Name = L"LabFilename";
174
			this->LabFilename->RightToLeft = System::Windows::Forms::RightToLeft::No;
175
			this->LabFilename->Size = System::Drawing::Size(450, 43);
176
			this->LabFilename->TabIndex = 1;
177
			this->LabFilename->Text = L"filename";
178
			this->LabFilename->UseWaitCursor = true;
179
			this->LabFilename->Click += gcnew System::EventHandler(this, &ExtractDialog::LabFilename_Click);
180
			// 
181
			// label2
182
			// 
183
			this->label2->AutoSize = true;
184
			this->label2->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
185
				static_cast<System::Byte>(0)));
186
			this->label2->Location = System::Drawing::Point(12, 52);
187
			this->label2->Name = L"label2";
188
			this->label2->Size = System::Drawing::Size(40, 16);
189
			this->label2->TabIndex = 2;
190
			this->label2->Text = L"Size:";
191
			// 
192
			// LabSize
193
			// 
194
			this->LabSize->AutoSize = true;
195
			this->LabSize->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
196
				static_cast<System::Byte>(0)));
197
			this->LabSize->Location = System::Drawing::Point(80, 52);
198
			this->LabSize->Name = L"LabSize";
199
			this->LabSize->Size = System::Drawing::Size(57, 16);
200
			this->LabSize->TabIndex = 3;
201
			this->LabSize->Text = L"filename";
202
			// 
203
			// progressBar1
204
			// 
205
			this->progressBar1->Location = System::Drawing::Point(12, 97);
206
			this->progressBar1->Name = L"progressBar1";
207
			this->progressBar1->Size = System::Drawing::Size(518, 32);
208
			this->progressBar1->Style = System::Windows::Forms::ProgressBarStyle::Continuous;
209
			this->progressBar1->TabIndex = 4;
210
			// 
211
			// label3
212
			// 
213
			this->label3->AutoSize = true;
214
			this->label3->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
215
				static_cast<System::Byte>(0)));
216
			this->label3->Location = System::Drawing::Point(12, 73);
217
			this->label3->Name = L"label3";
218
			this->label3->Size = System::Drawing::Size(47, 16);
219
			this->label3->TabIndex = 5;
220
			this->label3->Text = L"Status";
221
			// 
222
			// LabStatus
223
			// 
224
			this->LabStatus->AutoSize = true;
225
			this->LabStatus->Font = (gcnew System::Drawing::Font(L"Arial", 9.75F, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
226
				static_cast<System::Byte>(0)));
227
			this->LabStatus->Location = System::Drawing::Point(80, 72);
228
			this->LabStatus->Name = L"LabStatus";
229
			this->LabStatus->Size = System::Drawing::Size(57, 16);
230
			this->LabStatus->TabIndex = 6;
231
			this->LabStatus->Text = L"filename";
232
			// 
233
			// ExtractDialog
234
			// 
235
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
236
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
237
			this->ClientSize = System::Drawing::Size(542, 135);
238
			this->ControlBox = false;
239
			this->Controls->Add(this->LabStatus);
240
			this->Controls->Add(this->label3);
241
			this->Controls->Add(this->progressBar1);
242
			this->Controls->Add(this->LabSize);
243
			this->Controls->Add(this->label2);
244
			this->Controls->Add(this->LabFilename);
245
			this->Controls->Add(this->label1);
246
			this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
247
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
248
			this->Name = L"ExtractDialog";
249
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
250
			this->Text = L"Extracting";
251
			this->Load += gcnew System::EventHandler(this, &ExtractDialog::ExtractDialog_Load);
252
			this->ResumeLayout(false);
253
			this->PerformLayout();
254
 
255
		}
256
#pragma endregion
257
	private: System::Void ExtractDialog_Load(System::Object^  sender, System::EventArgs^  e) {
258
				 this->Start();
259
			 }
260
	private: System::Void LabFilename_Click(System::Object^  sender, System::EventArgs^  e) {
261
			 }
262
};
263
}