Subversion Repositories spk

Rev

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