Subversion Repositories spk

Rev

Rev 199 | 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
#include "SelectGame.h"
11
 
12
enum {FILE_NORMAL, FILE_SPK, FILE_XSP, FILE_PCK, FILE_XML, FILE_CAT, FILE_TXT, FILE_BOB, FILE_BOD, FILE_PBB, FILE_PBD, FILE_SPS};
13
 
14
namespace Creator {
15
 
16
	/// <summary>
17
	/// Summary for FileExplorer
18
	///
19
	/// WARNING: If you change the name of this class, you will need to change the
20
	///          'Resource File Name' property for the managed resource compiler tool
21
	///          associated with all .resx files this class depends on.  Otherwise,
22
	///          the designers will not be able to interact properly with localized
23
	///          resources associated with this form.
24
	/// </summary>
25
#pragma region Class Definintion
26
	public ref class FileExplorer : public System::Windows::Forms::Form
27
	{
28
	public:
29
		FileExplorer(System::Windows::Forms::Form ^creator, CPackages *p)
30
		{
31
			InitializeComponent();
32
 
33
			m_pCreator = creator;
34
			m_pPackages = p;
35
 
36
			UpdateFileSystem();
37
		}
38
#pragma endregion
39
 
40
#pragma region Public Functions
41
		bool OpenInCreator(String ^filename);
42
 
43
		void UpdateFileSystem()
44
		{
45
			this->treeView1->Nodes->Clear();
46
 
47
			TreeNode ^computernode = this->treeView1->Nodes->Add("Computer");
48
			computernode->ImageIndex = 0;
49
			computernode->SelectedImageIndex = -1;
50
 
51
			cli::array<IO::DriveInfo ^> ^Drives = IO::DriveInfo::GetDrives();
52
			if ( Drives && Drives->Length )
53
			{
54
				for ( int i = 0; i < Drives->Length; i++ )
55
				{
56
					IO::DriveInfo ^info = Drives[i];
57
					if ( !info->IsReady ) continue;
58
					String ^str = info->Name;
59
					if ( str->Contains("\\") )
60
						str = str->Remove(str->Length - 1);
61
					TreeNode ^node = computernode->Nodes->Add(str);
62
					if ( info->DriveType == IO::DriveType::Fixed )
63
						node->ImageIndex = 1;
64
					else if ( info->DriveType == IO::DriveType::CDRom )
65
						node->ImageIndex = 2;
66
					else if ( info->DriveType == IO::DriveType::Removable )
67
						node->ImageIndex = 4;
68
					else if ( info->DriveType == IO::DriveType::Network )
69
						node->ImageIndex = 5;
70
					else if ( info->DriveType == IO::DriveType::Ram )
71
						node->ImageIndex = 7;
72
					node->SelectedImageIndex = node->ImageIndex;
73
					UpdateNode(node);
74
				}
75
			}
76
 
77
			computernode->Expand();
78
		}
79
 
80
		int GetFileType(String ^file)
81
		{
82
			String ^ext = IO::FileInfo(file).Extension->ToLower();
83
			if ( ext == ".spk" ) return FILE_SPK;
84
			else if ( ext == ".xsp" ) return FILE_XSP;
85
			else if ( ext == ".pck" ) return FILE_PCK;
86
			else if ( ext == ".xml" ) return FILE_XML;
87
			else if ( ext == ".cat" ) return FILE_CAT;
88
			else if ( ext == ".txt" ) return FILE_TXT;
89
			else if ( ext == ".bob" ) return FILE_BOB;
90
			else if ( ext == ".pbb" ) return FILE_PBB;
91
			else if ( ext == ".bod" ) return FILE_BOD;
92
			else if ( ext == ".pbd" ) return FILE_PBD;
93
			else if ( ext == ".sps" ) return FILE_SPS;
94
			return FILE_NORMAL;
95
		}
96
		int GetFileIcon(String ^file)
97
		{
98
			String ^ext = IO::FileInfo(file).Extension->ToLower();
99
 
100
			int idx = this->imageList3->Images->IndexOfKey(ext);
101
			if ( idx > -1 )
102
				return idx;
103
 
104
			return 0;
105
		}
106
 
107
		void SetListView(Windows::Forms::View view)
108
		{
109
			if ( view == Windows::Forms::View::Details )
110
			{
111
				this->listView1->Visible = false;
112
				this->listView2->Visible = true;
113
			}
114
			else
115
			{
116
				this->listView1->View = view;
117
				this->listView2->Visible = false;
118
				this->listView1->Visible = true;
119
				this->ArrangeList();
120
			}
121
		}
122
		void ArrangeList()
123
		{
124
			this->listView1->ArrangeIcons();
125
			this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::ColumnContent);
126
		}
127
		void UpdateFilesList(String ^dir)
128
		{
129
			this->listView1->Items->Clear();
130
			this->listView2->Items->Clear();
131
			if ( !dir ) return;
132
			try {
133
				cli::array<String ^> ^Files = IO::Directory::GetFiles(dir);
134
				if ( Files )
135
				{
136
					for (int i = 0; i < Files->Length; i++ )
137
					{
138
						if ( this->onlyShowXUniverseFilesToolStripMenuItem->Checked && !GetFileType(Files[i]) )
139
							continue;
140
 
141
						if ( (IO::File::GetAttributes(Files[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden && !this->showHiddenToolStripMenuItem->Checked )
142
							continue;
143
						ListViewItem ^item = gcnew ListViewItem(IO::FileInfo(Files[i]).Name);
144
						this->listView1->Items->Add(item);
145
						item->ImageIndex = GetFileIcon(Files[i]);
146
						item->Tag = dir;
147
						if ( (IO::File::GetAttributes(Files[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden )
148
							item->ForeColor = System::Drawing::SystemColors::GradientInactiveCaption;
149
 
150
						ListViewItem ^item2 = gcnew ListViewItem(IO::FileInfo(Files[i]).Name);
151
						this->listView2->Items->Add(item2);
152
						item2->ImageIndex = GetFileIcon(Files[i]);
153
						item2->Tag = dir;
154
						if ( (IO::File::GetAttributes(Files[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden )
155
							item2->ForeColor = System::Drawing::SystemColors::GradientInactiveCaption;
156
 
157
						switch (GetFileType(Files[i]))
158
						{
159
							case FILE_XSP:
160
								item2->SubItems->Add("Ship");
161
								break;
162
							case FILE_SPK:
163
								item2->SubItems->Add("Package");
164
								break;
165
							case FILE_CAT:
166
								item2->SubItems->Add("Mod/Patch");
167
								break;
168
							case FILE_XML:
169
								item2->SubItems->Add("Script/Text");
170
								break;
171
							case FILE_TXT:
172
								item2->SubItems->Add("T File");
173
								break;
174
							case FILE_PCK:
175
								item2->SubItems->Add("Packed");
176
								break;
177
							case FILE_SPS:
178
								item2->SubItems->Add("Packager Script");
179
								break;
180
							case FILE_PBB:
181
							case FILE_PBD:
182
								item2->SubItems->Add("Packed Model");
183
								break;
184
							case FILE_BOB:
185
							case FILE_BOD:
186
								item2->SubItems->Add("Model");
187
								break;
188
							default:
189
								item2->SubItems->Add("");
190
						}
191
 
192
						String ^len;
193
						const int byteConversion = 1024;
194
						double bytes = Convert::ToDouble(IO::FileInfo(Files[i]).Length);
195
						if ( bytes >= System::Math::Pow(byteConversion, 3) )
196
						{
197
							len = System::String::Concat(System::Math::Round(bytes / System::Math::Pow(byteConversion, 3), 2), " GB");
198
						}
199
						else if ( bytes >= System::Math::Pow(byteConversion, 2) )
200
						{
201
							len = System::String::Concat(System::Math::Round(bytes / System::Math::Pow(byteConversion, 2), 2), " MB");
202
						}
203
						else if ( bytes >= byteConversion )
204
						{
205
							len = System::String::Concat(System::Math::Round(bytes / byteConversion, 2), " KB");
206
						}
207
						else
208
						{
209
							len = System::String::Concat(bytes, " B");
210
						}
211
 
212
						item2->SubItems->Add(len);
213
					}
214
 
215
					this->listView2->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
216
					this->listView1->AutoResizeColumns(ColumnHeaderAutoResizeStyle::ColumnContent);
217
				}
218
			}
219
			catch (IO::IOException ^) {}
220
			catch (System::UnauthorizedAccessException ^) {}
221
		}
222
 
223
		String ^GetDirectory(TreeNode ^node)
224
		{
225
			String ^str = node->FullPath;
226
			if ( str->StartsWith("Computer\\") )
227
			{
228
				int pos = str->IndexOf("\\");
229
				if ( pos != -1 )
230
				{
231
					str = str->Remove(0, pos + 1);
232
					if ( str[str->Length - 1] != '\\' )
233
						str += "\\";
234
					return str;
235
				}
236
			}
237
 
238
			return nullptr;
239
		}
240
 
241
		void SelectedNode(TreeNode ^node)
242
		{
243
			this->toolStripStatusLabel1->Text = "";
244
			this->listView1->Items->Clear();
245
			this->listView2->Items->Clear();
127 cycrow 246
			if (!node || !node->Parent ) return;
1 cycrow 247
 
248
			String ^str = node->FullPath;
249
			if ( str->StartsWith("Computer\\") )
250
			{
251
				int pos = str->IndexOf("\\");
252
				if ( pos != -1 )
253
				{
254
					str = str->Remove(0, pos + 1);
255
					if ( str[str->Length - 1] != '\\' )
256
						str += "\\";
257
					UpdateFilesList(str);
258
					try {
259
						str += " (Files: " + IO::Directory::GetFiles(str)->Length + ")";
260
					}
261
					catch (IO::IOException ^) {}
262
					catch (System::UnauthorizedAccessException ^) 
263
					{
264
						str += " (Unable to access)";
265
					}
266
					this->toolStripStatusLabel1->Text = str;
267
				}
268
			}
269
		}
270
 
271
		void Rename(String ^filename)
272
		{
273
			String ^ext = IO::FileInfo(filename).Extension->ToLower();
274
			String ^baseName = IO::FileInfo(filename).Name;
275
			int pos = baseName->LastIndexOf(".");
276
			if ( pos != -1 )
277
				baseName = baseName->Substring(0, pos);
278
			InputBox ^input = gcnew InputBox("Enter the filename to rename to", baseName);
279
			if ( input->ShowDialog(this) == Windows::Forms::DialogResult::OK )
280
			{
281
				try {
282
					IO::File::Move(filename, IO::FileInfo(filename).Directory + "\\" + input->GetInput() + IO::FileInfo(filename).Extension);
283
					this->SelectedNode(this->treeView1->SelectedNode);
284
				}
285
				catch (System::UnauthorizedAccessException ^)
286
				{
287
					MessageBox::Show(this, "Unable to rename file:\n" + filename + "\n\nAccess Denied", "Access Denied", MessageBoxButtons::OK, MessageBoxIcon::Error);
288
				}
289
			}
290
		}
291
 
292
		int UnpackFiles(cli::array<String ^> ^Files, String ^dir)
293
		{
294
			if ( !Files || !Files->Length ) return 0;
295
 
296
			int count = 0;	
297
			for ( int i = 0; i < Files->Length; i++ )
298
			{
299
				String ^file = Files[i];
300
 
199 cycrow 301
				if ( m_pPackages->unPackFile(_WS(file)) )
1 cycrow 302
					++count;
303
			}
304
 
305
			return count;
306
		}
307
		void UnpackDirectory(String ^dir)
308
		{
309
			int count = UnpackFiles(IO::Directory::GetFiles(dir, "*.pck"), dir);
310
			count += UnpackFiles(IO::Directory::GetFiles(dir, "*.pbb"), dir);
311
			count += UnpackFiles(IO::Directory::GetFiles(dir, "*.pbd"), dir);
312
 
313
			if ( count )
314
			{
315
				this->SelectedNode(this->treeView1->SelectedNode);
316
				MessageBox::Show(this, count + " files unpacked in " + dir, "Files Unpacked", MessageBoxButtons::OK, MessageBoxIcon::Information);
317
			}
318
			else
319
				MessageBox::Show(this, "There were no files to unpack in " + dir, "No Files", MessageBoxButtons::OK, MessageBoxIcon::Warning);
320
		}
321
 
322
		int PackFiles(cli::array<String ^> ^Files, String ^dir)
323
		{
324
			if ( !Files || !Files->Length ) return 0;
325
 
326
			int count = 0;	
327
			for ( int i = 0; i < Files->Length; i++ )
328
			{
329
				String ^file = Files[i];
330
 
199 cycrow 331
				if ( m_pPackages->packFile(_WS(file)) )
1 cycrow 332
					++count;
333
			}
334
 
335
			return count;
336
		}
337
		void PackDirectory(String ^dir)
338
		{
339
			int count = PackFiles(IO::Directory::GetFiles(dir, "*.txt"), dir);
340
			count += PackFiles(IO::Directory::GetFiles(dir, "*.xml"), dir);
341
			count += PackFiles(IO::Directory::GetFiles(dir, "*.bod"), dir);
342
			count += PackFiles(IO::Directory::GetFiles(dir, "*.bob"), dir);
343
 
344
			if ( count )
345
			{
346
				this->SelectedNode(this->treeView1->SelectedNode);
347
				MessageBox::Show(this, count + " files packed in " + dir, "Files Packed", MessageBoxButtons::OK, MessageBoxIcon::Information);
348
			}
349
			else
350
				MessageBox::Show(this, "There were no files to pack in " + dir, "No Files", MessageBoxButtons::OK, MessageBoxIcon::Warning);
351
		}
352
		void UnPack(ListViewItem ^item)
353
		{
354
			if ( !item ) return;
355
			UnPack(System::Convert::ToString(item->Tag) + item->Text);
356
		}
357
		void UnPack(String ^filename)
358
		{
199 cycrow 359
			 if ( m_pPackages->unPackFile(_WS(filename)) )
1 cycrow 360
			 {
361
				 MessageBox::Show(this, "File: " + filename + "\nHas been unpacked", "File UnPacked", MessageBoxButtons::OK, MessageBoxIcon::Information);
362
				 this->SelectedNode(this->treeView1->SelectedNode);
363
			 }
364
		}
365
		void Pack(ListViewItem ^item)
366
		{
367
			if ( !item ) return;
368
			Pack(System::Convert::ToString(item->Tag) + item->Text);
369
		}
370
		void Pack(String ^filename)
371
		{
199 cycrow 372
			 if ( m_pPackages->packFile(_WS(filename)) )
1 cycrow 373
			 {
374
				 MessageBox::Show(this, "File: " + filename + "\nHas been packed", "File Packed", MessageBoxButtons::OK, MessageBoxIcon::Information);
375
				 this->UpdateFiles();
376
			 }
377
		}
378
 
379
		void UpdateFiles() { this->SelectedNode(this->treeView1->SelectedNode); }
380
		void Extract(ListViewItem ^item)
381
		{
382
			if ( !item ) return;
383
			Extract(System::Convert::ToString(item->Tag) + item->Text);
384
		}
385
		void Extract(String ^filename)
386
		{
387
			String ^ext = IO::FileInfo(filename).Extension->ToLower();
388
 
389
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
390
			fbd->Description = "Select the path to extract files to";
391
			fbd->ShowNewFolderButton = true;
392
			fbd->SelectedPath = IO::FileInfo(filename).DirectoryName;
393
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
394
			{
395
				bool extracted = false;
396
 
397
				if ( ext == ".xsp" || ext == ".spk" )
398
				{
399
					int error;
197 cycrow 400
					int type = CSpkFile::CheckFile(_WS(filename));
1 cycrow 401
					if ( type == SPKFILE_BASE || type == SPKFILE_SINGLE || type == SPKFILE_SINGLESHIP )
402
					{
199 cycrow 403
						CBaseFile *package = m_pPackages->openPackage(_WS(filename), &error, 0, SPKREAD_ALL);
1 cycrow 404
						if ( package )
405
						{
406
							int game = 0;
407
							if ( package->IsMultipleGamesInPackage() ) {
408
								SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + filename, m_pPackages);
409
								if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
410
									game = selGame->GetGame() + 1;
411
								}
412
								else
413
									return;
414
							}
415
							else if ( package->IsAnyGameInPackage() ) {
416
								game = package->FindFirstGameInPackage();
417
							}
224 cycrow 418
							if(m_pPackages->extractAll(package, _WS(fbd->SelectedPath), game, true))
1 cycrow 419
								extracted = true;
420
						}
421
					}
422
					else if ( type == SPKFILE_MULTI )
423
					{
199 cycrow 424
						CMultiSpkFile *multispk = m_pPackages->openMultiPackage(_WS(filename), &error);
1 cycrow 425
						if ( multispk )
426
						{
224 cycrow 427
							if ( multispk->extractAll(_WS(fbd->SelectedPath)) )
1 cycrow 428
								extracted = true;
429
						}
430
					}
431
					else
432
					{
433
						MessageBox::Show(this, "Invalid package file: " + filename + "\n\nUnable to extract", "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Warning);
434
						return;
435
					}
436
				}
437
				else if ( ext == ".cat" )
438
				{
439
					CCatFile catfile;
199 cycrow 440
					if ( catfile.open(_WS(filename), L"", CATREAD_CATDECRYPT, false) == CATERR_NONE )
1 cycrow 441
					{
199 cycrow 442
						if ( catfile.extractAll(_WS(fbd->SelectedPath)) )
1 cycrow 443
							extracted = true;
444
					}
445
				}
446
				else
447
					return;
448
 
449
				if ( extracted )
450
				{
451
					UpdateFiles();
452
					MessageBox::Show(this, "File: " + filename + "\nHas been extracted (" + fbd->SelectedPath + ")", "Extracted", MessageBoxButtons::OK, MessageBoxIcon::Information);
453
				}
454
				else
455
					MessageBox::Show(this, "Unable to extract: " + filename, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
456
			}
457
		}
458
 
459
		void Rename(ListViewItem ^item)
460
		{
461
			if ( !item ) return;
462
			Rename(System::Convert::ToString(item->Tag) + item->Text);
463
		}
464
		void Open(ListViewItem ^item)
465
		{
466
			if ( !item ) return;
467
 
468
			String ^filename = System::Convert::ToString(item->Tag) + item->Text;
469
			String ^ext = IO::FileInfo(filename).Extension->ToLower();
470
 
471
			if ( (ext == ".xsp" || ext == ".spk" || ext == ".sps") && m_pCreator )
472
			{
473
				if ( OpenInCreator(filename) )
474
					return;
475
			}
476
 
477
			Diagnostics::Process ^process = gcnew Diagnostics::Process();
478
			try {
479
				process->StartInfo->WorkingDirectory = System::Convert::ToString(item->Tag);
480
				process->StartInfo->FileName = filename;
481
 
482
				// open in creator
483
				if ( ext == ".xsp" || ext == ".spk" || ext == ".sps" )
484
				{
485
					process->StartInfo->FileName = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName + "\\Creator.exe";
486
					process->StartInfo->Arguments = "\"" + filename + "\"";
487
				}
488
 
489
				if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
490
				{
491
					process->StartInfo->CreateNoWindow = true;
492
					process->Start();
493
				}
494
			}
495
			catch (System::Exception ^E) 
496
			{
497
				MessageBox::Show(this, "Error opening file:\n" + filename + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
498
			}
499
		}
500
 
501
		void Explore(ListViewItem ^item)
502
		{
503
			String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
504
			String ^ext = IO::FileInfo(filename).Extension->ToLower();
505
 
506
			Diagnostics::Process ^process = gcnew Diagnostics::Process();
507
			try {
508
				process->StartInfo->WorkingDirectory = System::Convert::ToString(m_pSelectedItem->Tag);
509
 
510
				// open in creator
511
				if ( ext == ".xsp" || ext == ".spk" )
512
				{
513
					process->StartInfo->FileName = System::IO::FileInfo(System::Windows::Forms::Application::ExecutablePath).DirectoryName + "\\SpkExplorer.exe";
514
					process->StartInfo->Arguments = "\"" + filename + "\"";
515
				}
516
 
517
				if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
518
				{
519
					process->StartInfo->CreateNoWindow = true;
520
					process->Start();
521
				}
522
			}
523
			catch (System::Exception ^E) 
524
			{
525
				MessageBox::Show(this, "Error opening file:\n" + filename + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
526
			}
527
		}
528
#pragma endregion
529
#pragma region Protected/Private functions
530
	protected:
531
		void UpdateNextNodes(TreeNode ^node)
532
		{
533
			for ( int i = 0; i < node->Nodes->Count; i++ )
534
				UpdateNode(node->Nodes[i]);
535
		}
536
 
537
		void UpdateNode(TreeNode ^node)
538
		{
539
			System::String ^str = node->FullPath;
540
			if ( !node->Nodes->Count && str->StartsWith("Computer\\") )
541
			{
542
				int pos = str->IndexOf("\\");
543
				if ( pos != -1 )
544
				{
545
					str = str->Remove(0, pos + 1);
546
					try {
547
						if ( str[str->Length - 1] != '\\' )
548
							str += "\\";
549
						cli::array<System::String ^> ^Dirs = IO::Directory::GetDirectories(str);
550
						if ( Dirs )
551
						{
552
							for ( int i = 0; i < Dirs->Length; i++ )
553
							{
554
								IO::DirectoryInfo ^info = gcnew IO::DirectoryInfo(Dirs[i]);
555
								bool hidden = false;
556
								if ( (IO::File::GetAttributes(Dirs[i]) & IO::FileAttributes::Hidden) == IO::FileAttributes::Hidden )
557
									hidden = true;
558
 
559
								if ( !this->showHiddenToolStripMenuItem->Checked && hidden )
560
									continue;
561
								TreeNode ^newnode = node->Nodes->Add(info->Name);
562
 
563
								if ( hidden )
564
								{
565
									newnode->Tag = 1;
566
									newnode->ImageIndex = 10;
567
									newnode->ForeColor = System::Drawing::SystemColors::GradientInactiveCaption;
568
								}
569
								else
570
								{
571
									newnode->ImageIndex = 9;
572
									newnode->Tag = System::Convert::ToInt32(0);
573
								}
574
								newnode->SelectedImageIndex = newnode->ImageIndex;
575
							}
576
						}
577
					}
578
					catch(IO::IOException ^) {}
579
					catch(System::UnauthorizedAccessException ^) {}
580
				}
581
			}
582
		}
583
 
584
		void UnselectAllViews()
585
		{
586
			this->tileToolStripMenuItem->Checked = false;
587
			this->largeIconToolStripMenuItem->Checked = false;
588
			this->smallIconsToolStripMenuItem->Checked = false;
589
			this->listToolStripMenuItem->Checked = false;
590
			this->detailsToolStripMenuItem->Checked = false;
591
		}
592
#pragma endregion
593
 
594
#pragma region Defined Variables
595
protected: 
596
		Windows::Forms::ContextMenuStrip ^m_pContext;
597
		Windows::Forms::ListViewItem	^m_pSelectedItem;
598
		Windows::Forms::TreeNode		^m_pSelectedNode;
599
		Windows::Forms::Form			^m_pCreator;
600
private: System::Windows::Forms::ToolStripMenuItem^  createPackageToolStripMenuItem;
601
private: System::Windows::Forms::ToolStripMenuItem^  editToolStripMenuItem;
602
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
603
private: System::Windows::Forms::ToolStripMenuItem^  generateUpdateFilesToolStripMenuItem;
604
protected: 
605
	CPackages						*m_pPackages;
606
#pragma endregion
607
 
608
		/// <summary>
609
		/// Clean up any resources being used.
610
		/// </summary>
611
		~FileExplorer()
612
		{
613
			if (components)
614
			{
615
				delete components;
616
			}
617
		}
618
 
619
#pragma region Builtin Variables
620
	private:
621
		/// <summary>
622
		/// Required designer variable.
623
		/// </summary>
624
 
625
private: System::Windows::Forms::ToolStripMenuItem^  renameToolStripMenuItem;
626
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
627
private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
628
private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
629
private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
630
private: System::Windows::Forms::ToolStripMenuItem^  showHiddenToolStripMenuItem;
631
private: System::Windows::Forms::ToolStripMenuItem^  onlyShowXUniverseFilesToolStripMenuItem;
632
private: System::Windows::Forms::ToolStripMenuItem^  packToolStripMenuItem;
633
private: System::Windows::Forms::ToolStripMenuItem^  unpackToolStripMenuItem;
634
private: System::Windows::Forms::ImageList^  imageList2;
635
private: System::Windows::Forms::ToolStripMenuItem^  viewToolStripMenuItem;
636
private: System::Windows::Forms::ToolStripMenuItem^  largeIconToolStripMenuItem;
637
private: System::Windows::Forms::ToolStripMenuItem^  updateToolStripMenuItem;
638
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
639
private: System::Windows::Forms::ToolStripMenuItem^  tileToolStripMenuItem;
640
private: System::Windows::Forms::ToolStripMenuItem^  smallIconsToolStripMenuItem;
641
private: System::Windows::Forms::ToolStripMenuItem^  listToolStripMenuItem;
642
private: System::Windows::Forms::ColumnHeader^  columnHeader1;
643
private: System::Windows::Forms::ColumnHeader^  columnHeader2;
644
private: System::Windows::Forms::ColumnHeader^  columnHeader3;
645
private: System::Windows::Forms::ListView^  listView2;
646
private: System::Windows::Forms::ToolStripMenuItem^  detailsToolStripMenuItem;
647
private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip2;
648
private: System::Windows::Forms::ToolStripMenuItem^  packDirectoryToolStripMenuItem;
649
private: System::Windows::Forms::ToolStripMenuItem^  unpackDirectoryToolStripMenuItem;
650
	private: System::Windows::Forms::StatusStrip^  statusStrip1;
651
	private: System::Windows::Forms::MenuStrip^  menuStrip1;
652
	private: System::Windows::Forms::SplitContainer^  splitContainer1;
653
	private: System::Windows::Forms::TreeView^  treeView1;
654
	private: System::Windows::Forms::ImageList^  imageList1;
655
	private: System::Windows::Forms::ToolStripStatusLabel^  toolStripStatusLabel1;
656
private: System::Windows::Forms::ListView^  listView1;
657
private: System::Windows::Forms::ImageList^  imageList3;
658
private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip1;
659
private: System::Windows::Forms::ToolStripMenuItem^  exploreToolStripMenuItem;
660
private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
661
private: System::Windows::Forms::ToolStripMenuItem^  extractToolStripMenuItem;
662
private: System::Windows::Forms::ToolStripMenuItem^  installToolStripMenuItem;
663
 
664
	private: System::ComponentModel::IContainer^  components;
665
#pragma endregion
666
 
667
#pragma region Windows Form Designer generated code
668
		/// <summary>
669
		/// Required method for Designer support - do not modify
670
		/// the contents of this method with the code editor.
671
		/// </summary>
672
		void InitializeComponent(void)
673
		{
674
			this->components = (gcnew System::ComponentModel::Container());
675
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(FileExplorer::typeid));
676
			this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
677
			this->toolStripStatusLabel1 = (gcnew System::Windows::Forms::ToolStripStatusLabel());
678
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
679
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
680
			this->updateToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
681
			this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
682
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
683
			this->settingsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
684
			this->showHiddenToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
685
			this->onlyShowXUniverseFilesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
686
			this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
687
			this->largeIconToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
688
			this->tileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
689
			this->smallIconsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
690
			this->listToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
691
			this->detailsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
692
			this->splitContainer1 = (gcnew System::Windows::Forms::SplitContainer());
693
			this->treeView1 = (gcnew System::Windows::Forms::TreeView());
694
			this->contextMenuStrip2 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
695
			this->packDirectoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
696
			this->unpackDirectoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
697
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
698
			this->listView2 = (gcnew System::Windows::Forms::ListView());
699
			this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
700
			this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
701
			this->columnHeader3 = (gcnew System::Windows::Forms::ColumnHeader());
702
			this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
703
			this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
704
			this->installToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
705
			this->exploreToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
706
			this->createPackageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
707
			this->editToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
708
			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
709
			this->extractToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
710
			this->renameToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
711
			this->packToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
712
			this->unpackToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
713
			this->imageList3 = (gcnew System::Windows::Forms::ImageList(this->components));
714
			this->imageList2 = (gcnew System::Windows::Forms::ImageList(this->components));
715
			this->listView1 = (gcnew System::Windows::Forms::ListView());
716
			this->generateUpdateFilesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
717
			this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
718
			this->statusStrip1->SuspendLayout();
719
			this->menuStrip1->SuspendLayout();
720
			this->splitContainer1->Panel1->SuspendLayout();
721
			this->splitContainer1->Panel2->SuspendLayout();
722
			this->splitContainer1->SuspendLayout();
723
			this->contextMenuStrip2->SuspendLayout();
724
			this->contextMenuStrip1->SuspendLayout();
725
			this->SuspendLayout();
726
			// 
727
			// statusStrip1
728
			// 
729
			this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->toolStripStatusLabel1});
730
			this->statusStrip1->Location = System::Drawing::Point(0, 595);
731
			this->statusStrip1->Name = L"statusStrip1";
732
			this->statusStrip1->Size = System::Drawing::Size(696, 22);
733
			this->statusStrip1->TabIndex = 0;
734
			this->statusStrip1->Text = L"statusStrip1";
735
			// 
736
			// toolStripStatusLabel1
737
			// 
738
			this->toolStripStatusLabel1->Name = L"toolStripStatusLabel1";
739
			this->toolStripStatusLabel1->Size = System::Drawing::Size(0, 17);
740
			// 
741
			// menuStrip1
742
			// 
743
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
744
				this->settingsToolStripMenuItem, this->viewToolStripMenuItem});
745
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
746
			this->menuStrip1->Name = L"menuStrip1";
747
			this->menuStrip1->Size = System::Drawing::Size(696, 24);
748
			this->menuStrip1->TabIndex = 1;
749
			this->menuStrip1->Text = L"menuStrip1";
750
			// 
751
			// fileToolStripMenuItem
752
			// 
753
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->updateToolStripMenuItem, 
754
				this->toolStripSeparator2, this->exitToolStripMenuItem});
755
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
756
			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
757
			this->fileToolStripMenuItem->Text = L"File";
758
			// 
759
			// updateToolStripMenuItem
760
			// 
761
			this->updateToolStripMenuItem->Name = L"updateToolStripMenuItem";
762
			this->updateToolStripMenuItem->Size = System::Drawing::Size(112, 22);
763
			this->updateToolStripMenuItem->Text = L"Update";
764
			this->updateToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::updateToolStripMenuItem_Click);
765
			// 
766
			// toolStripSeparator2
767
			// 
768
			this->toolStripSeparator2->Name = L"toolStripSeparator2";
769
			this->toolStripSeparator2->Size = System::Drawing::Size(109, 6);
770
			// 
771
			// exitToolStripMenuItem
772
			// 
773
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
774
			this->exitToolStripMenuItem->Size = System::Drawing::Size(112, 22);
775
			this->exitToolStripMenuItem->Text = L"Exit";
776
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::exitToolStripMenuItem_Click);
777
			// 
778
			// settingsToolStripMenuItem
779
			// 
780
			this->settingsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->showHiddenToolStripMenuItem, 
781
				this->onlyShowXUniverseFilesToolStripMenuItem});
782
			this->settingsToolStripMenuItem->Name = L"settingsToolStripMenuItem";
783
			this->settingsToolStripMenuItem->Size = System::Drawing::Size(61, 20);
784
			this->settingsToolStripMenuItem->Text = L"Settings";
785
			// 
786
			// showHiddenToolStripMenuItem
787
			// 
788
			this->showHiddenToolStripMenuItem->CheckOnClick = true;
789
			this->showHiddenToolStripMenuItem->Name = L"showHiddenToolStripMenuItem";
790
			this->showHiddenToolStripMenuItem->Size = System::Drawing::Size(211, 22);
791
			this->showHiddenToolStripMenuItem->Text = L"Show Hidden";
792
			this->showHiddenToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::showHiddenToolStripMenuItem_Click);
793
			// 
794
			// onlyShowXUniverseFilesToolStripMenuItem
795
			// 
796
			this->onlyShowXUniverseFilesToolStripMenuItem->CheckOnClick = true;
797
			this->onlyShowXUniverseFilesToolStripMenuItem->Name = L"onlyShowXUniverseFilesToolStripMenuItem";
798
			this->onlyShowXUniverseFilesToolStripMenuItem->Size = System::Drawing::Size(211, 22);
799
			this->onlyShowXUniverseFilesToolStripMenuItem->Text = L"Hide Non X-Universe Files";
800
			this->onlyShowXUniverseFilesToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::onlyShowXUniverseFilesToolStripMenuItem_Click);
801
			// 
802
			// viewToolStripMenuItem
803
			// 
804
			this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(5) {this->largeIconToolStripMenuItem, 
805
				this->tileToolStripMenuItem, this->smallIconsToolStripMenuItem, this->listToolStripMenuItem, this->detailsToolStripMenuItem});
806
			this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
807
			this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
808
			this->viewToolStripMenuItem->Text = L"View";
809
			// 
810
			// largeIconToolStripMenuItem
811
			// 
812
			this->largeIconToolStripMenuItem->Checked = true;
813
			this->largeIconToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Checked;
814
			this->largeIconToolStripMenuItem->Name = L"largeIconToolStripMenuItem";
815
			this->largeIconToolStripMenuItem->Size = System::Drawing::Size(134, 22);
816
			this->largeIconToolStripMenuItem->Text = L"Large Icon";
817
			this->largeIconToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::largeIconToolStripMenuItem_Click);
818
			// 
819
			// tileToolStripMenuItem
820
			// 
821
			this->tileToolStripMenuItem->Name = L"tileToolStripMenuItem";
822
			this->tileToolStripMenuItem->Size = System::Drawing::Size(134, 22);
823
			this->tileToolStripMenuItem->Text = L"Tile";
824
			this->tileToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::tileToolStripMenuItem_Click);
825
			// 
826
			// smallIconsToolStripMenuItem
827
			// 
828
			this->smallIconsToolStripMenuItem->Name = L"smallIconsToolStripMenuItem";
829
			this->smallIconsToolStripMenuItem->Size = System::Drawing::Size(134, 22);
830
			this->smallIconsToolStripMenuItem->Text = L"Small Icons";
831
			this->smallIconsToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::smallIconsToolStripMenuItem_Click);
832
			// 
833
			// listToolStripMenuItem
834
			// 
835
			this->listToolStripMenuItem->Name = L"listToolStripMenuItem";
836
			this->listToolStripMenuItem->Size = System::Drawing::Size(134, 22);
837
			this->listToolStripMenuItem->Text = L"List";
838
			this->listToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::listToolStripMenuItem_Click);
839
			// 
840
			// detailsToolStripMenuItem
841
			// 
842
			this->detailsToolStripMenuItem->Name = L"detailsToolStripMenuItem";
843
			this->detailsToolStripMenuItem->Size = System::Drawing::Size(134, 22);
844
			this->detailsToolStripMenuItem->Text = L"Details";
845
			this->detailsToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::detailsToolStripMenuItem_Click);
846
			// 
847
			// splitContainer1
848
			// 
849
			this->splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
850
			this->splitContainer1->Location = System::Drawing::Point(0, 24);
851
			this->splitContainer1->Name = L"splitContainer1";
852
			// 
853
			// splitContainer1.Panel1
854
			// 
855
			this->splitContainer1->Panel1->Controls->Add(this->treeView1);
856
			// 
857
			// splitContainer1.Panel2
858
			// 
859
			this->splitContainer1->Panel2->Controls->Add(this->listView2);
860
			this->splitContainer1->Panel2->Controls->Add(this->listView1);
861
			this->splitContainer1->Size = System::Drawing::Size(696, 571);
862
			this->splitContainer1->SplitterDistance = 280;
863
			this->splitContainer1->TabIndex = 2;
864
			// 
865
			// treeView1
866
			// 
867
			this->treeView1->ContextMenuStrip = this->contextMenuStrip2;
868
			this->treeView1->Dock = System::Windows::Forms::DockStyle::Fill;
869
			this->treeView1->HideSelection = false;
870
			this->treeView1->ImageIndex = 8;
871
			this->treeView1->ImageList = this->imageList1;
872
			this->treeView1->Location = System::Drawing::Point(0, 0);
873
			this->treeView1->Name = L"treeView1";
874
			this->treeView1->SelectedImageIndex = 0;
875
			this->treeView1->Size = System::Drawing::Size(280, 571);
876
			this->treeView1->TabIndex = 0;
877
			this->treeView1->BeforeExpand += gcnew System::Windows::Forms::TreeViewCancelEventHandler(this, &FileExplorer::treeView1_BeforeExpand);
878
			this->treeView1->NodeMouseClick += gcnew System::Windows::Forms::TreeNodeMouseClickEventHandler(this, &FileExplorer::treeView1_NodeMouseClick);
879
			this->treeView1->BeforeCheck += gcnew System::Windows::Forms::TreeViewCancelEventHandler(this, &FileExplorer::treeView1_BeforeCheck);
880
			// 
881
			// contextMenuStrip2
882
			// 
883
			this->contextMenuStrip2->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->packDirectoryToolStripMenuItem, 
884
				this->unpackDirectoryToolStripMenuItem, this->toolStripSeparator3, this->generateUpdateFilesToolStripMenuItem});
885
			this->contextMenuStrip2->Name = L"contextMenuStrip2";
886
			this->contextMenuStrip2->Size = System::Drawing::Size(189, 98);
887
			this->contextMenuStrip2->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &FileExplorer::contextMenuStrip2_Opening);
888
			// 
889
			// packDirectoryToolStripMenuItem
890
			// 
891
			this->packDirectoryToolStripMenuItem->Name = L"packDirectoryToolStripMenuItem";
892
			this->packDirectoryToolStripMenuItem->Size = System::Drawing::Size(188, 22);
893
			this->packDirectoryToolStripMenuItem->Text = L"Pack Directory";
894
			this->packDirectoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::packDirectoryToolStripMenuItem_Click);
895
			// 
896
			// unpackDirectoryToolStripMenuItem
897
			// 
898
			this->unpackDirectoryToolStripMenuItem->Name = L"unpackDirectoryToolStripMenuItem";
899
			this->unpackDirectoryToolStripMenuItem->Size = System::Drawing::Size(188, 22);
900
			this->unpackDirectoryToolStripMenuItem->Text = L"Unpack Directory";
901
			this->unpackDirectoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::unpackDirectoryToolStripMenuItem_Click);
902
			// 
903
			// imageList1
904
			// 
905
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
906
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
907
			this->imageList1->Images->SetKeyName(0, L"computer");
908
			this->imageList1->Images->SetKeyName(1, L"harddrive");
909
			this->imageList1->Images->SetKeyName(2, L"cdrom");
910
			this->imageList1->Images->SetKeyName(3, L"dvd");
911
			this->imageList1->Images->SetKeyName(4, L"floppy");
912
			this->imageList1->Images->SetKeyName(5, L"network");
913
			this->imageList1->Images->SetKeyName(6, L"web");
914
			this->imageList1->Images->SetKeyName(7, L"ram");
915
			this->imageList1->Images->SetKeyName(8, L"next.png");
916
			this->imageList1->Images->SetKeyName(9, L"gnome-folder.png");
917
			this->imageList1->Images->SetKeyName(10, L"file-types-properties.png");
918
			// 
919
			// listView2
920
			// 
921
			this->listView2->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(3) {this->columnHeader1, this->columnHeader2, 
922
				this->columnHeader3});
923
			this->listView2->ContextMenuStrip = this->contextMenuStrip1;
924
			this->listView2->Dock = System::Windows::Forms::DockStyle::Fill;
925
			this->listView2->FullRowSelect = true;
926
			this->listView2->LargeImageList = this->imageList3;
927
			this->listView2->Location = System::Drawing::Point(0, 0);
928
			this->listView2->MultiSelect = false;
929
			this->listView2->Name = L"listView2";
930
			this->listView2->Size = System::Drawing::Size(412, 571);
931
			this->listView2->SmallImageList = this->imageList2;
932
			this->listView2->TabIndex = 1;
933
			this->listView2->UseCompatibleStateImageBehavior = false;
934
			this->listView2->View = System::Windows::Forms::View::Details;
935
			this->listView2->Visible = false;
936
			this->listView2->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FileExplorer::listView2_MouseDoubleClick);
937
			// 
938
			// columnHeader1
939
			// 
940
			this->columnHeader1->Text = L"File";
941
			// 
942
			// columnHeader2
943
			// 
944
			this->columnHeader2->Text = L"Type";
945
			// 
946
			// columnHeader3
947
			// 
948
			this->columnHeader3->Text = L"Size";
949
			// 
950
			// contextMenuStrip1
951
			// 
952
			this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(10) {this->openToolStripMenuItem, 
953
				this->installToolStripMenuItem, this->exploreToolStripMenuItem, this->createPackageToolStripMenuItem, this->editToolStripMenuItem, 
954
				this->toolStripSeparator1, this->extractToolStripMenuItem, this->renameToolStripMenuItem, this->packToolStripMenuItem, this->unpackToolStripMenuItem});
955
			this->contextMenuStrip1->Name = L"contextMenuStrip1";
956
			this->contextMenuStrip1->Size = System::Drawing::Size(156, 208);
957
			this->contextMenuStrip1->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &FileExplorer::contextMenuStrip1_Opening);
958
			// 
959
			// openToolStripMenuItem
960
			// 
961
			this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
962
			this->openToolStripMenuItem->Size = System::Drawing::Size(155, 22);
963
			this->openToolStripMenuItem->Text = L"Open";
964
			this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::openToolStripMenuItem_Click);
965
			// 
966
			// installToolStripMenuItem
967
			// 
968
			this->installToolStripMenuItem->Name = L"installToolStripMenuItem";
969
			this->installToolStripMenuItem->Size = System::Drawing::Size(155, 22);
970
			this->installToolStripMenuItem->Text = L"Install";
971
			this->installToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::installToolStripMenuItem_Click);
972
			// 
973
			// exploreToolStripMenuItem
974
			// 
975
			this->exploreToolStripMenuItem->Name = L"exploreToolStripMenuItem";
976
			this->exploreToolStripMenuItem->Size = System::Drawing::Size(155, 22);
977
			this->exploreToolStripMenuItem->Text = L"Explore";
978
			this->exploreToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::exploreToolStripMenuItem_Click);
979
			// 
980
			// createPackageToolStripMenuItem
981
			// 
982
			this->createPackageToolStripMenuItem->Name = L"createPackageToolStripMenuItem";
983
			this->createPackageToolStripMenuItem->Size = System::Drawing::Size(155, 22);
984
			this->createPackageToolStripMenuItem->Text = L"Create Package";
985
			this->createPackageToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::createPackageToolStripMenuItem_Click);
986
			// 
987
			// editToolStripMenuItem
988
			// 
989
			this->editToolStripMenuItem->Name = L"editToolStripMenuItem";
990
			this->editToolStripMenuItem->Size = System::Drawing::Size(155, 22);
991
			this->editToolStripMenuItem->Text = L"Edit";
992
			this->editToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::editToolStripMenuItem_Click);
993
			// 
994
			// toolStripSeparator1
995
			// 
996
			this->toolStripSeparator1->Name = L"toolStripSeparator1";
997
			this->toolStripSeparator1->Size = System::Drawing::Size(152, 6);
998
			// 
999
			// extractToolStripMenuItem
1000
			// 
1001
			this->extractToolStripMenuItem->Name = L"extractToolStripMenuItem";
1002
			this->extractToolStripMenuItem->Size = System::Drawing::Size(155, 22);
1003
			this->extractToolStripMenuItem->Text = L"Extract";
1004
			this->extractToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::extractToolStripMenuItem_Click);
1005
			// 
1006
			// renameToolStripMenuItem
1007
			// 
1008
			this->renameToolStripMenuItem->Name = L"renameToolStripMenuItem";
1009
			this->renameToolStripMenuItem->Size = System::Drawing::Size(155, 22);
1010
			this->renameToolStripMenuItem->Text = L"Rename";
1011
			this->renameToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::renameToolStripMenuItem_Click);
1012
			// 
1013
			// packToolStripMenuItem
1014
			// 
1015
			this->packToolStripMenuItem->Name = L"packToolStripMenuItem";
1016
			this->packToolStripMenuItem->Size = System::Drawing::Size(155, 22);
1017
			this->packToolStripMenuItem->Text = L"Pack";
1018
			this->packToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::packToolStripMenuItem_Click);
1019
			// 
1020
			// unpackToolStripMenuItem
1021
			// 
1022
			this->unpackToolStripMenuItem->Name = L"unpackToolStripMenuItem";
1023
			this->unpackToolStripMenuItem->Size = System::Drawing::Size(155, 22);
1024
			this->unpackToolStripMenuItem->Text = L"Unpack";
1025
			this->unpackToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::unpackToolStripMenuItem_Click);
1026
			// 
1027
			// imageList3
1028
			// 
1029
			this->imageList3->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList3.ImageStream")));
1030
			this->imageList3->TransparentColor = System::Drawing::Color::Transparent;
1031
			this->imageList3->Images->SetKeyName(0, L"gnome-library.png");
1032
			this->imageList3->Images->SetKeyName(1, L".spk");
1033
			this->imageList3->Images->SetKeyName(2, L".xsp");
1034
			this->imageList3->Images->SetKeyName(3, L".xml");
1035
			this->imageList3->Images->SetKeyName(4, L".cat");
1036
			this->imageList3->Images->SetKeyName(5, L".pck");
1037
			this->imageList3->Images->SetKeyName(6, L".txt");
1038
			// 
1039
			// imageList2
1040
			// 
1041
			this->imageList2->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList2.ImageStream")));
1042
			this->imageList2->TransparentColor = System::Drawing::Color::Transparent;
1043
			this->imageList2->Images->SetKeyName(0, L"gnome-library.png");
1044
			this->imageList2->Images->SetKeyName(1, L".spk");
1045
			this->imageList2->Images->SetKeyName(2, L".xsp");
1046
			this->imageList2->Images->SetKeyName(3, L".xml");
1047
			this->imageList2->Images->SetKeyName(4, L".cat");
1048
			this->imageList2->Images->SetKeyName(5, L".pck");
1049
			this->imageList2->Images->SetKeyName(6, L".txt");
1050
			// 
1051
			// listView1
1052
			// 
1053
			this->listView1->ContextMenuStrip = this->contextMenuStrip1;
1054
			this->listView1->Dock = System::Windows::Forms::DockStyle::Fill;
1055
			this->listView1->FullRowSelect = true;
1056
			this->listView1->LargeImageList = this->imageList3;
1057
			this->listView1->Location = System::Drawing::Point(0, 0);
1058
			this->listView1->MultiSelect = false;
1059
			this->listView1->Name = L"listView1";
1060
			this->listView1->Size = System::Drawing::Size(412, 571);
1061
			this->listView1->SmallImageList = this->imageList2;
1062
			this->listView1->TabIndex = 0;
1063
			this->listView1->UseCompatibleStateImageBehavior = false;
1064
			this->listView1->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &FileExplorer::listView1_MouseDoubleClick);
1065
			// 
1066
			// generateUpdateFilesToolStripMenuItem
1067
			// 
1068
			this->generateUpdateFilesToolStripMenuItem->Name = L"generateUpdateFilesToolStripMenuItem";
1069
			this->generateUpdateFilesToolStripMenuItem->Size = System::Drawing::Size(188, 22);
1070
			this->generateUpdateFilesToolStripMenuItem->Text = L"Generate Update Files";
1071
			this->generateUpdateFilesToolStripMenuItem->Click += gcnew System::EventHandler(this, &FileExplorer::generateUpdateFilesToolStripMenuItem_Click);
1072
			// 
1073
			// toolStripSeparator3
1074
			// 
1075
			this->toolStripSeparator3->Name = L"toolStripSeparator3";
1076
			this->toolStripSeparator3->Size = System::Drawing::Size(185, 6);
1077
			// 
1078
			// FileExplorer
1079
			// 
1080
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
1081
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
1082
			this->ClientSize = System::Drawing::Size(696, 617);
1083
			this->Controls->Add(this->splitContainer1);
1084
			this->Controls->Add(this->statusStrip1);
1085
			this->Controls->Add(this->menuStrip1);
1086
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
1087
			this->MainMenuStrip = this->menuStrip1;
1088
			this->Name = L"FileExplorer";
1089
			this->Text = L"File Explorer";
1090
			this->statusStrip1->ResumeLayout(false);
1091
			this->statusStrip1->PerformLayout();
1092
			this->menuStrip1->ResumeLayout(false);
1093
			this->menuStrip1->PerformLayout();
1094
			this->splitContainer1->Panel1->ResumeLayout(false);
1095
			this->splitContainer1->Panel2->ResumeLayout(false);
1096
			this->splitContainer1->ResumeLayout(false);
1097
			this->contextMenuStrip2->ResumeLayout(false);
1098
			this->contextMenuStrip1->ResumeLayout(false);
1099
			this->ResumeLayout(false);
1100
			this->PerformLayout();
1101
 
1102
		}
1103
#pragma endregion
1104
#pragma region Designer object functions
1105
	private: System::Void treeView1_BeforeExpand(System::Object^  sender, System::Windows::Forms::TreeViewCancelEventArgs^  e) {
1106
				 UpdateNextNodes(e->Node);
1107
			 }
1108
private: System::Void treeView1_BeforeCheck(System::Object^  sender, System::Windows::Forms::TreeViewCancelEventArgs^  e) {
1109
		 }
1110
private: System::Void treeView1_NodeMouseClick(System::Object^  sender, System::Windows::Forms::TreeNodeMouseClickEventArgs^  e) {
1111
			 SelectedNode(e->Node);
1112
		 }
1113
private: System::Void exploreToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1114
			 Explore(m_pSelectedItem);
1115
		 }
1116
private: System::Void contextMenuStrip1_Opening(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
1117
			 ListView ^list = this->listView1;
1118
			 if ( this->listView2->Visible )
1119
				 list = this->listView2;
1120
			 Point ^mousePoint = list->PointToClient(this->contextMenuStrip1->MousePosition);
1121
			 ListViewItem ^item = list->GetItemAt(mousePoint->X, mousePoint->Y);
1122
 
1123
			 m_pSelectedItem = item;
1124
 
1125
			 bool open = false;
1126
			 if ( item ) // only display for certain file types
1127
			 {
1128
				String ^filename = System::Convert::ToString(item->Tag) + item->Text;
1129
				String ^ext = IO::FileInfo(filename).Extension->ToLower();
1130
 
1131
				bool script = (ext == ".xsp" || ext == ".spk") ? true : false;
1132
 
1133
				this->extractToolStripMenuItem->Visible = (ext == ".xsp" || ext == ".spk" || ext == ".cat") ? true : false;
1134
				this->installToolStripMenuItem->Visible = script;
1135
				this->exploreToolStripMenuItem->Visible = script;
1136
				this->unpackToolStripMenuItem->Visible  = (ext == ".pck" || ext == ".pbb" || ext == ".pbd") ? true : false;
1137
				this->packToolStripMenuItem->Visible = (ext == ".xml" || ext == ".bob" || ext == ".bod" || ext == ".txt") ? true : false;
1138
				this->createPackageToolStripMenuItem->Visible = (ext == ".sps") ? true : false;
1139
				this->editToolStripMenuItem->Visible = (ext == ".sps") ? true : false;
1140
 
1141
				open = true;
1142
			 }
1143
 
1144
			 if ( !open )
1145
				 e->Cancel = true;
1146
		 }
1147
private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1148
			 Open(m_pSelectedItem);
1149
		}
1150
private: System::Void installToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1151
			String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
1152
			String ^ext = IO::FileInfo(filename).Extension->ToLower();
1153
 
1154
			if ( ext == ".xsp" || ext == ".spk" )
1155
				Open(m_pSelectedItem);
1156
		 }
1157
private: System::Void listView1_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
1158
			 Open(this->listView1->GetItemAt(e->Location.X, e->Location.Y));
1159
		 }
1160
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1161
			 Close();
1162
		 }
1163
private: System::Void showHiddenToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1164
			 UpdateFileSystem();
1165
			 UpdateFilesList(nullptr);
1166
		 }
1167
private: System::Void onlyShowXUniverseFilesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1168
			SelectedNode(this->treeView1->SelectedNode);
1169
		 }
1170
private: System::Void renameToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1171
			 Rename(m_pSelectedItem);
1172
		 }
1173
private: System::Void extractToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1174
			 Extract(m_pSelectedItem);
1175
		 }
1176
private: System::Void updateToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1177
			 this->UpdateFileSystem();
1178
			 UpdateFilesList(nullptr);
1179
		 }
1180
private: System::Void largeIconToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1181
			 UnselectAllViews();
1182
			 this->largeIconToolStripMenuItem->Checked = true;
1183
			 SetListView(System::Windows::Forms::View::LargeIcon);
1184
		 }
1185
private: System::Void tileToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1186
			 UnselectAllViews();
1187
			 this->tileToolStripMenuItem->Checked = true;
1188
			 SetListView(System::Windows::Forms::View::Tile);
1189
		 }
1190
private: System::Void smallIconsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1191
			 UnselectAllViews();
1192
			 this->smallIconsToolStripMenuItem->Checked = true;
1193
			 SetListView(System::Windows::Forms::View::SmallIcon);
1194
		 }
1195
private: System::Void listToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1196
			 UnselectAllViews();
1197
			 this->listToolStripMenuItem->Checked = true;
1198
			 SetListView(System::Windows::Forms::View::List);
1199
		 }
1200
private: System::Void listView2_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
1201
			 Open(this->listView2->GetItemAt(e->Location.X, e->Location.Y));
1202
		 }
1203
private: System::Void detailsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1204
			 UnselectAllViews();
1205
			 this->detailsToolStripMenuItem->Checked = true;
1206
			 SetListView(System::Windows::Forms::View::Details);
1207
		 }
1208
private: System::Void packToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1209
			 Pack(m_pSelectedItem);
1210
		 }
1211
private: System::Void unpackToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1212
			 UnPack(m_pSelectedItem);
1213
		 }
1214
private: System::Void packDirectoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1215
			 PackDirectory(GetDirectory(m_pSelectedNode));
1216
		 }
1217
private: System::Void unpackDirectoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1218
			 UnpackDirectory(GetDirectory(m_pSelectedNode));
1219
		 }
1220
private: System::Void contextMenuStrip2_Opening(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
1221
			 Point ^mousePoint = this->treeView1->PointToClient(this->contextMenuStrip2->MousePosition);
1222
			 m_pSelectedNode = this->treeView1->GetNodeAt(mousePoint->X, mousePoint->Y);
1223
		 }
1224
private: System::Void createPackageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1225
			String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
199 cycrow 1226
			Utils::WString saved = CPackages::CreateFromPackagerScript(m_pPackages, _WS(filename));
131 cycrow 1227
			if ( !saved.empty() )
1228
			{
1229
				this->UpdateFiles();
1230
				MessageBox::Show(this, "Package: " + _US(saved) + "\nhas been created from packager script", "Package Created", MessageBoxButtons::OK, MessageBoxIcon::Information);
1231
			}
1232
			else
1233
				MessageBox::Show(this, "Unable to create package from script\n" + filename, "Package Creation Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1 cycrow 1234
		 }
1235
private: System::Void editToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1236
			String ^filename = System::Convert::ToString(m_pSelectedItem->Tag) + m_pSelectedItem->Text;
1237
			String ^ext = IO::FileInfo(filename).Extension->ToLower();
1238
 
1239
			Diagnostics::Process ^process = gcnew Diagnostics::Process();
1240
			try {
1241
				process->StartInfo->WorkingDirectory = System::Convert::ToString(m_pSelectedItem->Tag);
1242
				// open in creator
1243
				if ( ext == ".sps" )
1244
				{
1245
					process->StartInfo->FileName = "notepad.exe";
1246
					process->StartInfo->Arguments = "\"" + filename + "\"";
1247
				}
1248
 
1249
				if ( process->StartInfo->FileName && process->StartInfo->FileName->Length )
1250
				{
1251
					process->StartInfo->CreateNoWindow = true;
1252
					process->Start();
1253
				}
1254
			}
1255
			catch (System::Exception ^E) 
1256
			{
1257
				MessageBox::Show(this, "Error opening file:\n" + filename + "\n\nError: " + E->GetType()->Name, "Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
1258
			}
1259
		 }
1260
private: System::Void generateUpdateFilesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
199 cycrow 1261
			 int packages = CPackages::GeneratePackageUpdateData(_WS(GetDirectory(m_pSelectedNode)), true);
1 cycrow 1262
			 if ( packages )
1263
			 {
1264
				 this->UpdateFiles();
1265
				 MessageBox::Show(this, "Package Update files generated in " + GetDirectory(m_pSelectedNode) + "\n" + packages + " packages found", "Update Files generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
1266
			 }
1267
		 }
1268
};
1269
#pragma endregion
1270
}