Subversion Repositories spk

Rev

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