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