Subversion Repositories spk

Rev

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

Rev Author Line No. Line
1 cycrow 1
#pragma once
2
 
3
using namespace System;
4
using namespace System::ComponentModel;
5
using namespace System::Collections;
6
using namespace System::Windows::Forms;
7
using namespace System::Data;
8
using namespace System::Drawing;
9
 
10
typedef struct SGameDir {
68 cycrow 11
	bool			bLoad;
12
	Utils::String	dir;
13
	Utils::String	name;
14
	int				iGame;
36 cycrow 15
	CVirtualFileSystem *pVfs;
1 cycrow 16
} SGameDir;
17
 
18
namespace Creator {
19
	typedef struct SSettings {
20
		bool	bGenerateUpdate;
21
	} SSettings;
22
 
23
	/// <summary>
24
	/// Summary for Options
25
	///
26
	/// WARNING: If you change the name of this class, you will need to change the
27
	///          'Resource File Name' property for the managed resource compiler tool
28
	///          associated with all .resx files this class depends on.  Otherwise,
29
	///          the designers will not be able to interact properly with localized
30
	///          resources associated with this form.
31
	/// </summary>
32
	public ref class Options : public System::Windows::Forms::Form
33
	{
34
	public:
35
		Options(ImageList ^gameImages, CLinkList<SGameDir> *gameDir, CPackages *p, SSettings *set)
36
		{
37
			InitializeComponent();
38
 
39
			m_bLoadText = false;
40
			m_pGameImages = gameImages;
41
			m_pGameDir = gameDir;
42
			m_pP = p;
43
 
44
 
45
			this->Init();
46
 
47
			this->ListGameDir->LargeImageList = this->m_pGameImages;
48
			this->ListGameDir->SmallImageList = this->m_pGameImages;
49
 
50
			this->toolTip1->SetToolTip(this->button1, "Add new game directory");
51
			this->toolTip1->SetToolTip(this->ButDel, "Remove selected game directory");
52
			this->toolTip1->SetToolTip(this->ButClear, "Clear all game directories");
53
 
54
			m_sDirs = new CyStringList;
55
			this->GetAllDirs();
56
 
57
			this->checkBox1->Checked = set->bGenerateUpdate;
58
		}
59
 
60
		bool LoadText() { return m_bLoadText; }
61
		bool GetGenerateUpdate() { return this->checkBox1->Checked; }
62
 
63
		void GetAllDirs()
64
		{
65
			System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );
66
			CFileIO Config;
67
			if ( Config.Open(CyStringFromSystemString(mydoc) + "/Egosoft/pluginmanager.dat") )
68
			{
69
				std::vector<CyString> *lines = Config.ReadLines();
70
				if ( lines )
71
				{
72
					for ( int i = 0; i < (int)lines->size(); i++ )
73
					{
74
						CyString line(lines->at(i));
75
						CyString start = line.GetToken(":", 1, 1).ToLower();
76
						CyString rest = line.GetToken(":", 2).RemoveFirstSpace();
77
						if ( start.Compare("DirExe") )
78
						{
79
							if ( rest.NumToken("|" ) > 2 )
80
								m_sDirs->PushBack(rest.GetToken("|", 3, 3), rest.GetToken("|", 2, 2));
81
							else
82
								m_sDirs->PushBack(rest.GetToken("|", 2, 2), rest.GetToken("|", 1, 1));
83
						}
84
					}
85
 
86
					delete lines;
87
				}
88
			}
89
		}
90
 
91
		void UpdateGameDirs()
92
		{
93
			this->ListGameDir->Items->Clear();
94
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
95
			{
68 cycrow 96
				ListViewItem ^item = gcnew ListViewItem(_US(gd->dir));
97
				item->ImageIndex = gd->iGame;
98
				item->SubItems->Add(_US(gd->name));
1 cycrow 99
				if ( gd->bLoad )
100
					item->SubItems->Add("Yes");
101
				else
102
					item->SubItems->Add("No");
103
				this->ListGameDir->Items->Add(item);
104
			}
105
 
106
			this->ListGameDir->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);
107
			this->columnHeader3->Width = 100;
108
			this->columnHeader1->Width += 50;
109
 
110
			this->ButClear->Enabled = (this->ListGameDir->Items->Count) ? true : false;
111
			this->ButDel->Enabled = (this->ListGameDir->SelectedItems->Count) ? true : false;
112
		}
113
 
114
		void AddDir(String ^sDir, bool ask, bool load)
115
		{
57 cycrow 116
			Utils::String dir = _S(sDir);
1 cycrow 117
			CyString exe;
118
 
119
			CyString game = m_pP->GetGameName(dir);
120
			int iGame = m_pP->GetGameExe()->GetGameType(dir);
121
 
122
			dir = m_pP->GetGameExe()->GetProperDir(dir);
123
 
57 cycrow 124
			dir = dir.findReplace("\\", "/");
125
			dir = dir.findReplace("//", "/");
1 cycrow 126
			bool found = false;
127
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
128
			{
68 cycrow 129
				if ( gd->dir == dir )
1 cycrow 130
				{
131
					found = true;
132
					break;
133
				}
134
			}
135
 
136
			if ( !found )
137
			{
138
				SGameDir *gd = new SGameDir;
68 cycrow 139
				gd->dir = dir;
140
				gd->name = game.ToString();
141
				gd->iGame = iGame;
142
				gd->pVfs = new CVirtualFileSystem();
143
				gd->pVfs->setLanguage(44);
144
				gd->pVfs->LoadFilesystem(gd->dir);
145
 
146
				SGameExe *exe = m_pP->GetGameExe()->GetGame(gd->iGame);
147
				if ( exe ) gd->pVfs->SetAddon(exe->sAddon);
148
 
1 cycrow 149
				gd->bLoad = (ask) ? false : load;
150
				m_pGameDir->push_back(gd);
151
 
152
				if ( ask )
153
				{
68 cycrow 154
					if ( MessageBox::Show(this, "Do you want to load text from this directory\n" + _US(dir), "Load Game Text", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes )
1 cycrow 155
					{
156
						gd->bLoad = true;
157
						m_bLoadText = true;
158
					}
159
				}
160
				this->UpdateGameDirs();
161
			}
162
		}
163
 
164
		void AddNewDir()
165
		{
166
			OpenFileDialog ^ofd = gcnew OpenFileDialog();
167
			ofd->Filter = "X-Universe Executable|";
168
			String ^games = "";
169
			for ( int i = 0; i < m_pP->GetGameExe()->GetNumGames(); i++ )
170
			{
171
				SGameExe *exe = m_pP->GetGameExe()->GetGame(i);
172
				if ( i ) ofd->Filter += ";";
173
				ofd->Filter += SystemStringFromCyString(exe->sExe);
174
				games += "|" + SystemStringFromCyString(exe->sName) + "|" + SystemStringFromCyString(exe->sExe);
175
			}
176
			ofd->Filter += games;
177
			ofd->FilterIndex = 1;
178
			ofd->RestoreDirectory = true;
179
			if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK )
180
			{
181
				// check for a valid game
68 cycrow 182
				if ( m_pP->GetGameName(CyStringFromSystemString(ofd->FileName)).Empty() )
183
					MessageBox::Show(this, "The path selected doesn't contain a valid game version\n" + IO::FileInfo(ofd->FileName).DirectoryName, "Invalid Directory", MessageBoxButtons::OK, MessageBoxIcon::Error);
1 cycrow 184
				else
68 cycrow 185
					this->AddDir(ofd->FileName, true, false);
1 cycrow 186
			}
187
		}
188
		void Init()
189
		{
190
			this->UpdateGameDirs();
191
		}
192
 
193
	protected:
194
		bool	m_bLoadText;
195
		/// <summary>
196
		/// Clean up any resources being used.
197
		/// </summary>
198
		~Options()
199
		{
200
			if (components)
201
			{
202
				delete components;
203
			}
204
			delete m_sDirs;
205
		}
206
	private: System::Windows::Forms::PictureBox^  pictureBox1;
207
	private: System::Windows::Forms::Panel^  panel1;
208
	private: System::Windows::Forms::Button^  button1;
209
	private: System::Windows::Forms::ListView^  ListGameDir;
210
 
211
	private: System::Windows::Forms::Panel^  panel2;
212
	private: System::Windows::Forms::ImageList^  imageList1;
213
	private: System::Windows::Forms::Button^  ButDel;
214
	private: System::Windows::Forms::Button^  ButClear;
215
 
216
 
217
	private: System::Windows::Forms::ColumnHeader^  columnHeader1;
218
	private: System::Windows::Forms::ColumnHeader^  columnHeader2;
219
	private: System::Windows::Forms::ColumnHeader^  columnHeader3;
220
	private: System::Windows::Forms::Panel^  panel3;
221
	private: System::Windows::Forms::Button^  button3;
222
	private: System::Windows::Forms::Button^  button2;
223
 
224
	private: System::Windows::Forms::Label^  label1;
225
 
226
	private: System::ComponentModel::IContainer^  components;
227
 
228
	protected: 
229
 
230
	private:
231
		/// <summary>
232
		/// Required designer variable.
233
		/// </summary>
234
		ImageList ^m_pGameImages;
235
		CLinkList<SGameDir> *m_pGameDir;
236
		ListViewItem ^m_pSelectedItem;
237
		CyStringList *m_sDirs;
238
 
239
	private: System::Windows::Forms::ToolTip^  toolTip1;
240
	private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip1;
241
	private: System::Windows::Forms::ToolStripMenuItem^  addDirectoryToolStripMenuItem;
242
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator1;
243
private: System::Windows::Forms::ToolStripMenuItem^  clearAllToolStripMenuItem;
244
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator2;
245
private: System::Windows::Forms::ToolStripMenuItem^  removeSelectedToolStripMenuItem;
246
private: System::Windows::Forms::ToolStripMenuItem^  loadTextToolStripMenuItem;
247
private: System::Windows::Forms::ToolStripMenuItem^  yesToolStripMenuItem;
248
private: System::Windows::Forms::ToolStripMenuItem^  noToolStripMenuItem;
249
private: System::Windows::Forms::ContextMenuStrip^  contextMenuStrip2;
250
private: System::Windows::Forms::ToolStripMenuItem^  addDirectoryToolStripMenuItem1;
251
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator3;
252
private: System::Windows::Forms::ToolStripMenuItem^  testDirToolStripMenuItem;
253
private: System::Windows::Forms::ToolStripMenuItem^  addDirectoryToolStripMenuItem2;
254
private: System::Windows::Forms::ToolStripSeparator^  toolStripSeparator4;
255
private: System::Windows::Forms::ToolStripMenuItem^  testDirToolStripMenuItem1;
256
private: System::Windows::Forms::Panel^  panel4;
257
private: System::Windows::Forms::CheckBox^  checkBox1;
258
 
259
 
260
			 CPackages *m_pP;
261
 
262
 
263
#pragma region Windows Form Designer generated code
264
		/// <summary>
265
		/// Required method for Designer support - do not modify
266
		/// the contents of this method with the code editor.
267
		/// </summary>
268
		void InitializeComponent(void)
269
		{
270
			this->components = (gcnew System::ComponentModel::Container());
271
			System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Options::typeid));
272
			this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());
273
			this->panel1 = (gcnew System::Windows::Forms::Panel());
274
			this->label1 = (gcnew System::Windows::Forms::Label());
275
			this->button1 = (gcnew System::Windows::Forms::Button());
276
			this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));
277
			this->ButDel = (gcnew System::Windows::Forms::Button());
278
			this->ButClear = (gcnew System::Windows::Forms::Button());
279
			this->ListGameDir = (gcnew System::Windows::Forms::ListView());
280
			this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());
281
			this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());
282
			this->columnHeader3 = (gcnew System::Windows::Forms::ColumnHeader());
283
			this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
284
			this->addDirectoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
285
			this->addDirectoryToolStripMenuItem2 = (gcnew System::Windows::Forms::ToolStripMenuItem());
286
			this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());
287
			this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());
288
			this->loadTextToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
289
			this->yesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
290
			this->noToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
291
			this->removeSelectedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
292
			this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());
293
			this->clearAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
294
			this->panel2 = (gcnew System::Windows::Forms::Panel());
295
			this->panel3 = (gcnew System::Windows::Forms::Panel());
296
			this->button3 = (gcnew System::Windows::Forms::Button());
297
			this->button2 = (gcnew System::Windows::Forms::Button());
298
			this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));
299
			this->contextMenuStrip2 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));
300
			this->addDirectoryToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
301
			this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());
302
			this->testDirToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());
303
			this->testDirToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());
304
			this->panel4 = (gcnew System::Windows::Forms::Panel());
305
			this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
306
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->BeginInit();
307
			this->panel1->SuspendLayout();
308
			this->contextMenuStrip1->SuspendLayout();
309
			this->panel2->SuspendLayout();
310
			this->panel3->SuspendLayout();
311
			this->contextMenuStrip2->SuspendLayout();
312
			this->panel4->SuspendLayout();
313
			this->SuspendLayout();
314
			// 
315
			// pictureBox1
316
			// 
317
			this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Left;
318
			this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"pictureBox1.Image")));
319
			this->pictureBox1->Location = System::Drawing::Point(0, 0);
320
			this->pictureBox1->Name = L"pictureBox1";
321
			this->pictureBox1->Size = System::Drawing::Size(33, 33);
322
			this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;
323
			this->pictureBox1->TabIndex = 0;
324
			this->pictureBox1->TabStop = false;
325
			// 
326
			// panel1
327
			// 
328
			this->panel1->Controls->Add(this->label1);
329
			this->panel1->Controls->Add(this->button1);
330
			this->panel1->Controls->Add(this->pictureBox1);
331
			this->panel1->Controls->Add(this->ButDel);
332
			this->panel1->Controls->Add(this->ButClear);
333
			this->panel1->Dock = System::Windows::Forms::DockStyle::Top;
334
			this->panel1->Location = System::Drawing::Point(5, 5);
335
			this->panel1->Name = L"panel1";
336
			this->panel1->Size = System::Drawing::Size(643, 33);
337
			this->panel1->TabIndex = 1;
338
			// 
339
			// label1
340
			// 
341
			this->label1->Dock = System::Windows::Forms::DockStyle::Fill;
342
			this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
343
				static_cast<System::Byte>(0)));
344
			this->label1->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;
345
			this->label1->Location = System::Drawing::Point(33, 0);
346
			this->label1->Name = L"label1";
347
			this->label1->Size = System::Drawing::Size(385, 33);
348
			this->label1->TabIndex = 4;
349
			this->label1->Text = L"Game Directories";
350
			this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;
351
			// 
352
			// button1
353
			// 
354
			this->button1->Dock = System::Windows::Forms::DockStyle::Right;
355
			this->button1->ImageIndex = 0;
356
			this->button1->ImageList = this->imageList1;
357
			this->button1->Location = System::Drawing::Point(418, 0);
358
			this->button1->Name = L"button1";
359
			this->button1->Size = System::Drawing::Size(75, 33);
360
			this->button1->TabIndex = 1;
361
			this->button1->UseVisualStyleBackColor = true;
362
			this->button1->Click += gcnew System::EventHandler(this, &Options::button1_Click);
363
			// 
364
			// imageList1
365
			// 
366
			this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^  >(resources->GetObject(L"imageList1.ImageStream")));
367
			this->imageList1->TransparentColor = System::Drawing::Color::Transparent;
368
			this->imageList1->Images->SetKeyName(0, L"Button Add.png");
369
			this->imageList1->Images->SetKeyName(1, L"Button Delete.png");
370
			this->imageList1->Images->SetKeyName(2, L"Button Cancel.png");
371
			// 
372
			// ButDel
373
			// 
374
			this->ButDel->Dock = System::Windows::Forms::DockStyle::Right;
375
			this->ButDel->ImageIndex = 1;
376
			this->ButDel->ImageList = this->imageList1;
377
			this->ButDel->Location = System::Drawing::Point(493, 0);
378
			this->ButDel->Name = L"ButDel";
379
			this->ButDel->Size = System::Drawing::Size(75, 33);
380
			this->ButDel->TabIndex = 2;
381
			this->ButDel->UseVisualStyleBackColor = true;
382
			this->ButDel->Click += gcnew System::EventHandler(this, &Options::ButDel_Click);
383
			// 
384
			// ButClear
385
			// 
386
			this->ButClear->Dock = System::Windows::Forms::DockStyle::Right;
387
			this->ButClear->ImageIndex = 2;
388
			this->ButClear->ImageList = this->imageList1;
389
			this->ButClear->Location = System::Drawing::Point(568, 0);
390
			this->ButClear->Name = L"ButClear";
391
			this->ButClear->Size = System::Drawing::Size(75, 33);
392
			this->ButClear->TabIndex = 3;
393
			this->ButClear->UseVisualStyleBackColor = true;
394
			this->ButClear->Click += gcnew System::EventHandler(this, &Options::ButClear_Click);
395
			// 
396
			// ListGameDir
397
			// 
398
			this->ListGameDir->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^  >(3) {this->columnHeader1, 
399
				this->columnHeader2, this->columnHeader3});
400
			this->ListGameDir->ContextMenuStrip = this->contextMenuStrip1;
401
			this->ListGameDir->Dock = System::Windows::Forms::DockStyle::Fill;
402
			this->ListGameDir->FullRowSelect = true;
403
			this->ListGameDir->Location = System::Drawing::Point(5, 38);
404
			this->ListGameDir->Name = L"ListGameDir";
405
			this->ListGameDir->Size = System::Drawing::Size(643, 130);
406
			this->ListGameDir->TabIndex = 2;
407
			this->ListGameDir->UseCompatibleStateImageBehavior = false;
408
			this->ListGameDir->View = System::Windows::Forms::View::Details;
409
			this->ListGameDir->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Options::listView1_MouseDoubleClick);
410
			this->ListGameDir->SelectedIndexChanged += gcnew System::EventHandler(this, &Options::ListGameDir_SelectedIndexChanged);
411
			// 
412
			// columnHeader1
413
			// 
414
			this->columnHeader1->Text = L"Directory";
415
			// 
416
			// columnHeader2
417
			// 
418
			this->columnHeader2->Text = L"Game";
419
			// 
420
			// columnHeader3
421
			// 
422
			this->columnHeader3->Text = L"Load Text";
423
			// 
424
			// contextMenuStrip1
425
			// 
426
			this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(6) {this->addDirectoryToolStripMenuItem, 
427
				this->toolStripSeparator2, this->loadTextToolStripMenuItem, this->removeSelectedToolStripMenuItem, this->toolStripSeparator1, 
428
				this->clearAllToolStripMenuItem});
429
			this->contextMenuStrip1->Name = L"contextMenuStrip1";
430
			this->contextMenuStrip1->Size = System::Drawing::Size(181, 168);
431
			this->contextMenuStrip1->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &Options::contextMenuStrip1_Opening);
432
			// 
433
			// addDirectoryToolStripMenuItem
434
			// 
435
			this->addDirectoryToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->addDirectoryToolStripMenuItem2, 
436
				this->toolStripSeparator4});
437
			this->addDirectoryToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"addDirectoryToolStripMenuItem.Image")));
438
			this->addDirectoryToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
439
			this->addDirectoryToolStripMenuItem->Name = L"addDirectoryToolStripMenuItem";
440
			this->addDirectoryToolStripMenuItem->Size = System::Drawing::Size(180, 38);
441
			this->addDirectoryToolStripMenuItem->Text = L"Add Directory";
442
			this->addDirectoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::addDirectoryToolStripMenuItem_Click);
443
			// 
444
			// addDirectoryToolStripMenuItem2
445
			// 
446
			this->addDirectoryToolStripMenuItem2->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"addDirectoryToolStripMenuItem2.Image")));
447
			this->addDirectoryToolStripMenuItem2->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
448
			this->addDirectoryToolStripMenuItem2->Name = L"addDirectoryToolStripMenuItem2";
449
			this->addDirectoryToolStripMenuItem2->Size = System::Drawing::Size(196, 38);
450
			this->addDirectoryToolStripMenuItem2->Text = L"Add Other Directory";
451
			// 
452
			// toolStripSeparator4
453
			// 
454
			this->toolStripSeparator4->Name = L"toolStripSeparator4";
455
			this->toolStripSeparator4->Size = System::Drawing::Size(193, 6);
456
			// 
457
			// toolStripSeparator2
458
			// 
459
			this->toolStripSeparator2->Name = L"toolStripSeparator2";
460
			this->toolStripSeparator2->Size = System::Drawing::Size(177, 6);
461
			// 
462
			// loadTextToolStripMenuItem
463
			// 
464
			this->loadTextToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(2) {this->yesToolStripMenuItem, 
465
				this->noToolStripMenuItem});
466
			this->loadTextToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"loadTextToolStripMenuItem.Image")));
467
			this->loadTextToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
468
			this->loadTextToolStripMenuItem->Name = L"loadTextToolStripMenuItem";
469
			this->loadTextToolStripMenuItem->Size = System::Drawing::Size(180, 38);
470
			this->loadTextToolStripMenuItem->Text = L"Load Text";
471
			// 
472
			// yesToolStripMenuItem
473
			// 
474
			this->yesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"yesToolStripMenuItem.Image")));
475
			this->yesToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
476
			this->yesToolStripMenuItem->Name = L"yesToolStripMenuItem";
477
			this->yesToolStripMenuItem->Size = System::Drawing::Size(108, 38);
478
			this->yesToolStripMenuItem->Text = L"Yes";
479
			this->yesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::yesToolStripMenuItem_Click);
480
			// 
481
			// noToolStripMenuItem
482
			// 
483
			this->noToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"noToolStripMenuItem.Image")));
484
			this->noToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
485
			this->noToolStripMenuItem->Name = L"noToolStripMenuItem";
486
			this->noToolStripMenuItem->Size = System::Drawing::Size(108, 38);
487
			this->noToolStripMenuItem->Text = L"No";
488
			this->noToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::noToolStripMenuItem_Click);
489
			// 
490
			// removeSelectedToolStripMenuItem
491
			// 
492
			this->removeSelectedToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"removeSelectedToolStripMenuItem.Image")));
493
			this->removeSelectedToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
494
			this->removeSelectedToolStripMenuItem->Name = L"removeSelectedToolStripMenuItem";
495
			this->removeSelectedToolStripMenuItem->Size = System::Drawing::Size(180, 38);
496
			this->removeSelectedToolStripMenuItem->Text = L"Remove Selected";
497
			this->removeSelectedToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::removeSelectedToolStripMenuItem_Click);
498
			// 
499
			// toolStripSeparator1
500
			// 
501
			this->toolStripSeparator1->Name = L"toolStripSeparator1";
502
			this->toolStripSeparator1->Size = System::Drawing::Size(177, 6);
503
			// 
504
			// clearAllToolStripMenuItem
505
			// 
506
			this->clearAllToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"clearAllToolStripMenuItem.Image")));
507
			this->clearAllToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
508
			this->clearAllToolStripMenuItem->Name = L"clearAllToolStripMenuItem";
509
			this->clearAllToolStripMenuItem->Size = System::Drawing::Size(180, 38);
510
			this->clearAllToolStripMenuItem->Text = L"Clear All";
511
			this->clearAllToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::clearAllToolStripMenuItem_Click);
512
			// 
513
			// panel2
514
			// 
515
			this->panel2->Controls->Add(this->ListGameDir);
516
			this->panel2->Controls->Add(this->panel1);
517
			this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;
518
			this->panel2->Location = System::Drawing::Point(10, 10);
519
			this->panel2->Name = L"panel2";
520
			this->panel2->Padding = System::Windows::Forms::Padding(5);
521
			this->panel2->Size = System::Drawing::Size(653, 173);
522
			this->panel2->TabIndex = 3;
523
			// 
524
			// panel3
525
			// 
526
			this->panel3->Controls->Add(this->button3);
527
			this->panel3->Controls->Add(this->button2);
528
			this->panel3->Dock = System::Windows::Forms::DockStyle::Bottom;
529
			this->panel3->Location = System::Drawing::Point(10, 212);
530
			this->panel3->Name = L"panel3";
531
			this->panel3->Padding = System::Windows::Forms::Padding(0, 10, 0, 0);
532
			this->panel3->Size = System::Drawing::Size(653, 43);
533
			this->panel3->TabIndex = 4;
534
			// 
535
			// button3
536
			// 
537
			this->button3->DialogResult = System::Windows::Forms::DialogResult::Cancel;
538
			this->button3->Dock = System::Windows::Forms::DockStyle::Right;
539
			this->button3->Location = System::Drawing::Point(448, 10);
540
			this->button3->Name = L"button3";
541
			this->button3->Size = System::Drawing::Size(105, 33);
542
			this->button3->TabIndex = 1;
543
			this->button3->Text = L"Cancel";
544
			this->button3->UseVisualStyleBackColor = true;
545
			// 
546
			// button2
547
			// 
548
			this->button2->DialogResult = System::Windows::Forms::DialogResult::OK;
549
			this->button2->Dock = System::Windows::Forms::DockStyle::Right;
550
			this->button2->Location = System::Drawing::Point(553, 10);
551
			this->button2->Name = L"button2";
552
			this->button2->Size = System::Drawing::Size(100, 33);
553
			this->button2->TabIndex = 0;
554
			this->button2->Text = L"OK";
555
			this->button2->UseVisualStyleBackColor = true;
556
			// 
557
			// toolTip1
558
			// 
559
			this->toolTip1->IsBalloon = true;
560
			this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;
561
			this->toolTip1->ToolTipTitle = L"Game Directories";
562
			this->toolTip1->Popup += gcnew System::Windows::Forms::PopupEventHandler(this, &Options::toolTip1_Popup);
563
			// 
564
			// contextMenuStrip2
565
			// 
566
			this->contextMenuStrip2->ImageScalingSize = System::Drawing::Size(32, 32);
567
			this->contextMenuStrip2->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^  >(4) {this->addDirectoryToolStripMenuItem1, 
568
				this->toolStripSeparator3, this->testDirToolStripMenuItem, this->testDirToolStripMenuItem1});
569
			this->contextMenuStrip2->Name = L"contextMenuStrip2";
570
			this->contextMenuStrip2->Size = System::Drawing::Size(197, 124);
571
			this->contextMenuStrip2->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &Options::contextMenuStrip2_Opening);
572
			// 
573
			// addDirectoryToolStripMenuItem1
574
			// 
575
			this->addDirectoryToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"addDirectoryToolStripMenuItem1.Image")));
576
			this->addDirectoryToolStripMenuItem1->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
577
			this->addDirectoryToolStripMenuItem1->Name = L"addDirectoryToolStripMenuItem1";
578
			this->addDirectoryToolStripMenuItem1->Size = System::Drawing::Size(196, 38);
579
			this->addDirectoryToolStripMenuItem1->Text = L"Add Other Directory";
580
			this->addDirectoryToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Options::addDirectoryToolStripMenuItem1_Click);
581
			// 
582
			// toolStripSeparator3
583
			// 
584
			this->toolStripSeparator3->Name = L"toolStripSeparator3";
585
			this->toolStripSeparator3->Size = System::Drawing::Size(193, 6);
586
			// 
587
			// testDirToolStripMenuItem
588
			// 
589
			this->testDirToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"testDirToolStripMenuItem.Image")));
590
			this->testDirToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
591
			this->testDirToolStripMenuItem->Name = L"testDirToolStripMenuItem";
592
			this->testDirToolStripMenuItem->Size = System::Drawing::Size(196, 38);
593
			this->testDirToolStripMenuItem->Text = L"Test Dir";
594
			this->testDirToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::testDirToolStripMenuItem_Click);
595
			// 
596
			// testDirToolStripMenuItem1
597
			// 
598
			this->testDirToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"testDirToolStripMenuItem1.Image")));
599
			this->testDirToolStripMenuItem1->Name = L"testDirToolStripMenuItem1";
600
			this->testDirToolStripMenuItem1->Size = System::Drawing::Size(196, 38);
601
			this->testDirToolStripMenuItem1->Text = L"Test Dir";
602
			// 
603
			// panel4
604
			// 
605
			this->panel4->Controls->Add(this->checkBox1);
606
			this->panel4->Dock = System::Windows::Forms::DockStyle::Bottom;
607
			this->panel4->Location = System::Drawing::Point(10, 183);
608
			this->panel4->Name = L"panel4";
609
			this->panel4->Padding = System::Windows::Forms::Padding(20, 0, 0, 0);
610
			this->panel4->Size = System::Drawing::Size(653, 29);
611
			this->panel4->TabIndex = 5;
612
			// 
613
			// checkBox1
614
			// 
615
			this->checkBox1->Dock = System::Windows::Forms::DockStyle::Fill;
616
			this->checkBox1->Location = System::Drawing::Point(20, 0);
617
			this->checkBox1->Name = L"checkBox1";
618
			this->checkBox1->Size = System::Drawing::Size(633, 29);
619
			this->checkBox1->TabIndex = 0;
620
			this->checkBox1->Text = L"Automatically Generate Update files when saving packages";
621
			this->checkBox1->UseVisualStyleBackColor = true;
622
			// 
623
			// Options
624
			// 
625
			this->AcceptButton = this->button2;
626
			this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
627
			this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
628
			this->CancelButton = this->button3;
629
			this->ClientSize = System::Drawing::Size(673, 265);
630
			this->ControlBox = false;
631
			this->Controls->Add(this->panel2);
632
			this->Controls->Add(this->panel4);
633
			this->Controls->Add(this->panel3);
634
			this->Name = L"Options";
635
			this->Padding = System::Windows::Forms::Padding(10);
636
			this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;
637
			this->Text = L"Options";
638
			this->TopMost = true;
639
			(cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->pictureBox1))->EndInit();
640
			this->panel1->ResumeLayout(false);
641
			this->contextMenuStrip1->ResumeLayout(false);
642
			this->panel2->ResumeLayout(false);
643
			this->panel3->ResumeLayout(false);
644
			this->contextMenuStrip2->ResumeLayout(false);
645
			this->panel4->ResumeLayout(false);
646
			this->ResumeLayout(false);
647
 
648
		}
649
#pragma endregion
650
	private: System::Void listView1_MouseDoubleClick(System::Object^  sender, System::Windows::Forms::MouseEventArgs^  e) {
651
			 for ( int i = 0; i < this->ListGameDir->SelectedItems->Count; i++ )
652
			 {
68 cycrow 653
				 Utils::String dir = _S(this->ListGameDir->SelectedItems[i]->Text);
1 cycrow 654
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
655
				{
68 cycrow 656
					if ( gd->dir.Compare(dir) )
1 cycrow 657
					{
658
						gd->bLoad = !gd->bLoad;
659
						if ( gd->bLoad )
660
							this->ListGameDir->SelectedItems[i]->SubItems[2]->Text = "Yes";
661
						else
662
							this->ListGameDir->SelectedItems[i]->SubItems[2]->Text = "No";
663
						break;
664
					}
665
				}
666
			 }
667
		 }
668
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
669
			 this->contextMenuStrip2->Show(this->button1, this->button1->PointToClient(this->button1->MousePosition));
670
		 }
671
private: System::Void ListGameDir_SelectedIndexChanged(System::Object^  sender, System::EventArgs^  e) {
672
			this->ButDel->Enabled = (this->ListGameDir->SelectedItems->Count) ? true : false;
673
		 }
674
private: System::Void ButClear_Click(System::Object^  sender, System::EventArgs^  e) {
675
			 m_pGameDir->MemoryClear();
676
			 this->UpdateGameDirs();
677
		 }
678
private: System::Void ButDel_Click(System::Object^  sender, System::EventArgs^  e) {
679
			 for ( int i = 0; i < this->ListGameDir->SelectedItems->Count; i++ )
680
			 {
68 cycrow 681
				 Utils::String dir = _S(this->ListGameDir->SelectedItems[i]->Text);
1 cycrow 682
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
683
				{
68 cycrow 684
					if ( gd->dir.Compare(dir) )
1 cycrow 685
					{
686
						m_pGameDir->RemoveCurrent();
687
						break;
688
					}
689
				}
690
			 }
691
			 this->UpdateGameDirs();
692
		 }
693
private: System::Void toolTip1_Popup(System::Object^  sender, System::Windows::Forms::PopupEventArgs^  e) {
694
		 }
695
private: System::Void contextMenuStrip1_Opening(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
696
			 Point ^mousePoint = this->ListGameDir->PointToClient(this->contextMenuStrip1->MousePosition);
697
			ListViewItem ^item = this->ListGameDir->GetItemAt(mousePoint->X, mousePoint->Y);
698
 
699
			this->loadTextToolStripMenuItem->Visible = (item) ? true : false;
700
			this->removeSelectedToolStripMenuItem->Visible = (item) ? true : false;
701
			this->toolStripSeparator2->Visible = (item) ? true : false;
702
 
703
			this->clearAllToolStripMenuItem->Visible = (this->ListGameDir->Items->Count) ? true : false;
704
			this->toolStripSeparator1->Visible = (this->ListGameDir->Items->Count) ? true : false;
705
 
706
			 for ( int i = (this->addDirectoryToolStripMenuItem->DropDownItems->Count - 1); i >= 2; --i )
707
				 this->addDirectoryToolStripMenuItem->DropDownItems->RemoveAt(i);
708
 
709
			 // add any unadded directories
710
			 System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Options::typeid));
711
			 for ( SStringList *str = m_sDirs->Head(); str; str = str->next )
712
			 {
713
				 bool found = false;
714
				 for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
715
				 {
68 cycrow 716
					 if ( gd->dir.Compare(str->str.ToString()) )
1 cycrow 717
					 {
718
						 found = true;
719
						 break;
720
					 }
721
				 }
722
 
723
				 if ( !found )
724
				 {
725
					 ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();
726
					 newItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"testDirToolStripMenuItem.Image")));
727
					 newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
728
					 newItem->Text = SystemStringFromCyString(str->str) + " (" + SystemStringFromCyString(str->data) + ")";
729
					 newItem->Tag = SystemStringFromCyString(str->str);
730
					 newItem->Click += gcnew System::EventHandler(this, &Options::testDirToolStripMenuItem_Click);
731
					 this->addDirectoryToolStripMenuItem->DropDownItems->Add(newItem);
732
				 }
733
			 }
734
 
735
			 this->toolStripSeparator4->Visible = true;
736
			 if ( this->addDirectoryToolStripMenuItem->DropDownItems->Count == 2 )
737
				 this->toolStripSeparator4->Visible = false;
738
			 else
739
			 {
740
				 this->addDirectoryToolStripMenuItem->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());
741
				 ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();
742
				 newItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"testDirToolStripMenuItem1.Image")));
743
				 newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
744
				 newItem->Text = "Add All Directories";
745
				 newItem->Click += gcnew System::EventHandler(this, &Options::AllDirToolStripMenuItem_Click);
746
				 this->addDirectoryToolStripMenuItem->DropDownItems->Add(newItem);
747
			 }
748
 
749
			m_pSelectedItem = item;
750
			e->Cancel = false;
751
		 }
752
private: System::Void addDirectoryToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
753
			 this->AddNewDir();
754
		 }
755
private: System::Void clearAllToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
756
			 m_pGameDir->MemoryClear();
757
			 this->UpdateGameDirs();
758
		 }
759
private: System::Void removeSelectedToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
760
			 for ( int i = 0; i < this->ListGameDir->SelectedItems->Count; i++ )
761
			 {
68 cycrow 762
				 Utils::String dir = _S(this->ListGameDir->SelectedItems[i]->Text);
1 cycrow 763
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
764
				{
68 cycrow 765
					if ( gd->dir.Compare(dir) )
1 cycrow 766
					{
767
						m_pGameDir->RemoveCurrent();
768
						break;
769
					}
770
				}
771
			 }
772
			 this->UpdateGameDirs();
773
		 }
774
private: System::Void yesToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
775
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
776
				{
68 cycrow 777
					if ( gd->dir.Compare(_S(m_pSelectedItem->Text)) )
1 cycrow 778
					{
779
						gd->bLoad = true;
780
						m_pSelectedItem->SubItems[2]->Text = "Yes";
781
						break;
782
					}
783
				}
784
		 }
785
private: System::Void noToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
786
				for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
787
				{
68 cycrow 788
					if ( gd->dir.Compare(_S(m_pSelectedItem->Text)) )
1 cycrow 789
					{
790
						gd->bLoad = false;
791
						m_pSelectedItem->SubItems[2]->Text = "No";
792
						break;
793
					}
794
				}
795
		 }
796
private: System::Void addDirectoryToolStripMenuItem1_Click(System::Object^  sender, System::EventArgs^  e) {
797
			 this->AddNewDir();
798
		 }
799
private: System::Void contextMenuStrip2_Opening(System::Object^  sender, System::ComponentModel::CancelEventArgs^  e) {
800
			 // clear all but top items
801
			 for ( int i = (this->contextMenuStrip2->Items->Count - 1); i >= 2; --i )
802
				 this->contextMenuStrip2->Items->RemoveAt(i);
803
 
804
			 // add any unadded directories
805
			 System::ComponentModel::ComponentResourceManager^  resources = (gcnew System::ComponentModel::ComponentResourceManager(Options::typeid));
806
			 for ( SStringList *str = m_sDirs->Head(); str; str = str->next )
807
			 {
808
				 bool found = false;
809
				 for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() )
810
				 {
68 cycrow 811
					 if ( gd->dir.Compare(str->str.ToString()) )
1 cycrow 812
					 {
813
						 found = true;
814
						 break;
815
					 }
816
				 }
817
 
818
				 if ( !found )
819
				 {
820
					 ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();
821
					 newItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"testDirToolStripMenuItem.Image")));
822
					 newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
823
					 newItem->Text = SystemStringFromCyString(str->str) + " (" + SystemStringFromCyString(str->data) + ")";
824
					 newItem->Tag = SystemStringFromCyString(str->str);
825
					 newItem->Click += gcnew System::EventHandler(this, &Options::testDirToolStripMenuItem_Click);
826
					 this->contextMenuStrip2->Items->Add(newItem);
827
				 }
828
			 }
829
 
830
			 this->toolStripSeparator3->Visible = true;
831
			 if ( this->contextMenuStrip2->Items->Count == 2 )
832
				 this->toolStripSeparator3->Visible = false;
833
			 else
834
			 {
835
				 this->contextMenuStrip2->Items->Add(gcnew System::Windows::Forms::ToolStripSeparator());
836
				 ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();
837
				 newItem->Image = (cli::safe_cast<System::Drawing::Image^  >(resources->GetObject(L"testDirToolStripMenuItem1.Image")));
838
				 newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;
839
				 newItem->Text = "Add All Directories";
840
				 newItem->Click += gcnew System::EventHandler(this, &Options::AllDirToolStripMenuItem_Click);
841
				 this->contextMenuStrip2->Items->Add(newItem);
842
			 }
843
 
844
			 e->Cancel = false;
845
		 }
846
private: System::Void testDirToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
847
			 ToolStripMenuItem ^item = cli::safe_cast<ToolStripMenuItem ^>(sender);
848
			 this->AddDir(Convert::ToString(item->Tag), true, false);
849
		 }
850
private: System::Void AllDirToolStripMenuItem_Click(System::Object^  sender, System::EventArgs^  e) {
851
			 bool load = false;
852
			 if ( MessageBox::Show(this, "Do you want to load text for all the directories", "Load Game Text", MessageBoxButtons::YesNo, MessageBoxIcon::Question) == System::Windows::Forms::DialogResult::Yes )
853
				load = true;
854
			 for ( SStringList *str = m_sDirs->Head(); str; str = str->next )
855
				 this->AddDir(SystemStringFromCyString(str->str), false, load);
856
		 }
857
};
858
}