Subversion Repositories spk

Rev

Rev 196 | Rev 222 | 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
191 cycrow 284
				System::String ^sFile = _US(str->str.findreplace("/", "\\").ToString());
1 cycrow 285
				if ( this->IsOpen(sFile) )
286
					continue;
191 cycrow 287
				if ( this->IsOpen(_US(str->str.findreplace("\\", "/").ToString())) )
1 cycrow 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;
175 cycrow 554
			Utils::String sFile = _S(file);
1 cycrow 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
			{
182 cycrow 592
				CMultiSpkFile *mspk = m_pPackages->openMultiPackage(sFile, &error);
1 cycrow 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
			{
182 cycrow 605
				CBaseFile *package = m_pPackages->openPackage(sFile, &error, 0, SPKREAD_NODATA);
1 cycrow 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();
197 cycrow 614
							Utils::WString sIconFile = _WS(IO::Path::GetTempPath()) + L"\\" + CFileIO(sFile).baseName() + L"." + package->iconExt();
196 cycrow 615
							if ( package->extractFile(package->icon(), CFileIO(sIconFile).fullFilename().toString(), 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
175 cycrow 660
				sFile = sFile.findReplace("/", "\\").remove(9).remove('\r').remove('\n');
1 cycrow 661
				m_pLoadedList->Remove(sFile, true);
175 cycrow 662
				m_pLoadedList->PushFront(CyString(sFile));
1 cycrow 663
 
664
				while ( m_pLoadedList->Count() > 15 )
665
					m_pLoadedList->PopBack();
666
 
667
				this->SaveData();
668
 
669
				this->UpdateDropDownOpen();
670
			}	
671
			else
672
			{
673
				if ( display )
674
				{
191 cycrow 675
					System::String ^sError = "Unknown Error (" + _US(Utils::WString::Number(error)) + ")";
1 cycrow 676
					switch ( error )
677
					{
678
						case INSTALLERR_OLD:
679
							sError = "Old unsupported package file";
680
							break;
681
						case INSTALLERR_INVALID:
682
							sError = "Invalid Package File";
683
							break;
684
						case INSTALLERR_NOMULTI:
685
							sError = "Multi-Packages not currently supported";
686
							break;
687
					}
688
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
689
				}
690
			}
691
		}
692
 
693
		void Open()
694
		{
695
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
696
			ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";
697
			ofd->FilterIndex = 1;
698
			ofd->RestoreDirectory = true;
699
			ofd->Multiselect = true;
700
 
701
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
702
				this->OpenFiles(ofd->FileNames, false, true);
703
		}
704
 
705
		void CloseAll()
706
		{
707
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
708
			for ( int i = 0; i < children->Length; i++ )
709
			{
710
				delete ((SpkForm ^)children[i])->TabPage();
711
				delete children[i];
712
			}
713
			this->RemoveCopied(true);
714
			this->UpdateDisplay();
715
		}
716
 
717
		void ChangeView(System::Windows::Forms::View view)
718
		{
719
			this->listToolStripMenuItem->Checked = false;
720
			this->largeIconToolStripMenuItem->Checked = false;
721
			this->detailsToolStripMenuItem->Checked = false;
722
 
723
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
724
			for ( int i = 0; i < children->Length; i++ )
725
			{
726
				SpkForm ^childForm = (SpkForm ^)children[i];
727
				childForm->ChangeView(view);
728
			}
729
 
730
			m_curView = view;
731
		}
732
 
733
		void LoadFiles(String ^loadFrom)
734
		{
735
			if ( System::IO::File::Exists(loadFrom) )
736
			{
737
				System::String ^lines = System::IO::File::ReadAllText(loadFrom);
738
				try { System::IO::File::Delete(loadFrom); }
739
				catch (System::IO::IOException ^) {}
740
				catch (System::Exception ^) {}
741
 
742
				if ( lines )
743
				{
744
					CyString strLines = CyStringFromSystemString(lines);
745
					int num;
746
					CyString *aLines = strLines.SplitToken("\n", &num);
747
					if ( num && aLines )
748
					{
749
						ArrayList ^list = gcnew ArrayList();
750
						for ( int i = 0; i < num; i++ )
751
						{
752
							CyString l = aLines[i];
753
							l = l.Remove("\r");
754
							CyString first = l.GetToken(":", 1, 1);
755
							CyString rest = l.GetToken(":", 2);
756
							rest.RemoveFirstSpace();
757
 
758
							if ( first.Compare("File") )
191 cycrow 759
								list->Add(_US(rest.ToString()));
1 cycrow 760
						}
761
 
762
						this->OpenFiles(list, true, true);
763
 
764
						CLEANSPLIT(aLines, num);
765
					}
766
				}
767
			}			
768
		}
769
 
770
		void AddPackage()
771
		{
772
			SpkForm ^active = this->GetActiveChild();
773
			if ( !active )
774
				return;
775
 
776
			if ( !active->IsMultiPackage() )
777
				return;
778
 
779
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
780
 
781
			ofd->Filter = "All Vaild|*.spk;*.xsp|Packages|*.spk|Ships|*.xsp";
782
			ofd->FilterIndex = 1;
783
			ofd->RestoreDirectory = true;
784
			ofd->Multiselect = true;
785
			ofd->Title = "Select packages(s) to add";
786
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
787
			{
788
				AddDialog ^ad = gcnew AddDialog(NULL, active->GetMultiPackage());
789
				ad->AddFileArray(ofd->FileNames, "", -1, 0);
790
				ad->ShowDialog(this);
791
 
792
				active->UpdateView(false);
793
			}
794
		}
795
 
796
		void AddFile()
797
		{
798
			SpkForm ^active = this->GetActiveChild();
799
			if ( !active )
800
				return;
801
			CBaseFile *activePackage = active->GetPackage();
802
			if ( !activePackage )
803
				return;
804
 
805
			// add filters
806
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
807
 
808
			System::String ^filter;
809
			for ( int i = 0; i < FILETYPE_MAX; i++ )
810
			{
811
				if ( filter )
812
					filter += "|";
191 cycrow 813
				filter += _US(GetFileTypeString(i));
1 cycrow 814
				filter += "|";
815
				// add extensions
816
				switch ( i )
817
				{
818
					case FILETYPE_SCRIPT:
819
					case FILETYPE_UNINSTALL:
820
					case FILETYPE_MAP:
821
					case FILETYPE_TEXT:
822
					case FILETYPE_MISSION:
823
						filter += "*.pck;*.xml";
824
						break;
825
 
826
					case FILETYPE_README:
827
						filter += "*.txt;*.doc";
828
						break;
829
 
830
					case FILETYPE_MOD:
831
						filter += "*.cat";
832
						break;
833
 
834
					case FILETYPE_SOUND:
835
						filter += "*.wav";
836
						break;
837
 
838
					case FILETYPE_SCREEN:
839
					case FILETYPE_ADVERT:
840
						filter += "*.jpg;*.png";
841
						break;
842
 
843
					case FILETYPE_SHIPSCENE:
844
					case FILETYPE_COCKPITSCENE:
845
						filter += "*.pbd;*.bod";
846
						break;
847
 
848
					case FILETYPE_SHIPMODEL:
849
						filter += "*.pbd;*.bod;*.bob;*.pbb";
850
						break;
851
 
852
					default:
853
						filter += "*.*";
854
				}
855
			}
856
			ofd->Filter = filter;
857
			ofd->FilterIndex = 1;
858
			ofd->RestoreDirectory = true;
859
			ofd->Multiselect = true;
860
			ofd->Title = "Select File(s) to add to package";
861
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
862
			{
863
				System::String ^dir;
864
				if ( (ofd->FilterIndex - 1) == FILETYPE_EXTRA )
865
				{
866
					InputBox ^input = gcnew InputBox("Enter the directory for extra files", "PluginManager/Extras/$scriptname");
867
					if ( input->ShowDialog() == System::Windows::Forms::DialogResult::OK )
868
						dir = input->GetInput();
869
				}
870
 
871
				AddDialog ^ad = gcnew AddDialog(activePackage, active->GetMultiPackage());
872
				ad->AddFileArray(ofd->FileNames, dir, ofd->FilterIndex - 1, 0);
873
				ad->ShowDialog(this);
874
 
875
				active->UpdateView(false);
876
			}
877
		}
878
 
879
		void RemoveSelectedPackage()
880
		{
881
			SpkForm ^child = this->GetActiveChild();
882
			if ( child )
883
				child->RemoveSelectedPackage();
884
		}
885
		void RemoveSelected()
886
		{
887
			SpkForm ^child = this->GetActiveChild();
888
			if ( child )
889
				child->RemoveSelected();
890
		}
891
 
892
		System::Windows::Forms::View m_curView;
893
		CyStringList		*m_pLoadedList;
894
		CLinkList<C_File>	*m_lCopiedFiles;
895
		SpkForm				^m_pCutFrom;
896
		CLinkList<C_File>	*m_lDraggedFiles;
897
		SpkForm				^m_pDraggedFrom;
898
 
899
private: System::ComponentModel::IContainer^  components;
900
		 /// <summary>
901
		/// Required designer variable.
902
		/// </summary>
903
 
904
 
905
#pragma region Windows Form Designer generated code
906
		/// <summary>
907
		/// Required method for Designer support - do not modify
908
		/// the contents of this method with the code editor.
909
		/// </summary>
910
		void InitializeComponent(void)
911
		{
912
			this->components = (gcnew System::ComponentModel::Container());
913
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
914
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
915
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
916
			this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
917
			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
918
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
919
			this->viewToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
920
			this->layoutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
921
			this->maximisedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
922
			this->cascadeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
923
			this->tileVerticallyToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
924
			this->tileHorizontalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
925
			this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());
926
			this->detailsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
927
			this->largeIconToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
928
			this->listToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
929
			this->ToolWindows = (gcnew System::Windows::Forms::ToolStripMenuItem());
930
			this->closeAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
931
			this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator());
932
			this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
933
			this->toolStripSplitButton1 = (gcnew System::Windows::Forms::ToolStripSplitButton());
934
			this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
935
			this->ToolAdd = (gcnew System::Windows::Forms::ToolStripButton());
936
			this->ToolAdd2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
937
			this->toolStripMenuItem3 = (gcnew System::Windows::Forms::ToolStripMenuItem());
938
			this->toolStripMenuItem4 = (gcnew System::Windows::Forms::ToolStripMenuItem());
939
			this->ToolRemove2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
940
			this->toolStripMenuItem5 = (gcnew System::Windows::Forms::ToolStripMenuItem());
941
			this->toolStripMenuItem6 = (gcnew System::Windows::Forms::ToolStripMenuItem());
942
			this->ToolRemove = (gcnew System::Windows::Forms::ToolStripButton());
943
			this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
944
			this->ToolExtract2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
945
			this->packagesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
946
			this->filesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
947
			this->ToolExtract = (gcnew System::Windows::Forms::ToolStripButton());
948
			this->ToolExtractAll2 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
949
			this->toolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
950
			this->toolStripMenuItem2 = (gcnew System::Windows::Forms::ToolStripMenuItem());
951
			this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripButton());
952
			this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
953
			this->ToolPaste = (gcnew System::Windows::Forms::ToolStripButton());
954
			this->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator());
955
			this->ToolInfo = (gcnew System::Windows::Forms::ToolStripButton());
956
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
957
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
958
			this->panel1 = (gcnew System::Windows::Forms::Panel());
959
			this->button1 = (gcnew System::Windows::Forms::Button());
960
			this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
961
			this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
962
			this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
963
			this->StatusFiles = (gcnew System::Windows::Forms::ToolStripStatusLabel());
964
			this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
965
			this->packageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
966
			this->fileToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
967
			this->menuStrip1->SuspendLayout();
968
			this->toolStrip1->SuspendLayout();
969
			this->panel1->SuspendLayout();
970
			this->statusStrip1->SuspendLayout();
971
			this->contextMenuStrip1->SuspendLayout();
972
			this->SuspendLayout();
973
			// 
974
			// menuStrip1
975
			// 
976
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->fileToolStripMenuItem, 
977
				this->viewToolStripMenuItem, this->ToolWindows});
978
			this->menuStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;
979
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
980
			this->menuStrip1->Name = L"menuStrip1";
981
			this->menuStrip1->Size = System::Drawing::Size(746, 24);
982
			this->menuStrip1->TabIndex = 1;
983
			this->menuStrip1->Text = L"menuStrip1";
984
			// 
985
			// fileToolStripMenuItem
986
			// 
987
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->openToolStripMenuItem, 
988
				this->toolStripSeparator1, this->exitToolStripMenuItem});
989
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
990
			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
991
			this->fileToolStripMenuItem->Text = L"&File";
992
			// 
993
			// openToolStripMenuItem
994
			// 
995
			this->openToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"openToolStripMenuItem.Image")));
996
			this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
997
			this->openToolStripMenuItem->Size = System::Drawing::Size(103, 22);
998
			this->openToolStripMenuItem->Text = L"&Open";
999
			this->openToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::openToolStripMenuItem_Click);
1000
			// 
1001
			// toolStripSeparator1
1002
			// 
1003
			this->toolStripSeparator1->Name = L"toolStripSeparator1";
1004
			this->toolStripSeparator1->Size = System::Drawing::Size(100, 6);
1005
			// 
1006
			// exitToolStripMenuItem
1007
			// 
1008
			this->exitToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"exitToolStripMenuItem.Image")));
1009
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
1010
			this->exitToolStripMenuItem->Size = System::Drawing::Size(103, 22);
1011
			this->exitToolStripMenuItem->Text = L"E&xit";
1012
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
1013
			// 
1014
			// viewToolStripMenuItem
1015
			// 
1016
			this->viewToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(5) {this->layoutToolStripMenuItem, 
1017
				this->toolStripSeparator5, this->detailsToolStripMenuItem, this->largeIconToolStripMenuItem, this->listToolStripMenuItem});
1018
			this->viewToolStripMenuItem->Name = L"viewToolStripMenuItem";
1019
			this->viewToolStripMenuItem->Size = System::Drawing::Size(44, 20);
1020
			this->viewToolStripMenuItem->Text = L"&View";
1021
			// 
1022
			// layoutToolStripMenuItem
1023
			// 
1024
			this->layoutToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->maximisedToolStripMenuItem, 
1025
				this->cascadeToolStripMenuItem, this->tileVerticallyToolStripMenuItem, this->tileHorizontalToolStripMenuItem});
1026
			this->layoutToolStripMenuItem->Name = L"layoutToolStripMenuItem";
1027
			this->layoutToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1028
			this->layoutToolStripMenuItem->Text = L"Layout";
1029
			// 
1030
			// maximisedToolStripMenuItem
1031
			// 
1032
			this->maximisedToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"maximisedToolStripMenuItem.Image")));
1033
			this->maximisedToolStripMenuItem->Name = L"maximisedToolStripMenuItem";
1034
			this->maximisedToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1035
			this->maximisedToolStripMenuItem->Text = L"Maximised";
1036
			this->maximisedToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::maximisedToolStripMenuItem_Click);
1037
			// 
1038
			// cascadeToolStripMenuItem
1039
			// 
1040
			this->cascadeToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"cascadeToolStripMenuItem.Image")));
1041
			this->cascadeToolStripMenuItem->Name = L"cascadeToolStripMenuItem";
1042
			this->cascadeToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1043
			this->cascadeToolStripMenuItem->Text = L"Cascade";
1044
			this->cascadeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::cascadeToolStripMenuItem_Click);
1045
			// 
1046
			// tileVerticallyToolStripMenuItem
1047
			// 
1048
			this->tileVerticallyToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"tileVerticallyToolStripMenuItem.Image")));
1049
			this->tileVerticallyToolStripMenuItem->Name = L"tileVerticallyToolStripMenuItem";
1050
			this->tileVerticallyToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1051
			this->tileVerticallyToolStripMenuItem->Text = L"Tile Vertical";
1052
			this->tileVerticallyToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::tileVerticallyToolStripMenuItem_Click);
1053
			// 
1054
			// tileHorizontalToolStripMenuItem
1055
			// 
1056
			this->tileHorizontalToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"tileHorizontalToolStripMenuItem.Image")));
1057
			this->tileHorizontalToolStripMenuItem->Name = L"tileHorizontalToolStripMenuItem";
1058
			this->tileHorizontalToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1059
			this->tileHorizontalToolStripMenuItem->Text = L"Tile Horizontal";
1060
			this->tileHorizontalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::tileHorizontalToolStripMenuItem_Click);
1061
			// 
1062
			// toolStripSeparator5
1063
			// 
1064
			this->toolStripSeparator5->Name = L"toolStripSeparator5";
1065
			this->toolStripSeparator5->Size = System::Drawing::Size(107, 6);
1066
			// 
1067
			// detailsToolStripMenuItem
1068
			// 
1069
			this->detailsToolStripMenuItem->Checked = true;
1070
			this->detailsToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1071
			this->detailsToolStripMenuItem->Name = L"detailsToolStripMenuItem";
1072
			this->detailsToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1073
			this->detailsToolStripMenuItem->Text = L"Details";
1074
			this->detailsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::detailsToolStripMenuItem_Click);
1075
			// 
1076
			// largeIconToolStripMenuItem
1077
			// 
1078
			this->largeIconToolStripMenuItem->Name = L"largeIconToolStripMenuItem";
1079
			this->largeIconToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1080
			this->largeIconToolStripMenuItem->Text = L"Icons";
1081
			this->largeIconToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::largeIconToolStripMenuItem_Click);
1082
			// 
1083
			// listToolStripMenuItem
1084
			// 
1085
			this->listToolStripMenuItem->Name = L"listToolStripMenuItem";
1086
			this->listToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1087
			this->listToolStripMenuItem->Text = L"List";
1088
			this->listToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::listToolStripMenuItem_Click);
1089
			// 
1090
			// ToolWindows
1091
			// 
1092
			this->ToolWindows->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->closeAllToolStripMenuItem, 
1093
				this->toolStripSeparator6});
1094
			this->ToolWindows->Name = L"ToolWindows";
1095
			this->ToolWindows->Size = System::Drawing::Size(68, 20);
1096
			this->ToolWindows->Text = L"Windows";
1097
			// 
1098
			// closeAllToolStripMenuItem
1099
			// 
1100
			this->closeAllToolStripMenuItem->Name = L"closeAllToolStripMenuItem";
1101
			this->closeAllToolStripMenuItem->Size = System::Drawing::Size(120, 22);
1102
			this->closeAllToolStripMenuItem->Text = L"Close All";
1103
			this->closeAllToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::closeAllToolStripMenuItem_Click);
1104
			// 
1105
			// toolStripSeparator6
1106
			// 
1107
			this->toolStripSeparator6->Name = L"toolStripSeparator6";
1108
			this->toolStripSeparator6->Size = System::Drawing::Size(117, 6);
1109
			// 
1110
			// toolStrip1
1111
			// 
1112
			this->toolStrip1->GripStyle = System::Windows::Forms::ToolStripGripStyle::Hidden;
1113
			this->toolStrip1->ImageScalingSize = System::Drawing::Size(32, 32);
1114
			this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(15) {this->toolStripSplitButton1, 
1115
				this->toolStripSeparator2, this->ToolAdd, this->ToolAdd2, this->ToolRemove2, this->ToolRemove, this->toolStripSeparator3, this->ToolExtract2, 
1116
				this->ToolExtract, this->ToolExtractAll2, this->toolStripButton1, this->toolStripSeparator4, this->ToolPaste, this->toolStripSeparator7, 
1117
				this->ToolInfo});
1118
			this->toolStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;
1119
			this->toolStrip1->Location = System::Drawing::Point(0, 24);
1120
			this->toolStrip1->Name = L"toolStrip1";
1121
			this->toolStrip1->Size = System::Drawing::Size(746, 54);
1122
			this->toolStrip1->TabIndex = 2;
1123
			this->toolStrip1->Text = L"toolStrip1";
1124
			// 
1125
			// toolStripSplitButton1
1126
			// 
1127
			this->toolStripSplitButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
1128
			this->toolStripSplitButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1129
			this->toolStripSplitButton1->Name = L"toolStripSplitButton1";
1130
			this->toolStripSplitButton1->RightToLeft = System::Windows::Forms::RightToLeft::No;
1131
			this->toolStripSplitButton1->Size = System::Drawing::Size(84, 51);
1132
			this->toolStripSplitButton1->Text = L"Open";
1133
			this->toolStripSplitButton1->ButtonClick += gcnew System::EventHandler(this, &Form1::toolStripSplitButton1_ButtonClick);
1134
			// 
1135
			// toolStripSeparator2
1136
			// 
1137
			this->toolStripSeparator2->Name = L"toolStripSeparator2";
1138
			this->toolStripSeparator2->Size = System::Drawing::Size(6, 54);
1139
			// 
1140
			// ToolAdd
1141
			// 
1142
			this->ToolAdd->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolAdd.Image")));
1143
			this->ToolAdd->ImageTransparentColor = System::Drawing::Color::Magenta;
1144
			this->ToolAdd->Name = L"ToolAdd";
1145
			this->ToolAdd->Size = System::Drawing::Size(54, 51);
1146
			this->ToolAdd->Text = L"Add File";
1147
			this->ToolAdd->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1148
			this->ToolAdd->Click += gcnew System::EventHandler(this, &Form1::toolStripButton2_Click);
1149
			// 
1150
			// ToolAdd2
1151
			// 
1152
			this->ToolAdd2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->toolStripMenuItem3, 
1153
				this->toolStripMenuItem4});
1154
			this->ToolAdd2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolAdd2.Image")));
1155
			this->ToolAdd2->ImageTransparentColor = System::Drawing::Color::Magenta;
1156
			this->ToolAdd2->Name = L"ToolAdd2";
1157
			this->ToolAdd2->Size = System::Drawing::Size(63, 51);
1158
			this->ToolAdd2->Text = L"Add File";
1159
			this->ToolAdd2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1160
			// 
1161
			// toolStripMenuItem3
1162
			// 
1163
			this->toolStripMenuItem3->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem3.Image")));
1164
			this->toolStripMenuItem3->Name = L"toolStripMenuItem3";
1165
			this->toolStripMenuItem3->Size = System::Drawing::Size(123, 22);
1166
			this->toolStripMenuItem3->Text = L"Packages";
1167
			this->toolStripMenuItem3->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem3_Click);
1168
			// 
1169
			// toolStripMenuItem4
1170
			// 
1171
			this->toolStripMenuItem4->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem4.Image")));
1172
			this->toolStripMenuItem4->Name = L"toolStripMenuItem4";
1173
			this->toolStripMenuItem4->Size = System::Drawing::Size(123, 22);
1174
			this->toolStripMenuItem4->Text = L"Files";
1175
			this->toolStripMenuItem4->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem4_Click);
1176
			// 
1177
			// ToolRemove2
1178
			// 
1179
			this->ToolRemove2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->toolStripMenuItem5, 
1180
				this->toolStripMenuItem6});
1181
			this->ToolRemove2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolRemove2.Image")));
1182
			this->ToolRemove2->ImageTransparentColor = System::Drawing::Color::Magenta;
1183
			this->ToolRemove2->Name = L"ToolRemove2";
1184
			this->ToolRemove2->Size = System::Drawing::Size(84, 51);
1185
			this->ToolRemove2->Text = L"Remove File";
1186
			this->ToolRemove2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1187
			// 
1188
			// toolStripMenuItem5
1189
			// 
1190
			this->toolStripMenuItem5->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem5.Image")));
1191
			this->toolStripMenuItem5->Name = L"toolStripMenuItem5";
1192
			this->toolStripMenuItem5->Size = System::Drawing::Size(123, 22);
1193
			this->toolStripMenuItem5->Text = L"Packages";
1194
			this->toolStripMenuItem5->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem5_Click);
1195
			// 
1196
			// toolStripMenuItem6
1197
			// 
1198
			this->toolStripMenuItem6->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem6.Image")));
1199
			this->toolStripMenuItem6->Name = L"toolStripMenuItem6";
1200
			this->toolStripMenuItem6->Size = System::Drawing::Size(123, 22);
1201
			this->toolStripMenuItem6->Text = L"Files";
1202
			this->toolStripMenuItem6->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem6_Click);
1203
			// 
1204
			// ToolRemove
1205
			// 
1206
			this->ToolRemove->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolRemove.Image")));
1207
			this->ToolRemove->ImageTransparentColor = System::Drawing::Color::Magenta;
1208
			this->ToolRemove->Name = L"ToolRemove";
1209
			this->ToolRemove->Size = System::Drawing::Size(75, 51);
1210
			this->ToolRemove->Text = L"Remove File";
1211
			this->ToolRemove->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1212
			this->ToolRemove->Click += gcnew System::EventHandler(this, &Form1::ToolRemove_Click);
1213
			// 
1214
			// toolStripSeparator3
1215
			// 
1216
			this->toolStripSeparator3->Name = L"toolStripSeparator3";
1217
			this->toolStripSeparator3->Size = System::Drawing::Size(6, 54);
1218
			// 
1219
			// ToolExtract2
1220
			// 
1221
			this->ToolExtract2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->packagesToolStripMenuItem, 
1222
				this->filesToolStripMenuItem});
1223
			this->ToolExtract2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolExtract2.Image")));
1224
			this->ToolExtract2->ImageTransparentColor = System::Drawing::Color::Magenta;
1225
			this->ToolExtract2->Name = L"ToolExtract2";
1226
			this->ToolExtract2->Size = System::Drawing::Size(102, 51);
1227
			this->ToolExtract2->Text = L"Extract Selected";
1228
			this->ToolExtract2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1229
			// 
1230
			// packagesToolStripMenuItem
1231
			// 
1232
			this->packagesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"packagesToolStripMenuItem.Image")));
1233
			this->packagesToolStripMenuItem->Name = L"packagesToolStripMenuItem";
1234
			this->packagesToolStripMenuItem->Size = System::Drawing::Size(123, 22);
1235
			this->packagesToolStripMenuItem->Text = L"Packages";
1236
			this->packagesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packagesToolStripMenuItem_Click);
1237
			// 
1238
			// filesToolStripMenuItem
1239
			// 
1240
			this->filesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"filesToolStripMenuItem.Image")));
1241
			this->filesToolStripMenuItem->Name = L"filesToolStripMenuItem";
1242
			this->filesToolStripMenuItem->Size = System::Drawing::Size(123, 22);
1243
			this->filesToolStripMenuItem->Text = L"Files";
1244
			this->filesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::filesToolStripMenuItem_Click);
1245
			// 
1246
			// ToolExtract
1247
			// 
1248
			this->ToolExtract->Enabled = false;
1249
			this->ToolExtract->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolExtract.Image")));
1250
			this->ToolExtract->ImageTransparentColor = System::Drawing::Color::Magenta;
1251
			this->ToolExtract->Name = L"ToolExtract";
1252
			this->ToolExtract->Size = System::Drawing::Size(93, 51);
1253
			this->ToolExtract->Text = L"Extract Selected";
1254
			this->ToolExtract->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1255
			this->ToolExtract->Click += gcnew System::EventHandler(this, &Form1::ToolExtract_Click);
1256
			// 
1257
			// ToolExtractAll2
1258
			// 
1259
			this->ToolExtractAll2->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->toolStripMenuItem1, 
1260
				this->toolStripMenuItem2});
1261
			this->ToolExtractAll2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolExtractAll2.Image")));
1262
			this->ToolExtractAll2->ImageTransparentColor = System::Drawing::Color::Magenta;
1263
			this->ToolExtractAll2->Name = L"ToolExtractAll2";
1264
			this->ToolExtractAll2->Size = System::Drawing::Size(72, 51);
1265
			this->ToolExtractAll2->Text = L"Extract All";
1266
			this->ToolExtractAll2->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1267
			// 
1268
			// toolStripMenuItem1
1269
			// 
1270
			this->toolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem1.Image")));
1271
			this->toolStripMenuItem1->Name = L"toolStripMenuItem1";
1272
			this->toolStripMenuItem1->Size = System::Drawing::Size(123, 22);
1273
			this->toolStripMenuItem1->Text = L"Packages";
1274
			this->toolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem1_Click);
1275
			// 
1276
			// toolStripMenuItem2
1277
			// 
1278
			this->toolStripMenuItem2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripMenuItem2.Image")));
1279
			this->toolStripMenuItem2->Name = L"toolStripMenuItem2";
1280
			this->toolStripMenuItem2->Size = System::Drawing::Size(123, 22);
1281
			this->toolStripMenuItem2->Text = L"Files";
1282
			this->toolStripMenuItem2->Click += gcnew System::EventHandler(this, &Form1::toolStripMenuItem2_Click);
1283
			// 
1284
			// toolStripButton1
1285
			// 
1286
			this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton1.Image")));
1287
			this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1288
			this->toolStripButton1->Name = L"toolStripButton1";
1289
			this->toolStripButton1->Size = System::Drawing::Size(63, 51);
1290
			this->toolStripButton1->Text = L"Extract All";
1291
			this->toolStripButton1->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1292
			this->toolStripButton1->Click += gcnew System::EventHandler(this, &Form1::toolStripButton1_Click);
1293
			// 
1294
			// toolStripSeparator4
1295
			// 
1296
			this->toolStripSeparator4->Name = L"toolStripSeparator4";
1297
			this->toolStripSeparator4->Size = System::Drawing::Size(6, 54);
1298
			// 
1299
			// ToolPaste
1300
			// 
1301
			this->ToolPaste->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolPaste.Image")));
1302
			this->ToolPaste->ImageTransparentColor = System::Drawing::Color::Magenta;
1303
			this->ToolPaste->Name = L"ToolPaste";
1304
			this->ToolPaste->Size = System::Drawing::Size(39, 51);
1305
			this->ToolPaste->Text = L"Paste";
1306
			this->ToolPaste->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1307
			this->ToolPaste->Click += gcnew System::EventHandler(this, &Form1::ToolPaste_Click);
1308
			// 
1309
			// toolStripSeparator7
1310
			// 
1311
			this->toolStripSeparator7->Name = L"toolStripSeparator7";
1312
			this->toolStripSeparator7->Size = System::Drawing::Size(6, 54);
1313
			// 
1314
			// ToolInfo
1315
			// 
1316
			this->ToolInfo->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"ToolInfo.Image")));
1317
			this->ToolInfo->ImageTransparentColor = System::Drawing::Color::Magenta;
1318
			this->ToolInfo->Name = L"ToolInfo";
1319
			this->ToolInfo->Size = System::Drawing::Size(79, 51);
1320
			this->ToolInfo->Text = L"Package Info";
1321
			this->ToolInfo->TextImageRelation = System::Windows::Forms::TextImageRelation::ImageAboveText;
1322
			this->ToolInfo->Click += gcnew System::EventHandler(this, &Form1::ToolInfo_Click);
1323
			// 
1324
			// tabControl1
1325
			// 
1326
			this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
1327
			this->tabControl1->ImageList = this->imageList1;
1328
			this->tabControl1->Location = System::Drawing::Point(0, 0);
1329
			this->tabControl1->Name = L"tabControl1";
1330
			this->tabControl1->SelectedIndex = 0;
1331
			this->tabControl1->Size = System::Drawing::Size(725, 23);
1332
			this->tabControl1->TabIndex = 3;
1333
			this->tabControl1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::tabControl1_SelectedIndexChanged);
1334
			// 
1335
			// imageList1
1336
			// 
1337
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
1338
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
1339
			this->imageList1->Images->SetKeyName(0, L"standard");
1340
			this->imageList1->Images->SetKeyName(1, L"multi");
1341
			// 
1342
			// panel1
1343
			// 
1344
			this->panel1->Controls->Add(this->tabControl1);
1345
			this->panel1->Controls->Add(this->button1);
1346
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
1347
			this->panel1->Location = System::Drawing::Point(0, 78);
1348
			this->panel1->Name = L"panel1";
1349
			this->panel1->Size = System::Drawing::Size(746, 23);
1350
			this->panel1->TabIndex = 5;
1351
			// 
1352
			// button1
1353
			// 
1354
			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
1355
			this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
1356
				static_cast<System::Byte>(0)));
1357
			this->button1->ForeColor = System::Drawing::Color::Red;
1358
			this->button1->Location = System::Drawing::Point(725, 0);
1359
			this->button1->Name = L"button1";
1360
			this->button1->Size = System::Drawing::Size(21, 23);
1361
			this->button1->TabIndex = 4;
1362
			this->button1->Text = L"X";
1363
			this->button1->UseVisualStyleBackColor = true;
1364
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
1365
			// 
1366
			// toolTip1
1367
			// 
1368
			this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;
1369
			this->toolTip1->ToolTipTitle = L"Close All";
1370
			// 
1371
			// timer1
1372
			// 
1373
			this->timer1->Enabled = true;
1374
			this->timer1->Interval = 500;
1375
			this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
1376
			// 
1377
			// statusStrip1
1378
			// 
1379
			this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->StatusFiles});
1380
			this->statusStrip1->Location = System::Drawing::Point(0, 541);
1381
			this->statusStrip1->Name = L"statusStrip1";
1382
			this->statusStrip1->Size = System::Drawing::Size(746, 22);
1383
			this->statusStrip1->TabIndex = 7;
1384
			this->statusStrip1->Text = L"statusStrip1";
1385
			// 
1386
			// StatusFiles
1387
			// 
1388
			this->StatusFiles->Name = L"StatusFiles";
1389
			this->StatusFiles->Size = System::Drawing::Size(79, 17);
1390
			this->StatusFiles->Text = L"Files: 1 (10KB)";
1391
			// 
1392
			// contextMenuStrip1
1393
			// 
1394
			this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->packageToolStripMenuItem, 
1395
				this->fileToolStripMenuItem1});
1396
			this->contextMenuStrip1->Name = L"contextMenuStrip1";
1397
			this->contextMenuStrip1->Size = System::Drawing::Size(119, 48);
1398
			// 
1399
			// packageToolStripMenuItem
1400
			// 
1401
			this->packageToolStripMenuItem->Name = L"packageToolStripMenuItem";
1402
			this->packageToolStripMenuItem->Size = System::Drawing::Size(118, 22);
1403
			this->packageToolStripMenuItem->Text = L"Package";
1404
			// 
1405
			// fileToolStripMenuItem1
1406
			// 
1407
			this->fileToolStripMenuItem1->Name = L"fileToolStripMenuItem1";
1408
			this->fileToolStripMenuItem1->Size = System::Drawing::Size(118, 22);
1409
			this->fileToolStripMenuItem1->Text = L"File";
1410
			// 
1411
			// Form1
1412
			// 
1413
			this->AllowDrop = true;
1414
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
1415
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
1416
			this->AutoValidate = System::Windows::Forms::AutoValidate::EnableAllowFocusChange;
1417
			this->BackColor = System::Drawing::SystemColors::Control;
1418
			this->ClientSize = System::Drawing::Size(746, 563);
1419
			this->Controls->Add(this->statusStrip1);
1420
			this->Controls->Add(this->panel1);
1421
			this->Controls->Add(this->toolStrip1);
1422
			this->Controls->Add(this->menuStrip1);
1423
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
1424
			this->IsMdiContainer = true;
1425
			this->MainMenuStrip = this->menuStrip1;
1426
			this->Name = L"Form1";
1427
			this->Text = L"SPK Explorer";
1428
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
1429
			this->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragDrop);
1430
			this->DragOver += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragOver);
1431
			this->menuStrip1->ResumeLayout(false);
1432
			this->menuStrip1->PerformLayout();
1433
			this->toolStrip1->ResumeLayout(false);
1434
			this->toolStrip1->PerformLayout();
1435
			this->panel1->ResumeLayout(false);
1436
			this->statusStrip1->ResumeLayout(false);
1437
			this->statusStrip1->PerformLayout();
1438
			this->contextMenuStrip1->ResumeLayout(false);
1439
			this->ResumeLayout(false);
1440
			this->PerformLayout();
1441
 
1442
		}
1443
#pragma endregion
1444
	private: System::Void tabControl1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
1445
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1446
			 for ( int i = 0; i < children->Length; i++ )
1447
			 {
1448
				 SpkForm ^childForm = (SpkForm ^)children[i];
1449
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1450
				 {
1451
					 childForm->Select();
1452
					 break;
1453
				 }
1454
			 }
1455
			 }
1456
private: System::Void Event_Open(System::Object^  sender, System::EventArgs^  e) {
1457
			System::Windows::Forms::ToolStripMenuItem ^item = cli::safe_cast<System::Windows::Forms::ToolStripMenuItem ^>(sender);
1458
			if ( item->Tag == "$DIR" )
1459
			{
1460
				FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
1461
				fbd->Description = "Select the path to load all valid files from";
1462
				if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1463
					this->OpenDirectory(fbd->SelectedPath);
1464
			}
1465
			else
1466
			{
1467
				this->Open(cli::safe_cast<System::String ^>(item->Tag), true, false);
1468
			}
1469
		}
1470
private: System::Void openToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1471
			 this->Open();
1472
		 }
1473
private: System::Void toolStripSplitButton1_ButtonClick(System::Object^  sender, System::EventArgs^  e) {
1474
			 this->Open();
1475
		 }
1476
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1477
			 this->Close();
1478
		 }
1479
private: System::Void detailsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1480
			this->ChangeView(System::Windows::Forms::View::Details);
1481
			this->detailsToolStripMenuItem->Checked = true;
1482
			this->detailsToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1483
		 }
1484
private: System::Void listToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1485
			this->ChangeView(System::Windows::Forms::View::List);
1486
			this->listToolStripMenuItem->Checked = true;
1487
			this->listToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1488
		 }
1489
private: System::Void largeIconToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1490
			this->ChangeView(System::Windows::Forms::View::LargeIcon);
1491
			this->largeIconToolStripMenuItem->Checked = true;
1492
			this->largeIconToolStripMenuItem->CheckState = System::Windows::Forms::CheckState::Indeterminate;
1493
		 }
1494
private: System::Void toolStripButton1_Click(System::Object^  sender, System::EventArgs^  e) {
1495
			 this->ExtractAll();
1496
		 }
1497
private: System::Void ToolExtract_Click(System::Object^  sender, System::EventArgs^  e) {
1498
			 this->ExtractSelected();
1499
		 }
1500
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
1501
			 if ( m_iLocX != -1 && m_iLocY != -1 )
1502
				this->Location = System::Drawing::Point(m_iLocX, m_iLocY);
1503
			this->UpdateDropDownOpen();
1504
		 }
1505
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
1506
			 this->CloseAll();
1507
		 }
1508
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
1509
			 if ( IO::File::Exists(IO::Path::GetTempPath() + "\\spkexplorer_load.dat") )
1510
				 this->LoadFiles(IO::Path::GetTempPath() + "\\spkexplorer_load.dat");
1511
		 }
1512
private: System::Void toolStripButton2_Click(System::Object^  sender, System::EventArgs^  e) {
1513
			 this->AddFile();
1514
		 }
1515
private: System::Void ToolRemove_Click(System::Object^  sender, System::EventArgs^  e) {
1516
			 this->RemoveSelected();
1517
		 }
1518
private: System::Void Form1_DragOver(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
1519
			e->Effect = DragDropEffects::None;
1520
 
1521
			if (e->Data->GetDataPresent(DataFormats::FileDrop)) 
1522
			{
1523
				cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
1524
				int i;
1525
				for(i = 0; i < a->Length; i++)
1526
				{
1527
					if ( String::Compare(IO::FileInfo(a[i]).Extension, ".xsp", true) == 0 || String::Compare(IO::FileInfo(a[i]).Extension, ".spk", true) == 0 )
1528
					{
1529
						e->Effect = DragDropEffects::Copy;
1530
						break;
1531
					}
1532
				}
1533
			}
1534
		}
1535
private: System::Void Form1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
1536
			if (e->Data->GetDataPresent(DataFormats::FileDrop)) 
1537
			{
1538
				cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
1539
				this->OpenFiles(a, true, true);
1540
			}
1541
		 }
1542
private: System::Void ToolPaste_Click(System::Object^  sender, System::EventArgs^  e) {
1543
			SpkForm ^child = this->GetActiveChild();
1544
			if ( child )
1545
				child->PasteFiles(m_lCopiedFiles);
1546
		 }
1547
private: System::Void maximisedToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1548
			SpkForm ^child = this->GetActiveChild();
1549
			if ( child )
1550
				child->WindowState = FormWindowState::Maximized;
1551
		 }
1552
private: System::Void cascadeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1553
			 this->LayoutMdi(MdiLayout::Cascade);
1554
		 }
1555
private: System::Void tileVerticallyToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1556
			 this->LayoutMdi(MdiLayout::TileVertical);
1557
		 }
1558
private: System::Void tileHorizontalToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1559
			 this->LayoutMdi(MdiLayout::TileHorizontal);
1560
		 }
1561
private: System::Void closeAllToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1562
			 this->CloseAll();
1563
		 }
1564
private: System::Void WindowSelectEvent(System::Object^  sender, System::EventArgs^  e) {
1565
			 ToolStripMenuItem ^menu = cli::safe_cast<ToolStripMenuItem ^>(sender);
1566
			 if ( menu )
1567
			 {
1568
				 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1569
				 for ( int i = 0; i < children->Length; i++ )
1570
				 {
1571
					 SpkForm ^childForm = (SpkForm ^)children[i];
1572
					 if ( childForm->MenuItem() == menu )
1573
					 {
1574
						 childForm->Select();
1575
						 break;
1576
					 }
1577
				 }
1578
 
1579
			 }
1580
		 }
1581
private: System::Void ToolInfo_Click(System::Object^  sender, System::EventArgs^  e) {
1582
			SpkForm ^child = this->GetActiveChild();
1583
			if ( child )
1584
			{
1585
				PackageInfo ^info = gcnew PackageInfo(child->GetPackage(), 44);
1586
				info->ShowDialog(this);
1587
			}
1588
		 }
1589
private: System::Void filesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1590
			 this->ExtractSelected();
1591
		 }
1592
private: System::Void packagesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1593
			 this->ExtractSelectedPackage();
1594
		 }
1595
private: System::Void toolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
1596
			 this->ExtractAllPackage();
1597
		 }
1598
private: System::Void toolStripMenuItem2_Click(System::Object^  sender, System::EventArgs^  e) {
1599
			 this->ExtractAll();
1600
		 }
1601
private: System::Void toolStripMenuItem4_Click(System::Object^  sender, System::EventArgs^  e) {
1602
			 this->AddFile();
1603
		 }
1604
private: System::Void toolStripMenuItem3_Click(System::Object^  sender, System::EventArgs^  e) {
1605
			 this->AddPackage();
1606
		 }
1607
private: System::Void toolStripMenuItem6_Click(System::Object^  sender, System::EventArgs^  e) {
1608
			 this->RemoveSelected();
1609
		 }
1610
private: System::Void toolStripMenuItem5_Click(System::Object^  sender, System::EventArgs^  e) {
1611
			 this->RemoveSelectedPackage();
1612
		 }
1613
};
1614
}
1615