Subversion Repositories spk

Rev

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