Subversion Repositories spk

Rev

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

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