Subversion Repositories spk

Rev

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