Subversion Repositories spk

Rev

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