Subversion Repositories spk

Rev

Rev 1 | Rev 175 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1 Rev 47
Line 29... Line 29...
29
			m_iStatus = 0;
29
			m_iStatus = 0;
30
			m_pMultiPackage = NULL;
30
			m_pMultiPackage = NULL;
31
			m_pPackage = package;
31
			m_pPackage = package;
32
			m_sSaveFile = saveFile;
32
			m_sSaveFile = saveFile;
33
			m_pInfo = new CProgressInfoDone;
33
			m_pInfo = new CProgressInfoDone;
-
 
34
			m_pInfo2 = new CProgressInfoDone;
34
		}
35
		}
35
 
36
 
36
		SaveDialog(CMultiSpkFile *package, String ^saveFile)
37
		SaveDialog(CMultiSpkFile *package, String ^saveFile)
37
		{
38
		{
38
			InitializeComponent();
39
			InitializeComponent();
Line 40... Line 41...
40
			m_iStatus = 0;
41
			m_iStatus = 0;
41
			m_pMultiPackage = package;
42
			m_pMultiPackage = package;
42
			m_pPackage = NULL;
43
			m_pPackage = NULL;
43
			m_sSaveFile = saveFile;
44
			m_sSaveFile = saveFile;
44
			m_pInfo = new CProgressInfoDone;
45
			m_pInfo = new CProgressInfoDone;
-
 
46
			m_pInfo2 = new CProgressInfoDone;
45
		}
47
		}
46
 
48
 
47
	protected:
49
	protected:
48
		/// <summary>
50
		/// <summary>
49
		/// Clean up any resources being used.
51
		/// Clean up any resources being used.
Line 53... Line 55...
53
			if (components)
55
			if (components)
54
			{
56
			{
55
				delete components;
57
				delete components;
56
			}
58
			}
57
			delete m_pInfo;
59
			delete m_pInfo;
-
 
60
			delete m_pInfo2;
58
		}
61
		}
59
 
62
 
60
		int m_iStatus;
63
		int m_iStatus;
61
		CBaseFile *m_pPackage;
64
		CBaseFile *m_pPackage;
62
		CMultiSpkFile *m_pMultiPackage;
65
		CMultiSpkFile *m_pMultiPackage;
63
		CProgressInfoDone *m_pInfo;
66
		CProgressInfoDone *m_pInfo;
-
 
67
		CProgressInfoDone *m_pInfo2;
64
		String	^m_sSaveFile;
68
		String	^m_sSaveFile;
65
	private: System::Windows::Forms::Timer^  timer1;
69
	private: System::Windows::Forms::Timer^  timer1;
66
	protected: 
70
	protected: 
67
	private: System::Windows::Forms::Label^  label1;
71
	private: System::Windows::Forms::Label^  label1;
68
	private: System::Windows::Forms::Panel^  panel1;
72
	private: System::Windows::Forms::Panel^  panel1;
Line 71... Line 75...
71
	private: System::Windows::Forms::Label^  LabelCompress;
75
	private: System::Windows::Forms::Label^  LabelCompress;
72
	private: System::Windows::Forms::Label^  LabelStatus;
76
	private: System::Windows::Forms::Label^  LabelStatus;
73
	private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
77
	private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
74
	private: System::Windows::Forms::ProgressBar^  progressBar1;
78
	private: System::Windows::Forms::ProgressBar^  progressBar1;
75
	private: System::Windows::Forms::Panel^  panel2;
79
	private: System::Windows::Forms::Panel^  panel2;
-
 
80
	private: System::Windows::Forms::Panel^  panel3;
-
 
81
	private: System::Windows::Forms::ProgressBar^  progressBar2;
76
	private: System::ComponentModel::IContainer^  components;
82
	private: System::ComponentModel::IContainer^  components;
77
 
83
 
78
	private:
84
	private:
79
		/// <summary>
85
		/// <summary>
80
		/// Required designer variable.
86
		/// Required designer variable.
Line 97... Line 103...
97
			this->LabelCompress = (gcnew System::Windows::Forms::Label());
103
			this->LabelCompress = (gcnew System::Windows::Forms::Label());
98
			this->LabelStatus = (gcnew System::Windows::Forms::Label());
104
			this->LabelStatus = (gcnew System::Windows::Forms::Label());
99
			this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
105
			this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
100
			this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
106
			this->progressBar1 = (gcnew System::Windows::Forms::ProgressBar());
101
			this->panel2 = (gcnew System::Windows::Forms::Panel());
107
			this->panel2 = (gcnew System::Windows::Forms::Panel());
-
 
108
			this->panel3 = (gcnew System::Windows::Forms::Panel());
-
 
109
			this->progressBar2 = (gcnew System::Windows::Forms::ProgressBar());
102
			this->panel1->SuspendLayout();
110
			this->panel1->SuspendLayout();
103
			this->PanelCompress->SuspendLayout();
111
			this->PanelCompress->SuspendLayout();
104
			this->panel2->SuspendLayout();
112
			this->panel2->SuspendLayout();
-
 
113
			this->panel3->SuspendLayout();
105
			this->SuspendLayout();
114
			this->SuspendLayout();
106
			// 
115
			// 
107
			// timer1
116
			// timer1
108
			// 
117
			// 
109
			this->timer1->Enabled = true;
118
			this->timer1->Enabled = true;
Line 128... Line 137...
128
			this->panel1->Controls->Add(this->label2);
137
			this->panel1->Controls->Add(this->label2);
129
			this->panel1->Controls->Add(this->label1);
138
			this->panel1->Controls->Add(this->label1);
130
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
139
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
131
			this->panel1->Location = System::Drawing::Point(0, 0);
140
			this->panel1->Location = System::Drawing::Point(0, 0);
132
			this->panel1->Name = L"panel1";
141
			this->panel1->Name = L"panel1";
133
			this->panel1->Size = System::Drawing::Size(579, 28);
142
			this->panel1->Size = System::Drawing::Size(636, 28);
134
			this->panel1->TabIndex = 1;
143
			this->panel1->TabIndex = 1;
135
			this->panel1->UseWaitCursor = true;
144
			this->panel1->UseWaitCursor = true;
136
			// 
145
			// 
137
			// label2
146
			// label2
138
			// 
147
			// 
139
			this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
148
			this->label2->Dock = System::Windows::Forms::DockStyle::Fill;
140
			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
149
			this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
141
				static_cast<System::Byte>(0)));
150
				static_cast<System::Byte>(0)));
142
			this->label2->Location = System::Drawing::Point(163, 0);
151
			this->label2->Location = System::Drawing::Point(163, 0);
143
			this->label2->Name = L"label2";
152
			this->label2->Name = L"label2";
144
			this->label2->Size = System::Drawing::Size(416, 28);
153
			this->label2->Size = System::Drawing::Size(473, 28);
145
			this->label2->TabIndex = 1;
154
			this->label2->TabIndex = 1;
146
			this->label2->Text = L"filename";
155
			this->label2->Text = L"filename";
147
			this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
156
			this->label2->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
148
			this->label2->UseWaitCursor = true;
157
			this->label2->UseWaitCursor = true;
149
			// 
158
			// 
Line 152... Line 161...
152
			this->PanelCompress->Controls->Add(this->LabelCompress);
161
			this->PanelCompress->Controls->Add(this->LabelCompress);
153
			this->PanelCompress->Controls->Add(this->LabelStatus);
162
			this->PanelCompress->Controls->Add(this->LabelStatus);
154
			this->PanelCompress->Dock = System::Windows::Forms::DockStyle::Top;
163
			this->PanelCompress->Dock = System::Windows::Forms::DockStyle::Top;
155
			this->PanelCompress->Location = System::Drawing::Point(0, 28);
164
			this->PanelCompress->Location = System::Drawing::Point(0, 28);
156
			this->PanelCompress->Name = L"PanelCompress";
165
			this->PanelCompress->Name = L"PanelCompress";
157
			this->PanelCompress->Size = System::Drawing::Size(579, 28);
166
			this->PanelCompress->Size = System::Drawing::Size(636, 28);
158
			this->PanelCompress->TabIndex = 2;
167
			this->PanelCompress->TabIndex = 2;
159
			this->PanelCompress->UseWaitCursor = true;
168
			this->PanelCompress->UseWaitCursor = true;
160
			// 
169
			// 
161
			// LabelCompress
170
			// LabelCompress
162
			// 
171
			// 
163
			this->LabelCompress->Dock = System::Windows::Forms::DockStyle::Fill;
172
			this->LabelCompress->Dock = System::Windows::Forms::DockStyle::Fill;
164
			this->LabelCompress->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
173
			this->LabelCompress->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Italic, System::Drawing::GraphicsUnit::Point, 
165
				static_cast<System::Byte>(0)));
174
				static_cast<System::Byte>(0)));
166
			this->LabelCompress->Location = System::Drawing::Point(163, 0);
175
			this->LabelCompress->Location = System::Drawing::Point(163, 0);
167
			this->LabelCompress->Name = L"LabelCompress";
176
			this->LabelCompress->Name = L"LabelCompress";
168
			this->LabelCompress->Size = System::Drawing::Size(416, 28);
177
			this->LabelCompress->Size = System::Drawing::Size(473, 28);
169
			this->LabelCompress->TabIndex = 1;
178
			this->LabelCompress->TabIndex = 1;
170
			this->LabelCompress->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
179
			this->LabelCompress->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
171
			this->LabelCompress->UseWaitCursor = true;
180
			this->LabelCompress->UseWaitCursor = true;
172
			// 
181
			// 
173
			// LabelStatus
182
			// LabelStatus
Line 192... Line 201...
192
			// 
201
			// 
193
			this->progressBar1->Dock = System::Windows::Forms::DockStyle::Fill;
202
			this->progressBar1->Dock = System::Windows::Forms::DockStyle::Fill;
194
			this->progressBar1->Location = System::Drawing::Point(10, 10);
203
			this->progressBar1->Location = System::Drawing::Point(10, 10);
195
			this->progressBar1->Maximum = 1000;
204
			this->progressBar1->Maximum = 1000;
196
			this->progressBar1->Name = L"progressBar1";
205
			this->progressBar1->Name = L"progressBar1";
197
			this->progressBar1->Size = System::Drawing::Size(559, 25);
206
			this->progressBar1->Size = System::Drawing::Size(616, 25);
198
			this->progressBar1->TabIndex = 5;
207
			this->progressBar1->TabIndex = 5;
199
			this->progressBar1->UseWaitCursor = true;
208
			this->progressBar1->UseWaitCursor = true;
200
			// 
209
			// 
201
			// panel2
210
			// panel2
202
			// 
211
			// 
203
			this->panel2->Controls->Add(this->progressBar1);
212
			this->panel2->Controls->Add(this->progressBar1);
204
			this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
213
			this->panel2->Dock = System::Windows::Forms::DockStyle::Top;
205
			this->panel2->Location = System::Drawing::Point(0, 56);
214
			this->panel2->Location = System::Drawing::Point(0, 56);
206
			this->panel2->Name = L"panel2";
215
			this->panel2->Name = L"panel2";
207
			this->panel2->Padding = System::Windows::Forms::Padding(10);
216
			this->panel2->Padding = System::Windows::Forms::Padding(10);
208
			this->panel2->Size = System::Drawing::Size(579, 45);
217
			this->panel2->Size = System::Drawing::Size(636, 45);
209
			this->panel2->TabIndex = 6;
218
			this->panel2->TabIndex = 6;
210
			this->panel2->UseWaitCursor = true;
219
			this->panel2->UseWaitCursor = true;
-
 
220
			// 
-
 
221
			// panel3
-
 
222
			// 
-
 
223
			this->panel3->Controls->Add(this->progressBar2);
-
 
224
			this->panel3->Dock = System::Windows::Forms::DockStyle::Top;
-
 
225
			this->panel3->Location = System::Drawing::Point(0, 101);
-
 
226
			this->panel3->Name = L"panel3";
-
 
227
			this->panel3->Padding = System::Windows::Forms::Padding(10);
-
 
228
			this->panel3->Size = System::Drawing::Size(636, 45);
-
 
229
			this->panel3->TabIndex = 7;
-
 
230
			this->panel3->UseWaitCursor = true;
-
 
231
			// 
-
 
232
			// progressBar2
-
 
233
			// 
-
 
234
			this->progressBar2->Dock = System::Windows::Forms::DockStyle::Fill;
-
 
235
			this->progressBar2->Location = System::Drawing::Point(10, 10);
-
 
236
			this->progressBar2->Maximum = 1000;
-
 
237
			this->progressBar2->Name = L"progressBar2";
-
 
238
			this->progressBar2->Size = System::Drawing::Size(616, 25);
-
 
239
			this->progressBar2->TabIndex = 5;
-
 
240
			this->progressBar2->UseWaitCursor = true;
211
			// 
241
			// 
212
			// SaveDialog
242
			// SaveDialog
213
			// 
243
			// 
214
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
244
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
215
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
245
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
216
			this->ClientSize = System::Drawing::Size(579, 101);
246
			this->ClientSize = System::Drawing::Size(636, 147);
217
			this->ControlBox = false;
247
			this->ControlBox = false;
-
 
248
			this->Controls->Add(this->panel3);
218
			this->Controls->Add(this->panel2);
249
			this->Controls->Add(this->panel2);
219
			this->Controls->Add(this->PanelCompress);
250
			this->Controls->Add(this->PanelCompress);
220
			this->Controls->Add(this->panel1);
251
			this->Controls->Add(this->panel1);
221
			this->Name = L"SaveDialog";
252
			this->Name = L"SaveDialog";
222
			this->ShowInTaskbar = false;
253
			this->ShowInTaskbar = false;
Line 225... Line 256...
225
			this->UseWaitCursor = true;
256
			this->UseWaitCursor = true;
226
			this->Load += gcnew System::EventHandler(this, &SaveDialog::SaveDialog_Load);
257
			this->Load += gcnew System::EventHandler(this, &SaveDialog::SaveDialog_Load);
227
			this->panel1->ResumeLayout(false);
258
			this->panel1->ResumeLayout(false);
228
			this->PanelCompress->ResumeLayout(false);
259
			this->PanelCompress->ResumeLayout(false);
229
			this->panel2->ResumeLayout(false);
260
			this->panel2->ResumeLayout(false);
-
 
261
			this->panel3->ResumeLayout(false);
230
			this->ResumeLayout(false);
262
			this->ResumeLayout(false);
231
 
263
 
232
		}
264
		}
233
#pragma endregion
265
#pragma endregion
234
	private: System::Void SaveDialog_Load(System::Object^  sender, System::EventArgs^  e) {
266
	private: System::Void SaveDialog_Load(System::Object^  sender, System::EventArgs^  e) {
235
				 this->label2->Text = m_sSaveFile;
267
				 this->label2->Text = m_sSaveFile;
236
				 m_pInfo->SetDone(0);
268
				 m_pInfo->SetDone(0);
-
 
269
				 m_pInfo2->SetDone(0);
237
				 this->backgroundWorker1->RunWorkerAsync();
270
				 this->backgroundWorker1->RunWorkerAsync();
238
			 }
271
			 }
239
	private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
272
	private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
240
				 if ( m_iStatus == 0 )
273
				 if ( m_iStatus == 0 )
241
				 {
274
				 {
Line 254... Line 287...
254
								this->progressBar1->Value = m_pInfo->GetDone();
287
								this->progressBar1->Value = m_pInfo->GetDone();
255
						}
288
						}
256
					}
289
					}
257
					else
290
					else
258
						LabelCompress->Text = "";
291
						LabelCompress->Text = "";
-
 
292
 
-
 
293
					this->progressBar2->Maximum = m_pInfo2->GetMax();
-
 
294
					if ( (int)m_pInfo2->GetDone() >= this->progressBar2->Minimum )
-
 
295
					{
-
 
296
						if ( (int)m_pInfo2->GetDone() > this->progressBar2->Maximum )
-
 
297
							this->progressBar2->Value = this->progressBar2->Maximum;
-
 
298
						else
-
 
299
							this->progressBar2->Value = m_pInfo2->GetDone();
-
 
300
					}
259
				 }
301
				 }
260
				 else if ( m_iStatus == 3 )
302
				 else if ( m_iStatus == 3 )
261
				 {
303
				 {
262
					this->progressBar1->Style = Windows::Forms::ProgressBarStyle::Marquee;
304
					this->progressBar1->Style = Windows::Forms::ProgressBarStyle::Marquee;
263
					LabelStatus->Text = "Writing..";
305
					LabelStatus->Text = "Writing..";
Line 267... Line 309...
267
private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
309
private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
268
				m_iStatus = 0;
310
				m_iStatus = 0;
269
				if ( m_pPackage )
311
				if ( m_pPackage )
270
				{
312
				{
271
					m_pPackage->UpdateSigned(true);
313
					m_pPackage->UpdateSigned(true);
272
					m_pPackage->CompressAllFiles(SPKCOMPRESS_LZMA, m_pInfo);
314
					m_pPackage->CompressAllFiles(SPKCOMPRESS_LZMA, m_pInfo, m_pInfo2);
273
					m_iStatus = 3;
315
					m_iStatus = 3;
274
 
316
 
275
					if ( !m_pPackage->WriteFile(CyStringFromSystemString(m_sSaveFile), m_pInfo) )
317
					if ( !m_pPackage->WriteFile(CyStringFromSystemString(m_sSaveFile), m_pInfo) )
276
						m_iStatus = 1;
318
						m_iStatus = 1;
277
					else
319
					else