Subversion Repositories spk

Rev

Rev 160 | Rev 175 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
#include "SpkForm.h"
4
#include "AddDialog.h"
5
 
6
#include "../../common/InputBox.h"
7
#include "PackageInfo.h"
8
#include "ConvertFile.h"
9
 
10
#undef GetTempPath
11
 
128 cycrow 12
#define VERSION 1.30
1 cycrow 13
#define BETA 0
14
 
15
namespace SpkExplorer {
16
 
17
	using namespace System;
18
	using namespace System::ComponentModel;
19
	using namespace System::Collections;
20
	using namespace System::Windows::Forms;
21
	using namespace System::Data;
22
	using namespace System::Drawing;
23
 
24
	/// <summary>
25
	/// Summary for Form1
26
	///
27
	/// WARNING: If you change the name of this class, you will need to change the
28
	///          'Resource File Name' property for the managed resource compiler tool
29
	///          associated with all .resx files this class depends on.  Otherwise,
30
	///          the designers will not be able to interact properly with localized
31
	///          resources associated with this form.
32
	/// </summary>
33
	public ref class Form1 : public System::Windows::Forms::Form
34
	{
35
	public:
36
		Form1(array<System::String ^> ^args)
37
		{
38
			InitializeComponent();
39
			this->AllowDrop = true;
40
			this->DoToolTips();
41
 
42
			this->Closed += gcnew System::EventHandler(this, &Form1::CloseEvent);
43
 
44
			this->Text = "SPK Explorer " + GetProgramVersionString((float)VERSION, (int)BETA);
45
			m_pLoadedList = new CyStringList;
46
 
47
			m_pPackages = new CPackages;
129 cycrow 48
			m_pPackages->startup(".", _S(IO::Path::GetTempPath()), _S(Environment::GetFolderPath(Environment::SpecialFolder::Personal)));
1 cycrow 49
 
50
			this->UpdateDisplay();
51
 
52
			m_curView = System::Windows::Forms::View::Details;
53
			m_lCopiedFiles = new CLinkList<C_File>;
54
			m_pCutFrom = nullptr;
55
			m_lDraggedFiles = new CLinkList<C_File>;
56
			m_pDraggedFrom = nullptr;
57
 
58
			m_iLocX = m_iLocY = -1;
59
 
60
			this->LoadData();
61
 
62
			if ( args )
63
				this->OpenFiles(args, true, true);
64
		}
65
 
66
		CLinkList<C_File> *CopiedFiles() { return m_lCopiedFiles; }
67
		void PastedFiles() { m_lCopiedFiles->clear(); this->ToolPaste->Enabled = false; }
68
 
69
		void DoToolTips()
70
		{
71
			this->toolTip1->SetToolTip(this->button1, "Click to close all open windows");
72
		}
73
 
74
		void RemoveCopied(bool deleteFrom)
75
		{
76
			if ( m_lCopiedFiles->size() )
77
			{
78
				// restore the file
79
				if ( m_pCutFrom && !deleteFrom )
80
					m_pCutFrom->RestoreCut(m_lCopiedFiles);
81
				else
82
					m_lCopiedFiles->MemoryClear();
83
 
84
				m_pCutFrom = nullptr;
85
				m_lCopiedFiles->clear();
86
				this->ToolPaste->Enabled = false;
87
			}
88
		}
89
		void CopyFile(C_File *f, bool first)
90
		{
91
			if ( first )
92
				this->RemoveCopied(false);
93
			C_File *newFile = new C_File();
94
			newFile->CopyData(f);
95
			m_lCopiedFiles->push_back(newFile);
96
			this->ToolPaste->Enabled = true;
97
		}
98
 
99
		void CutFile(C_File *f, SpkForm ^From, bool first)
100
		{
101
			if ( first || From != m_pCutFrom )
102
				this->RemoveCopied(false);
103
			m_lCopiedFiles->push_back(f);
104
			m_pCutFrom = From;
105
			this->ToolPaste->Enabled = true;
106
		}
107
 
108
		void DragFile(C_File *f, SpkForm ^From)
109
		{
110
			if ( m_pDraggedFrom != From )
111
				m_lDraggedFiles->clear();
112
			m_lDraggedFiles->push_back(f);
113
			m_pDraggedFrom = From;
114
		}
115
 
116
		SpkForm ^DragFromForm()
117
		{
118
			return m_pDraggedFrom;
119
		}
120
 
121
		void Dragged(SpkForm ^ToForm, bool copy)
122
		{
123
			if ( !m_pDraggedFrom || m_lDraggedFiles->empty() )
124
				return;
125
			if ( m_pDraggedFrom != ToForm )
126
			{
127
				if ( copy )
128
				{
129
					for ( C_File *f = m_lDraggedFiles->First(); f; f = m_lDraggedFiles->Next() )
130
					{
131
						C_File *newFile = new C_File();
132
						newFile->CopyData(f);
133
						ToForm->DroppedFile(newFile);
134
					}
135
				}
136
				else
137
				{
138
					for ( C_File *f = m_lDraggedFiles->First(); f; f = m_lDraggedFiles->Next() )
139
					{
140
						m_pDraggedFrom->DraggedFile(f);
141
						ToForm->DroppedFile(f);
142
					}
143
				}
144
			}
145
			m_pDraggedFrom = nullptr;
146
			m_lDraggedFiles->clear();
147
		}
148
 
149
		void LoadData()
150
		{
151
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
152
			CFileIO Config;
118 cycrow 153
			if ( Config.open(_S(mydoc) + "/Egosoft/spkexplorer.dat") )
1 cycrow 154
			{
160 cycrow 155
				std::vector<Utils::String> *lines = Config.readLines();
1 cycrow 156
				if ( lines )
157
				{
158
					for ( int i = 0; i < (int)lines->size(); i++ )
159
					{
160 cycrow 160
						Utils::String line(lines->at(i));
161
						Utils::String start = line.token(":", 1).lower();
162
						Utils::String rest = line.tokens(":", 2).removeFirstSpace();
1 cycrow 163
						if ( start.Compare("ExplorerSize") )
160 cycrow 164
							this->Size = System::Drawing::Size(rest.token(" ", 1).toInt(), rest.token(" ", 2).toInt());
1 cycrow 165
						else if ( start.Compare("ExplorerPos") )
166
						{
160 cycrow 167
							m_iLocX = rest.token(" ", 1).toInt();
168
							m_iLocY = rest.token(" ", 2).toInt();
1 cycrow 169
						}
170
						else if ( start.Compare("Loaded") )
160 cycrow 171
							m_pLoadedList->PushBack(CyString(rest));
1 cycrow 172
						else if ( start.Compare("ExplorerMax") )
173
							this->WindowState = FormWindowState::Maximized;
174
					}
175
 
176
					delete lines;
177
				}
178
			}
179
		}
180
 
181
 
182
		void UpdateDisplay()
183
		{
184
			bool e = (this->tabControl1->HasChildren) ? true : false;
185
 
186
			SpkForm ^active = this->GetActiveChild();
187
			CBaseFile *activePackage = NULL;
188
			if ( active )
189
				activePackage = active->GetPackage();
190
			else
191
				e = false;
192
 
193
			this->panel1->Visible = e;
194
			this->tabControl1->Visible = e;
195
			this->ToolPaste->Enabled = false;
196
 
197
			bool e2 = (activePackage) ? e : false;
198
 
199
			this->ToolExtract->Visible = false;
200
			this->ToolExtract2->Visible = false;
201
			this->ToolExtractAll2->Visible = false;
202
			this->toolStripButton1->Visible = false;
203
			this->ToolAdd->Visible = false;
204
			this->ToolAdd2->Visible = false;
205
			this->ToolRemove->Visible = false;
206
			this->ToolRemove2->Visible = false;
207
 
208
			if ( active &&  active->IsMultiPackage() )
209
			{
210
				this->ToolExtract2->Visible = true;
211
				this->ToolExtractAll2->Visible = true;
212
				this->ToolAdd2->Visible = true;
213
				this->ToolRemove2->Visible = true;
214
			}
215
			else
216
			{
217
				this->ToolExtract->Visible = true;
218
				this->toolStripButton1->Visible = true;
219
				this->ToolAdd->Visible = true;
220
				this->ToolRemove->Visible = true;
221
			}
222
 
223
			this->toolStripMenuItem1->Enabled = e;
224
			this->ToolExtractAll2->Enabled = e;
225
			this->toolStripButton1->Enabled = e2;
226
			this->ToolAdd->Enabled = e;
227
			this->ToolAdd2->Enabled = e;
228
			this->ToolInfo->Enabled = e2;
229
			this->toolStripMenuItem3->Enabled = e;
230
			if ( e && m_lCopiedFiles->size() )
231
				this->ToolPaste->Enabled = e2;
232
 
233
			this->UpdateDropDownOpen();
234
 
235
			if ( !e )
236
			{
237
				this->SelectedFile(false);
238
				this->SelectedPackage(false, false);
239
			}
240
 
241
			if ( !e || !activePackage )
242
				this->StatusFiles->Text = "";
243
			else
170 cycrow 244
				this->StatusFiles->Text = "Files: " + activePackage->fileList().size() + " (" + _US(activePackage->fileSizeString()) + ")";
1 cycrow 245
		}
246
 
247
		void SelectedFile(bool selected)
248
		{
249
			this->ToolExtract->Enabled = selected;
250
			this->ToolRemove->Enabled = selected;
251
		}
252
 
253
		void SelectedPackage(bool fSelected, bool pSelected)
254
		{
255
			this->ToolInfo->Enabled = pSelected;
256
			this->ToolExtract2->Enabled = (fSelected || pSelected) ? true : false;
257
			this->packagesToolStripMenuItem->Enabled = pSelected;
258
			this->filesToolStripMenuItem->Enabled = fSelected;
259
			this->ToolRemove2->Enabled = (fSelected || pSelected) ? true : false;
260
			this->toolStripMenuItem2->Enabled = pSelected;
261
			this->toolStripMenuItem4->Enabled = pSelected;
262
			this->toolStripMenuItem5->Enabled = pSelected;
263
			this->toolStripMenuItem6->Enabled = fSelected;
264
		}
265
 
266
 
267
		void UpdateDropDownOpen()
268
		{
269
			// clear them all
270
			this->toolStripSplitButton1->DropDownItems->Clear();
271
 
272
			System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;
273
			newItem->Text = "Open Directory";
274
			newItem->Tag = "$DIR";
275
			newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
276
			this->toolStripSplitButton1->DropDownItems->Add(newItem);
277
 
278
			this->toolStripSplitButton1->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
279
 
280
			// add all none open items
281
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
282
			{
283
				// check if we have it open
284
				System::String ^sFile = SystemStringFromCyString(str->str.findreplace("/", "\\"));
285
				if ( this->IsOpen(sFile) )
286
					continue;
287
				if ( this->IsOpen(SystemStringFromCyString(str->str.findreplace("\\", "/"))) )
288
					continue;
289
 
290
				// otherwise add it to the list
291
				System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;
292
				newItem->Text = sFile;
293
				newItem->Tag = newItem->Text;
294
				newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
295
				this->toolStripSplitButton1->DropDownItems->Add(newItem);
296
			}
297
		}
298
 
299
		void SaveData()
300
		{
301
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
160 cycrow 302
			CFileIO Config(_S(mydoc) + "/Egosoft/spkexplorer.dat");
303
			Utils::CStringList lines;
1 cycrow 304
 
305
			if ( this->WindowState == FormWindowState::Normal )
306
			{
160 cycrow 307
				lines.pushBack(Utils::String("ExplorerSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
308
				lines.pushBack(Utils::String("ExplorerPos:") + (long)this->Location.X + " " + (long)this->Location.Y);
1 cycrow 309
			}
310
			else
311
			{
160 cycrow 312
				lines.pushBack(Utils::String("ExplorerPos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
313
				lines.pushBack(Utils::String("ExplorerSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
1 cycrow 314
			}
315
 
316
			if ( this->WindowState == FormWindowState::Maximized )
160 cycrow 317
				lines.pushBack("ExplorerMax:");
1 cycrow 318
 
319
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
160 cycrow 320
				lines.pushBack(Utils::String("Loaded:") + str->data.ToString() + " " + str->str.ToString());
321
			Config.writeFile(&lines);
1 cycrow 322
		}
323
		void CloseEvent(System::Object ^Sender, System::EventArgs ^E) 
324
		{
325
			this->CloseAll();
326
			this->SaveData();
327
		}
328
 
329
	protected:
330
		int		m_iLocX;
331
		int		m_iLocY;
332
 
333
		CPackages *m_pPackages;
334
 
335
private: System::Windows::Forms::Panel^  panel1;
336
protected: 
337
private: System::Windows::Forms::Button^  button1;
338
private: System::Windows::Forms::ToolTip^  toolTip1;
339
private: System::Windows::Forms::Timer^  timer1;
340
private: System::Windows::Forms::ToolStripButton^  ToolAdd;
341
private: System::Windows::Forms::ToolStripButton^  ToolRemove;
342
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator4;
343
private: System::Windows::Forms::ToolStripButton^  ToolPaste;
344
private: System::Windows::Forms::ImageList^  imageList1;
345
private: System::Windows::Forms::StatusStrip^  statusStrip1;
346
private: System::Windows::Forms::ToolStripStatusLabel^  StatusFiles;
347
private: System::Windows::Forms::ToolStripMenuItem^  layoutToolStripMenuItem;
348
private: System::Windows::Forms::ToolStripMenuItem^  maximisedToolStripMenuItem;
349
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator5;
350
private: System::Windows::Forms::ToolStripMenuItem^  cascadeToolStripMenuItem;
351
private: System::Windows::Forms::ToolStripMenuItem^  tileVerticallyToolStripMenuItem;
352
private: System::Windows::Forms::ToolStripMenuItem^  tileHorizontalToolStripMenuItem;
353
private: System::Windows::Forms::ToolStripMenuItem^  ToolWindows;
354
 
355
private: System::Windows::Forms::ToolStripMenuItem^  closeAllToolStripMenuItem;
356
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator6;
357
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator7;
358
private: System::Windows::Forms::ToolStripButton^  ToolInfo;
359
private: System::Windows::Forms::ToolStripButton^  ToolExtract;
360
private: System::Windows::Forms::ToolStripButton^  toolStripButton1;
361
private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip1;
362
private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem;
363
private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem1;
364
private: System::Windows::Forms::ToolStripDropDownButton^  ToolExtract2;
365
 
366
private: System::Windows::Forms::ToolStripMenuItem^  packagesToolStripMenuItem;
367
private: System::Windows::Forms::ToolStripMenuItem^  filesToolStripMenuItem;
368
private: System::Windows::Forms::ToolStripDropDownButton^  ToolExtractAll2;
369
private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem1;
370
private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem2;
371
private: System::Windows::Forms::ToolStripDropDownButton^  ToolAdd2;
372
private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem3;
373
private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem4;
374
private: System::Windows::Forms::ToolStripDropDownButton^  ToolRemove2;
375
private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem5;
376
private: System::Windows::Forms::ToolStripMenuItem^  toolStripMenuItem6;
377
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
378
		/// <summary>
379
		/// Clean up any resources being used.
380
		/// </summary>
381
		~Form1()
382
		{
383
			if (components)
384
			{
385
				delete components;
386
			}
387
			delete m_pLoadedList;
388
		}
389
	private: System::Windows::Forms::MenuStrip^  menuStrip1;
390
	protected: 
391
	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
392
	private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
393
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
394
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
395
	private: System::Windows::Forms::ToolStrip^  toolStrip1;
396
	private: System::Windows::Forms::ToolStripSplitButton^  toolStripSplitButton1;
397
	private: System::Windows::Forms::ToolStripMenuItem^  viewToolStripMenuItem;
398
	private: System::Windows::Forms::ToolStripMenuItem^  detailsToolStripMenuItem;
399
	private: System::Windows::Forms::ToolStripMenuItem^  largeIconToolStripMenuItem;
400
 
401
	private: System::Windows::Forms::ToolStripMenuItem^  listToolStripMenuItem;
402
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
403
 
404
 
405
	private: System::Windows::Forms::TabControl^  tabControl1;
406
 
407
	private:
408
		SpkForm ^GetActiveChild()
409
		{
410
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
411
			 for ( int i = 0; i < children->Length; i++ )
412
			 {
413
				 SpkForm ^childForm = (SpkForm ^)children[i];
414
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
415
					 return childForm;
416
			 }
417
 
418
			 return nullptr;
419
		}
420
 
421
		bool IsOpen(System::String ^file)
422
		{
423
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
424
			 for ( int i = 0; i < children->Length; i++ )
425
			 {
426
				 SpkForm ^childForm = (SpkForm ^)children[i];
427
				 if ( childForm->CheckFilename(file) )
428
					 return true;
429
			 }
430
 
431
			 return false;
432
		}
433
 
434
		void ExtractSelected()
435
		{
436
			SpkForm ^child = this->GetActiveChild();
437
			if ( child )
438
			{
439
				System::String ^toDir = GetExtractDir(false);
440
				if ( toDir )
441
					child->ExtractSelected(toDir);
442
			}
443
		}
444
		void ExtractSelectedPackage()
445
		{
446
			SpkForm ^child = this->GetActiveChild();
447
			if ( child && child->IsMultiPackage() )
448
			{
449
				System::String ^toDir = GetExtractDir(true);
450
				if ( toDir )
451
					child->ExtractSelectedPackage(toDir);
452
			}
453
		}
454
 
455
		System::String ^GetExtractDir(bool package)
456
		{
457
			SpkForm ^child = this->GetActiveChild();
458
			if ( child )
459
				return child->GetExtractDir(package);
460
 
461
			return nullptr;
462
		}
463
 
464
		void ExtractAll()
465
		{
466
			SpkForm ^child = this->GetActiveChild();
467
			if ( child )
468
			{
469
				System::String ^toDir = GetExtractDir(false);
470
				if ( toDir )
471
					child->ExtractAll(toDir);
472
			}
473
		}
474
 
475
		void ExtractAllPackage()
476
		{
477
			SpkForm ^child = this->GetActiveChild();
478
			if ( child && child->IsMultiPackage() )
479
			{
480
				System::String ^toDir = GetExtractDir(false);
481
				if ( toDir )
482
					child->ExtractAllPackage(toDir);
483
			}
484
		}
485
 
486
		void OpenDirectory(System::String ^dir)
487
		{
488
			if ( !System::IO::Directory::Exists(dir) )
489
			{
490
				MessageBox::Show(this, "Unable to open packages from directory\nDirectory not found\n\n" + dir, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
491
				return;
492
			}
493
 
494
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.spk"), false, false);
495
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.xsp"), false, false);
496
		}
497
 
498
		void OpenFiles(cli::array<System::String ^> ^list, bool checkExtension, bool display)
499
		{
500
			if ( !list )
501
				return;
502
 
503
			for ( int i = 0; i < list->Length; i++ )
504
				this->Open(list[i], display, checkExtension);
505
 
506
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
507
			for ( int i = 0; i < children->Length; i++ )
508
			{
509
				SpkForm ^childForm = (SpkForm ^)children[i];
510
				if ( !childForm->TabPage()->Visible )
511
				{
512
					childForm->Show();
513
					childForm->TabPage()->Show();
514
				}
515
			}
516
		}
517
 
518
		void OpenFiles(ArrayList ^list, bool checkExtension, bool display)
519
		{
520
			if ( !list )
521
				return;
522
 
523
			for ( int i = 0; i < list->Count; i++ )
524
				this->Open(cli::safe_cast<String ^>(list[i]), display, checkExtension);
525
 
526
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
527
			for ( int i = 0; i < children->Length; i++ )
528
			{
529
				SpkForm ^childForm = (SpkForm ^)children[i];
530
				if ( !childForm->TabPage()->Visible )
531
				{
532
					childForm->Show();
533
					childForm->TabPage()->Show();
534
				}
535
			}
536
		}
537
 
538
		void Open(System::String ^file, bool display, bool checkExtension)
539
		{
540
			if ( checkExtension )
541
			{
542
				if ( String::Compare(IO::FileInfo(file).Extension, ".spk") != 0 && String::Compare(IO::FileInfo(file).Extension, ".xsp") != 0 )
543
					return;
544
			}
545
 
546
			if ( !System::IO::File::Exists(file) )
547
			{
548
				if ( display )
549
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nFile doesn't exist", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
550
				return;
551
			}
552
 
553
			float fVersion;
554
			CyString sFile = CyStringFromSystemString(file);
555
			int fileType = CSpkFile::CheckFile(sFile, &fVersion);
556
 
557
			if ( fVersion > (float)FILEVERSION )
558
			{
559
				if ( display )
560
					MessageBox::Show(this, "Package file is created with a newer version, unable to open", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
561
				return;
562
			}
563
 
564
			if ( fileType == SPKFILE_INVALID )
565
			{
566
				if ( display )
567
				{
568
					if ( String::Compare(IO::FileInfo(file).Extension, ".xsp") == 0)
569
					{
570
						if ( MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nThis could be an old format XSP file, would u like to attempt to convert the file?\nThis will overright the existing file", "Load Error", MessageBoxButtons::YesNo, MessageBoxIcon::Error) == Windows::Forms::DialogResult::Yes )
571
						{
572
							ConvertFile ^convert = gcnew ConvertFile(file);
573
							if ( convert->ShowDialog(this) == Windows::Forms::DialogResult::OK )
574
								this->Open(file, display, checkExtension);
575
							else
576
								MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nUnable to convert package\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
577
						}
578
					}
579
					else
580
						MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
581
				}
582
				return;				
583
			}
584
 
585
			// open multi package
586
			TabPage ^tp;
587
			SpkForm ^childForm;
588
 
589
			int error;
590
			if ( fileType == SPKFILE_MULTI )
591
			{
592
				CMultiSpkFile *mspk = m_pPackages->OpenMultiPackage(sFile, &error);
593
				if ( mspk )
594
				{
595
					tp = gcnew TabPage();
129 cycrow 596
					childForm = gcnew SpkForm(this, tabControl1, tp, m_pPackages);
1 cycrow 597
					childForm->SetMultiPackage(mspk, file);
598
					tp->ImageIndex = this->imageList1->Images->IndexOfKey("multi");
599
					if ( tp->ImageIndex == -1 )
600
						tp->ImageIndex = 0;
601
				}
602
			}
603
			else
604
			{
605
				CBaseFile *package = m_pPackages->OpenPackage(sFile, &error, 0, SPKREAD_NODATA);
606
				if ( package )
607
				{
608
					tp = gcnew TabPage();
609
					if ( this->imageList1->Images->IndexOfKey(file) == -1 )
610
					{
170 cycrow 611
						if (package->icon())
1 cycrow 612
						{
613
							package->ReadIconFileToMemory();
158 cycrow 614
							Utils::String sIconFile = _S(IO::Path::GetTempPath()) + "\\" + CFileIO(sFile).baseName() + "." + package->iconExt();
170 cycrow 615
							if ( package->ExtractFile(package->icon(), CFileIO(sIconFile).fullFilename(), false) )
1 cycrow 616
							{
170 cycrow 617
								String ^iconFile = _US(sIconFile);
1 cycrow 618
								if ( IO::File::Exists(iconFile) )
619
								{
620
									String ^ext = System::IO::FileInfo(iconFile).Extension;
621
									if ( !String::Compare(ext, "bmp", false) || !String::Compare(ext, "ico", false) )
622
										this->imageList1->Images->Add(file, Bitmap::FromFile(iconFile));
623
									else
624
									{
625
										Bitmap ^myBitmap = gcnew Bitmap(iconFile);
626
										if ( myBitmap )
627
											this->imageList1->Images->Add(file, myBitmap);
628
									}
629
								}
630
							}
631
						}
632
					}
633
 
634
					tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
635
					if ( tp->ImageIndex == -1 )
636
						tp->ImageIndex = 0;
637
 
129 cycrow 638
					childForm = gcnew SpkForm(this, tabControl1, tp, m_pPackages);
1 cycrow 639
					childForm->SetPackage(package, file);
640
				}
641
			}
642
 
643
			if ( tp && childForm )
644
			{
645
				ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(file, this->imageList1->Images[tp->ImageIndex], gcnew System::EventHandler(this, &Form1::WindowSelectEvent));
646
				childForm->SetToolButton(toolBut);
647
				this->ToolWindows->DropDownItems->Add(toolBut);
648
				tp->Parent = tabControl1;
649
				childForm->Text = file;
650
				if ( display || !this->HasChildren )
651
				{
652
					tp->Show();
653
					childForm->Show();
654
					tabControl1->SelectedTab = tp;
655
				}
656
				childForm->WindowState = FormWindowState::Maximized;
657
				childForm->ChangeView(m_curView);
658
 
659
				// adjust the loaded list
660
				sFile.FindReplace("/", "\\");
661
				sFile.RemoveChar(9);
662
				sFile.RemoveChar('\r');
663
				sFile.RemoveChar('\n');
664
				m_pLoadedList->Remove(sFile, true);
665
				m_pLoadedList->PushFront(sFile);
666
 
667
				while ( m_pLoadedList->Count() > 15 )
668
					m_pLoadedList->PopBack();
669
 
670
				this->SaveData();
671
 
672
				this->UpdateDropDownOpen();
673
			}	
674
			else
675
			{
676
				if ( display )
677
				{
678
					System::String ^sError = "Unknown Error (" + SystemStringFromCyString(CyString::Number(error)) + ")";
679
					switch ( error )
680
					{
681
						case INSTALLERR_OLD:
682
							sError = "Old unsupported package file";
683
							break;
684
						case INSTALLERR_INVALID:
685
							sError = "Invalid Package File";
686
							break;
687
						case INSTALLERR_NOMULTI:
688
							sError = "Multi-Packages not currently supported";
689
							break;
690
					}
691
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
692
				}
693
			}
694
		}
695
 
696
		void Open()
697
		{
698
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
699
			ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";
700
			ofd->FilterIndex = 1;
701
			ofd->RestoreDirectory = true;
702
			ofd->Multiselect = true;
703
 
704
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
705
				this->OpenFiles(ofd->FileNames, false, true);
706
		}
707
 
708
		void CloseAll()
709
		{
710
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
711
			for ( int i = 0; i < children->Length; i++ )
712
			{
713
				delete ((SpkForm ^)children[i])->TabPage();
714
				delete children[i];
715
			}
716
			this->RemoveCopied(true);
717
			this->UpdateDisplay();
718
		}
719
 
720
		void ChangeView(System::Windows::Forms::View view)
721
		{
722
			this->listToolStripMenuItem->Checked = false;
723
			this->largeIconToolStripMenuItem->Checked = false;
724
			this->detailsToolStripMenuItem->Checked = false;
725
 
726
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
727
			for ( int i = 0; i < children->Length; i++ )
728
			{
729
				SpkForm ^childForm = (SpkForm ^)children[i];
730
				childForm->ChangeView(view);
731
			}
732
 
733
			m_curView = view;
734
		}
735
 
736
		void LoadFiles(String ^loadFrom)
737
		{
738
			if ( System::IO::File::Exists(loadFrom) )
739
			{
740
				System::String ^lines = System::IO::File::ReadAllText(loadFrom);
741
				try { System::IO::File::Delete(loadFrom); }
742
				catch (System::IO::IOException ^) {}
743
				catch (System::Exception ^) {}
744
 
745
				if ( lines )
746
				{
747
					CyString strLines = CyStringFromSystemString(lines);
748
					int num;
749
					CyString *aLines = strLines.SplitToken("\n", &num);
750
					if ( num && aLines )
751
					{
752
						ArrayList ^list = gcnew ArrayList();
753
						for ( int i = 0; i < num; i++ )
754
						{
755
							CyString l = aLines[i];
756
							l = l.Remove("\r");
757
							CyString first = l.GetToken(":", 1, 1);
758
							CyString rest = l.GetToken(":", 2);
759
							rest.RemoveFirstSpace();
760
 
761
							if ( first.Compare("File") )
762
								list->Add(SystemStringFromCyString(rest));
763
						}
764
 
765
						this->OpenFiles(list, true, true);
766
 
767
						CLEANSPLIT(aLines, num);
768
					}
769
				}
770
			}			
771
		}
772
 
773
		void AddPackage()
774
		{
775
			SpkForm ^active = this->GetActiveChild();
776
			if ( !active )
777
				return;
778
 
779
			if ( !active->IsMultiPackage() )
780
				return;
781
 
782
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
783
 
784
			ofd->Filter = "All Vaild|*.spk;*.xsp|Packages|*.spk|Ships|*.xsp";
785
			ofd->FilterIndex = 1;
786
			ofd->RestoreDirectory = true;
787
			ofd->Multiselect = true;
788
			ofd->Title = "Select packages(s) to add";
789
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
790
			{
791
				AddDialog ^ad = gcnew AddDialog(NULL, active->GetMultiPackage());
792
				ad->AddFileArray(ofd->FileNames, "", -1, 0);
793
				ad->ShowDialog(this);
794
 
795
				active->UpdateView(false);
796
			}
797
		}
798
 
799
		void AddFile()
800
		{
801
			SpkForm ^active = this->GetActiveChild();
802
			if ( !active )
803
				return;
804
			CBaseFile *activePackage = active->GetPackage();
805
			if ( !activePackage )
806
				return;
807
 
808
			// add filters
809
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
810
 
811
			System::String ^filter;
812
			for ( int i = 0; i < FILETYPE_MAX; i++ )
813
			{
814
				if ( filter )
815
					filter += "|";
816
				filter += SystemStringFromCyString(GetFileTypeString(i));
817
				filter += "|";
818
				// add extensions
819
				switch ( i )
820
				{
821
					case FILETYPE_SCRIPT:
822
					case FILETYPE_UNINSTALL:
823
					case FILETYPE_MAP:
824
					case FILETYPE_TEXT:
825
					case FILETYPE_MISSION:
826
						filter += "*.pck;*.xml";
827
						break;
828
 
829
					case FILETYPE_README:
830
						filter += "*.txt;*.doc";
831
						break;
832
 
833
					case FILETYPE_MOD:
834
						filter += "*.cat";
835
						break;
836
 
837
					case FILETYPE_SOUND:
838
						filter += "*.wav";
839
						break;
840
 
841
					case FILETYPE_SCREEN:
842
					case FILETYPE_ADVERT:
843
						filter += "*.jpg;*.png";
844
						break;
845
 
846
					case FILETYPE_SHIPSCENE:
847
					case FILETYPE_COCKPITSCENE:
848
						filter += "*.pbd;*.bod";
849
						break;
850
 
851
					case FILETYPE_SHIPMODEL:
852
						filter += "*.pbd;*.bod;*.bob;*.pbb";
853
						break;
854
 
855
					default:
856
						filter += "*.*";
857
				}
858
			}
859
			ofd->Filter = filter;
860
			ofd->FilterIndex = 1;
861
			ofd->RestoreDirectory = true;
862
			ofd->Multiselect = true;
863
			ofd->Title = "Select File(s) to add to package";
864
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
865
			{
866
				System::String ^dir;
867
				if ( (ofd->FilterIndex - 1) == FILETYPE_EXTRA )
868
				{
869
					InputBox ^input = gcnew InputBox("Enter the directory for extra files", "PluginManager/Extras/$scriptname");
870
					if ( input->ShowDialog() == System::Windows::Forms::DialogResult::OK )
871
						dir = input->GetInput();
872
				}
873
 
874
				AddDialog ^ad = gcnew AddDialog(activePackage, active->GetMultiPackage());
875
				ad->AddFileArray(ofd->FileNames, dir, ofd->FilterIndex - 1, 0);
876
				ad->ShowDialog(this);
877
 
878
				active->UpdateView(false);
879
			}
880
		}
881
 
882
		void RemoveSelectedPackage()
883
		{
884
			SpkForm ^child = this->GetActiveChild();
885
			if ( child )
886
				child->RemoveSelectedPackage();
887
		}
888
		void RemoveSelected()
889
		{
890
			SpkForm ^child = this->GetActiveChild();
891
			if ( child )
892
				child->RemoveSelected();
893
		}
894
 
895
		System::Windows::Forms::View m_curView;
896
		CyStringList		*m_pLoadedList;
897
		CLinkList<C_File>	*m_lCopiedFiles;
898
		SpkForm				^m_pCutFrom;
899
		CLinkList<C_File>	*m_lDraggedFiles;
900
		SpkForm				^m_pDraggedFrom;
901
 
902
private: System::ComponentModel::IContainer^  components;
903
		 /// <summary>
904
		/// Required designer variable.
905
		/// </summary>
906
 
907
 
908
#pragma region Windows Form Designer generated code
909
		/// <summary>
910
		/// Required method for Designer support - do not modify
911
		/// the contents of this method with the code editor.
912
		/// </summary>
913
		void InitializeComponent(void)
914
		{
915
			this->components = (gcnew System::ComponentModel::Container());
916
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
917
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
918
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
919
			this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
920
			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
921
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
922
			this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
923
			this->layoutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
924
			this->maximisedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
925
			this->cascadeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
926
			this->tileVerticallyToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
927
			this->tileHorizontalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
928
			this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());
929
			this->detailsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
930
			this->largeIconToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
931
			this->listToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
932
			this->ToolWindows = (gcnew System::Windows::Forms::ToolStripMenuItem());
933
			this->closeAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
934
			this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator());
935
			this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
936
			this->toolStripSplitButton1 = (gcnew System::Windows::Forms::ToolStripSplitButton());
937
			this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
938
			this->ToolAdd = (gcnew System::Windows::Forms::ToolStripButton());
939
			this->ToolAdd2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
940
			this->toolStripMenuItem3 = (gcnew System::Windows::Forms::ToolStripMenuItem());
941
			this->toolStripMenuItem4 = (gcnew System::Windows::Forms::ToolStripMenuItem());
942
			this->ToolRemove2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
943
			this->toolStripMenuItem5 = (gcnew System::Windows::Forms::ToolStripMenuItem());
944
			this->toolStripMenuItem6 = (gcnew System::Windows::Forms::ToolStripMenuItem());
945
			this->ToolRemove = (gcnew System::Windows::Forms::ToolStripButton());
946
			this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
947
			this->ToolExtract2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
948
			this->packagesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
949
			this->filesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
950
			this->ToolExtract = (gcnew System::Windows::Forms::ToolStripButton());
951
			this->ToolExtractAll2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
952
			this->toolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
953
			this->toolStripMenuItem2 = (gcnew System::Windows::Forms::ToolStripMenuItem());
954
			this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
955
			this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
956
			this->ToolPaste = (gcnew System::Windows::Forms::ToolStripButton());
957
			this->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator());
958
			this->ToolInfo = (gcnew System::Windows::Forms::ToolStripButton());
959
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
960
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
961
			this->panel1 = (gcnew System::Windows::Forms::Panel());
962
			this->button1 = (gcnew System::Windows::Forms::Button());
963
			this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
964
			this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
965
			this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
966
			this->StatusFiles = (gcnew System::Windows::Forms::ToolStripStatusLabel());
967
			this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
968
			this->packageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
969
			this->fileToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
970
			this->menuStrip1->SuspendLayout();
971
			this->toolStrip1->SuspendLayout();
972
			this->panel1->SuspendLayout();
973
			this->statusStrip1->SuspendLayout();
974
			this->contextMenuStrip1->SuspendLayout();
975
			this->SuspendLayout();
976
			// 
977
			// menuStrip1
978
			// 
979
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
980
				this->viewToolStripMenuItem, this->ToolWindows});
981
			this->menuStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;
982
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
983
			this->menuStrip1->Name = L"menuStrip1";
984
			this->menuStrip1->Size = System::Drawing::Size(746, 24);
985
			this->menuStrip1->TabIndex = 1;
986
			this->menuStrip1->Text = L"menuStrip1";
987
			// 
988
			// fileToolStripMenuItem
989
			// 
990
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->openToolStripMenuItem, 
991
				this->toolStripSeparator1, this->exitToolStripMenuItem});
992
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
993
			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
994
			this->fileToolStripMenuItem->Text = L"&File";
995
			// 
996
			// openToolStripMenuItem
997
			// 
998
			this->openToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"openToolStripMenuItem.Image")));
999
			this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
1000
			this->openToolStripMenuItem->Size = System::Drawing::Size(103, 22);
1001
			this->openToolStripMenuItem->Text = L"&Open";
1002
			this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openToolStripMenuItem_Click);
1003
			// 
1004
			// toolStripSeparator1
1005
			// 
1006
			this->toolStripSeparator1->Name = L"toolStripSeparator1";
1007
			this->toolStripSeparator1->Size = System::Drawing::Size(100, 6);
1008
			// 
1009
			// exitToolStripMenuItem
1010
			// 
1011
			this->exitToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"exitToolStripMenuItem.Image")));
1012
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
1013
			this->exitToolStripMenuItem->Size = System::Drawing::Size(103, 22);
1014
			this->exitToolStripMenuItem->Text = L"E&xit";
1015
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
1016
			// 
1017
			// viewToolStripMenuItem
1018
			// 
1019
			this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(5) {this->layoutToolStripMenuItem, 
1020
				this->toolStripSeparator5, this->detailsToolStripMenuItem, this->largeIconToolStripMenuItem, this->listToolStripMenuItem});
1021
			this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
1022
			this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
1023
			this->viewToolStripMenuItem->Text = L"&View";
1024
			// 
1025
			// layoutToolStripMenuItem
1026
			// 
1027
			this->layoutToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->maximisedToolStripMenuItem, 
1028
				this->cascadeToolStripMenuItem, this->tileVerticallyToolStripMenuItem, this->tileHorizontalToolStripMenuItem});
1029
			this->layoutToolStripMenuItem->Name = L"layoutToolStripMenuItem";
1030
			this->layoutToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1031
			this->layoutToolStripMenuItem->Text = L"Layout";
1032
			// 
1033
			// maximisedToolStripMenuItem
1034
			// 
1035
			this->maximisedToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"maximisedToolStripMenuItem.Image")));
1036
			this->maximisedToolStripMenuItem->Name = L"maximisedToolStripMenuItem";
1037
			this->maximisedToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1038
			this->maximisedToolStripMenuItem->Text = L"Maximised";
1039
			this->maximisedToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::maximisedToolStripMenuItem_Click);
1040
			// 
1041
			// cascadeToolStripMenuItem
1042
			// 
1043
			this->cascadeToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"cascadeToolStripMenuItem.Image")));
1044
			this->cascadeToolStripMenuItem->Name = L"cascadeToolStripMenuItem";
1045
			this->cascadeToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1046
			this->cascadeToolStripMenuItem->Text = L"Cascade";
1047
			this->cascadeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::cascadeToolStripMenuItem_Click);
1048
			// 
1049
			// tileVerticallyToolStripMenuItem
1050
			// 
1051
			this->tileVerticallyToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"tileVerticallyToolStripMenuItem.Image")));
1052
			this->tileVerticallyToolStripMenuItem->Name = L"tileVerticallyToolStripMenuItem";
1053
			this->tileVerticallyToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1054
			this->tileVerticallyToolStripMenuItem->Text = L"Tile Vertical";
1055
			this->tileVerticallyToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::tileVerticallyToolStripMenuItem_Click);
1056
			// 
1057
			// tileHorizontalToolStripMenuItem
1058
			// 
1059
			this->tileHorizontalToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"tileHorizontalToolStripMenuItem.Image")));
1060
			this->tileHorizontalToolStripMenuItem->Name = L"tileHorizontalToolStripMenuItem";
1061
			this->tileHorizontalToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1062
			this->tileHorizontalToolStripMenuItem->Text = L"Tile Horizontal";
1063
			this->tileHorizontalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::tileHorizontalToolStripMenuItem_Click);
1064
			// 
1065
			// toolStripSeparator5
1066
			// 
1067
			this->toolStripSeparator5->Name = L"toolStripSeparator5";
1068
			this->toolStripSeparator5->Size = System::Drawing::Size(107, 6);
1069
			// 
1070
			// detailsToolStripMenuItem
1071
			// 
1072
			this->detailsToolStripMenuItem->Checked = true;
1073
			this->detailsToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1074
			this->detailsToolStripMenuItem->Name = L"detailsToolStripMenuItem";
1075
			this->detailsToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1076
			this->detailsToolStripMenuItem->Text = L"Details";
1077
			this->detailsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::detailsToolStripMenuItem_Click);
1078
			// 
1079
			// largeIconToolStripMenuItem
1080
			// 
1081
			this->largeIconToolStripMenuItem->Name = L"largeIconToolStripMenuItem";
1082
			this->largeIconToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1083
			this->largeIconToolStripMenuItem->Text = L"Icons";
1084
			this->largeIconToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::largeIconToolStripMenuItem_Click);
1085
			// 
1086
			// listToolStripMenuItem
1087
			// 
1088
			this->listToolStripMenuItem->Name = L"listToolStripMenuItem";
1089
			this->listToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1090
			this->listToolStripMenuItem->Text = L"List";
1091
			this->listToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::listToolStripMenuItem_Click);
1092
			// 
1093
			// ToolWindows
1094
			// 
1095
			this->ToolWindows->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->closeAllToolStripMenuItem, 
1096
				this->toolStripSeparator6});
1097
			this->ToolWindows->Name = L"ToolWindows";
1098
			this->ToolWindows->Size = System::Drawing::Size(68, 20);
1099
			this->ToolWindows->Text = L"Windows";
1100
			// 
1101
			// closeAllToolStripMenuItem
1102
			// 
1103
			this->closeAllToolStripMenuItem->Name = L"closeAllToolStripMenuItem";
1104
			this->closeAllToolStripMenuItem->Size = System::Drawing::Size(120, 22);
1105
			this->closeAllToolStripMenuItem->Text = L"Close All";
1106
			this->closeAllToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::closeAllToolStripMenuItem_Click);
1107
			// 
1108
			// toolStripSeparator6
1109
			// 
1110
			this->toolStripSeparator6->Name = L"toolStripSeparator6";
1111
			this->toolStripSeparator6->Size = System::Drawing::Size(117, 6);
1112
			// 
1113
			// toolStrip1
1114
			// 
1115
			this->toolStrip1->GripStyle = System::Windows::Forms::ToolStripGripStyle::Hidden;
1116
			this->toolStrip1->ImageScalingSize = System::Drawing::Size(32, 32);
1117
			this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(15) {this->toolStripSplitButton1, 
1118
				this->toolStripSeparator2, this->ToolAdd, this->ToolAdd2, this->ToolRemove2, this->ToolRemove, this->toolStripSeparator3, this->ToolExtract2, 
1119
				this->ToolExtract, this->ToolExtractAll2, this->toolStripButton1, this->toolStripSeparator4, this->ToolPaste, this->toolStripSeparator7, 
1120
				this->ToolInfo});
1121
			this->toolStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;
1122
			this->toolStrip1->Location = System::Drawing::Point(0, 24);
1123
			this->toolStrip1->Name = L"toolStrip1";
1124
			this->toolStrip1->Size = System::Drawing::Size(746, 54);
1125
			this->toolStrip1->TabIndex = 2;
1126
			this->toolStrip1->Text = L"toolStrip1";
1127
			// 
1128
			// toolStripSplitButton1
1129
			// 
1130
			this->toolStripSplitButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
1131
			this->toolStripSplitButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1132
			this->toolStripSplitButton1->Name = L"toolStripSplitButton1";
1133
			this->toolStripSplitButton1->RightToLeft = System::Windows::Forms::RightToLeft::No;
1134
			this->toolStripSplitButton1->Size = System::Drawing::Size(84, 51);
1135
			this->toolStripSplitButton1->Text = L"Open";
1136
			this->toolStripSplitButton1->ButtonClick += gcnew System::EventHandler(this, &Form1::toolStripSplitButton1_ButtonClick);
1137
			// 
1138
			// toolStripSeparator2
1139
			// 
1140
			this->toolStripSeparator2->Name = L"toolStripSeparator2";
1141
			this->toolStripSeparator2->Size = System::Drawing::Size(6, 54);
1142
			// 
1143
			// ToolAdd
1144
			// 
1145
			this->ToolAdd->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolAdd.Image")));
1146
			this->ToolAdd->ImageTransparentColor = System::Drawing::Color::Magenta;
1147
			this->ToolAdd->Name = L"ToolAdd";
1148
			this->ToolAdd->Size = System::Drawing::Size(54, 51);
1149
			this->ToolAdd->Text = L"Add File";
1150
			this->ToolAdd->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1151
			this->ToolAdd->Click += gcnew System::EventHandler(this, &Form1::toolStripButton2_Click);
1152
			// 
1153
			// ToolAdd2
1154
			// 
1155
			this->ToolAdd2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->toolStripMenuItem3, 
1156
				this->toolStripMenuItem4});
1157
			this->ToolAdd2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolAdd2.Image")));
1158
			this->ToolAdd2->ImageTransparentColor = System::Drawing::Color::Magenta;
1159
			this->ToolAdd2->Name = L"ToolAdd2";
1160
			this->ToolAdd2->Size = System::Drawing::Size(63, 51);
1161
			this->ToolAdd2->Text = L"Add File";
1162
			this->ToolAdd2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1163
			// 
1164
			// toolStripMenuItem3
1165
			// 
1166
			this->toolStripMenuItem3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem3.Image")));
1167
			this->toolStripMenuItem3->Name = L"toolStripMenuItem3";
1168
			this->toolStripMenuItem3->Size = System::Drawing::Size(123, 22);
1169
			this->toolStripMenuItem3->Text = L"Packages";
1170
			this->toolStripMenuItem3->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem3_Click);
1171
			// 
1172
			// toolStripMenuItem4
1173
			// 
1174
			this->toolStripMenuItem4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem4.Image")));
1175
			this->toolStripMenuItem4->Name = L"toolStripMenuItem4";
1176
			this->toolStripMenuItem4->Size = System::Drawing::Size(123, 22);
1177
			this->toolStripMenuItem4->Text = L"Files";
1178
			this->toolStripMenuItem4->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem4_Click);
1179
			// 
1180
			// ToolRemove2
1181
			// 
1182
			this->ToolRemove2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->toolStripMenuItem5, 
1183
				this->toolStripMenuItem6});
1184
			this->ToolRemove2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolRemove2.Image")));
1185
			this->ToolRemove2->ImageTransparentColor = System::Drawing::Color::Magenta;
1186
			this->ToolRemove2->Name = L"ToolRemove2";
1187
			this->ToolRemove2->Size = System::Drawing::Size(84, 51);
1188
			this->ToolRemove2->Text = L"Remove File";
1189
			this->ToolRemove2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1190
			// 
1191
			// toolStripMenuItem5
1192
			// 
1193
			this->toolStripMenuItem5->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem5.Image")));
1194
			this->toolStripMenuItem5->Name = L"toolStripMenuItem5";
1195
			this->toolStripMenuItem5->Size = System::Drawing::Size(123, 22);
1196
			this->toolStripMenuItem5->Text = L"Packages";
1197
			this->toolStripMenuItem5->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem5_Click);
1198
			// 
1199
			// toolStripMenuItem6
1200
			// 
1201
			this->toolStripMenuItem6->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem6.Image")));
1202
			this->toolStripMenuItem6->Name = L"toolStripMenuItem6";
1203
			this->toolStripMenuItem6->Size = System::Drawing::Size(123, 22);
1204
			this->toolStripMenuItem6->Text = L"Files";
1205
			this->toolStripMenuItem6->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem6_Click);
1206
			// 
1207
			// ToolRemove
1208
			// 
1209
			this->ToolRemove->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolRemove.Image")));
1210
			this->ToolRemove->ImageTransparentColor = System::Drawing::Color::Magenta;
1211
			this->ToolRemove->Name = L"ToolRemove";
1212
			this->ToolRemove->Size = System::Drawing::Size(75, 51);
1213
			this->ToolRemove->Text = L"Remove File";
1214
			this->ToolRemove->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1215
			this->ToolRemove->Click += gcnew System::EventHandler(this, &Form1::ToolRemove_Click);
1216
			// 
1217
			// toolStripSeparator3
1218
			// 
1219
			this->toolStripSeparator3->Name = L"toolStripSeparator3";
1220
			this->toolStripSeparator3->Size = System::Drawing::Size(6, 54);
1221
			// 
1222
			// ToolExtract2
1223
			// 
1224
			this->ToolExtract2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->packagesToolStripMenuItem, 
1225
				this->filesToolStripMenuItem});
1226
			this->ToolExtract2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolExtract2.Image")));
1227
			this->ToolExtract2->ImageTransparentColor = System::Drawing::Color::Magenta;
1228
			this->ToolExtract2->Name = L"ToolExtract2";
1229
			this->ToolExtract2->Size = System::Drawing::Size(102, 51);
1230
			this->ToolExtract2->Text = L"Extract Selected";
1231
			this->ToolExtract2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1232
			// 
1233
			// packagesToolStripMenuItem
1234
			// 
1235
			this->packagesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"packagesToolStripMenuItem.Image")));
1236
			this->packagesToolStripMenuItem->Name = L"packagesToolStripMenuItem";
1237
			this->packagesToolStripMenuItem->Size = System::Drawing::Size(123, 22);
1238
			this->packagesToolStripMenuItem->Text = L"Packages";
1239
			this->packagesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packagesToolStripMenuItem_Click);
1240
			// 
1241
			// filesToolStripMenuItem
1242
			// 
1243
			this->filesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"filesToolStripMenuItem.Image")));
1244
			this->filesToolStripMenuItem->Name = L"filesToolStripMenuItem";
1245
			this->filesToolStripMenuItem->Size = System::Drawing::Size(123, 22);
1246
			this->filesToolStripMenuItem->Text = L"Files";
1247
			this->filesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::filesToolStripMenuItem_Click);
1248
			// 
1249
			// ToolExtract
1250
			// 
1251
			this->ToolExtract->Enabled = false;
1252
			this->ToolExtract->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolExtract.Image")));
1253
			this->ToolExtract->ImageTransparentColor = System::Drawing::Color::Magenta;
1254
			this->ToolExtract->Name = L"ToolExtract";
1255
			this->ToolExtract->Size = System::Drawing::Size(93, 51);
1256
			this->ToolExtract->Text = L"Extract Selected";
1257
			this->ToolExtract->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1258
			this->ToolExtract->Click += gcnew System::EventHandler(this, &Form1::ToolExtract_Click);
1259
			// 
1260
			// ToolExtractAll2
1261
			// 
1262
			this->ToolExtractAll2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->toolStripMenuItem1, 
1263
				this->toolStripMenuItem2});
1264
			this->ToolExtractAll2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolExtractAll2.Image")));
1265
			this->ToolExtractAll2->ImageTransparentColor = System::Drawing::Color::Magenta;
1266
			this->ToolExtractAll2->Name = L"ToolExtractAll2";
1267
			this->ToolExtractAll2->Size = System::Drawing::Size(72, 51);
1268
			this->ToolExtractAll2->Text = L"Extract All";
1269
			this->ToolExtractAll2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1270
			// 
1271
			// toolStripMenuItem1
1272
			// 
1273
			this->toolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem1.Image")));
1274
			this->toolStripMenuItem1->Name = L"toolStripMenuItem1";
1275
			this->toolStripMenuItem1->Size = System::Drawing::Size(123, 22);
1276
			this->toolStripMenuItem1->Text = L"Packages";
1277
			this->toolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem1_Click);
1278
			// 
1279
			// toolStripMenuItem2
1280
			// 
1281
			this->toolStripMenuItem2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem2.Image")));
1282
			this->toolStripMenuItem2->Name = L"toolStripMenuItem2";
1283
			this->toolStripMenuItem2->Size = System::Drawing::Size(123, 22);
1284
			this->toolStripMenuItem2->Text = L"Files";
1285
			this->toolStripMenuItem2->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem2_Click);
1286
			// 
1287
			// toolStripButton1
1288
			// 
1289
			this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton1.Image")));
1290
			this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1291
			this->toolStripButton1->Name = L"toolStripButton1";
1292
			this->toolStripButton1->Size = System::Drawing::Size(63, 51);
1293
			this->toolStripButton1->Text = L"Extract All";
1294
			this->toolStripButton1->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1295
			this->toolStripButton1->Click += gcnew System::EventHandler(this, &Form1::toolStripButton1_Click);
1296
			// 
1297
			// toolStripSeparator4
1298
			// 
1299
			this->toolStripSeparator4->Name = L"toolStripSeparator4";
1300
			this->toolStripSeparator4->Size = System::Drawing::Size(6, 54);
1301
			// 
1302
			// ToolPaste
1303
			// 
1304
			this->ToolPaste->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolPaste.Image")));
1305
			this->ToolPaste->ImageTransparentColor = System::Drawing::Color::Magenta;
1306
			this->ToolPaste->Name = L"ToolPaste";
1307
			this->ToolPaste->Size = System::Drawing::Size(39, 51);
1308
			this->ToolPaste->Text = L"Paste";
1309
			this->ToolPaste->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1310
			this->ToolPaste->Click += gcnew System::EventHandler(this, &Form1::ToolPaste_Click);
1311
			// 
1312
			// toolStripSeparator7
1313
			// 
1314
			this->toolStripSeparator7->Name = L"toolStripSeparator7";
1315
			this->toolStripSeparator7->Size = System::Drawing::Size(6, 54);
1316
			// 
1317
			// ToolInfo
1318
			// 
1319
			this->ToolInfo->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolInfo.Image")));
1320
			this->ToolInfo->ImageTransparentColor = System::Drawing::Color::Magenta;
1321
			this->ToolInfo->Name = L"ToolInfo";
1322
			this->ToolInfo->Size = System::Drawing::Size(79, 51);
1323
			this->ToolInfo->Text = L"Package Info";
1324
			this->ToolInfo->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1325
			this->ToolInfo->Click += gcnew System::EventHandler(this, &Form1::ToolInfo_Click);
1326
			// 
1327
			// tabControl1
1328
			// 
1329
			this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
1330
			this->tabControl1->ImageList = this->imageList1;
1331
			this->tabControl1->Location = System::Drawing::Point(0, 0);
1332
			this->tabControl1->Name = L"tabControl1";
1333
			this->tabControl1->SelectedIndex = 0;
1334
			this->tabControl1->Size = System::Drawing::Size(725, 23);
1335
			this->tabControl1->TabIndex = 3;
1336
			this->tabControl1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::tabControl1_SelectedIndexChanged);
1337
			// 
1338
			// imageList1
1339
			// 
1340
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
1341
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
1342
			this->imageList1->Images->SetKeyName(0, L"standard");
1343
			this->imageList1->Images->SetKeyName(1, L"multi");
1344
			// 
1345
			// panel1
1346
			// 
1347
			this->panel1->Controls->Add(this->tabControl1);
1348
			this->panel1->Controls->Add(this->button1);
1349
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
1350
			this->panel1->Location = System::Drawing::Point(0, 78);
1351
			this->panel1->Name = L"panel1";
1352
			this->panel1->Size = System::Drawing::Size(746, 23);
1353
			this->panel1->TabIndex = 5;
1354
			// 
1355
			// button1
1356
			// 
1357
			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
1358
			this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
1359
				static_cast<System::Byte>(0)));
1360
			this->button1->ForeColor = System::Drawing::Color::Red;
1361
			this->button1->Location = System::Drawing::Point(725, 0);
1362
			this->button1->Name = L"button1";
1363
			this->button1->Size = System::Drawing::Size(21, 23);
1364
			this->button1->TabIndex = 4;
1365
			this->button1->Text = L"X";
1366
			this->button1->UseVisualStyleBackColor = true;
1367
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
1368
			// 
1369
			// toolTip1
1370
			// 
1371
			this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;
1372
			this->toolTip1->ToolTipTitle = L"Close All";
1373
			// 
1374
			// timer1
1375
			// 
1376
			this->timer1->Enabled = true;
1377
			this->timer1->Interval = 500;
1378
			this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
1379
			// 
1380
			// statusStrip1
1381
			// 
1382
			this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->StatusFiles});
1383
			this->statusStrip1->Location = System::Drawing::Point(0, 541);
1384
			this->statusStrip1->Name = L"statusStrip1";
1385
			this->statusStrip1->Size = System::Drawing::Size(746, 22);
1386
			this->statusStrip1->TabIndex = 7;
1387
			this->statusStrip1->Text = L"statusStrip1";
1388
			// 
1389
			// StatusFiles
1390
			// 
1391
			this->StatusFiles->Name = L"StatusFiles";
1392
			this->StatusFiles->Size = System::Drawing::Size(79, 17);
1393
			this->StatusFiles->Text = L"Files: 1 (10KB)";
1394
			// 
1395
			// contextMenuStrip1
1396
			// 
1397
			this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->packageToolStripMenuItem, 
1398
				this->fileToolStripMenuItem1});
1399
			this->contextMenuStrip1->Name = L"contextMenuStrip1";
1400
			this->contextMenuStrip1->Size = System::Drawing::Size(119, 48);
1401
			// 
1402
			// packageToolStripMenuItem
1403
			// 
1404
			this->packageToolStripMenuItem->Name = L"packageToolStripMenuItem";
1405
			this->packageToolStripMenuItem->Size = System::Drawing::Size(118, 22);
1406
			this->packageToolStripMenuItem->Text = L"Package";
1407
			// 
1408
			// fileToolStripMenuItem1
1409
			// 
1410
			this->fileToolStripMenuItem1->Name = L"fileToolStripMenuItem1";
1411
			this->fileToolStripMenuItem1->Size = System::Drawing::Size(118, 22);
1412
			this->fileToolStripMenuItem1->Text = L"File";
1413
			// 
1414
			// Form1
1415
			// 
1416
			this->AllowDrop = true;
1417
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
1418
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
1419
			this->AutoValidate = System::Windows::Forms::AutoValidate::EnableAllowFocusChange;
1420
			this->BackColor = System::Drawing::SystemColors::Control;
1421
			this->ClientSize = System::Drawing::Size(746, 563);
1422
			this->Controls->Add(this->statusStrip1);
1423
			this->Controls->Add(this->panel1);
1424
			this->Controls->Add(this->toolStrip1);
1425
			this->Controls->Add(this->menuStrip1);
1426
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
1427
			this->IsMdiContainer = true;
1428
			this->MainMenuStrip = this->menuStrip1;
1429
			this->Name = L"Form1";
1430
			this->Text = L"SPK Explorer";
1431
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
1432
			this->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragDrop);
1433
			this->DragOver += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragOver);
1434
			this->menuStrip1->ResumeLayout(false);
1435
			this->menuStrip1->PerformLayout();
1436
			this->toolStrip1->ResumeLayout(false);
1437
			this->toolStrip1->PerformLayout();
1438
			this->panel1->ResumeLayout(false);
1439
			this->statusStrip1->ResumeLayout(false);
1440
			this->statusStrip1->PerformLayout();
1441
			this->contextMenuStrip1->ResumeLayout(false);
1442
			this->ResumeLayout(false);
1443
			this->PerformLayout();
1444
 
1445
		}
1446
#pragma endregion
1447
	private: System::Void tabControl1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
1448
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1449
			 for ( int i = 0; i < children->Length; i++ )
1450
			 {
1451
				 SpkForm ^childForm = (SpkForm ^)children[i];
1452
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1453
				 {
1454
					 childForm->Select();
1455
					 break;
1456
				 }
1457
			 }
1458
			 }
1459
private: System::Void Event_Open(System::Object^  sender, System::EventArgs^  e) {
1460
			System::Windows::Forms::ToolStripMenuItem ^item = cli::safe_cast<System::Windows::Forms::ToolStripMenuItem ^>(sender);
1461
			if ( item->Tag == "$DIR" )
1462
			{
1463
				FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
1464
				fbd->Description = "Select the path to load all valid files from";
1465
				if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1466
					this->OpenDirectory(fbd->SelectedPath);
1467
			}
1468
			else
1469
			{
1470
				this->Open(cli::safe_cast<System::String ^>(item->Tag), true, false);
1471
			}
1472
		}
1473
private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1474
			 this->Open();
1475
		 }
1476
private: System::Void toolStripSplitButton1_ButtonClick(System::Object^  sender, System::EventArgs^  e) {
1477
			 this->Open();
1478
		 }
1479
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1480
			 this->Close();
1481
		 }
1482
private: System::Void detailsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1483
			this->ChangeView(System::Windows::Forms::View::Details);
1484
			this->detailsToolStripMenuItem->Checked = true;
1485
			this->detailsToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1486
		 }
1487
private: System::Void listToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1488
			this->ChangeView(System::Windows::Forms::View::List);
1489
			this->listToolStripMenuItem->Checked = true;
1490
			this->listToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1491
		 }
1492
private: System::Void largeIconToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1493
			this->ChangeView(System::Windows::Forms::View::LargeIcon);
1494
			this->largeIconToolStripMenuItem->Checked = true;
1495
			this->largeIconToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1496
		 }
1497
private: System::Void toolStripButton1_Click(System::Object^  sender, System::EventArgs^  e) {
1498
			 this->ExtractAll();
1499
		 }
1500
private: System::Void ToolExtract_Click(System::Object^  sender, System::EventArgs^  e) {
1501
			 this->ExtractSelected();
1502
		 }
1503
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
1504
			 if ( m_iLocX != -1 && m_iLocY != -1 )
1505
				this->Location = System::Drawing::Point(m_iLocX, m_iLocY);
1506
			this->UpdateDropDownOpen();
1507
		 }
1508
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
1509
			 this->CloseAll();
1510
		 }
1511
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
1512
			 if ( IO::File::Exists(IO::Path::GetTempPath() + "\\spkexplorer_load.dat") )
1513
				 this->LoadFiles(IO::Path::GetTempPath() + "\\spkexplorer_load.dat");
1514
		 }
1515
private: System::Void toolStripButton2_Click(System::Object^  sender, System::EventArgs^  e) {
1516
			 this->AddFile();
1517
		 }
1518
private: System::Void ToolRemove_Click(System::Object^  sender, System::EventArgs^  e) {
1519
			 this->RemoveSelected();
1520
		 }
1521
private: System::Void Form1_DragOver(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
1522
			e->Effect = DragDropEffects::None;
1523
 
1524
			if (e->Data->GetDataPresent(DataFormats::FileDrop)) 
1525
			{
1526
				cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
1527
				int i;
1528
				for(i = 0; i < a->Length; i++)
1529
				{
1530
					if ( String::Compare(IO::FileInfo(a[i]).Extension, ".xsp", true) == 0 || String::Compare(IO::FileInfo(a[i]).Extension, ".spk", true) == 0 )
1531
					{
1532
						e->Effect = DragDropEffects::Copy;
1533
						break;
1534
					}
1535
				}
1536
			}
1537
		}
1538
private: System::Void Form1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
1539
			if (e->Data->GetDataPresent(DataFormats::FileDrop)) 
1540
			{
1541
				cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
1542
				this->OpenFiles(a, true, true);
1543
			}
1544
		 }
1545
private: System::Void ToolPaste_Click(System::Object^  sender, System::EventArgs^  e) {
1546
			SpkForm ^child = this->GetActiveChild();
1547
			if ( child )
1548
				child->PasteFiles(m_lCopiedFiles);
1549
		 }
1550
private: System::Void maximisedToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1551
			SpkForm ^child = this->GetActiveChild();
1552
			if ( child )
1553
				child->WindowState = FormWindowState::Maximized;
1554
		 }
1555
private: System::Void cascadeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1556
			 this->LayoutMdi(MdiLayout::Cascade);
1557
		 }
1558
private: System::Void tileVerticallyToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1559
			 this->LayoutMdi(MdiLayout::TileVertical);
1560
		 }
1561
private: System::Void tileHorizontalToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1562
			 this->LayoutMdi(MdiLayout::TileHorizontal);
1563
		 }
1564
private: System::Void closeAllToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1565
			 this->CloseAll();
1566
		 }
1567
private: System::Void WindowSelectEvent(System::Object^  sender, System::EventArgs^  e) {
1568
			 ToolStripMenuItem ^menu = cli::safe_cast<ToolStripMenuItem ^>(sender);
1569
			 if ( menu )
1570
			 {
1571
				 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1572
				 for ( int i = 0; i < children->Length; i++ )
1573
				 {
1574
					 SpkForm ^childForm = (SpkForm ^)children[i];
1575
					 if ( childForm->MenuItem() == menu )
1576
					 {
1577
						 childForm->Select();
1578
						 break;
1579
					 }
1580
				 }
1581
 
1582
			 }
1583
		 }
1584
private: System::Void ToolInfo_Click(System::Object^  sender, System::EventArgs^  e) {
1585
			SpkForm ^child = this->GetActiveChild();
1586
			if ( child )
1587
			{
1588
				PackageInfo ^info = gcnew PackageInfo(child->GetPackage(), 44);
1589
				info->ShowDialog(this);
1590
			}
1591
		 }
1592
private: System::Void filesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1593
			 this->ExtractSelected();
1594
		 }
1595
private: System::Void packagesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1596
			 this->ExtractSelectedPackage();
1597
		 }
1598
private: System::Void toolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
1599
			 this->ExtractAllPackage();
1600
		 }
1601
private: System::Void toolStripMenuItem2_Click(System::Object^  sender, System::EventArgs^  e) {
1602
			 this->ExtractAll();
1603
		 }
1604
private: System::Void toolStripMenuItem4_Click(System::Object^  sender, System::EventArgs^  e) {
1605
			 this->AddFile();
1606
		 }
1607
private: System::Void toolStripMenuItem3_Click(System::Object^  sender, System::EventArgs^  e) {
1608
			 this->AddPackage();
1609
		 }
1610
private: System::Void toolStripMenuItem6_Click(System::Object^  sender, System::EventArgs^  e) {
1611
			 this->RemoveSelected();
1612
		 }
1613
private: System::Void toolStripMenuItem5_Click(System::Object^  sender, System::EventArgs^  e) {
1614
			 this->RemoveSelectedPackage();
1615
		 }
1616
};
1617
}
1618