Subversion Repositories spk

Rev

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

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