Subversion Repositories spk

Rev

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