Subversion Repositories spk

Rev

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