Subversion Repositories spk

Rev

Rev 68 | Rev 95 | 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
		int GetHighestGame()
51
		{
94 cycrow 52
			return _pGameDir->highestGame();
1 cycrow 53
		}
54
 
55
		void ModMerge()
56
		{
57
			ModMerge::Form1 ^merge = gcnew ModMerge::Form1();
58
			merge->StartPosition = Windows::Forms::FormStartPosition::CenterParent;
59
			merge->TopMost = true;
94 cycrow 60
			if ( !_pGameDir->isEmpty() ) 
61
				merge->SetGameDir(-1, _US(_pGameDir->first()));
1 cycrow 62
			merge->ShowDialog(this);
63
		}
64
 
65
		void ModDiffDialog()
66
		{
94 cycrow 67
			ModDiff ^diff = gcnew ModDiff(_pGameDir, m_pPackages);
1 cycrow 68
			diff->ShowDialog(this);
69
		}
70
 
71
		void OpenArchive()
72
		{
73
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
74
			ofd->Filter = "All Supported Archives|*.zip; *.rar|Zip Archive (*.zip)|*.zip|Rar Archive (*.rar)|*.rar";
75
			ofd->Title = "Select archive file you wish to import from";
76
			ofd->FilterIndex = 1;
77
			ofd->RestoreDirectory = true;
78
			ofd->Multiselect = false;
79
 
80
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
81
			{
82
				m_sConvertFile = ofd->FileName;
83
				m_pWait = gcnew Waiting("Converting Archive");
84
				this->backgroundWorker1->RunWorkerAsync();
85
				m_pWait->ShowDialog(this);
86
			}
87
		}
88
 
89
		String ^ParseText(int game, String ^text)
90
		{
91
			String ^t = text;
92
 
93
			bool found = true;
94
			int pos = 0;
95
			while (found)
96
			{
97
				pos = t->IndexOf('{', pos);
98
				found = false;
99
				if ( pos > -1 )
100
				{
101
					int page = -1;
102
					int id = -1;
103
 
104
					int commaPos = t->IndexOf(',', pos);
105
					if ( commaPos > -1 )
106
					{
107
						page = Convert::ToInt32(t->Substring(pos + 1, commaPos - (pos + 1)));
108
						int endPos = t->IndexOf('}', commaPos);
109
						if ( endPos > -1 )
110
						{
111
							id = Convert::ToInt32(t->Substring(commaPos + 1, endPos - (commaPos + 1)));
112
							found = true;
113
							t = t->Replace(t->Substring(pos, endPos - pos + 1 ), this->FindText(game, page, id));
114
						}
115
					}
116
				}
117
			}
118
			return t;
119
		}
120
 
94 cycrow 121
		CGameDirectories *gameDirectories()
36 cycrow 122
		{
94 cycrow 123
			return _pGameDir;
124
		}
36 cycrow 125
 
94 cycrow 126
		void LoadText()
127
		{
128
			this->LoadText(false, false);
36 cycrow 129
		}
130
 
1 cycrow 131
		String ^FindText(int game, int page, int id)
132
		{
133
			this->LoadText(false, false);
36 cycrow 134
 
94 cycrow 135
			Utils::String text = _pGameDir->findText(game, 44, page, id);
136
			if ( !text.empty() ) {
137
				return ParseText(game, _US(text));
1 cycrow 138
			}
139
 
94 cycrow 140
			return nullptr;
1 cycrow 141
		}
142
 
143
		void UpdateStatus()
144
		{
145
			bool e = (this->tabControl1->HasChildren) ? true : false;
146
 
147
			BaseForm ^active = this->GetActiveChild();
148
			if ( active && active->GetFormType() == FORMTYPE_SINGLE )
149
			{
150
				CBaseFile *activePackage = ((PackageForm ^)active)->GetPackage();
151
				if ( !activePackage )
152
					e = false;
153
				else
154
					this->StatusFiles->Text = "Files: " + activePackage->GetFileList()->size() + " (" + SystemStringFromCyString(activePackage->GetFullFileSizeString()) + ")";
155
			}
156
			else if ( active && active->GetFormType() == FORMTYPE_MULTI )
157
			{
158
				CMultiSpkFile *activePackage = ((MultiForm ^)active)->GetPackage();
159
				if ( !activePackage )
160
					e = false;
161
				else
162
					this->StatusFiles->Text = "Files: " + activePackage->GetAvailableFiles() + " (" + SystemStringFromCyString(SPK::GetSizeString(activePackage->GetFileSize())) + ")";
163
			}
164
			else
165
				e = false;
166
 
167
			if ( !e  )
168
				this->StatusFiles->Text = "";
169
		}
170
 
171
		void UpdateDisplay()
172
		{
173
			bool e = (this->tabControl1->HasChildren) ? true : false;
174
 
175
			BaseForm ^active = this->GetActiveChild();
176
			if ( !active )
177
				e = false;
178
			else if ( active->GetFormType() != FORMTYPE_SINGLE && active->GetFormType() != FORMTYPE_MULTI)
179
				e = false;
180
 
181
			this->saveAsToolStripMenuItem->Enabled = e;
182
			this->saveToolStripMenuItem->Enabled = e;
183
			this->tabControl1->Visible = e;
184
 
185
			if ( !this->PanelTab->Visible && e )
186
			{
187
				this->PanelTab->Visible = e;
188
				this->toolStrip1->SendToBack();
189
				this->menuStrip1->SendToBack();
190
			}
191
			else if ( !e )
192
				this->PanelTab->Visible = e;
193
 
194
			this->UpdateStatus();
195
			this->UpdateDropDownOpen();
196
		}
197
 
198
		void OpenFileExplorer()
199
		{
200
			FileExplorer ^file = gcnew FileExplorer(this, m_pPackages);
201
			file->Show(this);
202
		}
203
 
204
		void OpenFile(String ^filename)
205
		{
206
			ArrayList ^a = gcnew ArrayList();
207
			a->Add(filename);
208
 
209
			this->OpenFiles(a, false, true);
210
		}
211
 
212
	protected:
213
		/// <summary>
214
		/// Clean up any resources being used.
215
		/// </summary>
216
		~Form1()
217
		{
218
			if (components)
219
			{
220
				delete components;
221
			}
222
			delete m_pLoadedList;
223
			delete m_pPackages;
224
			delete m_settings;
225
		}
226
 
227
	protected: 
228
		bool			 m_bAutoClose;
229
		int				 m_iLocX;
230
		int				 m_iLocY;
231
		CyStringList	*m_pLoadedList;
232
		CPackages *m_pPackages;
94 cycrow 233
		SPK::CGameDirectories	*_pGameDir;
234
 
1 cycrow 235
		SSettings		*m_settings;
236
		bool			 m_bTextLoaded;
237
		String			^m_sConvertFile;
238
		Waiting			^m_pWait;
239
		CBaseFile		*m_pConverted;
240
 
36 cycrow 241
		//System::Collections::Hashtable ^textList;
1 cycrow 242
 
243
	private: System::Windows::Forms::MenuStrip^  menuStrip1;
244
	private: System::Windows::Forms::ToolStripMenuItem^  fileToolStripMenuItem;
245
	private: System::Windows::Forms::ToolStripMenuItem^  newToolStripMenuItem;
246
	private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem;
247
	private: System::Windows::Forms::ToolStripMenuItem^  shipToolStripMenuItem;
248
	private: System::Windows::Forms::ToolStripMenuItem^  windowsToolStripMenuItem;
249
	private: System::Windows::Forms::ToolStripMenuItem^  layoutToolStripMenuItem;
250
	private: System::Windows::Forms::ToolStripMenuItem^  cascadeToolStripMenuItem;
251
	private: System::Windows::Forms::ToolStripMenuItem^  horizontalToolStripMenuItem;
252
	private: System::Windows::Forms::ToolStripMenuItem^  verticalToolStripMenuItem;
253
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
254
	private: System::Windows::Forms::ToolStripMenuItem^  openToolStripMenuItem;
255
	private: System::Windows::Forms::ToolStripMenuItem^  saveToolStripMenuItem;
256
	private: System::Windows::Forms::ToolStripMenuItem^  saveAsToolStripMenuItem;
257
	private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
258
	private: System::Windows::Forms::Panel^  PanelTab;
259
	private: System::Windows::Forms::TabControl^  tabControl1;
260
	private: System::Windows::Forms::Button^  button1;
261
	private: System::Windows::Forms::ToolStrip^  toolStrip1;
262
	private: System::Windows::Forms::ToolStripSplitButton^  toolStripSplitButton1;
263
 
264
	private: System::Windows::Forms::ImageList^  imageList1;
265
	private: System::Windows::Forms::ToolStripDropDownButton^  toolStripButton1;
266
	private: System::Windows::Forms::ToolStripMenuItem^  packageToolStripMenuItem1;
267
	private: System::Windows::Forms::ToolStripMenuItem^  shipToolStripMenuItem1;
268
 
269
 
270
	private: System::Windows::Forms::Timer^  timer1;
271
	private: System::Windows::Forms::StatusStrip^  statusStrip1;
272
	private: System::Windows::Forms::ToolStripStatusLabel^  StatusFiles;
273
private: System::Windows::Forms::ToolStripMenuItem^  settingsToolStripMenuItem;
274
private: System::Windows::Forms::ToolStripMenuItem^  configToolStripMenuItem;
275
private: System::Windows::Forms::ImageList^  imageListGames;
276
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
277
private: System::Windows::Forms::ToolStripButton^  toolStripButton2;
278
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator5;
279
private: System::Windows::Forms::ToolStripMenuItem^  fromPackagerScriptToolStripMenuItem1;
280
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator4;
281
private: System::Windows::Forms::ToolStripMenuItem^  fromPackagerScriptToolStripMenuItem;
282
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromModToolStripMenuItem1;
283
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromModToolStripMenuItem;
284
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator6;
285
private: System::Windows::Forms::ToolStripMenuItem^  packageCreationWizardToolStripMenuItem;
286
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator7;
287
private: System::Windows::Forms::ToolStripMenuItem^  packageCreationWizardToolStripMenuItem1;
288
private: System::Windows::Forms::ToolTip^  toolTip1;
289
private: System::Windows::Forms::ImageList^  imageListSmall;
290
private: System::Windows::Forms::ImageList^  imageListLarge;
291
private: System::Windows::Forms::ImageList^  imageListFiles;
292
private: System::Windows::Forms::ToolStripMenuItem^  multiPackageToolStripMenuItem;
293
private: System::Windows::Forms::ToolStripMenuItem^  toolsToolStripMenuItem;
294
private: System::Windows::Forms::ToolStripMenuItem^  modMergeToolStripMenuItem;
295
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator8;
296
private: System::Windows::Forms::ToolStripDropDownButton^  toolStripDropDownButton1;
297
private: System::Windows::Forms::ToolStripMenuItem^  modMergeToolStripMenuItem1;
298
private: System::Windows::Forms::ToolStripMenuItem^  modDiffToolStripMenuItem;
299
private: System::Windows::Forms::ToolStripMenuItem^  modDiffToolStripMenuItem1;
300
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator10;
301
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageWebListToolStripMenuItem1;
302
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator9;
303
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageWebListToolStripMenuItem;
304
private: System::Windows::Forms::ToolStripMenuItem^  fromArchiveToolStripMenuItem;
305
private: System::ComponentModel::BackgroundWorker^  backgroundWorker1;
306
private: System::Windows::Forms::ToolStripMenuItem^  generatePackageUpdatesToolStripMenuItem;
307
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator11;
308
private: System::Windows::Forms::ToolStripMenuItem^  fileExplorerToolStripMenuItem;
36 cycrow 309
private: System::Windows::Forms::ToolStripMenuItem^  importShipFromVFSToolStripMenuItem;
1 cycrow 310
 
311
	private: System::Windows::Forms::ToolStripMenuItem^  exitToolStripMenuItem;
312
 
313
 
314
	private:
315
		BaseForm ^GetActiveChild()
316
		{
317
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
318
			 for ( int i = 0; i < children->Length; i++ )
319
			 {
320
				 BaseForm ^childForm = (BaseForm ^)children[i];
321
				 if ( !childForm->TabPage() )
322
					 continue;
323
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
324
					 return childForm;
325
			 }
326
 
327
			 return nullptr;
328
		}
329
 
36 cycrow 330
		void ImportShip();
331
		void ImportShipFromVFS();
1 cycrow 332
 
36 cycrow 333
		String ^getShipSelection(CVirtualFileSystem *pVfs);
1 cycrow 334
 
335
 
336
		void OpenDirectory(System::String ^dir)
337
		{
338
			if ( !System::IO::Directory::Exists(dir) )
339
			{
340
				MessageBox::Show(this, "Unable to open packages from directory\nDirectory not found\n\n" + dir, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
341
				return;
342
			}
343
 
344
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.spk"), false, false);
345
			this->OpenFiles(System::IO::Directory::GetFiles(dir, "*.xsp"), false, false);
346
		}
347
 
348
		void OpenFiles(cli::array<System::String ^> ^list, bool checkExtension, bool display)
349
		{
350
			if ( !list )
351
				return;
352
 
353
			for ( int i = 0; i < list->Length; i++ )
354
				this->Open(list[i], display, checkExtension);
355
 
356
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
357
			for ( int i = 0; i < children->Length; i++ )
358
			{
359
				BaseForm ^childForm = (BaseForm ^)children[i];
360
				if ( !childForm->TabPage()->Visible )
361
				{
362
					childForm->Show();
363
					childForm->TabPage()->Show();
364
				}
365
			}
366
		}
367
 
368
		void OpenOptionsMenu()
369
		{
94 cycrow 370
			 Options ^opt = gcnew Options(this->imageListGames, _pGameDir, m_pPackages, m_settings);
1 cycrow 371
			 if ( opt->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
372
			 {
373
				 m_settings->bGenerateUpdate = opt->GetGenerateUpdate();
374
			 }
375
 
376
			 if ( opt->LoadText() )
377
				 this->LoadText(false, true);
378
		}
379
 
380
		void OpenFiles(ArrayList ^list, bool checkExtension, bool display)
381
		{
382
			if ( !list )
383
				return;
384
 
385
			for ( int i = 0; i < list->Count; i++ )
386
				this->Open(cli::safe_cast<String ^>(list[i]), display, checkExtension);
387
 
388
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
389
			for ( int i = 0; i < children->Length; i++ )
390
			{
391
				BaseForm ^childForm = (BaseForm ^)children[i];
392
				if ( !childForm->TabPage()->Visible )
393
				{
394
					childForm->Show();
395
					childForm->TabPage()->Show();
396
				}
397
			}
398
		}
399
 
400
		void Open()
401
		{
402
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
403
			ofd->Filter = "All (*.spk *.xsp)|*.spk;*.xsp|Package Files (*.spk)|*.spk|Ship Files (*.xsp)|*.xsp";
404
			ofd->Title = "Select the package/ship file to open";
405
			ofd->FilterIndex = 1;
406
			ofd->RestoreDirectory = true;
407
			ofd->Multiselect = true;
408
 
409
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
410
				this->OpenFiles(ofd->FileNames, false, true);
411
		}
412
 
413
		void LoadFiles(String ^loadFrom)
414
		{
415
			if ( System::IO::File::Exists(loadFrom) )
416
			{
417
				System::String ^lines = System::IO::File::ReadAllText(loadFrom);
418
				try { System::IO::File::Delete(loadFrom); }
419
				catch (System::IO::IOException ^) {}
420
				catch (System::Exception ^) {}
421
 
422
				if ( lines )
423
				{
424
					CyString strLines = CyStringFromSystemString(lines);
425
					int num;
426
					CyString *aLines = strLines.SplitToken("\n", &num);
427
					if ( num && aLines )
428
					{
429
						ArrayList ^list = gcnew ArrayList();
430
						for ( int i = 0; i < num; i++ )
431
						{
432
							CyString l = aLines[i];
433
							l = l.Remove("\r");
434
							CyString first = l.GetToken(":", 1, 1);
435
							CyString rest = l.GetToken(":", 2);
436
							rest.RemoveFirstSpace();
437
 
438
							if ( first.Compare("File") )
439
								list->Add(SystemStringFromCyString(rest));
440
						}
441
 
442
						CLEANSPLIT(aLines, num)
443
 
444
						this->OpenFiles(list, true, true);
445
					}
446
 
447
				}
448
			}			
449
		}
450
 
451
		void ExportPackage(String ^file)
452
		{
453
			CyString sFile = CyStringFromSystemString(file);
454
			int error = 0;
455
 
456
			CBaseFile *p = m_pPackages->OpenPackage(sFile, &error, 0, SPKREAD_NODATA);
457
			if ( !p ) {
458
				MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
459
			}
460
			else {
461
				String ^to = IO::FileInfo(file).DirectoryName;
462
				int game = 0;
463
				if ( p->IsMultipleGamesInPackage() ) {
464
					SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + file, m_pPackages);
465
					if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
466
						game = selGame->GetGame() + 1;
467
					}
468
					else
469
						to = nullptr;
470
				}
471
				else if ( p->IsAnyGameInPackage() ) {
472
					game = p->FindFirstGameInPackage();
473
				}
474
 
475
				if ( to && to->Length ) {
476
					CyString exportFilename = CFileIO(sFile).ChangeFileExtension("zip");
477
					if ( game ) {
58 cycrow 478
						exportFilename = CFileIO(exportFilename).GetDir() + "/" + CFileIO(exportFilename).baseName() + "_" + CBaseFile::ConvertGameToString(game) + ".zip";
1 cycrow 479
					}
480
					if ( p->SaveToArchive(exportFilename, game) ) {
481
						String ^message = "Export: " + file + "\nTo: " + SystemStringFromCyString(CFileIO(exportFilename).GetFilename());
482
						if ( game ) {
483
							message += "\nGame: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(game - 1)->sName);
484
						}
485
						MessageBox::Show(this, message, "Exported Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
486
					}
487
					else {
488
						MessageBox::Show(this, "Error: Unable to export to:\n" + SystemStringFromCyString(exportFilename), "Error Export", MessageBoxButtons::OK, MessageBoxIcon::Error);
489
					}
490
				}
491
			}
492
		}
493
 
494
		void ExtractPackage(String ^file, bool here)
495
		{
496
			CyString sFile = CyStringFromSystemString(file);
497
			int error = 0;
498
 
499
			CBaseFile *p = m_pPackages->OpenPackage(sFile, &error, 0, SPKREAD_NODATA);
500
			if ( !p ) {
501
				MessageBox::Show(this, "Error: Unable to open package file\n" + file, "Error Opening", MessageBoxButtons::OK, MessageBoxIcon::Error);
502
			}
503
			else {
504
				String ^to = nullptr;
505
				if ( here ) {
506
					to = IO::FileInfo(file).DirectoryName;
507
				}
508
				else {
509
					FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
510
					fbd->Description = "Select the path to extract package to";
511
					if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
512
						to = fbd->SelectedPath;
513
				}
514
 
515
				if ( to && to->Length ) {
516
					// check if theres multiple games in package
517
					int game = 0;
518
					if ( p->IsMultipleGamesInPackage() ) {
519
						SelectGame ^selGame = gcnew SelectGame("Select game to extract package:\n" + file, m_pPackages);
520
						if ( selGame->ShowDialog(this) == Windows::Forms::DialogResult::OK ) {
521
							game = selGame->GetGame() + 1;
522
						}
523
						else
524
							to = nullptr;
525
					}
526
					else if ( p->IsAnyGameInPackage() ) {
527
						game = p->FindFirstGameInPackage();
528
					}
529
 
530
					if ( to && to->Length ) {
531
						if ( p->ExtractAll(CyStringFromSystemString(to), game, true) ) {
532
							String ^message = "Extracted: " + file + "\nTo: " + to;
533
							if ( game ) {
534
								message += "\nGame: " + SystemStringFromCyString(m_pPackages->GetGameExe()->GetGame(game - 1)->sName);
535
							}
536
							MessageBox::Show(this, message, "Extracted Package", MessageBoxButtons::OK, MessageBoxIcon::Information);
537
						}
538
						else {
539
							MessageBox::Show(this, "Error: Unable to extract to:\n" + to, "Error Extracting", MessageBoxButtons::OK, MessageBoxIcon::Error);
540
						}
541
					}
542
				}
543
			}
544
		}
545
 
546
		void SavePackagerScript(String ^file)
547
		{
548
			CyString sFile = CyStringFromSystemString(file);
549
			CyStringList malformed, unknown;
550
			CBaseFile *package = m_pPackages->LoadPackagerScript(sFile, -1, NULL, &malformed, &unknown);
551
			if ( package )
552
			{
50 cycrow 553
				CyString saveto = package->filename();
1 cycrow 554
				saveto = saveto.FindReplace("$DEFAULTDIR", CFileIO(sFile).GetDir() + "/");
555
				saveto = saveto.FindReplace("$PATH", CFileIO(sFile).GetDir());
556
				saveto = saveto.FindReplace("\\", "/");
557
				saveto = saveto.FindReplace("//", "/");
558
				if ( !saveto.Right(4).Compare(".spk") && package->GetType() != TYPE_XSP )
559
					saveto += ".spk";
560
				else if ( !saveto.Right(4).Compare(".xsp") && package->GetType() == TYPE_XSP )
561
					saveto += ".xsp";
562
				// write script
563
				if ( package->WriteFile(saveto) ) {
564
					String ^message = "Package: " + SystemStringFromCyString(saveto) + " has been created\n";
565
					if ( package->AutoGenerateUpdateFile() )
566
						package->CreateUpdateFile(CFileIO(saveto).GetDir());
50 cycrow 567
					CyString exportto = package->exportFilename();
1 cycrow 568
					if ( !exportto.Empty() ) {
569
						exportto = exportto.FindReplace("$DEFAULTDIR", CFileIO(sFile).GetDir() + "/");
570
						exportto = exportto.FindReplace("$PATH", CFileIO(sFile).GetDir());
571
						exportto = exportto.FindReplace("\\", "/");
572
						exportto = exportto.FindReplace("//", "/");
573
						if ( package->SaveToArchive(exportto, 0) ) {
574
							message += "\nExported to:\n" + SystemStringFromCyString(exportto) + "\n";
575
							if ( package->IsAnyGameInPackage() ) {
576
								for ( int i = 0; i < m_pPackages->GetGameExe()->GetNumGames(); i++ ) {
577
									if ( package->IsGameInPackage(i + 1) ) {
58 cycrow 578
										CyString exportFile = CFileIO(saveto).GetDir() + "/" + CFileIO(saveto).baseName() + "_" + CBaseFile::ConvertGameToString(i + 1) + "." + CFileIO(exportto).GetFileExtension();
1 cycrow 579
										if ( package->SaveToArchive(exportFile, i + 1) ) {
580
											message += SystemStringFromCyString(CFileIO(exportFile).GetFilename()) + "\n";
581
										}
582
									}
583
								}
584
							}
585
						}
586
					}
587
					MessageBox::Show(this, message, "Package Created", MessageBoxButtons::OK, MessageBoxIcon::Information);
588
				}
589
				else
590
					MessageBox::Show(this, "Error: Unable to create package from script\n" + file, "Error Creating Package", MessageBoxButtons::OK, MessageBoxIcon::Error);
591
			}
592
		}
593
 
594
		void OpenPackagerScript(String ^file)
595
		{
596
			CyStringList malformed, unknown;
597
			CBaseFile *package = m_pPackages->LoadPackagerScript(CyStringFromSystemString(file), SPKCOMPRESS_NONE, NULL, &malformed, &unknown);
598
			if ( package )
599
			{
600
				package->SetDataCompression(SPKCOMPRESS_7ZIP);
601
				PackageForm ^childForm = this->OpenPackage(true, package, file, "");
50 cycrow 602
				childForm->Text = _US(package->filename());
1 cycrow 603
			}
604
		}
605
		void OpenPackagerScript()
606
		{
607
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
608
			ofd->Filter = "Packager Script (*.sps)|*.sps";
609
			ofd->FilterIndex = 1;
610
			ofd->Title = "Select the packager script to create a package from";
611
			ofd->RestoreDirectory = true;
612
			ofd->Multiselect = false;
613
 
614
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
615
				OpenPackagerScript(ofd->FileName);
616
		}
617
 
618
		MultiForm ^OpenPackage(bool display, CMultiSpkFile *package, String ^file, String ^title)
619
		{
620
			CyString sFile = CyStringFromSystemString(file);
621
			TabPage ^tp = gcnew TabPage();
622
			tp->Text = title;
623
			tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
624
			if ( tp->ImageIndex == -1 )
625
				tp->ImageIndex = 0;
626
 
627
			ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
36 cycrow 628
			MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 629
 
630
			childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
631
			this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
632
			childForm->WindowState = FormWindowState::Minimized;
633
 
634
			this->ProcessOpen(false, tp, childForm);
635
			childForm->LoadPackage(package, file);
636
			this->ProcessOpen(display, tp, childForm);
637
 
638
			return childForm;
639
		}
640
		PackageForm ^OpenPackage(bool display, CBaseFile *package, String ^file, String ^title)
641
		{
642
			CyString sFile = CyStringFromSystemString(file);
643
 
644
			if ( this->imageList1->Images->IndexOfKey(file) == -1 )
645
			{
646
				if ( package->GetIcon() )
647
				{
648
					package->ReadIconFileToMemory();
58 cycrow 649
					CyString sIconFile = CyStringFromSystemString(IO::Path::GetTempPath()) + "\\" + CFileIO(sFile).baseName() + "." + package->GetIconExt();
1 cycrow 650
					if ( package->ExtractFile(package->GetIcon(), CFileIO(sIconFile).GetFullFilename(), false) )
651
					{
652
						String ^iconFile = SystemStringFromCyString(sIconFile);
653
						if ( IO::File::Exists(iconFile) )
654
						{
655
							String ^ext = System::IO::FileInfo(iconFile).Extension;
656
							if ( !String::Compare(ext, "bmp", false) || !String::Compare(ext, "ico", false) )
657
								this->imageList1->Images->Add(file, Bitmap::FromFile(iconFile));
658
							else
659
							{
660
								Bitmap ^myBitmap = gcnew Bitmap(iconFile);
661
								if ( myBitmap )
662
									this->imageList1->Images->Add(file, myBitmap);
663
							}
664
						}
665
					}
666
				}
667
			}
668
 
669
			TabPage ^tp = gcnew TabPage();
670
			tp->Text = title;
671
			tp->ImageIndex = this->imageList1->Images->IndexOfKey(file);
672
			if ( tp->ImageIndex == -1 )
673
				tp->ImageIndex = 0;
674
 
675
			ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem((file->Empty) ? title : file, this->imageList1->Images[tp->ImageIndex]);
36 cycrow 676
			PackageForm ^childForm = gcnew PackageForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 677
			childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames, this->imageListFiles);
678
			this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
679
			childForm->WindowState = FormWindowState::Minimized;
680
 
681
			this->ProcessOpen(false, tp, childForm);
682
			childForm->LoadPackage(package, file);
683
			this->ProcessOpen(display, tp, childForm);
684
 
685
			return childForm;
686
		}
687
 
688
		void ProcessOpen(bool display, TabPage ^tp, BaseForm ^childForm)
689
		{
690
			tp->Parent = tabControl1;
691
			if ( display || !this->HasChildren )
692
			{
693
				tabControl1->SelectedTab = tp;
694
				tp->Show();
695
				childForm->Show();
696
				childForm->WindowState = FormWindowState::Maximized;
697
				this->UpdateStatus();
698
			}
699
		}
700
 
701
		void GeneratePackageUpdates()
702
		{
703
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
704
			fbd->Description = "Select the path to generate the updates from";
705
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
706
			{
707
				int count = 0;
708
				for ( int type = 0; type < 2; type++ )
709
				{
710
					array <System::String ^> ^Files = nullptr;
711
					if ( type == 0 )
712
						Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
713
					else if ( type == 1 )
714
						Files = Directory::GetFiles(fbd->SelectedPath, "*.xsp");
715
					else
716
						break;
717
 
718
					for ( int i = 0; i < Files->Length; i++ )
719
					{
720
						CyString file = CyStringFromSystemString(Files[i]);
721
						int error = 0;
722
						CBaseFile *p = m_pPackages->OpenPackage(file, &error, 0, SPKREAD_NODATA);
723
						if ( !p )
724
							continue;
725
 
726
						CyString ufile = p->CreateUpdateFile(CyStringFromSystemString(fbd->SelectedPath));
727
						if ( !ufile.Empty() )
728
							++count;
729
						delete p;
730
					}
731
				}
732
 
733
				if ( !count )
734
					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);
735
				else
736
					MessageBox::Show(this, "Update files generated for " + count + " packages\nDirectory: " + fbd->SelectedPath, "Update File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
737
			}
738
		}
739
 
740
		void GeneratePackageWebList()
741
		{
742
			FolderBrowserDialog ^fbd = gcnew FolderBrowserDialog;
743
			fbd->Description = "Select the path to generate the list from";
744
			if ( fbd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
745
			{
746
				CyStringList filedata;
747
				for ( int type = 0; type < 2; type++ )
748
				{
749
					array <System::String ^> ^Files = nullptr;
750
					if ( type == 0 )
751
						Files = Directory::GetFiles(fbd->SelectedPath, "*.spk");
752
					else if ( type == 1 )
753
						Files = Directory::GetFiles(fbd->SelectedPath, "*.xsp");
754
					else
755
						break;
756
 
757
					for ( int i = 0; i < Files->Length; i++ )
758
					{
759
						CyString file = CyStringFromSystemString(Files[i]);
760
						int error = 0;
761
						CBaseFile *p = m_pPackages->OpenPackage(file, &error, 0, SPKREAD_NODATA);
762
						if ( !p )
763
							continue;
764
 
765
						filedata.PushBack(CPackages::FormatAvailablePackageData(p));
766
						delete p;
767
					}
768
				}
769
 
770
				if ( filedata.Empty() )
771
					MessageBox::Show(this, "No package files found in " + fbd->SelectedPath + "\nSelect a directory that contains spk/xsp files", "No Packages", MessageBoxButtons::OK, MessageBoxIcon::Error);
772
				else
773
				{
774
					CFileIO File(CyStringFromSystemString(fbd->SelectedPath) + "/xpackagedata.dat");
775
					if ( File.WriteFile(&filedata) )
776
						MessageBox::Show(this, "Data file generated for " + filedata.Count() + " packages\nDirectory: " + fbd->SelectedPath, "Web File Generated", MessageBoxButtons::OK, MessageBoxIcon::Information);
777
					else
778
						MessageBox::Show(this, "Unable to write web data file in " + fbd->SelectedPath, "File Write Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
779
				}
780
			}
781
		}
782
 
783
		void Open(System::String ^file, bool display, bool checkExtension)
784
		{
785
			CBaseFile *convertFile = NULL;
786
			if ( checkExtension )
787
			{
788
				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 )
789
					return;
790
			}
791
 
792
			if ( !System::IO::File::Exists(file) )
793
			{
794
				if ( display )
795
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nFile doesn't exist", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
796
				return;
797
			}
798
 
799
			// check if its already open
800
			if ( this->IsOpen(file) )
801
			{
802
				if ( display )
803
					MessageBox::Show(this, "The package is currently open\n" + file, "Already Open", MessageBoxButtons::OK, MessageBoxIcon::Information);
804
				return;
805
			}
806
 
807
			// sps
808
			if ( String::Compare(IO::FileInfo(file).Extension, ".sps") == 0 )
809
			{
810
				OpenPackagerScript(file);
811
				return;
812
			}
813
 
814
			float fVersion;
815
			CyString sFile = CyStringFromSystemString(file);
816
			int fileType = CSpkFile::CheckFile(sFile, &fVersion);
817
 
818
			if ( fVersion > (float)FILEVERSION )
819
			{
820
				if ( display )
821
					MessageBox::Show(this, "Package file is created with a newer version, unable to open", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
822
				return;
823
			}
824
 
9 cycrow 825
			if ( fileType == SPKFILE_INVALID || fileType == SPKFILE_OLD )
1 cycrow 826
			{
827
				bool loaded = false;
828
				if ( String::Compare(IO::FileInfo(file).Extension, ".xsp") == 0 )
829
				{
830
					CXspFile *shipFile = new CXspFile;
39 cycrow 831
					loaded = shipFile->ConvertOld(_S(file));
1 cycrow 832
					if ( loaded )
833
					{
50 cycrow 834
						shipFile->adjustChanged(true);
835
						shipFile->setFilename(_S(file));
1 cycrow 836
						convertFile = shipFile;
837
					}
838
					else 
839
						delete shipFile;
840
				}
9 cycrow 841
				else if ( String::Compare(IO::FileInfo(file).Extension, ".spk") == 0 )
842
				{
843
					CSpkFile *spkFile = CSpkFile::convertFromOld(CyStringFromSystemString(file).ToString());
844
					if ( spkFile ) {
845
						loaded = true;
50 cycrow 846
						spkFile->adjustChanged(true);
847
						spkFile->setFilename(_S(file));
9 cycrow 848
						convertFile = spkFile;
849
					}
850
				}
1 cycrow 851
 
852
				if ( !loaded )
853
				{
854
					if ( display )
855
						MessageBox::Show(this, "Invalid package file:\n" + file + "\n\nDoesn't appear to be a valid package", "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
856
					return;				
857
				}
858
			}
859
 
860
			// open multi package
861
			bool loaded = false;
862
 
863
			int error;
864
			if ( fileType == SPKFILE_MULTI )
865
			{
866
				CMultiSpkFile *mspk = m_pPackages->OpenMultiPackage(sFile, &error);
867
				if ( mspk )
868
				{
869
					loaded = true;
870
					BaseForm ^childForm = this->OpenPackage(display, mspk, file, "");
871
					childForm->Text = file;
872
				}
873
			}
874
			else
875
			{
876
				CBaseFile *package = (convertFile) ? convertFile : m_pPackages->OpenPackage(sFile, &error);
877
				if ( package )
878
				{
879
					loaded = true;
880
					PackageForm ^childForm = this->OpenPackage(display, package, file, "");
881
					if ( convertFile )
882
					{
50 cycrow 883
						convertFile->adjustChanged(true);
1 cycrow 884
						childForm->UpdateChanged();
885
					}
886
				}
887
			}
888
 
889
			if ( loaded )
890
			{
891
				// adjust the loaded list
892
				sFile.FindReplace("/", "\\");
893
				sFile.RemoveChar(9);
894
				sFile.RemoveChar('\r');
895
				sFile.RemoveChar('\n');
896
				m_pLoadedList->Remove(sFile, true);
897
				m_pLoadedList->PushFront(sFile);
898
 
899
				while ( m_pLoadedList->Count() > 15 )
900
					m_pLoadedList->PopBack();
901
 
902
				this->SaveData();
903
 
904
				this->UpdateDropDownOpen();
905
			}	
906
			else
907
			{
908
				if ( display )
909
				{
910
					System::String ^sError = "Unknown Error (" + SystemStringFromCyString(CyString::Number(error)) + ")";
911
					switch ( error )
912
					{
913
						case INSTALLERR_OLD:
914
							sError = "Old unsupported package file";
915
							break;
916
						case INSTALLERR_INVALID:
917
							sError = "Invalid Package File";
918
							break;
919
						case INSTALLERR_NOMULTI:
920
							sError = "Multi-Packages not currently supported";
921
							break;
922
					}
923
					MessageBox::Show(this, "Unable to open package file:\n" + file + "\n\nError: " + sError, "Load Error", MessageBoxButtons::OK, MessageBoxIcon::Error);
924
				}
925
			}
926
		}
927
 
928
		void NewPackage(bool ship)
929
		{
930
			 TabPage ^tp = gcnew TabPage();
931
  			 tp->ImageIndex = 0;
932
			 if ( ship )
933
				tp->Text = "New Ship";
934
			 else
935
				tp->Text = "New Package";
936
			 ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(tp->Text, this->imageList1->Images[tp->ImageIndex]);
937
 			 this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
36 cycrow 938
			 PackageForm ^childForm = gcnew PackageForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 939
			 childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames, this->imageListFiles);
940
			 tp->Parent = tabControl1;
941
			 tabControl1->SelectedTab = tp;
942
 
943
			 if ( ship )
944
				childForm->CreateShip();
945
			 else
946
				childForm->CreatePackage();
947
 
948
			 childForm->WindowState = FormWindowState::Maximized;
949
			 tp->Show();
950
			 childForm->Show();
951
		}
952
 
953
		void NewMultiPackage()
954
		{
955
			 TabPage ^tp = gcnew TabPage();
956
  			 tp->ImageIndex = 0;
957
			 tp->Text = "New Mutli Package";
958
			 ToolStripMenuItem ^toolBut = gcnew ToolStripMenuItem(tp->Text, this->imageList1->Images[tp->ImageIndex]);
959
 			 this->windowsToolStripMenuItem->DropDownItems->Add(toolBut);
36 cycrow 960
			 MultiForm ^childForm = gcnew MultiForm(this, tabControl1, tp, toolBut, m_pPackages, this->imageList1, this->m_settings);
1 cycrow 961
			 childForm->SetImageLists(this->imageListSmall, this->imageListLarge, this->imageListGames);
962
			 tp->Parent = tabControl1;
963
			 tabControl1->SelectedTab = tp;
964
 
965
			 childForm->CreatePackage();
966
 
967
			 childForm->WindowState = FormWindowState::Maximized;
968
			 tp->Show();
969
			 childForm->Show();
970
 
971
		}
972
 
973
		void CloseAll()
974
		{
975
			cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
976
			for ( int i = 0; i < children->Length; i++ )
977
			{
978
				delete ((BaseForm ^)children[i])->TabPage();
979
				//((BaseForm ^)children[i])->
980
				delete children[i];
981
			}
982
			this->UpdateDisplay();
983
		}
984
 
985
		void CloseEvent(System::Object ^Sender, System::EventArgs ^E) 
986
		{
987
			this->CloseAll();
988
			this->SaveData();
989
		}
990
 
991
		void UpdateDropDownOpen()
992
		{
993
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Form1::typeid));
994
 
995
			// clear them all
996
			this->toolStripSplitButton1->DropDownItems->Clear();
997
			this->openToolStripMenuItem->DropDownItems->Clear();
998
 
999
			System::Windows::Forms::ToolStripMenuItem ^openPackage = gcnew System::Windows::Forms::ToolStripMenuItem;
1000
			openPackage->Text = "Open Package";
1001
			openPackage->Tag = "$PACKAGE";
1002
			openPackage->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1003
			openPackage->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
1004
			this->openToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"toolStripSplitButton1.Image")));
1005
			this->openToolStripMenuItem->DropDownItems->Add(openPackage);
1006
 
1007
			System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;
1008
			newItem->Text = "Open Directory";
1009
			newItem->Tag = "$DIR";
1010
			newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1011
			this->toolStripSplitButton1->DropDownItems->Add(newItem);
1012
 
1013
			// add all none open items
1014
			bool sep = false;
1015
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1016
			{
1017
				// check if we have it open
1018
				System::String ^sFile = SystemStringFromCyString(str->str.findreplace("/", "\\"));
1019
				if ( this->IsOpen(sFile) )
1020
					continue;
1021
				if ( this->IsOpen(SystemStringFromCyString(str->str.findreplace("\\", "/"))) )
1022
					continue;
1023
 
1024
				if ( !IO::File::Exists(sFile) )
1025
					continue;
1026
 
1027
				if ( !sep )
1028
				{
1029
					sep = true;
1030
					this->toolStripSplitButton1->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
1031
					this->openToolStripMenuItem->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
1032
				}
1033
 
1034
				// work out the type
1035
				float fVersion;
1036
				int iconType = -1;
1037
				int check = CBaseFile::CheckFile(str->str, &fVersion);
1038
				switch ( check )
1039
				{
1040
					case SPKFILE_BASE:
1041
						iconType = 5;
1042
						break;
1043
					case SPKFILE_SINGLE:
1044
						iconType = 0;
1045
						break;
1046
					case SPKFILE_SINGLESHIP:
1047
						iconType = 1;
1048
						break;
1049
					case SPKFILE_MULTI:
1050
						iconType = 4;
1051
						break;
1052
				}
1053
 
1054
				// otherwise add it to the list
1055
				System::Windows::Forms::ToolStripMenuItem ^newItem = gcnew System::Windows::Forms::ToolStripMenuItem;
1056
				newItem->Text = sFile;
1057
				newItem->Tag = newItem->Text;
1058
				newItem->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1059
				if ( iconType > -1 )
1060
					newItem->Image = this->imageList1->Images[iconType];
1061
				this->toolStripSplitButton1->DropDownItems->Add(newItem);
1062
 
1063
				System::Windows::Forms::ToolStripMenuItem ^newItem2 = gcnew System::Windows::Forms::ToolStripMenuItem;
1064
				newItem2->Text = sFile;
1065
				newItem2->Tag = newItem->Text;
1066
				newItem2->Click += gcnew System::EventHandler(this, &Form1::Event_Open);
1067
				if ( iconType > -1 )
1068
					newItem2->Image = this->imageList1->Images[iconType];
1069
				this->openToolStripMenuItem->DropDownItems->Add(newItem2);
1070
			}
1071
		}
1072
 
1073
		bool IsOpen(System::String ^file)
1074
		{
1075
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1076
			 for ( int i = 0; i < children->Length; i++ )
1077
			 {
1078
				 BaseForm ^childForm = (BaseForm ^)children[i];
1079
				 if ( childForm->IsClosing() )
1080
					 continue;
1081
				 if ( childForm->CheckFilename(file) )
1082
					 return true;
1083
			 }
1084
 
1085
			 return false;
1086
		}
1087
 
1088
		void Save()
1089
		{
1090
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1091
			 for ( int i = 0; i < children->Length; i++ )
1092
			 {
1093
				 BaseForm ^childForm = (BaseForm ^)children[i];
1094
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1095
				 {
1096
					 if ( childForm->GetFormType() == FORMTYPE_SINGLE )
1097
						((PackageForm ^)childForm)->Save();
1098
					 else if ( childForm->GetFormType() == FORMTYPE_MULTI )
1099
						((MultiForm ^)childForm)->Save();
1100
					 else
1101
						childForm->Save();
1102
					 this->UpdateDropDownOpen();
1103
					 break;
1104
				 }
1105
			 }
1106
		}
1107
 
1108
		void SaveAs()
1109
		{
1110
			 cli::array<System::Windows::Forms::Form ^> ^children = this->MdiChildren;
1111
			 for ( int i = 0; i < children->Length; i++ )
1112
			 {
1113
				 BaseForm ^childForm = (BaseForm ^)children[i];
1114
				 if ( childForm->TabPage()->Equals(tabControl1->SelectedTab) )
1115
				 {
1116
					 if ( childForm->GetFormType() == FORMTYPE_SINGLE )
1117
						((PackageForm ^)childForm)->SaveAs();
1118
					 else if ( childForm->GetFormType() == FORMTYPE_MULTI )
1119
						((MultiForm ^)childForm)->SaveAs();
1120
					 else
1121
						childForm->SaveAs();
1122
					 this->UpdateDropDownOpen();
1123
					 break;
1124
				 }
1125
			 }
1126
		}
1127
 
1128
		void PackageCreationWizard()
1129
		{
1130
			MessageBox::Show(this, "The creation wizard is currently not available", "Feature Missing", MessageBoxButtons::OK, MessageBoxIcon::Error);
1131
			return;
1132
 
1133
			CreationWizard ^wizard = gcnew CreationWizard();
1134
			if ( wizard->ShowDialog(this) == Windows::Forms::DialogResult::OK )
1135
			{
1136
			}
1137
		}
1138
 
1139
		void SaveData()
1140
		{
1141
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
1142
			CFileIO Config(CyStringFromSystemString(mydoc) + "/Egosoft/creator.dat");
1143
			CyStringList lines;
1144
 
1145
			if ( this->WindowState == FormWindowState::Normal )
1146
			{
1147
				lines.PushBack(CyString("CreatorSize:") + (long)this->Size.Width + " " + (long)this->Size.Height);
1148
				lines.PushBack(CyString("CreatorPos:") + (long)this->Location.X + " " + (long)this->Location.Y);
1149
			}
1150
			else
1151
			{
1152
				lines.PushBack(CyString("CreatorPos:") + (long)this->RestoreBounds.Location.X + " " + (long)this->RestoreBounds.Location.Y);
1153
				lines.PushBack(CyString("CreatorSize:") + (long)this->RestoreBounds.Size.Width + " " + (long)this->RestoreBounds.Size.Height);
1154
			}
1155
 
1156
			if ( this->WindowState == FormWindowState::Maximized )
1157
				lines.PushBack("CreatorMax:");
1158
 
1159
			for ( SStringList *str = m_pLoadedList->Head(); str; str = str->next )
1160
				lines.PushBack(CyString("Loaded:") + str->data + " " + str->str);
94 cycrow 1161
			_pGameDir->writeData(&lines);
1 cycrow 1162
			if ( m_settings->bGenerateUpdate )
1163
				lines.PushBack("GenerateUpdate:");
1164
 
1165
			Config.WriteFile(&lines);
1166
		}
1167
 
1168
		void LoadData()
1169
		{
1170
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
1171
			CFileIO Config;
1172
			if ( Config.Open(CyStringFromSystemString(mydoc) + "/Egosoft/creator.dat") )
1173
			{
1174
				std::vector<CyString> *lines = Config.ReadLines();
1175
				if ( lines )
1176
				{
1177
					for ( int i = 0; i < (int)lines->size(); i++ )
1178
					{
1179
						CyString line(lines->at(i));
1180
						CyString start = line.GetToken(":", 1, 1).ToLower();
1181
						CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
1182
						if ( start.Compare("CreatorSize") )
1183
							this->Size = System::Drawing::Size(rest.GetToken(" ", 1, 1).ToInt(), rest.GetToken(" ", 2, 2).ToInt());
1184
						else if ( start.Compare("CreatorPos") )
1185
						{
1186
							m_iLocX = rest.GetToken(" ", 1, 1).ToInt();
1187
							m_iLocY = rest.GetToken(" ", 2, 2).ToInt();
1188
						}
1189
						else if ( start.Compare("Loaded") )
1190
							m_pLoadedList->PushBack(rest);
1191
						else if ( start.Compare("CreatorMax") )
1192
							this->WindowState = FormWindowState::Maximized;
1193
						else if ( start.Compare("GenerateUpdate") )
1194
							m_settings->bGenerateUpdate = true;
1195
						else if ( start.Compare("GameDir") )
94 cycrow 1196
							_pGameDir->parse(rest.ToString(), m_pPackages);
1 cycrow 1197
					}
1198
 
1199
					delete lines;
1200
				}
1201
			}
1202
		}
1203
 
1204
 
1205
		void LoadText(bool center, bool reload)
1206
		{
1207
			if ( m_bTextLoaded && !reload )
1208
				return;
1209
			m_bTextLoaded = true;
1210
 
94 cycrow 1211
			if ( _pGameDir->isEmpty() ) return;
1 cycrow 1212
 
94 cycrow 1213
			Creator::LoadText ^load = gcnew Creator::LoadText(_pGameDir, m_pPackages);
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