Subversion Repositories spk

Rev

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