Subversion Repositories spk

Rev

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