Subversion Repositories spk

Rev

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