Subversion Repositories spk

Rev

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