Subversion Repositories spk

Rev

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