Subversion Repositories spk

Rev

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

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
#include "PackageForm.h"
4
#include "MultiForm.h"
5
#include "Options.h"
6
#include "LoadShip.h"
7
#include "ImportShip.h"
8
#include "CreationWizard.h"
9
#include "LoadText.h"
2 cycrow 10
//TODO: remove this dependacy
11
#include "../../ModMerge/src/Forms/Form1.h"
1 cycrow 12
#include "ModDiff.h"
13
#include "Waiting.h"
14
#include "FileExplorer.h"
15
#include "SelectGame.h"
36 cycrow 16
#include "SelectFilesystem.h"
17
#include <VirtualFileSystem.h>
1 cycrow 18
 
36 cycrow 19
 
1 cycrow 20
using namespace System;
21
using namespace System::IO;
22
 
23
namespace Creator {
24
 
25
	enum {SWITCH_NONE, SWITCH_CREATE, SWITCH_EXTRACT, SWITCH_EXTRACTHERE, SWITCH_EXPORT};
26
 
27
	using namespace System;
28
	using namespace System::ComponentModel;
29
	using namespace System::Collections;
30
	using namespace System::Windows::Forms;
31
	using namespace System::Data;
32
	using namespace System::Drawing;
33
 
34
	/// <summary>
35
	/// Summary for Form1
36
	///
37
	/// WARNING: If you change the name of this class, you will need to change the
38
	///          'Resource File Name' property for the managed resource compiler tool
39
	///          associated with all .resx files this class depends on.  Otherwise,
40
	///          the designers will not be able to interact properly with localized
41
	///          resources associated with this form.
42
	/// </summary>
43
	public ref class Form1 : public System::Windows::Forms::Form
44
	{
45
	public:
36 cycrow 46
		Form1(array<System::String ^> ^args);
1 cycrow 47
 
36 cycrow 48
		void parseCommandArguments(array<System::String ^> ^args);
1 cycrow 49
 
50
		void ModMerge()
51
		{
52
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
53
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
54
			merge->TopMost = true;
94 cycrow 55
			if ( !_pGameDir->isEmpty() ) 
56
				merge->SetGameDir(-1, _US(_pGameDir->first()));
1 cycrow 57
			merge->ShowDialog(this);
58
		}
59
 
60
		void ModDiffDialog()
61
		{
94 cycrow 62
			ModDiff ^diff = gcnew ModDiff(_pGameDir, m_pPackages);
1 cycrow 63
			diff->ShowDialog(this);
64
		}
65
 
66
		void OpenArchive()
67
		{
68
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
69
			ofd->Filter = "All Supported Archives|*.zip; *.rar|Zip Archive (*.zip)|*.zip|Rar Archive (*.rar)|*.rar";
70
			ofd->Title = "Select archive file you wish to import from";
71
			ofd->FilterIndex = 1;
72
			ofd->RestoreDirectory = true;
73
			ofd->Multiselect = false;
74
 
75
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
76
			{
77
				m_sConvertFile = ofd->FileName;
78
				m_pWait = gcnew Waiting("Converting Archive");
79
				this->backgroundWorker1->RunWorkerAsync();
80
				m_pWait->ShowDialog(this);
81
			}
82
		}
83
 
84
		String ^ParseText(int game, String ^text)
85
		{
86
			String ^t = text;
87
 
88
			bool found = true;
89
			int pos = 0;
90
			while (found)
91
			{
92
				pos = t->IndexOf('{', pos);
93
				found = false;
94
				if ( pos > -1 )
95
				{
96
					int page = -1;
97
					int id = -1;
98
 
99
					int commaPos = t->IndexOf(',', pos);
100
					if ( commaPos > -1 )
101
					{
102
						page = Convert::ToInt32(t->Substring(pos + 1, commaPos - (pos + 1)));
103
						int endPos = t->IndexOf('}', commaPos);
104
						if ( endPos > -1 )
105
						{
106
							id = Convert::ToInt32(t->Substring(commaPos + 1, endPos - (commaPos + 1)));
107
							found = true;
108
							t = t->Replace(t->Substring(pos, endPos - pos + 1 ), this->FindText(game, page, id));
109
						}
110
					}
111
				}
112
			}
113
			return t;
114
		}
115
 
94 cycrow 116
		CGameDirectories *gameDirectories()
36 cycrow 117
		{
94 cycrow 118
			return _pGameDir;
119
		}
36 cycrow 120
 
94 cycrow 121
		void LoadText()
122
		{
123
			this->LoadText(false, false);
36 cycrow 124
		}
125
 
1 cycrow 126
		String ^FindText(int game, int page, int id)
127
		{
128
			this->LoadText(false, false);
36 cycrow 129
 
94 cycrow 130
			Utils::String text = _pGameDir->findText(game, 44, page, id);
131
			if ( !text.empty() ) {
132
				return ParseText(game, _US(text));
1 cycrow 133
			}
134
 
94 cycrow 135
			return nullptr;
1 cycrow 136
		}
137
 
138
		void UpdateStatus()
139
		{
140
			bool e = (this->tabControl1->HasChildren) ? true : false;
141
 
142
			BaseForm ^active = this->GetActiveChild();
143
			if ( active && active->GetFormType() == FORMTYPE_SINGLE )
144
			{
145
				CBaseFile *activePackage = ((PackageForm ^)active)->GetPackage();
146
				if ( !activePackage )
147
					e = false;
148
				else
149
					this->StatusFiles->Text = "Files: " + activePackage->GetFileList()->size() + " (" + SystemStringFromCyString(activePackage->GetFullFileSizeString()) + ")";
150
			}
151
			else if ( active && active->GetFormType() == FORMTYPE_MULTI )
152
			{
153
				CMultiSpkFile *activePackage = ((MultiForm ^)active)->GetPackage();
154
				if ( !activePackage )
155
					e = false;
156
				else
157
					this->StatusFiles->Text = "Files: " + activePackage->GetAvailableFiles() + " (" + SystemStringFromCyString(SPK::GetSizeString(activePackage->GetFileSize())) + ")";
158
			}
159
			else
160
				e = false;
161
 
162
			if ( !e  )
163
				this->StatusFiles->Text = "";
164
		}
165
 
166
		void UpdateDisplay()
167
		{
168
			bool e = (this->tabControl1->HasChildren) ? true : false;
169
 
170
			BaseForm ^active = this->GetActiveChild();
171
			if ( !active )
172
				e = false;
173
			else if ( active->GetFormType() != FORMTYPE_SINGLE && active->GetFormType() != FORMTYPE_MULTI)
174
				e = false;
175
 
176
			this->saveAsToolStripMenuItem->Enabled = e;
177
			this->saveToolStripMenuItem->Enabled = e;
178
			this->tabControl1->Visible = e;
179
 
180
			if ( !this->PanelTab->Visible && e )
181
			{
182
				this->PanelTab->Visible = e;
183
				this->toolStrip1->SendToBack();
184
				this->menuStrip1->SendToBack();
185
			}
186
			else if ( !e )
187
				this->PanelTab->Visible = e;
188
 
189
			this->UpdateStatus();
190
			this->UpdateDropDownOpen();
191
		}
192
 
193
		void OpenFileExplorer()
194
		{
195
			FileExplorer ^file = gcnew FileExplorer(this, m_pPackages);
196
			file->Show(this);
197
		}
198
 
199
		void OpenFile(String ^filename)
200
		{
201
			ArrayList ^a = gcnew ArrayList();
202
			a->Add(filename);
203
 
204
			this->OpenFiles(a, false, true);
205
		}
206
 
207
	protected:
208
		/// <summary>
209
		/// Clean up any resources being used.
210
		/// </summary>
211
		~Form1()
212
		{
213
			if (components)
214
			{
215
				delete components;
216
			}
217
			delete m_pLoadedList;
218
			delete m_pPackages;
219
			delete m_settings;
220
		}
221
 
222
	protected: 
223
		bool			 m_bAutoClose;
224
		int				 m_iLocX;
225
		int				 m_iLocY;
226
		CyStringList	*m_pLoadedList;
227
		CPackages *m_pPackages;
94 cycrow 228
		SPK::CGameDirectories	*_pGameDir;
229
 
1 cycrow 230
		SSettings		*m_settings;
231
		bool			 m_bTextLoaded;
232
		String			^m_sConvertFile;
233
		Waiting			^m_pWait;
234
		CBaseFile		*m_pConverted;
235
 
36 cycrow 236
		//System::Collections::Hashtable ^textList;
1 cycrow 237
 
238
	private: System::Windows::Forms::MenuStrip^  menuStrip1;
239
	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
240
	private: System::Windows::Forms::ToolStripMenuItem^  newToolStripMenuItem;
241
	private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem;
242
	private: System::Windows::Forms::ToolStripMenuItem^  shipToolStripMenuItem;
243
	private: System::Windows::Forms::ToolStripMenuItem^  windowsToolStripMenuItem;
244
	private: System::Windows::Forms::ToolStripMenuItem^  layoutToolStripMenuItem;
245
	private: System::Windows::Forms::ToolStripMenuItem^  cascadeToolStripMenuItem;
246
	private: System::Windows::Forms::ToolStripMenuItem^  horizontalToolStripMenuItem;
247
	private: System::Windows::Forms::ToolStripMenuItem^  verticalToolStripMenuItem;
248
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
249
	private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
250
	private: System::Windows::Forms::ToolStripMenuItem^  saveToolStripMenuItem;
251
	private: System::Windows::Forms::ToolStripMenuItem^  saveAsToolStripMenuItem;
252
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
253
	private: System::Windows::Forms::Panel^  PanelTab;
254
	private: System::Windows::Forms::TabControl^  tabControl1;
255
	private: System::Windows::Forms::Button^  button1;
256
	private: System::Windows::Forms::ToolStrip^  toolStrip1;
257
	private: System::Windows::Forms::ToolStripSplitButton^  toolStripSplitButton1;
258
 
259
	private: System::Windows::Forms::ImageList^  imageList1;
260
	private: System::Windows::Forms::ToolStripDropDownButton^  toolStripButton1;
261
	private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem1;
262
	private: System::Windows::Forms::ToolStripMenuItem^  shipToolStripMenuItem1;
263
 
264
 
265
	private: System::Windows::Forms::Timer^  timer1;
266
	private: System::Windows::Forms::StatusStrip^  statusStrip1;
267
	private: System::Windows::Forms::ToolStripStatusLabel^  StatusFiles;
268
private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
269
private: System::Windows::Forms::ToolStripMenuItem^  configToolStripMenuItem;
270
private: System::Windows::Forms::ImageList^  imageListGames;
271
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
272
private: System::Windows::Forms::ToolStripButton^  toolStripButton2;
273
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator5;
274
private: System::Windows::Forms::ToolStripMenuItem^  fromPackagerScriptToolStripMenuItem1;
275
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator4;
276
private: System::Windows::Forms::ToolStripMenuItem^  fromPackagerScriptToolStripMenuItem;
277
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromModToolStripMenuItem1;
278
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromModToolStripMenuItem;
279
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator6;
280
private: System::Windows::Forms::ToolStripMenuItem^  packageCreationWizardToolStripMenuItem;
281
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator7;
282
private: System::Windows::Forms::ToolStripMenuItem^  packageCreationWizardToolStripMenuItem1;
283
private: System::Windows::Forms::ToolTip^  toolTip1;
284
private: System::Windows::Forms::ImageList^  imageListSmall;
285
private: System::Windows::Forms::ImageList^  imageListLarge;
286
private: System::Windows::Forms::ImageList^  imageListFiles;
287
private: System::Windows::Forms::ToolStripMenuItem^  multiPackageToolStripMenuItem;
288
private: System::Windows::Forms::ToolStripMenuItem^  toolsToolStripMenuItem;
289
private: System::Windows::Forms::ToolStripMenuItem^  modMergeToolStripMenuItem;
290
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator8;
291
private: System::Windows::Forms::ToolStripDropDownButton^  toolStripDropDownButton1;
292
private: System::Windows::Forms::ToolStripMenuItem^  modMergeToolStripMenuItem1;
293
private: System::Windows::Forms::ToolStripMenuItem^  modDiffToolStripMenuItem;
294
private: System::Windows::Forms::ToolStripMenuItem^  modDiffToolStripMenuItem1;
295
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator10;
296
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageWebListToolStripMenuItem1;
297
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator9;
298
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageWebListToolStripMenuItem;
299
private: System::Windows::Forms::ToolStripMenuItem^  fromArchiveToolStripMenuItem;
300
private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
301
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageUpdatesToolStripMenuItem;
302
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator11;
303
private: System::Windows::Forms::ToolStripMenuItem^  fileExplorerToolStripMenuItem;
36 cycrow 304
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromVFSToolStripMenuItem;
1 cycrow 305
 
306
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
307
 
308
 
309
	private:
310
		BaseForm ^GetActiveChild()
311
		{
312
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
313
			 for ( int i = 0; i < children->Length; i++ )
314
			 {
315
				 BaseForm ^childForm = (BaseForm ^)children[i];
316
				 if ( !childForm->TabPage() )
317
					 continue;
318
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
319
					 return childForm;
320
			 }
321
 
322
			 return nullptr;
323
		}
324
 
36 cycrow 325
		void ImportShip();
326
		void ImportShipFromVFS();
1 cycrow 327
 
36 cycrow 328
		String ^getShipSelection(CVirtualFileSystem *pVfs);
1 cycrow 329
 
330
 
331
		void OpenDirectory(System::String ^dir)
332
		{
333
			if ( !System::IO::Directory::Exists(dir) )
334
			{
335
				MessageBox::Show(this, "Unable to open packages from directory\nDirectory not found\n\n" + dir, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
336
				return;
337
			}
338
 
339
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.spk"), false, false);
340
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.xsp"), false, false);
341
		}
342
 
343
		void OpenFiles(cli::array<System::String ^> ^list, bool checkExtension, bool display)
344
		{
345
			if ( !list )
346
				return;
347
 
348
			for ( int i = 0; i < list->Length; i++ )
349
				this->Open(list[i], display, checkExtension);
350
 
351
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
352
			for ( int i = 0; i < children->Length; i++ )
353
			{
354
				BaseForm ^childForm = (BaseForm ^)children[i];
355
				if ( !childForm->TabPage()->Visible )
356
				{
357
					childForm->Show();
358
					childForm->TabPage()->Show();
359
				}
360
			}
361
		}
362
 
363
		void OpenOptionsMenu()
364
		{
94 cycrow 365
			 Options ^opt = gcnew Options(this->imageListGames, _pGameDir, m_pPackages, m_settings);
1 cycrow 366
			 if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
367
			 {
368
				 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
369
			 }
370
 
371
			 if ( opt->LoadText() )
372
				 this->LoadText(false, true);
373
		}
374
 
375
		void OpenFiles(ArrayList ^list, bool checkExtension, bool display)
376
		{
377
			if ( !list )
378
				return;
379
 
380
			for ( int i = 0; i < list->Count; i++ )
381
				this->Open(cli::safe_cast<String ^>(list[i]), display, checkExtension);
382
 
383
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
384
			for ( int i = 0; i < children->Length; i++ )
385
			{
386
				BaseForm ^childForm = (BaseForm ^)children[i];
387
				if ( !childForm->TabPage()->Visible )
388
				{
389
					childForm->Show();
390
					childForm->TabPage()->Show();
391
				}
392
			}
393
		}
394
 
395
		void Open()
396
		{
397
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
398
			ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";
399
			ofd->Title = "Select the package/ship file to open";
400
			ofd->FilterIndex = 1;
401
			ofd->RestoreDirectory = true;
402
			ofd->Multiselect = true;
403
 
404
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
405
				this->OpenFiles(ofd->FileNames, false, true);
406
		}
407
 
408
		void LoadFiles(String ^loadFrom)
409
		{
410
			if ( System::IO::File::Exists(loadFrom) )
411
			{
412
				System::String ^lines = System::IO::File::ReadAllText(loadFrom);
413
				try { System::IO::File::Delete(loadFrom); }
414
				catch (System::IO::IOException ^) {}
415
				catch (System::Exception ^) {}
416
 
417
				if ( lines )
418
				{
419
					CyString strLines = CyStringFromSystemString(lines);
420
					int num;
421
					CyString *aLines = strLines.SplitToken("\n", &num);
422
					if ( num && aLines )
423
					{
424
						ArrayList ^list = gcnew ArrayList();
425
						for ( int i = 0; i < num; i++ )
426
						{
427
							CyString l = aLines[i];
428
							l = l.Remove("\r");
429
							CyString first = l.GetToken(":", 1, 1);
430
							CyString rest = l.GetToken(":", 2);
431
							rest.RemoveFirstSpace();
432
 
433
							if ( first.Compare("File") )
434
								list->Add(SystemStringFromCyString(rest));
435
						}
436
 
437
						CLEANSPLIT(aLines, num)
438
 
439
						this->OpenFiles(list, true, true);
440
					}
441
 
442
				}
443
			}			
444
		}
445
 
446
		void ExportPackage(String ^file)
447
		{
448
			CyString sFile = CyStringFromSystemString(file);
449
			int error = 0;
450
 
451
			CBaseFile *p = m_pPackages->OpenPackage(sFile, &error, 0, SPKREAD_NODATA);
452
			if ( !p ) {
453
				MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
454
			}
455
			else {
456
				String ^to = IO::FileInfo(file).DirectoryName;
457
				int game = 0;
458
				if ( p->IsMultipleGamesInPackage() ) {
459
					SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + file, m_pPackages);
460
					if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
461
						game = selGame->GetGame() + 1;
462
					}
463
					else
464
						to = nullptr;
465
				}
466
				else if ( p->IsAnyGameInPackage() ) {
467
					game = p->FindFirstGameInPackage();
468
				}
469
 
470
				if ( to && to->Length ) {
471
					CyString exportFilename = CFileIO(sFile).ChangeFileExtension("zip");
472
					if ( game ) {
58 cycrow 473
						exportFilename = CFileIO(exportFilename).GetDir() + "/" + CFileIO(exportFilename).baseName() + "_" + CBaseFile::ConvertGameToString(game) + ".zip";
1 cycrow 474
					}
475
					if ( p->SaveToArchive(exportFilename, game) ) {
476
						String ^message = "Export: " + file + "\nTo: " + SystemStringFromCyString(CFileIO(exportFilename).GetFilename());
477
						if ( game ) {
478
							message += "\nGame: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(game - 1)->sName);
479
						}
480
						MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
481
					}
482
					else {
483
						MessageBox::Show(this, "Error: Unable to export to:\n" + SystemStringFromCyString(exportFilename), "Error Export", MessageBoxButtons::OK, MessageBoxIcon::Error);
484
					}
485
				}
486
			}
487
		}
488
 
489
		void ExtractPackage(String ^file, bool here)
490
		{
491
			CyString sFile = CyStringFromSystemString(file);
492
			int error = 0;
493
 
494
			CBaseFile *p = m_pPackages->OpenPackage(sFile, &error, 0, SPKREAD_NODATA);
495
			if ( !p ) {
496
				MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
497
			}
498
			else {
499
				String ^to = nullptr;
500
				if ( here ) {
501
					to = IO::FileInfo(file).DirectoryName;
502
				}
503
				else {
504
					FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
505
					fbd->Description = "Select the path to extract package to";
506
					if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
507
						to = fbd->SelectedPath;
508
				}
509
 
510
				if ( to && to->Length ) {
511
					// check if theres multiple games in package
512
					int game = 0;
513
					if ( p->IsMultipleGamesInPackage() ) {
514
						SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + file, m_pPackages);
515
						if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
516
							game = selGame->GetGame() + 1;
517
						}
518
						else
519
							to = nullptr;
520
					}
521
					else if ( p->IsAnyGameInPackage() ) {
522
						game = p->FindFirstGameInPackage();
523
					}
524
 
525
					if ( to && to->Length ) {
526
						if ( p->ExtractAll(CyStringFromSystemString(to), game, true) ) {
527
							String ^message = "Extracted: " + file + "\nTo: " + to;
528
							if ( game ) {
529
								message += "\nGame: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(game - 1)->sName);
530
							}
531
							MessageBox::Show(this, message, "Extracted Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
532
						}
533
						else {
534
							MessageBox::Show(this, "Error: Unable to extract to:\n" + to, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
535
						}
536
					}
537
				}
538
			}
539
		}
540
 
541
		void SavePackagerScript(String ^file)
542
		{
543
			CyString sFile = CyStringFromSystemString(file);
544
			CyStringList malformed, unknown;
545
			CBaseFile *package = m_pPackages->LoadPackagerScript(sFile, -1, NULL, &malformed, &unknown);
546
			if ( package )
547
			{
50 cycrow 548
				CyString saveto = package->filename();
1 cycrow 549
				saveto = saveto.FindReplace("$DEFAULTDIR", CFileIO(sFile).GetDir() + "/");
550
				saveto = saveto.FindReplace("$PATH", CFileIO(sFile).GetDir());
551
				saveto = saveto.FindReplace("\\", "/");
552
				saveto = saveto.FindReplace("//", "/");
553
				if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
554
					saveto += ".spk";
555
				else if ( !saveto.Right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
556
					saveto += ".xsp";
557
				// write script
558
				if ( package->WriteFile(saveto) ) {
559
					String ^message = "Package: " + SystemStringFromCyString(saveto) + " has been created\n";
560
					if ( package->AutoGenerateUpdateFile() )
561
						package->CreateUpdateFile(CFileIO(saveto).GetDir());
50 cycrow 562
					CyString exportto = package->exportFilename();
1 cycrow 563
					if ( !exportto.Empty() ) {
564
						exportto = exportto.FindReplace("$DEFAULTDIR", CFileIO(sFile).GetDir() + "/");
565
						exportto = exportto.FindReplace("$PATH", CFileIO(sFile).GetDir());
566
						exportto = exportto.FindReplace("\\", "/");
567
						exportto = exportto.FindReplace("//", "/");
568
						if ( package->SaveToArchive(exportto, 0) ) {
569
							message += "\nExported to:\n" + SystemStringFromCyString(exportto) + "\n";
570
							if ( package->IsAnyGameInPackage() ) {
571
								for ( int i = 0; i < m_pPackages->GetGameExe()->GetNumGames(); i++ ) {
572
									if ( package->IsGameInPackage(i + 1) ) {
58 cycrow 573
										CyString exportFile = CFileIO(saveto).GetDir() + "/" + CFileIO(saveto).baseName() + "_" + CBaseFile::ConvertGameToString(i + 1) + "." + CFileIO(exportto).GetFileExtension();
1 cycrow 574
										if ( package->SaveToArchive(exportFile, i + 1) ) {
575
											message += SystemStringFromCyString(CFileIO(exportFile).GetFilename()) + "\n";
576
										}
577
									}
578
								}
579
							}
580
						}
581
					}
582
					MessageBox::Show(this, message, "Package Created", MessageBoxButtons::OK, MessageBoxIcon::Information);
583
				}
584
				else
585
					MessageBox::Show(this, "Error: Unable to create package from script\n" + file, "Error Creating Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
586
			}
587
		}
588
 
589
		void OpenPackagerScript(String ^file)
590
		{
591
			CyStringList malformed, unknown;
592
			CBaseFile *package = m_pPackages->LoadPackagerScript(CyStringFromSystemString(file), SPKCOMPRESS_NONE, NULL, &malformed, &unknown);
593
			if ( package )
594
			{
595
				package->SetDataCompression(SPKCOMPRESS_7ZIP);
596
				PackageForm ^childForm = this->OpenPackage(true, package, file, "");
50 cycrow 597
				childForm->Text = _US(package->filename());
1 cycrow 598
			}
599
		}
600
		void OpenPackagerScript()
601
		{
602
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
603
			ofd->Filter = "Packager Script (*.sps)|*.sps";
604
			ofd->FilterIndex = 1;
605
			ofd->Title = "Select the packager script to create a package from";
606
			ofd->RestoreDirectory = true;
607
			ofd->Multiselect = false;
608
 
609
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
610
				OpenPackagerScript(ofd->FileName);
611
		}
612
 
613
		MultiForm ^OpenPackage(bool display, CMultiSpkFile *package, String ^file, String ^title)
614
		{
615
			CyString sFile = CyStringFromSystemString(file);
616
			TabPage ^tp = gcnew TabPage();
617
			tp->Text = title;
618
			tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
619
			if ( tp->ImageIndex == -1 )
620
				tp->ImageIndex = 0;
621
 
622
			ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
36 cycrow 623
			MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 624
 
625
			childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
626
			this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
627
			childForm->WindowState = FormWindowState::Minimized;
628
 
629
			this->ProcessOpen(false, tp, childForm);
630
			childForm->LoadPackage(package, file);
631
			this->ProcessOpen(display, tp, childForm);
632
 
633
			return childForm;
634
		}
635
		PackageForm ^OpenPackage(bool display, CBaseFile *package, String ^file, String ^title)
636
		{
637
			CyString sFile = CyStringFromSystemString(file);
638
 
639
			if ( this->imageList1->Images->IndexOfKey(file) == -1 )
640
			{
641
				if ( package->GetIcon() )
642
				{
643
					package->ReadIconFileToMemory();
58 cycrow 644
					CyString sIconFile = CyStringFromSystemString(IO::Path::GetTempPath()) + "\\" + CFileIO(sFile).baseName() + "." + package->GetIconExt();
1 cycrow 645
					if ( package->ExtractFile(package->GetIcon(), CFileIO(sIconFile).GetFullFilename(), false) )
646
					{
647
						String ^iconFile = SystemStringFromCyString(sIconFile);
648
						if ( IO::File::Exists(iconFile) )
649
						{
650
							String ^ext = System::IO::FileInfo(iconFile).Extension;
651
							if ( !String::Compare(ext, "bmp", false) || !String::Compare(ext, "ico", false) )
652
								this->imageList1->Images->Add(file, Bitmap::FromFile(iconFile));
653
							else
654
							{
655
								Bitmap ^myBitmap = gcnew Bitmap(iconFile);
656
								if ( myBitmap )
657
									this->imageList1->Images->Add(file, myBitmap);
658
							}
659
						}
660
					}
661
				}
662
			}
663
 
664
			TabPage ^tp = gcnew TabPage();
665
			tp->Text = title;
666
			tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
667
			if ( tp->ImageIndex == -1 )
668
				tp->ImageIndex = 0;
669
 
670
			ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
36 cycrow 671
			PackageForm ^childForm = gcnew PackageForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 672
			childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames, this->imageListFiles);
673
			this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
674
			childForm->WindowState = FormWindowState::Minimized;
675
 
676
			this->ProcessOpen(false, tp, childForm);
677
			childForm->LoadPackage(package, file);
678
			this->ProcessOpen(display, tp, childForm);
679
 
680
			return childForm;
681
		}
682
 
683
		void ProcessOpen(bool display, TabPage ^tp, BaseForm ^childForm)
684
		{
685
			tp->Parent = tabControl1;
686
			if ( display || !this->HasChildren )
687
			{
688
				tabControl1->SelectedTab = tp;
689
				tp->Show();
690
				childForm->Show();
691
				childForm->WindowState = FormWindowState::Maximized;
692
				this->UpdateStatus();
693
			}
694
		}
695
 
696
		void GeneratePackageUpdates()
697
		{
698
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
699
			fbd->Description = "Select the path to generate the updates from";
700
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
701
			{
702
				int count = 0;
703
				for ( int type = 0; type < 2; type++ )
704
				{
705
					array <System::String ^> ^Files = nullptr;
706
					if ( type == 0 )
707
						Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
708
					else if ( type == 1 )
709
						Files = Directory::GetFiles(fbd->SelectedPath, "*.xsp");
710
					else
711
						break;
712
 
713
					for ( int i = 0; i < Files->Length; i++ )
714
					{
715
						CyString file = CyStringFromSystemString(Files[i]);
716
						int error = 0;
717
						CBaseFile *p = m_pPackages->OpenPackage(file, &error, 0, SPKREAD_NODATA);
718
						if ( !p )
719
							continue;
720
 
721
						CyString ufile = p->CreateUpdateFile(CyStringFromSystemString(fbd->SelectedPath));
722
						if ( !ufile.Empty() )
723
							++count;
724
						delete p;
725
					}
726
				}
727
 
728
				if ( !count )
729
					MessageBox::Show(this, "No package files with updates found in " + fbd->SelectedPath + "\nSelect a directory that contains spk/xsp files", "No Packages", MessageBoxButtons::OK, MessageBoxIcon::Error);
730
				else
731
					MessageBox::Show(this, "Update files generated for " + count + " packages\nDirectory: " + fbd->SelectedPath, "Update File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
732
			}
733
		}
734
 
735
		void GeneratePackageWebList()
736
		{
737
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
738
			fbd->Description = "Select the path to generate the list from";
739
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
740
			{
741
				CyStringList filedata;
742
				for ( int type = 0; type < 2; type++ )
743
				{
744
					array <System::String ^> ^Files = nullptr;
745
					if ( type == 0 )
746
						Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
747
					else if ( type == 1 )
748
						Files = Directory::GetFiles(fbd->SelectedPath, "*.xsp");
749
					else
750
						break;
751
 
752
					for ( int i = 0; i < Files->Length; i++ )
753
					{
754
						CyString file = CyStringFromSystemString(Files[i]);
755
						int error = 0;
756
						CBaseFile *p = m_pPackages->OpenPackage(file, &error, 0, SPKREAD_NODATA);
757
						if ( !p )
758
							continue;
759
 
760
						filedata.PushBack(CPackages::FormatAvailablePackageData(p));
761
						delete p;
762
					}
763
				}
764
 
765
				if ( filedata.Empty() )
766
					MessageBox::Show(this, "No package files found in " + fbd->SelectedPath + "\nSelect a directory that contains spk/xsp files", "No Packages", MessageBoxButtons::OK, MessageBoxIcon::Error);
767
				else
768
				{
769
					CFileIO File(CyStringFromSystemString(fbd->SelectedPath) + "/xpackagedata.dat");
770
					if ( File.WriteFile(&filedata) )
771
						MessageBox::Show(this, "Data file generated for " + filedata.Count() + " packages\nDirectory: " + fbd->SelectedPath, "Web File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
772
					else
773
						MessageBox::Show(this, "Unable to write web data file in " + fbd->SelectedPath, "File Write Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
774
				}
775
			}
776
		}
777
 
778
		void Open(System::String ^file, bool display, bool checkExtension)
779
		{
780
			CBaseFile *convertFile = NULL;
781
			if ( checkExtension )
782
			{
783
				if ( String::Compare(IO::FileInfo(file).Extension, ".spk") != 0 && String::Compare(IO::FileInfo(file).Extension, ".xsp") != 0 && String::Compare(IO::FileInfo(file).Extension, ".sps") != 0 )
784
					return;
785
			}
786
 
787
			if ( !System::IO::File::Exists(file) )
788
			{
789
				if ( display )
790
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nFile doesn't exist", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
791
				return;
792
			}
793
 
794
			// check if its already open
795
			if ( this->IsOpen(file) )
796
			{
797
				if ( display )
798
					MessageBox::Show(this, "The package is currently open\n" + file, "Already Open", MessageBoxButtons::OK, MessageBoxIcon::Information);
799
				return;
800
			}
801
 
802
			// sps
803
			if ( String::Compare(IO::FileInfo(file).Extension, ".sps") == 0 )
804
			{
805
				OpenPackagerScript(file);
806
				return;
807
			}
808
 
809
			float fVersion;
810
			CyString sFile = CyStringFromSystemString(file);
811
			int fileType = CSpkFile::CheckFile(sFile, &fVersion);
812
 
813
			if ( fVersion > (float)FILEVERSION )
814
			{
815
				if ( display )
816
					MessageBox::Show(this, "Package file is created with a newer version, unable to open", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
817
				return;
818
			}
819
 
9 cycrow 820
			if ( fileType == SPKFILE_INVALID || fileType == SPKFILE_OLD )
1 cycrow 821
			{
822
				bool loaded = false;
823
				if ( String::Compare(IO::FileInfo(file).Extension, ".xsp") == 0 )
824
				{
825
					CXspFile *shipFile = new CXspFile;
39 cycrow 826
					loaded = shipFile->ConvertOld(_S(file));
1 cycrow 827
					if ( loaded )
828
					{
50 cycrow 829
						shipFile->adjustChanged(true);
830
						shipFile->setFilename(_S(file));
1 cycrow 831
						convertFile = shipFile;
832
					}
833
					else 
834
						delete shipFile;
835
				}
9 cycrow 836
				else if ( String::Compare(IO::FileInfo(file).Extension, ".spk") == 0 )
837
				{
838
					CSpkFile *spkFile = CSpkFile::convertFromOld(CyStringFromSystemString(file).ToString());
839
					if ( spkFile ) {
840
						loaded = true;
50 cycrow 841
						spkFile->adjustChanged(true);
842
						spkFile->setFilename(_S(file));
9 cycrow 843
						convertFile = spkFile;
844
					}
845
				}
1 cycrow 846
 
847
				if ( !loaded )
848
				{
849
					if ( display )
850
						MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
851
					return;				
852
				}
853
			}
854
 
855
			// open multi package
856
			bool loaded = false;
857
 
858
			int error;
859
			if ( fileType == SPKFILE_MULTI )
860
			{
861
				CMultiSpkFile *mspk = m_pPackages->OpenMultiPackage(sFile, &error);
862
				if ( mspk )
863
				{
864
					loaded = true;
865
					BaseForm ^childForm = this->OpenPackage(display, mspk, file, "");
866
					childForm->Text = file;
867
				}
868
			}
869
			else
870
			{
871
				CBaseFile *package = (convertFile) ? convertFile : m_pPackages->OpenPackage(sFile, &error);
872
				if ( package )
873
				{
874
					loaded = true;
875
					PackageForm ^childForm = this->OpenPackage(display, package, file, "");
876
					if ( convertFile )
877
					{
50 cycrow 878
						convertFile->adjustChanged(true);
1 cycrow 879
						childForm->UpdateChanged();
880
					}
881
				}
882
			}
883
 
884
			if ( loaded )
885
			{
886
				// adjust the loaded list
887
				sFile.FindReplace("/", "\\");
888
				sFile.RemoveChar(9);
889
				sFile.RemoveChar('\r');
890
				sFile.RemoveChar('\n');
891
				m_pLoadedList->Remove(sFile, true);
892
				m_pLoadedList->PushFront(sFile);
893
 
894
				while ( m_pLoadedList->Count() > 15 )
895
					m_pLoadedList->PopBack();
896
 
897
				this->SaveData();
898
 
899
				this->UpdateDropDownOpen();
900
			}	
901
			else
902
			{
903
				if ( display )
904
				{
905
					System::String ^sError = "Unknown Error (" + SystemStringFromCyString(CyString::Number(error)) + ")";
906
					switch ( error )
907
					{
908
						case INSTALLERR_OLD:
909
							sError = "Old unsupported package file";
910
							break;
911
						case INSTALLERR_INVALID:
912
							sError = "Invalid Package File";
913
							break;
914
						case INSTALLERR_NOMULTI:
915
							sError = "Multi-Packages not currently supported";
916
							break;
917
					}
918
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
919
				}
920
			}
921
		}
922
 
923
		void NewPackage(bool ship)
924
		{
925
			 TabPage ^tp = gcnew TabPage();
926
  			 tp->ImageIndex = 0;
927
			 if ( ship )
928
				tp->Text = "New Ship";
929
			 else
930
				tp->Text = "New Package";
931
			 ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(tp->Text, this->imageList1->Images[tp->ImageIndex]);
932
 			 this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
36 cycrow 933
			 PackageForm ^childForm = gcnew PackageForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 934
			 childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames, this->imageListFiles);
935
			 tp->Parent = tabControl1;
936
			 tabControl1->SelectedTab = tp;
937
 
938
			 if ( ship )
939
				childForm->CreateShip();
940
			 else
941
				childForm->CreatePackage();
942
 
943
			 childForm->WindowState = FormWindowState::Maximized;
944
			 tp->Show();
945
			 childForm->Show();
946
		}
947
 
948
		void NewMultiPackage()
949
		{
950
			 TabPage ^tp = gcnew TabPage();
951
  			 tp->ImageIndex = 0;
952
			 tp->Text = "New Mutli Package";
953
			 ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(tp->Text, this->imageList1->Images[tp->ImageIndex]);
954
 			 this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
36 cycrow 955
			 MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 956
			 childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
957
			 tp->Parent = tabControl1;
958
			 tabControl1->SelectedTab = tp;
959
 
960
			 childForm->CreatePackage();
961
 
962
			 childForm->WindowState = FormWindowState::Maximized;
963
			 tp->Show();
964
			 childForm->Show();
965
 
966
		}
967
 
968
		void CloseAll()
969
		{
970
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
971
			for ( int i = 0; i < children->Length; i++ )
972
			{
973
				delete ((BaseForm ^)children[i])->TabPage();
974
				//((BaseForm ^)children[i])->
975
				delete children[i];
976
			}
977
			this->UpdateDisplay();
978
		}
979
 
980
		void CloseEvent(System::Object ^Sender, System::EventArgs ^E) 
981
		{
982
			this->CloseAll();
983
			this->SaveData();
984
		}
985
 
986
		void UpdateDropDownOpen()
987
		{
988
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
989
 
990
			// clear them all
991
			this->toolStripSplitButton1->DropDownItems->Clear();
992
			this->openToolStripMenuItem->DropDownItems->Clear();
993
 
994
			System::Windows::Forms::ToolStripMenuItem ^openPackage = gcnew System::Windows::Forms::ToolStripMenuItem;
995
			openPackage->Text = "Open Package";
996
			openPackage->Tag = "$PACKAGE";
997
			openPackage->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
998
			openPackage->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
999
			this->openToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
1000
			this->openToolStripMenuItem->DropDownItems->Add(openPackage);
1001
 
1002
			System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;
1003
			newItem->Text = "Open Directory";
1004
			newItem->Tag = "$DIR";
1005
			newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1006
			this->toolStripSplitButton1->DropDownItems->Add(newItem);
1007
 
1008
			// add all none open items
1009
			bool sep = false;
1010
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1011
			{
1012
				// check if we have it open
1013
				System::String ^sFile = SystemStringFromCyString(str->str.findreplace("/", "\\"));
1014
				if ( this->IsOpen(sFile) )
1015
					continue;
1016
				if ( this->IsOpen(SystemStringFromCyString(str->str.findreplace("\\", "/"))) )
1017
					continue;
1018
 
1019
				if ( !IO::File::Exists(sFile) )
1020
					continue;
1021
 
1022
				if ( !sep )
1023
				{
1024
					sep = true;
1025
					this->toolStripSplitButton1->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
1026
					this->openToolStripMenuItem->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
1027
				}
1028
 
1029
				// work out the type
1030
				float fVersion;
1031
				int iconType = -1;
1032
				int check = CBaseFile::CheckFile(str->str, &fVersion);
1033
				switch ( check )
1034
				{
1035
					case SPKFILE_BASE:
1036
						iconType = 5;
1037
						break;
1038
					case SPKFILE_SINGLE:
1039
						iconType = 0;
1040
						break;
1041
					case SPKFILE_SINGLESHIP:
1042
						iconType = 1;
1043
						break;
1044
					case SPKFILE_MULTI:
1045
						iconType = 4;
1046
						break;
1047
				}
1048
 
1049
				// otherwise add it to the list
1050
				System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;
1051
				newItem->Text = sFile;
1052
				newItem->Tag = newItem->Text;
1053
				newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1054
				if ( iconType > -1 )
1055
					newItem->Image = this->imageList1->Images[iconType];
1056
				this->toolStripSplitButton1->DropDownItems->Add(newItem);
1057
 
1058
				System::Windows::Forms::ToolStripMenuItem ^newItem2 = gcnew System::Windows::Forms::ToolStripMenuItem;
1059
				newItem2->Text = sFile;
1060
				newItem2->Tag = newItem->Text;
1061
				newItem2->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1062
				if ( iconType > -1 )
1063
					newItem2->Image = this->imageList1->Images[iconType];
1064
				this->openToolStripMenuItem->DropDownItems->Add(newItem2);
1065
			}
1066
		}
1067
 
1068
		bool IsOpen(System::String ^file)
1069
		{
1070
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1071
			 for ( int i = 0; i < children->Length; i++ )
1072
			 {
1073
				 BaseForm ^childForm = (BaseForm ^)children[i];
1074
				 if ( childForm->IsClosing() )
1075
					 continue;
1076
				 if ( childForm->CheckFilename(file) )
1077
					 return true;
1078
			 }
1079
 
1080
			 return false;
1081
		}
1082
 
1083
		void Save()
1084
		{
1085
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1086
			 for ( int i = 0; i < children->Length; i++ )
1087
			 {
1088
				 BaseForm ^childForm = (BaseForm ^)children[i];
1089
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1090
				 {
1091
					 if ( childForm->GetFormType() == FORMTYPE_SINGLE )
1092
						((PackageForm ^)childForm)->Save();
1093
					 else if ( childForm->GetFormType() == FORMTYPE_MULTI )
1094
						((MultiForm ^)childForm)->Save();
1095
					 else
1096
						childForm->Save();
1097
					 this->UpdateDropDownOpen();
1098
					 break;
1099
				 }
1100
			 }
1101
		}
1102
 
1103
		void SaveAs()
1104
		{
1105
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1106
			 for ( int i = 0; i < children->Length; i++ )
1107
			 {
1108
				 BaseForm ^childForm = (BaseForm ^)children[i];
1109
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1110
				 {
1111
					 if ( childForm->GetFormType() == FORMTYPE_SINGLE )
1112
						((PackageForm ^)childForm)->SaveAs();
1113
					 else if ( childForm->GetFormType() == FORMTYPE_MULTI )
1114
						((MultiForm ^)childForm)->SaveAs();
1115
					 else
1116
						childForm->SaveAs();
1117
					 this->UpdateDropDownOpen();
1118
					 break;
1119
				 }
1120
			 }
1121
		}
1122
 
1123
		void PackageCreationWizard()
1124
		{
1125
			MessageBox::Show(this, "The creation wizard is currently not available", "Feature Missing", MessageBoxButtons::OK, MessageBoxIcon::Error);
1126
			return;
1127
 
1128
			CreationWizard ^wizard = gcnew CreationWizard();
1129
			if ( wizard->ShowDialog(this) == Windows::Forms::DialogResult::OK )
1130
			{
1131
			}
1132
		}
1133
 
1134
		void SaveData()
1135
		{
1136
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
1137
			CFileIO Config(CyStringFromSystemString(mydoc) + "/Egosoft/creator.dat");
1138
			CyStringList lines;
1139
 
1140
			if ( this->WindowState == FormWindowState::Normal )
1141
			{
1142
				lines.PushBack(CyString("CreatorSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
1143
				lines.PushBack(CyString("CreatorPos:") + (long)this->Location.X + " " + (long)this->Location.Y);
1144
			}
1145
			else
1146
			{
1147
				lines.PushBack(CyString("CreatorPos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
1148
				lines.PushBack(CyString("CreatorSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
1149
			}
1150
 
1151
			if ( this->WindowState == FormWindowState::Maximized )
1152
				lines.PushBack("CreatorMax:");
1153
 
1154
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1155
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
94 cycrow 1156
			_pGameDir->writeData(&lines);
1 cycrow 1157
			if ( m_settings->bGenerateUpdate )
1158
				lines.PushBack("GenerateUpdate:");
1159
 
1160
			Config.WriteFile(&lines);
1161
		}
1162
 
1163
		void LoadData()
1164
		{
1165
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
1166
			CFileIO Config;
1167
			if ( Config.Open(CyStringFromSystemString(mydoc) + "/Egosoft/creator.dat") )
1168
			{
1169
				std::vector<CyString> *lines = Config.ReadLines();
1170
				if ( lines )
1171
				{
1172
					for ( int i = 0; i < (int)lines->size(); i++ )
1173
					{
1174
						CyString line(lines->at(i));
1175
						CyString start = line.GetToken(":", 1, 1).ToLower();
1176
						CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
1177
						if ( start.Compare("CreatorSize") )
1178
							this->Size = System::Drawing::Size(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2).ToInt());
1179
						else if ( start.Compare("CreatorPos") )
1180
						{
1181
							m_iLocX = rest.GetToken(" ", 1, 1).ToInt();
1182
							m_iLocY = rest.GetToken(" ", 2, 2).ToInt();
1183
						}
1184
						else if ( start.Compare("Loaded") )
1185
							m_pLoadedList->PushBack(rest);
1186
						else if ( start.Compare("CreatorMax") )
1187
							this->WindowState = FormWindowState::Maximized;
1188
						else if ( start.Compare("GenerateUpdate") )
1189
							m_settings->bGenerateUpdate = true;
1190
						else if ( start.Compare("GameDir") )
94 cycrow 1191
							_pGameDir->parse(rest.ToString(), m_pPackages);
1 cycrow 1192
					}
1193
 
1194
					delete lines;
1195
				}
1196
			}
1197
		}
1198
 
1199
 
1200
		void LoadText(bool center, bool reload)
1201
		{
1202
			if ( m_bTextLoaded && !reload )
1203
				return;
1204
			m_bTextLoaded = true;
1205
 
94 cycrow 1206
			if ( _pGameDir->isEmpty() ) return;
1 cycrow 1207
 
94 cycrow 1208
			Creator::LoadText ^load = gcnew Creator::LoadText(_pGameDir, m_pPackages);
1 cycrow 1209
			if ( center )
1210
				load->StartPosition = Windows::Forms::FormStartPosition::CenterScreen;
1211
 
1212
			load->ShowDialog(this);
1213
		}
1214
 
1215
 
1216
private: System::ComponentModel::IContainer^  components;
1217
 
1218
 
1219
		/// <summary>
1220
		/// Required designer variable.
1221
		/// </summary>
1222
 
1223
 
1224
#pragma region Windows Form Designer generated code
1225
		/// <summary>
1226
		/// Required method for Designer support - do not modify
1227
		/// the contents of this method with the code editor.
1228
		/// </summary>
1229
		void InitializeComponent(void)
1230
		{
1231
			this->components = (gcnew System::ComponentModel::Container());
1232
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
1233
			this->menuStrip1 = (gcnew System::Windows::Forms::MenuStrip());
1234
			this->fileToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1235
			this->newToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1236
			this->packageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1237
			this->shipToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1238
			this->toolStripSeparator5 = (gcnew System::Windows::Forms::ToolStripSeparator());
1239
			this->fromPackagerScriptToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1240
			this->importShipFromModToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1241
			this->toolStripSeparator6 = (gcnew System::Windows::Forms::ToolStripSeparator());
1242
			this->packageCreationWizardToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1243
			this->openToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1244
			this->saveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1245
			this->saveAsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1246
			this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
1247
			this->exitToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1248
			this->windowsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1249
			this->layoutToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1250
			this->cascadeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1251
			this->horizontalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1252
			this->verticalToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1253
			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
1254
			this->settingsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1255
			this->configToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1256
			this->toolsToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1257
			this->modMergeToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1258
			this->modDiffToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1259
			this->toolStripSeparator10 = (gcnew System::Windows::Forms::ToolStripSeparator());
1260
			this->generatePackageWebListToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1261
			this->PanelTab = (gcnew System::Windows::Forms::Panel());
1262
			this->tabControl1 = (gcnew System::Windows::Forms::TabControl());
1263
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
1264
			this->button1 = (gcnew System::Windows::Forms::Button());
1265
			this->toolStrip1 = (gcnew System::Windows::Forms::ToolStrip());
1266
			this->toolStripButton1 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
1267
			this->packageToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1268
			this->shipToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1269
			this->multiPackageToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1270
			this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
1271
			this->fromPackagerScriptToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1272
			this->fromArchiveToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1273
			this->importShipFromModToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1274
			this->toolStripSeparator7 = (gcnew System::Windows::Forms::ToolStripSeparator());
1275
			this->packageCreationWizardToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1276
			this->toolStripSplitButton1 = (gcnew System::Windows::Forms::ToolStripSplitButton());
1277
			this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
1278
			this->toolStripButton2 = (gcnew System::Windows::Forms::ToolStripButton());
1279
			this->toolStripSeparator8 = (gcnew System::Windows::Forms::ToolStripSeparator());
1280
			this->toolStripDropDownButton1 = (gcnew System::Windows::Forms::ToolStripDropDownButton());
1281
			this->modMergeToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
1282
			this->modDiffToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1283
			this->toolStripSeparator9 = (gcnew System::Windows::Forms::ToolStripSeparator());
1284
			this->generatePackageWebListToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1285
			this->generatePackageUpdatesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1286
			this->toolStripSeparator11 = (gcnew System::Windows::Forms::ToolStripSeparator());
1287
			this->fileExplorerToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1288
			this->timer1 = (gcnew System::Windows::Forms::Timer(this->components));
1289
			this->statusStrip1 = (gcnew System::Windows::Forms::StatusStrip());
1290
			this->StatusFiles = (gcnew System::Windows::Forms::ToolStripStatusLabel());
1291
			this->imageListGames = (gcnew System::Windows::Forms::ImageList(this->components));
1292
			this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
1293
			this->imageListSmall = (gcnew System::Windows::Forms::ImageList(this->components));
1294
			this->imageListLarge = (gcnew System::Windows::Forms::ImageList(this->components));
1295
			this->imageListFiles = (gcnew System::Windows::Forms::ImageList(this->components));
1296
			this->backgroundWorker1 = (gcnew System::ComponentModel::BackgroundWorker());
36 cycrow 1297
			this->importShipFromVFSToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
1 cycrow 1298
			this->menuStrip1->SuspendLayout();
1299
			this->PanelTab->SuspendLayout();
1300
			this->toolStrip1->SuspendLayout();
1301
			this->statusStrip1->SuspendLayout();
1302
			this->SuspendLayout();
1303
			// 
1304
			// menuStrip1
1305
			// 
1306
			this->menuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->fileToolStripMenuItem, 
1307
				this->windowsToolStripMenuItem, this->settingsToolStripMenuItem, this->toolsToolStripMenuItem});
1308
			this->menuStrip1->Location = System::Drawing::Point(0, 0);
1309
			this->menuStrip1->Name = L"menuStrip1";
1310
			this->menuStrip1->Size = System::Drawing::Size(747, 24);
1311
			this->menuStrip1->TabIndex = 2;
1312
			this->menuStrip1->Text = L"menuStrip1";
1313
			// 
1314
			// fileToolStripMenuItem
1315
			// 
1316
			this->fileToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->newToolStripMenuItem, 
1317
				this->openToolStripMenuItem, this->saveToolStripMenuItem, this->saveAsToolStripMenuItem, this->toolStripSeparator2, this->exitToolStripMenuItem});
1318
			this->fileToolStripMenuItem->Name = L"fileToolStripMenuItem";
1319
			this->fileToolStripMenuItem->Size = System::Drawing::Size(37, 20);
1320
			this->fileToolStripMenuItem->Text = L"&File";
1321
			// 
1322
			// newToolStripMenuItem
1323
			// 
1324
			this->newToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(7) {this->packageToolStripMenuItem, 
1325
				this->shipToolStripMenuItem, this->toolStripSeparator5, this->fromPackagerScriptToolStripMenuItem1, this->importShipFromModToolStripMenuItem1, 
1326
				this->toolStripSeparator6, this->packageCreationWizardToolStripMenuItem});
1327
			this->newToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"newToolStripMenuItem.Image")));
1328
			this->newToolStripMenuItem->Name = L"newToolStripMenuItem";
1329
			this->newToolStripMenuItem->Size = System::Drawing::Size(150, 22);
1330
			this->newToolStripMenuItem->Text = L"&New";
1331
			// 
1332
			// packageToolStripMenuItem
1333
			// 
1334
			this->packageToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"packageToolStripMenuItem.Image")));
1335
			this->packageToolStripMenuItem->Name = L"packageToolStripMenuItem";
1336
			this->packageToolStripMenuItem->Size = System::Drawing::Size(205, 22);
1337
			this->packageToolStripMenuItem->Text = L"Package";
1338
			this->packageToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packageToolStripMenuItem_Click);
1339
			// 
1340
			// shipToolStripMenuItem
1341
			// 
1342
			this->shipToolStripMenuItem->Name = L"shipToolStripMenuItem";
1343
			this->shipToolStripMenuItem->Size = System::Drawing::Size(205, 22);
1344
			this->shipToolStripMenuItem->Text = L"Ship";
1345
			this->shipToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::shipToolStripMenuItem_Click);
1346
			// 
1347
			// toolStripSeparator5
1348
			// 
1349
			this->toolStripSeparator5->Name = L"toolStripSeparator5";
1350
			this->toolStripSeparator5->Size = System::Drawing::Size(202, 6);
1351
			// 
1352
			// fromPackagerScriptToolStripMenuItem1
1353
			// 
1354
			this->fromPackagerScriptToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"fromPackagerScriptToolStripMenuItem1.Image")));
1355
			this->fromPackagerScriptToolStripMenuItem1->Name = L"fromPackagerScriptToolStripMenuItem1";
1356
			this->fromPackagerScriptToolStripMenuItem1->Size = System::Drawing::Size(205, 22);
1357
			this->fromPackagerScriptToolStripMenuItem1->Text = L"From Packager Script";
1358
			this->fromPackagerScriptToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::fromPackagerScriptToolStripMenuItem1_Click);
1359
			// 
1360
			// importShipFromModToolStripMenuItem1
1361
			// 
1362
			this->importShipFromModToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"importShipFromModToolStripMenuItem1.Image")));
1363
			this->importShipFromModToolStripMenuItem1->Name = L"importShipFromModToolStripMenuItem1";
1364
			this->importShipFromModToolStripMenuItem1->Size = System::Drawing::Size(205, 22);
1365
			this->importShipFromModToolStripMenuItem1->Text = L"Import Ship From Mod";
1366
			this->importShipFromModToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::importShipFromModToolStripMenuItem1_Click);
1367
			// 
1368
			// toolStripSeparator6
1369
			// 
1370
			this->toolStripSeparator6->Name = L"toolStripSeparator6";
1371
			this->toolStripSeparator6->Size = System::Drawing::Size(202, 6);
1372
			// 
1373
			// packageCreationWizardToolStripMenuItem
1374
			// 
1375
			this->packageCreationWizardToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"packageCreationWizardToolStripMenuItem.Image")));
1376
			this->packageCreationWizardToolStripMenuItem->Name = L"packageCreationWizardToolStripMenuItem";
1377
			this->packageCreationWizardToolStripMenuItem->Size = System::Drawing::Size(205, 22);
1378
			this->packageCreationWizardToolStripMenuItem->Text = L"Package Creation Wizard";
1379
			this->packageCreationWizardToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::packageCreationWizardToolStripMenuItem_Click);
1380
			// 
1381
			// openToolStripMenuItem
1382
			// 
1383
			this->openToolStripMenuItem->Name = L"openToolStripMenuItem";
1384
			this->openToolStripMenuItem->Size = System::Drawing::Size(150, 22);
1385
			this->openToolStripMenuItem->Text = L"&Open Package";
1386
			// 
1387
			// saveToolStripMenuItem
1388
			// 
1389
			this->saveToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"saveToolStripMenuItem.Image")));
1390
			this->saveToolStripMenuItem->Name = L"saveToolStripMenuItem";
1391
			this->saveToolStripMenuItem->Size = System::Drawing::Size(150, 22);
1392
			this->saveToolStripMenuItem->Text = L"&Save";
1393
			this->saveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveToolStripMenuItem_Click);
1394
			// 
1395
			// saveAsToolStripMenuItem
1396
			// 
1397
			this->saveAsToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"saveAsToolStripMenuItem.Image")));
1398
			this->saveAsToolStripMenuItem->Name = L"saveAsToolStripMenuItem";
1399
			this->saveAsToolStripMenuItem->Size = System::Drawing::Size(150, 22);
1400
			this->saveAsToolStripMenuItem->Text = L"Save &As";
1401
			this->saveAsToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::saveAsToolStripMenuItem_Click);
1402
			// 
1403
			// toolStripSeparator2
1404
			// 
1405
			this->toolStripSeparator2->Name = L"toolStripSeparator2";
1406
			this->toolStripSeparator2->Size = System::Drawing::Size(147, 6);
1407
			// 
1408
			// exitToolStripMenuItem
1409
			// 
1410
			this->exitToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"exitToolStripMenuItem.Image")));
1411
			this->exitToolStripMenuItem->Name = L"exitToolStripMenuItem";
1412
			this->exitToolStripMenuItem->Size = System::Drawing::Size(150, 22);
1413
			this->exitToolStripMenuItem->Text = L"E&xit";
1414
			this->exitToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::exitToolStripMenuItem_Click);
1415
			// 
1416
			// windowsToolStripMenuItem
1417
			// 
1418
			this->windowsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->layoutToolStripMenuItem, 
1419
				this->toolStripSeparator1});
1420
			this->windowsToolStripMenuItem->Name = L"windowsToolStripMenuItem";
1421
			this->windowsToolStripMenuItem->Size = System::Drawing::Size(68, 20);
1422
			this->windowsToolStripMenuItem->Text = L"&Windows";
1423
			// 
1424
			// layoutToolStripMenuItem
1425
			// 
1426
			this->layoutToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(3) {this->cascadeToolStripMenuItem, 
1427
				this->horizontalToolStripMenuItem, this->verticalToolStripMenuItem});
1428
			this->layoutToolStripMenuItem->Name = L"layoutToolStripMenuItem";
1429
			this->layoutToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1430
			this->layoutToolStripMenuItem->Text = L"Layout";
1431
			// 
1432
			// cascadeToolStripMenuItem
1433
			// 
1434
			this->cascadeToolStripMenuItem->Name = L"cascadeToolStripMenuItem";
1435
			this->cascadeToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1436
			this->cascadeToolStripMenuItem->Text = L"Cascade";
1437
			this->cascadeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::cascadeToolStripMenuItem_Click);
1438
			// 
1439
			// horizontalToolStripMenuItem
1440
			// 
1441
			this->horizontalToolStripMenuItem->Name = L"horizontalToolStripMenuItem";
1442
			this->horizontalToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1443
			this->horizontalToolStripMenuItem->Text = L"Tile Horizontal";
1444
			this->horizontalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::horizontalToolStripMenuItem_Click);
1445
			// 
1446
			// verticalToolStripMenuItem
1447
			// 
1448
			this->verticalToolStripMenuItem->Name = L"verticalToolStripMenuItem";
1449
			this->verticalToolStripMenuItem->Size = System::Drawing::Size(151, 22);
1450
			this->verticalToolStripMenuItem->Text = L"Tile Vertical";
1451
			this->verticalToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::verticalToolStripMenuItem_Click);
1452
			// 
1453
			// toolStripSeparator1
1454
			// 
1455
			this->toolStripSeparator1->Name = L"toolStripSeparator1";
1456
			this->toolStripSeparator1->Size = System::Drawing::Size(107, 6);
1457
			// 
1458
			// settingsToolStripMenuItem
1459
			// 
1460
			this->settingsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->configToolStripMenuItem});
1461
			this->settingsToolStripMenuItem->Name = L"settingsToolStripMenuItem";
1462
			this->settingsToolStripMenuItem->Size = System::Drawing::Size(61, 20);
1463
			this->settingsToolStripMenuItem->Text = L"Settings";
1464
			// 
1465
			// configToolStripMenuItem
1466
			// 
1467
			this->configToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"configToolStripMenuItem.Image")));
1468
			this->configToolStripMenuItem->Name = L"configToolStripMenuItem";
1469
			this->configToolStripMenuItem->Size = System::Drawing::Size(110, 22);
1470
			this->configToolStripMenuItem->Text = L"Config";
1471
			this->configToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::configToolStripMenuItem_Click);
1472
			// 
1473
			// toolsToolStripMenuItem
1474
			// 
1475
			this->toolsToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->modMergeToolStripMenuItem, 
1476
				this->modDiffToolStripMenuItem1, this->toolStripSeparator10, this->generatePackageWebListToolStripMenuItem1});
1477
			this->toolsToolStripMenuItem->Name = L"toolsToolStripMenuItem";
1478
			this->toolsToolStripMenuItem->Size = System::Drawing::Size(48, 20);
1479
			this->toolsToolStripMenuItem->Text = L"Tools";
1480
			// 
1481
			// modMergeToolStripMenuItem
1482
			// 
1483
			this->modMergeToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"modMergeToolStripMenuItem.Image")));
1484
			this->modMergeToolStripMenuItem->Name = L"modMergeToolStripMenuItem";
1485
			this->modMergeToolStripMenuItem->Size = System::Drawing::Size(216, 22);
1486
			this->modMergeToolStripMenuItem->Text = L"Mod Merge";
1487
			this->modMergeToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::modMergeToolStripMenuItem_Click);
1488
			// 
1489
			// modDiffToolStripMenuItem1
1490
			// 
1491
			this->modDiffToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"modDiffToolStripMenuItem1.Image")));
1492
			this->modDiffToolStripMenuItem1->Name = L"modDiffToolStripMenuItem1";
1493
			this->modDiffToolStripMenuItem1->Size = System::Drawing::Size(216, 22);
1494
			this->modDiffToolStripMenuItem1->Text = L"Mod Diff";
1495
			this->modDiffToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::modDiffToolStripMenuItem1_Click);
1496
			// 
1497
			// toolStripSeparator10
1498
			// 
1499
			this->toolStripSeparator10->Name = L"toolStripSeparator10";
1500
			this->toolStripSeparator10->Size = System::Drawing::Size(213, 6);
1501
			// 
1502
			// generatePackageWebListToolStripMenuItem1
1503
			// 
1504
			this->generatePackageWebListToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"generatePackageWebListToolStripMenuItem1.Image")));
1505
			this->generatePackageWebListToolStripMenuItem1->Name = L"generatePackageWebListToolStripMenuItem1";
1506
			this->generatePackageWebListToolStripMenuItem1->Size = System::Drawing::Size(216, 22);
1507
			this->generatePackageWebListToolStripMenuItem1->Text = L"Generate Package Web List";
1508
			this->generatePackageWebListToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::generatePackageWebListToolStripMenuItem1_Click);
1509
			// 
1510
			// PanelTab
1511
			// 
1512
			this->PanelTab->Controls->Add(this->tabControl1);
1513
			this->PanelTab->Controls->Add(this->button1);
1514
			this->PanelTab->Dock = System::Windows::Forms::DockStyle::Top;
1515
			this->PanelTab->Location = System::Drawing::Point(0, 63);
1516
			this->PanelTab->Name = L"PanelTab";
1517
			this->PanelTab->Size = System::Drawing::Size(747, 27);
1518
			this->PanelTab->TabIndex = 6;
1519
			// 
1520
			// tabControl1
1521
			// 
1522
			this->tabControl1->Dock = System::Windows::Forms::DockStyle::Fill;
1523
			this->tabControl1->ImageList = this->imageList1;
1524
			this->tabControl1->Location = System::Drawing::Point(0, 0);
1525
			this->tabControl1->Name = L"tabControl1";
1526
			this->tabControl1->SelectedIndex = 0;
1527
			this->tabControl1->Size = System::Drawing::Size(726, 27);
1528
			this->tabControl1->TabIndex = 3;
1529
			this->tabControl1->SelectedIndexChanged += gcnew System::EventHandler(this, &Form1::tabControl1_SelectedIndexChanged_1);
1530
			// 
1531
			// imageList1
1532
			// 
1533
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
1534
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
1535
			this->imageList1->Images->SetKeyName(0, L"standard");
1536
			this->imageList1->Images->SetKeyName(1, L"ship");
1537
			this->imageList1->Images->SetKeyName(2, L"fake");
1538
			this->imageList1->Images->SetKeyName(3, L"library");
1539
			this->imageList1->Images->SetKeyName(4, L"multi");
1540
			this->imageList1->Images->SetKeyName(5, L"normal");
1541
			this->imageList1->Images->SetKeyName(6, L"update");
1542
			this->imageList1->Images->SetKeyName(7, L"patch");
1543
			this->imageList1->Images->SetKeyName(8, L"start");
1544
			// 
1545
			// button1
1546
			// 
1547
			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
1548
			this->button1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 8.25F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
1549
				static_cast<System::Byte>(0)));
1550
			this->button1->ForeColor = System::Drawing::Color::Red;
1551
			this->button1->Location = System::Drawing::Point(726, 0);
1552
			this->button1->Name = L"button1";
1553
			this->button1->Size = System::Drawing::Size(21, 27);
1554
			this->button1->TabIndex = 4;
1555
			this->button1->Text = L"X";
1556
			this->button1->UseVisualStyleBackColor = true;
1557
			this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
1558
			// 
1559
			// toolStrip1
1560
			// 
1561
			this->toolStrip1->GripStyle = System::Windows::Forms::ToolStripGripStyle::Hidden;
1562
			this->toolStrip1->ImageScalingSize = System::Drawing::Size(32, 32);
1563
			this->toolStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->toolStripButton1, 
1564
				this->toolStripSplitButton1, this->toolStripSeparator3, this->toolStripButton2, this->toolStripSeparator8, this->toolStripDropDownButton1});
1565
			this->toolStrip1->LayoutStyle = System::Windows::Forms::ToolStripLayoutStyle::HorizontalStackWithOverflow;
1566
			this->toolStrip1->Location = System::Drawing::Point(0, 24);
1567
			this->toolStrip1->Name = L"toolStrip1";
1568
			this->toolStrip1->Size = System::Drawing::Size(747, 39);
1569
			this->toolStrip1->TabIndex = 7;
1570
			this->toolStrip1->Text = L"toolStrip1";
1571
			// 
1572
			// toolStripButton1
1573
			// 
36 cycrow 1574
			this->toolStripButton1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(10) {this->packageToolStripMenuItem1, 
1 cycrow 1575
				this->shipToolStripMenuItem1, this->multiPackageToolStripMenuItem, this->toolStripSeparator4, this->fromPackagerScriptToolStripMenuItem, 
36 cycrow 1576
				this->fromArchiveToolStripMenuItem, this->importShipFromModToolStripMenuItem, this->importShipFromVFSToolStripMenuItem, this->toolStripSeparator7, 
1577
				this->packageCreationWizardToolStripMenuItem1});
1 cycrow 1578
			this->toolStripButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton1.Image")));
1579
			this->toolStripButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1580
			this->toolStripButton1->Name = L"toolStripButton1";
1581
			this->toolStripButton1->Size = System::Drawing::Size(76, 36);
1582
			this->toolStripButton1->Text = L"New";
1583
			// 
1584
			// packageToolStripMenuItem1
1585
			// 
1586
			this->packageToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"packageToolStripMenuItem1.Image")));
1587
			this->packageToolStripMenuItem1->Name = L"packageToolStripMenuItem1";
1588
			this->packageToolStripMenuItem1->Size = System::Drawing::Size(221, 38);
1589
			this->packageToolStripMenuItem1->Text = L"Package";
1590
			this->packageToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::packageToolStripMenuItem1_Click);
1591
			// 
1592
			// shipToolStripMenuItem1
1593
			// 
1594
			this->shipToolStripMenuItem1->Name = L"shipToolStripMenuItem1";
1595
			this->shipToolStripMenuItem1->Size = System::Drawing::Size(221, 38);
1596
			this->shipToolStripMenuItem1->Text = L"Ship";
1597
			this->shipToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::shipToolStripMenuItem1_Click);
1598
			// 
1599
			// multiPackageToolStripMenuItem
1600
			// 
1601
			this->multiPackageToolStripMenuItem->Name = L"multiPackageToolStripMenuItem";
1602
			this->multiPackageToolStripMenuItem->Size = System::Drawing::Size(221, 38);
1603
			this->multiPackageToolStripMenuItem->Text = L"Multi Package";
1604
			this->multiPackageToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::multiPackageToolStripMenuItem_Click);
1605
			// 
1606
			// toolStripSeparator4
1607
			// 
1608
			this->toolStripSeparator4->Name = L"toolStripSeparator4";
1609
			this->toolStripSeparator4->Size = System::Drawing::Size(218, 6);
1610
			// 
1611
			// fromPackagerScriptToolStripMenuItem
1612
			// 
1613
			this->fromPackagerScriptToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"fromPackagerScriptToolStripMenuItem.Image")));
1614
			this->fromPackagerScriptToolStripMenuItem->Name = L"fromPackagerScriptToolStripMenuItem";
1615
			this->fromPackagerScriptToolStripMenuItem->Size = System::Drawing::Size(221, 38);
1616
			this->fromPackagerScriptToolStripMenuItem->Text = L"From Packager Script";
1617
			this->fromPackagerScriptToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fromPackagerScriptToolStripMenuItem_Click);
1618
			// 
1619
			// fromArchiveToolStripMenuItem
1620
			// 
1621
			this->fromArchiveToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"fromArchiveToolStripMenuItem.Image")));
1622
			this->fromArchiveToolStripMenuItem->Name = L"fromArchiveToolStripMenuItem";
1623
			this->fromArchiveToolStripMenuItem->Size = System::Drawing::Size(221, 38);
1624
			this->fromArchiveToolStripMenuItem->Text = L"From Archive";
1625
			this->fromArchiveToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fromArchiveToolStripMenuItem_Click);
1626
			// 
1627
			// importShipFromModToolStripMenuItem
1628
			// 
1629
			this->importShipFromModToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"importShipFromModToolStripMenuItem.Image")));
1630
			this->importShipFromModToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
1631
			this->importShipFromModToolStripMenuItem->Name = L"importShipFromModToolStripMenuItem";
1632
			this->importShipFromModToolStripMenuItem->Size = System::Drawing::Size(221, 38);
1633
			this->importShipFromModToolStripMenuItem->Text = L"Import Ship From Mod";
1634
			this->importShipFromModToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::importShipFromModToolStripMenuItem_Click);
1635
			// 
1636
			// toolStripSeparator7
1637
			// 
1638
			this->toolStripSeparator7->Name = L"toolStripSeparator7";
1639
			this->toolStripSeparator7->Size = System::Drawing::Size(218, 6);
1640
			// 
1641
			// packageCreationWizardToolStripMenuItem1
1642
			// 
1643
			this->packageCreationWizardToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"packageCreationWizardToolStripMenuItem1.Image")));
1644
			this->packageCreationWizardToolStripMenuItem1->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
1645
			this->packageCreationWizardToolStripMenuItem1->Name = L"packageCreationWizardToolStripMenuItem1";
1646
			this->packageCreationWizardToolStripMenuItem1->Size = System::Drawing::Size(221, 38);
1647
			this->packageCreationWizardToolStripMenuItem1->Text = L"Package Creation Wizard";
1648
			this->packageCreationWizardToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::packageCreationWizardToolStripMenuItem1_Click);
1649
			// 
1650
			// toolStripSplitButton1
1651
			// 
1652
			this->toolStripSplitButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
1653
			this->toolStripSplitButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1654
			this->toolStripSplitButton1->Name = L"toolStripSplitButton1";
1655
			this->toolStripSplitButton1->RightToLeft = System::Windows::Forms::RightToLeft::No;
1656
			this->toolStripSplitButton1->Size = System::Drawing::Size(84, 36);
1657
			this->toolStripSplitButton1->Text = L"Open";
1658
			this->toolStripSplitButton1->ToolTipText = L"Open an existing package/ship";
1659
			this->toolStripSplitButton1->ButtonClick += gcnew System::EventHandler(this, &Form1::toolStripSplitButton1_ButtonClick);
1660
			// 
1661
			// toolStripSeparator3
1662
			// 
1663
			this->toolStripSeparator3->Name = L"toolStripSeparator3";
1664
			this->toolStripSeparator3->Size = System::Drawing::Size(6, 39);
1665
			// 
1666
			// toolStripButton2
1667
			// 
1668
			this->toolStripButton2->DisplayStyle = System::Windows::Forms::ToolStripItemDisplayStyle::Image;
1669
			this->toolStripButton2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripButton2.Image")));
1670
			this->toolStripButton2->ImageTransparentColor = System::Drawing::Color::Magenta;
1671
			this->toolStripButton2->Name = L"toolStripButton2";
1672
			this->toolStripButton2->Size = System::Drawing::Size(36, 36);
1673
			this->toolStripButton2->Text = L"toolStripButton2";
1674
			this->toolStripButton2->ToolTipText = L"Open the options menu";
1675
			this->toolStripButton2->Click += gcnew System::EventHandler(this, &Form1::toolStripButton2_Click);
1676
			// 
1677
			// toolStripSeparator8
1678
			// 
1679
			this->toolStripSeparator8->Name = L"toolStripSeparator8";
1680
			this->toolStripSeparator8->Size = System::Drawing::Size(6, 39);
1681
			// 
1682
			// toolStripDropDownButton1
1683
			// 
1684
			this->toolStripDropDownButton1->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(7) {this->modMergeToolStripMenuItem1, 
1685
				this->modDiffToolStripMenuItem, this->toolStripSeparator9, this->generatePackageWebListToolStripMenuItem, this->generatePackageUpdatesToolStripMenuItem, 
1686
				this->toolStripSeparator11, this->fileExplorerToolStripMenuItem});
1687
			this->toolStripDropDownButton1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripDropDownButton1.Image")));
1688
			this->toolStripDropDownButton1->ImageTransparentColor = System::Drawing::Color::Magenta;
1689
			this->toolStripDropDownButton1->Name = L"toolStripDropDownButton1";
1690
			this->toolStripDropDownButton1->Size = System::Drawing::Size(81, 36);
1691
			this->toolStripDropDownButton1->Text = L"Tools";
1692
			// 
1693
			// modMergeToolStripMenuItem1
1694
			// 
1695
			this->modMergeToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"modMergeToolStripMenuItem1.Image")));
1696
			this->modMergeToolStripMenuItem1->Name = L"modMergeToolStripMenuItem1";
1697
			this->modMergeToolStripMenuItem1->Size = System::Drawing::Size(216, 22);
1698
			this->modMergeToolStripMenuItem1->Text = L"Mod Merge";
1699
			this->modMergeToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Form1::modMergeToolStripMenuItem1_Click);
1700
			// 
1701
			// modDiffToolStripMenuItem
1702
			// 
1703
			this->modDiffToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"modDiffToolStripMenuItem.Image")));
1704
			this->modDiffToolStripMenuItem->Name = L"modDiffToolStripMenuItem";
1705
			this->modDiffToolStripMenuItem->Size = System::Drawing::Size(216, 22);
1706
			this->modDiffToolStripMenuItem->Text = L"Mod Diff";
1707
			this->modDiffToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::modDiffToolStripMenuItem_Click);
1708
			// 
1709
			// toolStripSeparator9
1710
			// 
1711
			this->toolStripSeparator9->Name = L"toolStripSeparator9";
1712
			this->toolStripSeparator9->Size = System::Drawing::Size(213, 6);
1713
			// 
1714
			// generatePackageWebListToolStripMenuItem
1715
			// 
1716
			this->generatePackageWebListToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"generatePackageWebListToolStripMenuItem.Image")));
1717
			this->generatePackageWebListToolStripMenuItem->Name = L"generatePackageWebListToolStripMenuItem";
1718
			this->generatePackageWebListToolStripMenuItem->Size = System::Drawing::Size(216, 22);
1719
			this->generatePackageWebListToolStripMenuItem->Text = L"Generate Package Web List";
1720
			this->generatePackageWebListToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::generatePackageWebListToolStripMenuItem_Click);
1721
			// 
1722
			// generatePackageUpdatesToolStripMenuItem
1723
			// 
1724
			this->generatePackageUpdatesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"generatePackageUpdatesToolStripMenuItem.Image")));
1725
			this->generatePackageUpdatesToolStripMenuItem->Name = L"generatePackageUpdatesToolStripMenuItem";
1726
			this->generatePackageUpdatesToolStripMenuItem->Size = System::Drawing::Size(216, 22);
1727
			this->generatePackageUpdatesToolStripMenuItem->Text = L"Generate Package Updates";
1728
			this->generatePackageUpdatesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::generatePackageUpdatesToolStripMenuItem_Click);
1729
			// 
1730
			// toolStripSeparator11
1731
			// 
1732
			this->toolStripSeparator11->Name = L"toolStripSeparator11";
1733
			this->toolStripSeparator11->Size = System::Drawing::Size(213, 6);
1734
			// 
1735
			// fileExplorerToolStripMenuItem
1736
			// 
1737
			this->fileExplorerToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"fileExplorerToolStripMenuItem.Image")));
1738
			this->fileExplorerToolStripMenuItem->Name = L"fileExplorerToolStripMenuItem";
1739
			this->fileExplorerToolStripMenuItem->Size = System::Drawing::Size(216, 22);
1740
			this->fileExplorerToolStripMenuItem->Text = L"File Explorer";
1741
			this->fileExplorerToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::fileExplorerToolStripMenuItem_Click);
1742
			// 
1743
			// timer1
1744
			// 
1745
			this->timer1->Enabled = true;
1746
			this->timer1->Interval = 500;
1747
			this->timer1->Tick += gcnew System::EventHandler(this, &Form1::timer1_Tick);
1748
			// 
1749
			// statusStrip1
1750
			// 
1751
			this->statusStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(1) {this->StatusFiles});
1752
			this->statusStrip1->Location = System::Drawing::Point(0, 674);
1753
			this->statusStrip1->Name = L"statusStrip1";
1754
			this->statusStrip1->Size = System::Drawing::Size(747, 22);
1755
			this->statusStrip1->TabIndex = 9;
1756
			this->statusStrip1->Text = L"statusStrip1";
1757
			// 
1758
			// StatusFiles
1759
			// 
1760
			this->StatusFiles->Name = L"StatusFiles";
1761
			this->StatusFiles->Size = System::Drawing::Size(79, 17);
1762
			this->StatusFiles->Text = L"Files: 1 (10KB)";
1763
			// 
1764
			// imageListGames
1765
			// 
1766
			this->imageListGames->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageListGames.ImageStream")));
1767
			this->imageListGames->TransparentColor = System::Drawing::Color::Transparent;
1768
			this->imageListGames->Images->SetKeyName(0, L"X2");
1769
			this->imageListGames->Images->SetKeyName(1, L"X3");
1770
			this->imageListGames->Images->SetKeyName(2, L"X3TC");
1771
			this->imageListGames->Images->SetKeyName(3, L"X3AP");
1772
			// 
1773
			// toolTip1
1774
			// 
1775
			this->toolTip1->AutomaticDelay = 1000;
1776
			this->toolTip1->IsBalloon = true;
1777
			this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;
1778
			this->toolTip1->ToolTipTitle = L"Close All Windows";
1779
			// 
1780
			// imageListSmall
1781
			// 
1782
			this->imageListSmall->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageListSmall.ImageStream")));
1783
			this->imageListSmall->TransparentColor = System::Drawing::Color::Transparent;
1784
			this->imageListSmall->Images->SetKeyName(0, L"language");
1785
			this->imageListSmall->Images->SetKeyName(1, L"web");
1786
			this->imageListSmall->Images->SetKeyName(2, L"ware");
1787
			this->imageListSmall->Images->SetKeyName(3, L"components");
1788
			this->imageListSmall->Images->SetKeyName(4, L"dummies");
1789
			this->imageListSmall->Images->SetKeyName(5, L"cockpit");
1790
			this->imageListSmall->Images->SetKeyName(6, L"cutdata");
1791
			this->imageListSmall->Images->SetKeyName(7, L"bodies");
1792
			this->imageListSmall->Images->SetKeyName(8, L"animations");
1793
			this->imageListSmall->Images->SetKeyName(9, L"turret");
1794
			this->imageListSmall->Images->SetKeyName(10, L"gun");
1795
			// 
1796
			// imageListLarge
1797
			// 
1798
			this->imageListLarge->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageListLarge.ImageStream")));
1799
			this->imageListLarge->TransparentColor = System::Drawing::Color::Transparent;
1800
			this->imageListLarge->Images->SetKeyName(0, L"language");
1801
			this->imageListLarge->Images->SetKeyName(1, L"web");
1802
			this->imageListLarge->Images->SetKeyName(2, L"ware");
1803
			this->imageListLarge->Images->SetKeyName(3, L"turret");
1804
			this->imageListLarge->Images->SetKeyName(4, L"gun");
1805
			// 
1806
			// imageListFiles
1807
			// 
1808
			this->imageListFiles->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageListFiles.ImageStream")));
1809
			this->imageListFiles->TransparentColor = System::Drawing::Color::Transparent;
1810
			this->imageListFiles->Images->SetKeyName(0, L"script.png");
1811
			this->imageListFiles->Images->SetKeyName(1, L"textfile.png");
1812
			this->imageListFiles->Images->SetKeyName(2, L"readme.png");
1813
			this->imageListFiles->Images->SetKeyName(3, L"map.png");
1814
			this->imageListFiles->Images->SetKeyName(4, L"mods.png");
1815
			this->imageListFiles->Images->SetKeyName(5, L"uninstall.png");
1816
			this->imageListFiles->Images->SetKeyName(6, L"sound.png");
1817
			this->imageListFiles->Images->SetKeyName(7, L"extras.png");
1818
			this->imageListFiles->Images->SetKeyName(8, L"screenshot.png");
1819
			this->imageListFiles->Images->SetKeyName(9, L"mission.png");
1820
			this->imageListFiles->Images->SetKeyName(10, L"advert.png");
1821
			this->imageListFiles->Images->SetKeyName(11, L"shipother.png");
1822
			this->imageListFiles->Images->SetKeyName(12, L"shipmodel.png");
1823
			this->imageListFiles->Images->SetKeyName(13, L"shipscene.png");
1824
			this->imageListFiles->Images->SetKeyName(14, L"cockpitscene.png");
1825
			this->imageListFiles->Images->SetKeyName(15, L"package");
1826
			this->imageListFiles->Images->SetKeyName(16, L"backup.png");
1827
			this->imageListFiles->Images->SetKeyName(17, L"fakepatch");
1828
			// 
1829
			// backgroundWorker1
1830
			// 
1831
			this->backgroundWorker1->WorkerReportsProgress = true;
1832
			this->backgroundWorker1->WorkerSupportsCancellation = true;
1833
			this->backgroundWorker1->DoWork += gcnew System::ComponentModel::DoWorkEventHandler(this, &Form1::backgroundWorker1_DoWork);
1834
			this->backgroundWorker1->RunWorkerCompleted += gcnew System::ComponentModel::RunWorkerCompletedEventHandler(this, &Form1::backgroundWorker1_RunWorkerCompleted);
1835
			// 
36 cycrow 1836
			// importShipFromVFSToolStripMenuItem
1837
			// 
1838
			this->importShipFromVFSToolStripMenuItem->Name = L"importShipFromVFSToolStripMenuItem";
1839
			this->importShipFromVFSToolStripMenuItem->Size = System::Drawing::Size(221, 38);
1840
			this->importShipFromVFSToolStripMenuItem->Text = L"Import Ship from VFS";
1841
			this->importShipFromVFSToolStripMenuItem->Click += gcnew System::EventHandler(this, &Form1::importShipFromVFSToolStripMenuItem_Click);
1842
			// 
1 cycrow 1843
			// Form1
1844
			// 
1845
			this->AllowDrop = true;
1846
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
1847
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
1848
			this->ClientSize = System::Drawing::Size(747, 696);
1849
			this->Controls->Add(this->statusStrip1);
1850
			this->Controls->Add(this->PanelTab);
1851
			this->Controls->Add(this->toolStrip1);
1852
			this->Controls->Add(this->menuStrip1);
1853
			this->Icon = (cli::safe_cast<System::Drawing::Icon^  >(resources->GetObject(L"$this.Icon")));
1854
			this->IsMdiContainer = true;
1855
			this->MainMenuStrip = this->menuStrip1;
1856
			this->Name = L"Form1";
1857
			this->Text = L"Package Creator";
1858
			this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
1859
			this->DragDrop += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragDrop);
1860
			this->FormClosing += gcnew System::Windows::Forms::FormClosingEventHandler(this, &Form1::Form1_FormClosing);
1861
			this->DragOver += gcnew System::Windows::Forms::DragEventHandler(this, &Form1::Form1_DragOver);
1862
			this->menuStrip1->ResumeLayout(false);
1863
			this->menuStrip1->PerformLayout();
1864
			this->PanelTab->ResumeLayout(false);
1865
			this->toolStrip1->ResumeLayout(false);
1866
			this->toolStrip1->PerformLayout();
1867
			this->statusStrip1->ResumeLayout(false);
1868
			this->statusStrip1->PerformLayout();
1869
			this->ResumeLayout(false);
1870
			this->PerformLayout();
1871
 
1872
		}
1873
#pragma endregion
1874
	private: System::Void cascadeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1875
				 this->LayoutMdi(MdiLayout::Cascade);
1876
			 }
1877
private: System::Void horizontalToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1878
			 this->LayoutMdi(MdiLayout::TileHorizontal);
1879
		 }
1880
private: System::Void verticalToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1881
			 this->LayoutMdi(MdiLayout::TileVertical);
1882
		 }
1883
private: System::Void tabControl1_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
1884
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1885
			 for ( int i = 0; i < children->Length; i++ )
1886
			 {
1887
				 BaseForm ^childForm = (BaseForm ^)children[i];
1888
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1889
				 {
1890
					 childForm->Select();
1891
					 break;
1892
				 }
1893
			 }
1894
 
1895
		 }
1896
private: System::Void packageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1897
			 this->NewPackage(false);
1898
		 }
1899
private: System::Void shipToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1900
			 this->NewPackage(true);
1901
		 }
1902
private: System::Void exitToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1903
			 this->Close();
1904
		 }
1905
private: System::Void saveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1906
			 this->Save();
1907
		 }
1908
private: System::Void saveAsToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1909
			 this->SaveAs();
1910
		 }
1911
private: System::Void Event_Open(System::Object^  sender, System::EventArgs^  e) {
1912
			System::Windows::Forms::ToolStripMenuItem ^item = cli::safe_cast<System::Windows::Forms::ToolStripMenuItem ^>(sender);
1913
			if ( item->Tag == "$PACKAGE" )
1914
				this->Open();
1915
			else if ( item->Tag == "$DIR" )
1916
			{
1917
				FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
1918
				fbd->Description = "Select the path to load all valid files from";
1919
				if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
1920
					this->OpenDirectory(fbd->SelectedPath);
1921
			}
1922
			else
1923
			{
1924
				this->Open(cli::safe_cast<System::String ^>(item->Tag), true, false);
1925
			}
1926
		}
1927
 
1928
private: System::Void openPackageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1929
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
1930
			ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";
1931
			ofd->FilterIndex = 1;
1932
			ofd->RestoreDirectory = true;
1933
			ofd->Multiselect = true;
1934
 
1935
			if ( ofd->ShowDialog() == System::Windows::Forms::DialogResult::OK )
1936
				this->OpenFiles(ofd->FileNames, false, true);
1937
		 }
1938
	private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
1939
				 this->CloseAll();
1940
			 }
1941
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
1942
			 if ( m_bAutoClose )
1943
				 this->Close();
1944
			 if ( m_iLocX != -1 && m_iLocY != -1 )
1945
				this->Location = System::Drawing::Point(m_iLocX, m_iLocY);
1946
			this->UpdateDropDownOpen();
1947
		 }
1948
private: System::Void toolStripSplitButton1_ButtonClick(System::Object^  sender, System::EventArgs^  e) {
1949
			 this->Open();
1950
		 }
1951
private: System::Void packageToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
1952
			 this->NewPackage(false);
1953
		 }
1954
private: System::Void shipToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
1955
			 this->NewPackage(true);
1956
		 }
1957
private: System::Void timer1_Tick(System::Object^  sender, System::EventArgs^  e) {
1958
			 if ( IO::File::Exists(IO::Path::GetTempPath() + "\\creator_load.dat") )
1959
				 this->LoadFiles(IO::Path::GetTempPath() + "\\creator_load.dat");
1960
		 }
1961
private: System::Void tabControl1_SelectedIndexChanged_1(System::Object^  sender, System::EventArgs^  e) {
1962
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1963
			 for ( int i = 0; i < children->Length; i++ )
1964
			 {
1965
				 BaseForm ^childForm = (BaseForm ^)children[i];
1966
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1967
				 {
1968
					 childForm->Select();
1969
					 break;
1970
				 }
1971
			 }
1972
		 }
1973
private: System::Void configToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1974
			 this->OpenOptionsMenu();
1975
		 }
1976
private: System::Void toolStripButton2_Click(System::Object^  sender, System::EventArgs^  e) {
1977
			 this->OpenOptionsMenu();
1978
		 }
1979
private: System::Void fromPackagerScriptToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
1980
			 this->OpenPackagerScript();
1981
		 }
1982
private: System::Void fromPackagerScriptToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
1983
			 this->OpenPackagerScript();
1984
		 }
1985
private: System::Void Form1_DragOver(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
1986
			e->Effect = DragDropEffects::None;
1987
 
1988
			if (e->Data->GetDataPresent(DataFormats::FileDrop)) 
1989
			{
1990
				cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
1991
				int i;
1992
				for(i = 0; i < a->Length; i++)
1993
				{
1994
					if ( String::Compare(IO::FileInfo(a[i]).Extension, ".xsp", true) == 0 || String::Compare(IO::FileInfo(a[i]).Extension, ".spk", true) == 0 )
1995
					{
1996
						e->Effect = DragDropEffects::Copy;
1997
						break;
1998
					}
1999
				}
2000
			}
2001
		 }
2002
private: System::Void Form1_DragDrop(System::Object^  sender, System::Windows::Forms::DragEventArgs^  e) {
2003
			if (e->Data->GetDataPresent(DataFormats::FileDrop)) 
2004
			{
2005
				cli::array<String ^> ^a = (cli::array<String ^> ^)e->Data->GetData(DataFormats::FileDrop, false);
2006
				this->OpenFiles(a, true, true);
2007
			}
2008
		 }
2009
private: System::Void importShipFromModToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
2010
			 this->ImportShip();
2011
		 }
2012
private: System::Void importShipFromModToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2013
			 this->ImportShip();
2014
		 }
2015
private: System::Void Form1_FormClosing(System::Object^  sender, System::Windows::Forms::FormClosingEventArgs^  e) {
2016
			 this->CloseAll();
2017
			 e->Cancel = false;
2018
		 }
2019
private: System::Void packageCreationWizardToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2020
			 this->PackageCreationWizard();
2021
		 }
2022
private: System::Void packageCreationWizardToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
2023
			 this->PackageCreationWizard();
2024
		 }
2025
private: System::Void multiPackageToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2026
			 this->NewMultiPackage();
2027
		 }
2028
private: System::Void modMergeToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
2029
			 ModMerge();
2030
		 }
2031
private: System::Void modMergeToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2032
			 ModMerge();
2033
		 }
2034
private: System::Void modDiffToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
2035
			 ModDiffDialog();
2036
		 }
2037
private: System::Void modDiffToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2038
			 ModDiffDialog();
2039
		 }
2040
private: System::Void generatePackageWebListToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
2041
			 GeneratePackageWebList();
2042
		 }
2043
private: System::Void generatePackageWebListToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2044
			 GeneratePackageWebList();
2045
		 }
2046
private: System::Void fromArchiveToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2047
			 OpenArchive();
2048
		 }
2049
private: System::Void backgroundWorker1_DoWork(System::Object^  sender, System::ComponentModel::DoWorkEventArgs^  e) {
2050
			 Threading::Thread::Sleep(500);
2051
			 m_pConverted = m_pPackages->CreateFromArchive(CyStringFromSystemString(m_sConvertFile));
2052
		 }
2053
private: System::Void backgroundWorker1_RunWorkerCompleted(System::Object^  sender, System::ComponentModel::RunWorkerCompletedEventArgs^  e) {
2054
			 if ( m_pWait ) 
2055
			 {
2056
				 m_pWait->Close();
2057
				 delete m_pWait;
2058
				 m_pWait = nullptr;
2059
			}
2060
 
2061
			 if ( !m_pConverted )
2062
				MessageBox::Show(this, "Unable to open archive file, " + m_sConvertFile, "Unable to open", MessageBoxButtons::OK, MessageBoxIcon::Error);
2063
			 else
2064
			 {
2065
				PackageForm ^childForm = this->OpenPackage(true, m_pConverted, m_sConvertFile, "");
50 cycrow 2066
				childForm->Text = _US(m_pConverted->filename());
1 cycrow 2067
			 }
2068
		 }
2069
private: System::Void generatePackageUpdatesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2070
			 GeneratePackageUpdates();
2071
		 }
2072
private: System::Void fileExplorerToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2073
			 OpenFileExplorer();
2074
		 }
36 cycrow 2075
private: System::Void importShipFromVFSToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
2076
			 ImportShipFromVFS();
2077
		 }
1 cycrow 2078
};
2079
}
2080