Rev 118 | Rev 191 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#pragma once#include "GameDirectories.h"using namespace System;using namespace System::ComponentModel;using namespace System::Collections;using namespace System::Windows::Forms;using namespace System::Data;using namespace System::Drawing;namespace Creator {typedef struct SSettings {bool bGenerateUpdate;} SSettings;/// <summary>/// Summary for Options////// WARNING: If you change the name of this class, you will need to change the/// 'Resource File Name' property for the managed resource compiler tool/// associated with all .resx files this class depends on. Otherwise,/// the designers will not be able to interact properly with localized/// resources associated with this form./// </summary>public ref class Options : public System::Windows::Forms::Form{public:Options(ImageList ^gameImages, CGameDirectories *gameDir, CPackages *p, SSettings *set){InitializeComponent();m_bLoadText = false;m_pGameImages = gameImages;_pGameDir = gameDir;m_pP = p;this->Init();this->ListGameDir->LargeImageList = this->m_pGameImages;this->ListGameDir->SmallImageList = this->m_pGameImages;this->toolTip1->SetToolTip(this->button1, "Add new game directory");this->toolTip1->SetToolTip(this->ButDel, "Remove selected game directory");this->toolTip1->SetToolTip(this->ButClear, "Clear all game directories");m_sDirs = new CyStringList;this->GetAllDirs();this->checkBox1->Checked = set->bGenerateUpdate;}bool LoadText() { return m_bLoadText; }bool GetGenerateUpdate() { return this->checkBox1->Checked; }void GetAllDirs(){System::String ^mydoc = Environment::GetFolderPath(Environment::SpecialFolder::Personal );CFileIO Config;if ( Config.open(_S(mydoc) + "/Egosoft/pluginmanager.dat") ){std::vector<CyString> *lines = Config.ReadLines();if ( lines ){for ( int i = 0; i < (int)lines->size(); i++ ){CyString line(lines->at(i));CyString start = line.GetToken(":", 1, 1).ToLower();CyString rest = line.GetToken(":", 2).RemoveFirstSpace();if ( start.Compare("DirExe") ){if ( rest.NumToken("|" ) > 2 )m_sDirs->PushBack(rest.GetToken("|", 3, 3), rest.GetToken("|", 2, 2));elsem_sDirs->PushBack(rest.GetToken("|", 2, 2), rest.GetToken("|", 1, 1));}}delete lines;}}}void UpdateGameDirs(){this->ListGameDir->Items->Clear();for ( Utils::String dir = _pGameDir->first(); !dir.empty(); dir = _pGameDir->next() ) {ListViewItem ^item = gcnew ListViewItem(_US(dir));item->ImageIndex = _pGameDir->currentGame();item->SubItems->Add(_US(_pGameDir->currentName()));if ( _pGameDir->currentLoad() )item->SubItems->Add("Yes");elseitem->SubItems->Add("No");this->ListGameDir->Items->Add(item);}this->ListGameDir->AutoResizeColumns(ColumnHeaderAutoResizeStyle::HeaderSize);this->columnHeader3->Width = 100;this->columnHeader1->Width += 50;this->ButClear->Enabled = (this->ListGameDir->Items->Count) ? true : false;this->ButDel->Enabled = (this->ListGameDir->SelectedItems->Count) ? true : false;}void AddDir(String ^sDir, bool ask, bool load){Utils::String dir = _S(sDir);Utils::String game = m_pP->getGameName(dir);int iGame = m_pP->GetGameExe()->GetGameType(dir);dir = m_pP->GetGameExe()->GetProperDir(dir);dir = dir.findReplace("\\", "/");dir = dir.findReplace("//", "/");SGameExe *exe = m_pP->GetGameExe()->GetGame(iGame);if ( !_pGameDir->isDir(dir) && ask ) {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 ){load = true;m_bLoadText = true;}}if ( _pGameDir->add(dir, game, iGame, (exe) ? exe->sAddon : Utils::String::Null(), load) ) {this->UpdateGameDirs();}}void AddNewDir(){OpenFileDialog ^ofd = gcnew OpenFileDialog();ofd->Filter = "X-Universe Executable|";String ^games = "";for ( int i = 0; i < m_pP->GetGameExe()->GetNumGames(); i++ ){SGameExe *exe = m_pP->GetGameExe()->GetGame(i);if ( i ) ofd->Filter += ";";ofd->Filter += SystemStringFromCyString(exe->sExe);games += "|" + SystemStringFromCyString(exe->sName) + "|" + SystemStringFromCyString(exe->sExe);}ofd->Filter += games;ofd->FilterIndex = 1;ofd->RestoreDirectory = true;if ( ofd->ShowDialog(this) == System::Windows::Forms::DialogResult::OK ){// check for a valid gameif ( m_pP->getGameName(_S(ofd->FileName)).empty() )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);elsethis->AddDir(ofd->FileName, true, false);}}void Init(){this->UpdateGameDirs();}protected:bool m_bLoadText;/// <summary>/// Clean up any resources being used./// </summary>~Options(){if (components){delete components;}delete m_sDirs;}private: System::Windows::Forms::PictureBox^ pictureBox1;private: System::Windows::Forms::Panel^ panel1;private: System::Windows::Forms::Button^ button1;private: System::Windows::Forms::ListView^ ListGameDir;private: System::Windows::Forms::Panel^ panel2;private: System::Windows::Forms::ImageList^ imageList1;private: System::Windows::Forms::Button^ ButDel;private: System::Windows::Forms::Button^ ButClear;private: System::Windows::Forms::ColumnHeader^ columnHeader1;private: System::Windows::Forms::ColumnHeader^ columnHeader2;private: System::Windows::Forms::ColumnHeader^ columnHeader3;private: System::Windows::Forms::Panel^ panel3;private: System::Windows::Forms::Button^ button3;private: System::Windows::Forms::Button^ button2;private: System::Windows::Forms::Label^ label1;private: System::ComponentModel::IContainer^ components;protected:private:/// <summary>/// Required designer variable./// </summary>ImageList ^m_pGameImages;CGameDirectories *_pGameDir;ListViewItem ^m_pSelectedItem;CyStringList *m_sDirs;private: System::Windows::Forms::ToolTip^ toolTip1;private: System::Windows::Forms::ContextMenuStrip^ contextMenuStrip1;private: System::Windows::Forms::ToolStripMenuItem^ addDirectoryToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator1;private: System::Windows::Forms::ToolStripMenuItem^ clearAllToolStripMenuItem;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator2;private: System::Windows::Forms::ToolStripMenuItem^ removeSelectedToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ loadTextToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ yesToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ noToolStripMenuItem;private: System::Windows::Forms::ContextMenuStrip^ contextMenuStrip2;private: System::Windows::Forms::ToolStripMenuItem^ addDirectoryToolStripMenuItem1;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator3;private: System::Windows::Forms::ToolStripMenuItem^ testDirToolStripMenuItem;private: System::Windows::Forms::ToolStripMenuItem^ addDirectoryToolStripMenuItem2;private: System::Windows::Forms::ToolStripSeparator^ toolStripSeparator4;private: System::Windows::Forms::ToolStripMenuItem^ testDirToolStripMenuItem1;private: System::Windows::Forms::Panel^ panel4;private: System::Windows::Forms::CheckBox^ checkBox1;CPackages *m_pP;#pragma region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>void InitializeComponent(void){this->components = (gcnew System::ComponentModel::Container());System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Options::typeid));this->pictureBox1 = (gcnew System::Windows::Forms::PictureBox());this->panel1 = (gcnew System::Windows::Forms::Panel());this->label1 = (gcnew System::Windows::Forms::Label());this->button1 = (gcnew System::Windows::Forms::Button());this->imageList1 = (gcnew System::Windows::Forms::ImageList(this->components));this->ButDel = (gcnew System::Windows::Forms::Button());this->ButClear = (gcnew System::Windows::Forms::Button());this->ListGameDir = (gcnew System::Windows::Forms::ListView());this->columnHeader1 = (gcnew System::Windows::Forms::ColumnHeader());this->columnHeader2 = (gcnew System::Windows::Forms::ColumnHeader());this->columnHeader3 = (gcnew System::Windows::Forms::ColumnHeader());this->contextMenuStrip1 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));this->addDirectoryToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->addDirectoryToolStripMenuItem2 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator4 = (gcnew System::Windows::Forms::ToolStripSeparator());this->toolStripSeparator2 = (gcnew System::Windows::Forms::ToolStripSeparator());this->loadTextToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->yesToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->noToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->removeSelectedToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator1 = (gcnew System::Windows::Forms::ToolStripSeparator());this->clearAllToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->panel2 = (gcnew System::Windows::Forms::Panel());this->panel3 = (gcnew System::Windows::Forms::Panel());this->button3 = (gcnew System::Windows::Forms::Button());this->button2 = (gcnew System::Windows::Forms::Button());this->toolTip1 = (gcnew System::Windows::Forms::ToolTip(this->components));this->contextMenuStrip2 = (gcnew System::Windows::Forms::ContextMenuStrip(this->components));this->addDirectoryToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->toolStripSeparator3 = (gcnew System::Windows::Forms::ToolStripSeparator());this->testDirToolStripMenuItem = (gcnew System::Windows::Forms::ToolStripMenuItem());this->testDirToolStripMenuItem1 = (gcnew System::Windows::Forms::ToolStripMenuItem());this->panel4 = (gcnew System::Windows::Forms::Panel());this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->BeginInit();this->panel1->SuspendLayout();this->contextMenuStrip1->SuspendLayout();this->panel2->SuspendLayout();this->panel3->SuspendLayout();this->contextMenuStrip2->SuspendLayout();this->panel4->SuspendLayout();this->SuspendLayout();//// pictureBox1//this->pictureBox1->Dock = System::Windows::Forms::DockStyle::Left;this->pictureBox1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"pictureBox1.Image")));this->pictureBox1->Location = System::Drawing::Point(0, 0);this->pictureBox1->Name = L"pictureBox1";this->pictureBox1->Size = System::Drawing::Size(33, 33);this->pictureBox1->SizeMode = System::Windows::Forms::PictureBoxSizeMode::StretchImage;this->pictureBox1->TabIndex = 0;this->pictureBox1->TabStop = false;//// panel1//this->panel1->Controls->Add(this->label1);this->panel1->Controls->Add(this->button1);this->panel1->Controls->Add(this->pictureBox1);this->panel1->Controls->Add(this->ButDel);this->panel1->Controls->Add(this->ButClear);this->panel1->Dock = System::Windows::Forms::DockStyle::Top;this->panel1->Location = System::Drawing::Point(5, 5);this->panel1->Name = L"panel1";this->panel1->Size = System::Drawing::Size(643, 33);this->panel1->TabIndex = 1;//// label1//this->label1->Dock = System::Windows::Forms::DockStyle::Fill;this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point,static_cast<System::Byte>(0)));this->label1->ImageAlign = System::Drawing::ContentAlignment::MiddleLeft;this->label1->Location = System::Drawing::Point(33, 0);this->label1->Name = L"label1";this->label1->Size = System::Drawing::Size(385, 33);this->label1->TabIndex = 4;this->label1->Text = L"Game Directories";this->label1->TextAlign = System::Drawing::ContentAlignment::MiddleLeft;//// button1//this->button1->Dock = System::Windows::Forms::DockStyle::Right;this->button1->ImageIndex = 0;this->button1->ImageList = this->imageList1;this->button1->Location = System::Drawing::Point(418, 0);this->button1->Name = L"button1";this->button1->Size = System::Drawing::Size(75, 33);this->button1->TabIndex = 1;this->button1->UseVisualStyleBackColor = true;this->button1->Click += gcnew System::EventHandler(this, &Options::button1_Click);//// imageList1//this->imageList1->ImageStream = (cli::safe_cast<System::Windows::Forms::ImageListStreamer^ >(resources->GetObject(L"imageList1.ImageStream")));this->imageList1->TransparentColor = System::Drawing::Color::Transparent;this->imageList1->Images->SetKeyName(0, L"Button Add.png");this->imageList1->Images->SetKeyName(1, L"Button Delete.png");this->imageList1->Images->SetKeyName(2, L"Button Cancel.png");//// ButDel//this->ButDel->Dock = System::Windows::Forms::DockStyle::Right;this->ButDel->ImageIndex = 1;this->ButDel->ImageList = this->imageList1;this->ButDel->Location = System::Drawing::Point(493, 0);this->ButDel->Name = L"ButDel";this->ButDel->Size = System::Drawing::Size(75, 33);this->ButDel->TabIndex = 2;this->ButDel->UseVisualStyleBackColor = true;this->ButDel->Click += gcnew System::EventHandler(this, &Options::ButDel_Click);//// ButClear//this->ButClear->Dock = System::Windows::Forms::DockStyle::Right;this->ButClear->ImageIndex = 2;this->ButClear->ImageList = this->imageList1;this->ButClear->Location = System::Drawing::Point(568, 0);this->ButClear->Name = L"ButClear";this->ButClear->Size = System::Drawing::Size(75, 33);this->ButClear->TabIndex = 3;this->ButClear->UseVisualStyleBackColor = true;this->ButClear->Click += gcnew System::EventHandler(this, &Options::ButClear_Click);//// ListGameDir//this->ListGameDir->Columns->AddRange(gcnew cli::array< System::Windows::Forms::ColumnHeader^ >(3) {this->columnHeader1,this->columnHeader2, this->columnHeader3});this->ListGameDir->ContextMenuStrip = this->contextMenuStrip1;this->ListGameDir->Dock = System::Windows::Forms::DockStyle::Fill;this->ListGameDir->FullRowSelect = true;this->ListGameDir->Location = System::Drawing::Point(5, 38);this->ListGameDir->Name = L"ListGameDir";this->ListGameDir->Size = System::Drawing::Size(643, 130);this->ListGameDir->TabIndex = 2;this->ListGameDir->UseCompatibleStateImageBehavior = false;this->ListGameDir->View = System::Windows::Forms::View::Details;this->ListGameDir->MouseDoubleClick += gcnew System::Windows::Forms::MouseEventHandler(this, &Options::listView1_MouseDoubleClick);this->ListGameDir->SelectedIndexChanged += gcnew System::EventHandler(this, &Options::ListGameDir_SelectedIndexChanged);//// columnHeader1//this->columnHeader1->Text = L"Directory";//// columnHeader2//this->columnHeader2->Text = L"Game";//// columnHeader3//this->columnHeader3->Text = L"Load Text";//// contextMenuStrip1//this->contextMenuStrip1->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(6) {this->addDirectoryToolStripMenuItem,this->toolStripSeparator2, this->loadTextToolStripMenuItem, this->removeSelectedToolStripMenuItem, this->toolStripSeparator1,this->clearAllToolStripMenuItem});this->contextMenuStrip1->Name = L"contextMenuStrip1";this->contextMenuStrip1->Size = System::Drawing::Size(181, 168);this->contextMenuStrip1->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &Options::contextMenuStrip1_Opening);//// addDirectoryToolStripMenuItem//this->addDirectoryToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->addDirectoryToolStripMenuItem2,this->toolStripSeparator4});this->addDirectoryToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"addDirectoryToolStripMenuItem.Image")));this->addDirectoryToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->addDirectoryToolStripMenuItem->Name = L"addDirectoryToolStripMenuItem";this->addDirectoryToolStripMenuItem->Size = System::Drawing::Size(180, 38);this->addDirectoryToolStripMenuItem->Text = L"Add Directory";this->addDirectoryToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::addDirectoryToolStripMenuItem_Click);//// addDirectoryToolStripMenuItem2//this->addDirectoryToolStripMenuItem2->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"addDirectoryToolStripMenuItem2.Image")));this->addDirectoryToolStripMenuItem2->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->addDirectoryToolStripMenuItem2->Name = L"addDirectoryToolStripMenuItem2";this->addDirectoryToolStripMenuItem2->Size = System::Drawing::Size(196, 38);this->addDirectoryToolStripMenuItem2->Text = L"Add Other Directory";//// toolStripSeparator4//this->toolStripSeparator4->Name = L"toolStripSeparator4";this->toolStripSeparator4->Size = System::Drawing::Size(193, 6);//// toolStripSeparator2//this->toolStripSeparator2->Name = L"toolStripSeparator2";this->toolStripSeparator2->Size = System::Drawing::Size(177, 6);//// loadTextToolStripMenuItem//this->loadTextToolStripMenuItem->DropDownItems->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(2) {this->yesToolStripMenuItem,this->noToolStripMenuItem});this->loadTextToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"loadTextToolStripMenuItem.Image")));this->loadTextToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->loadTextToolStripMenuItem->Name = L"loadTextToolStripMenuItem";this->loadTextToolStripMenuItem->Size = System::Drawing::Size(180, 38);this->loadTextToolStripMenuItem->Text = L"Load Text";//// yesToolStripMenuItem//this->yesToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"yesToolStripMenuItem.Image")));this->yesToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->yesToolStripMenuItem->Name = L"yesToolStripMenuItem";this->yesToolStripMenuItem->Size = System::Drawing::Size(108, 38);this->yesToolStripMenuItem->Text = L"Yes";this->yesToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::yesToolStripMenuItem_Click);//// noToolStripMenuItem//this->noToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"noToolStripMenuItem.Image")));this->noToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->noToolStripMenuItem->Name = L"noToolStripMenuItem";this->noToolStripMenuItem->Size = System::Drawing::Size(108, 38);this->noToolStripMenuItem->Text = L"No";this->noToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::noToolStripMenuItem_Click);//// removeSelectedToolStripMenuItem//this->removeSelectedToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"removeSelectedToolStripMenuItem.Image")));this->removeSelectedToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->removeSelectedToolStripMenuItem->Name = L"removeSelectedToolStripMenuItem";this->removeSelectedToolStripMenuItem->Size = System::Drawing::Size(180, 38);this->removeSelectedToolStripMenuItem->Text = L"Remove Selected";this->removeSelectedToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::removeSelectedToolStripMenuItem_Click);//// toolStripSeparator1//this->toolStripSeparator1->Name = L"toolStripSeparator1";this->toolStripSeparator1->Size = System::Drawing::Size(177, 6);//// clearAllToolStripMenuItem//this->clearAllToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"clearAllToolStripMenuItem.Image")));this->clearAllToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->clearAllToolStripMenuItem->Name = L"clearAllToolStripMenuItem";this->clearAllToolStripMenuItem->Size = System::Drawing::Size(180, 38);this->clearAllToolStripMenuItem->Text = L"Clear All";this->clearAllToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::clearAllToolStripMenuItem_Click);//// panel2//this->panel2->Controls->Add(this->ListGameDir);this->panel2->Controls->Add(this->panel1);this->panel2->Dock = System::Windows::Forms::DockStyle::Fill;this->panel2->Location = System::Drawing::Point(10, 10);this->panel2->Name = L"panel2";this->panel2->Padding = System::Windows::Forms::Padding(5);this->panel2->Size = System::Drawing::Size(653, 173);this->panel2->TabIndex = 3;//// panel3//this->panel3->Controls->Add(this->button3);this->panel3->Controls->Add(this->button2);this->panel3->Dock = System::Windows::Forms::DockStyle::Bottom;this->panel3->Location = System::Drawing::Point(10, 212);this->panel3->Name = L"panel3";this->panel3->Padding = System::Windows::Forms::Padding(0, 10, 0, 0);this->panel3->Size = System::Drawing::Size(653, 43);this->panel3->TabIndex = 4;//// button3//this->button3->DialogResult = System::Windows::Forms::DialogResult::Cancel;this->button3->Dock = System::Windows::Forms::DockStyle::Right;this->button3->Location = System::Drawing::Point(448, 10);this->button3->Name = L"button3";this->button3->Size = System::Drawing::Size(105, 33);this->button3->TabIndex = 1;this->button3->Text = L"Cancel";this->button3->UseVisualStyleBackColor = true;//// button2//this->button2->DialogResult = System::Windows::Forms::DialogResult::OK;this->button2->Dock = System::Windows::Forms::DockStyle::Right;this->button2->Location = System::Drawing::Point(553, 10);this->button2->Name = L"button2";this->button2->Size = System::Drawing::Size(100, 33);this->button2->TabIndex = 0;this->button2->Text = L"OK";this->button2->UseVisualStyleBackColor = true;//// toolTip1//this->toolTip1->IsBalloon = true;this->toolTip1->ToolTipIcon = System::Windows::Forms::ToolTipIcon::Info;this->toolTip1->ToolTipTitle = L"Game Directories";this->toolTip1->Popup += gcnew System::Windows::Forms::PopupEventHandler(this, &Options::toolTip1_Popup);//// contextMenuStrip2//this->contextMenuStrip2->ImageScalingSize = System::Drawing::Size(32, 32);this->contextMenuStrip2->Items->AddRange(gcnew cli::array< System::Windows::Forms::ToolStripItem^ >(4) {this->addDirectoryToolStripMenuItem1,this->toolStripSeparator3, this->testDirToolStripMenuItem, this->testDirToolStripMenuItem1});this->contextMenuStrip2->Name = L"contextMenuStrip2";this->contextMenuStrip2->Size = System::Drawing::Size(197, 124);this->contextMenuStrip2->Opening += gcnew System::ComponentModel::CancelEventHandler(this, &Options::contextMenuStrip2_Opening);//// addDirectoryToolStripMenuItem1//this->addDirectoryToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"addDirectoryToolStripMenuItem1.Image")));this->addDirectoryToolStripMenuItem1->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->addDirectoryToolStripMenuItem1->Name = L"addDirectoryToolStripMenuItem1";this->addDirectoryToolStripMenuItem1->Size = System::Drawing::Size(196, 38);this->addDirectoryToolStripMenuItem1->Text = L"Add Other Directory";this->addDirectoryToolStripMenuItem1->Click += gcnew System::EventHandler(this, &Options::addDirectoryToolStripMenuItem1_Click);//// toolStripSeparator3//this->toolStripSeparator3->Name = L"toolStripSeparator3";this->toolStripSeparator3->Size = System::Drawing::Size(193, 6);//// testDirToolStripMenuItem//this->testDirToolStripMenuItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"testDirToolStripMenuItem.Image")));this->testDirToolStripMenuItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;this->testDirToolStripMenuItem->Name = L"testDirToolStripMenuItem";this->testDirToolStripMenuItem->Size = System::Drawing::Size(196, 38);this->testDirToolStripMenuItem->Text = L"Test Dir";this->testDirToolStripMenuItem->Click += gcnew System::EventHandler(this, &Options::testDirToolStripMenuItem_Click);//// testDirToolStripMenuItem1//this->testDirToolStripMenuItem1->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"testDirToolStripMenuItem1.Image")));this->testDirToolStripMenuItem1->Name = L"testDirToolStripMenuItem1";this->testDirToolStripMenuItem1->Size = System::Drawing::Size(196, 38);this->testDirToolStripMenuItem1->Text = L"Test Dir";//// panel4//this->panel4->Controls->Add(this->checkBox1);this->panel4->Dock = System::Windows::Forms::DockStyle::Bottom;this->panel4->Location = System::Drawing::Point(10, 183);this->panel4->Name = L"panel4";this->panel4->Padding = System::Windows::Forms::Padding(20, 0, 0, 0);this->panel4->Size = System::Drawing::Size(653, 29);this->panel4->TabIndex = 5;//// checkBox1//this->checkBox1->Dock = System::Windows::Forms::DockStyle::Fill;this->checkBox1->Location = System::Drawing::Point(20, 0);this->checkBox1->Name = L"checkBox1";this->checkBox1->Size = System::Drawing::Size(633, 29);this->checkBox1->TabIndex = 0;this->checkBox1->Text = L"Automatically Generate Update files when saving packages";this->checkBox1->UseVisualStyleBackColor = true;//// Options//this->AcceptButton = this->button2;this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;this->CancelButton = this->button3;this->ClientSize = System::Drawing::Size(673, 265);this->ControlBox = false;this->Controls->Add(this->panel2);this->Controls->Add(this->panel4);this->Controls->Add(this->panel3);this->Name = L"Options";this->Padding = System::Windows::Forms::Padding(10);this->StartPosition = System::Windows::Forms::FormStartPosition::CenterParent;this->Text = L"Options";this->TopMost = true;(cli::safe_cast<System::ComponentModel::ISupportInitialize^ >(this->pictureBox1))->EndInit();this->panel1->ResumeLayout(false);this->contextMenuStrip1->ResumeLayout(false);this->panel2->ResumeLayout(false);this->panel3->ResumeLayout(false);this->contextMenuStrip2->ResumeLayout(false);this->panel4->ResumeLayout(false);this->ResumeLayout(false);}#pragma endregionprivate: System::Void listView1_MouseDoubleClick(System::Object^ sender, System::Windows::Forms::MouseEventArgs^ e) {for ( int i = 0; i < this->ListGameDir->SelectedItems->Count; i++ ){Utils::String dir = _S(this->ListGameDir->SelectedItems[i]->Text);if ( _pGameDir->findDir(dir) ) {_pGameDir->setLoad(!_pGameDir->currentLoad());if ( _pGameDir->currentLoad() )this->ListGameDir->SelectedItems[i]->SubItems[2]->Text = "Yes";elsethis->ListGameDir->SelectedItems[i]->SubItems[2]->Text = "No";}}}private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) {this->contextMenuStrip2->Show(this->button1, this->button1->PointToClient(this->button1->MousePosition));}private: System::Void ListGameDir_SelectedIndexChanged(System::Object^ sender, System::EventArgs^ e) {this->ButDel->Enabled = (this->ListGameDir->SelectedItems->Count) ? true : false;}private: System::Void ButClear_Click(System::Object^ sender, System::EventArgs^ e) {_pGameDir->clear();this->UpdateGameDirs();}private: System::Void ButDel_Click(System::Object^ sender, System::EventArgs^ e) {for ( int i = 0; i < this->ListGameDir->SelectedItems->Count; i++ ){Utils::String dir = _S(this->ListGameDir->SelectedItems[i]->Text);_pGameDir->remove(dir);}this->UpdateGameDirs();}private: System::Void toolTip1_Popup(System::Object^ sender, System::Windows::Forms::PopupEventArgs^ e) {}private: System::Void contextMenuStrip1_Opening(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {Point ^mousePoint = this->ListGameDir->PointToClient(this->contextMenuStrip1->MousePosition);ListViewItem ^item = this->ListGameDir->GetItemAt(mousePoint->X, mousePoint->Y);this->loadTextToolStripMenuItem->Visible = (item) ? true : false;this->removeSelectedToolStripMenuItem->Visible = (item) ? true : false;this->toolStripSeparator2->Visible = (item) ? true : false;this->clearAllToolStripMenuItem->Visible = (this->ListGameDir->Items->Count) ? true : false;this->toolStripSeparator1->Visible = (this->ListGameDir->Items->Count) ? true : false;for ( int i = (this->addDirectoryToolStripMenuItem->DropDownItems->Count - 1); i >= 2; --i )this->addDirectoryToolStripMenuItem->DropDownItems->RemoveAt(i);// add any unadded directoriesSystem::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Options::typeid));for ( SStringList *str = m_sDirs->Head(); str; str = str->next ){if ( !_pGameDir->isDir(str->str.ToString()) ) {ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();newItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"testDirToolStripMenuItem.Image")));newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;newItem->Text = SystemStringFromCyString(str->str) + " (" + SystemStringFromCyString(str->data) + ")";newItem->Tag = SystemStringFromCyString(str->str);newItem->Click += gcnew System::EventHandler(this, &Options::testDirToolStripMenuItem_Click);this->addDirectoryToolStripMenuItem->DropDownItems->Add(newItem);}}this->toolStripSeparator4->Visible = true;if ( this->addDirectoryToolStripMenuItem->DropDownItems->Count == 2 )this->toolStripSeparator4->Visible = false;else{this->addDirectoryToolStripMenuItem->DropDownItems->Add(gcnew System::Windows::Forms::ToolStripSeparator());ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();newItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"testDirToolStripMenuItem1.Image")));newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;newItem->Text = "Add All Directories";newItem->Click += gcnew System::EventHandler(this, &Options::AllDirToolStripMenuItem_Click);this->addDirectoryToolStripMenuItem->DropDownItems->Add(newItem);}m_pSelectedItem = item;e->Cancel = false;}private: System::Void addDirectoryToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {this->AddNewDir();}private: System::Void clearAllToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {_pGameDir->clear();this->UpdateGameDirs();}private: System::Void removeSelectedToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {for ( int i = 0; i < this->ListGameDir->SelectedItems->Count; i++ ){Utils::String dir = _S(this->ListGameDir->SelectedItems[i]->Text);_pGameDir->remove(dir);}this->UpdateGameDirs();}private: System::Void yesToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( _pGameDir->findDir(_S(m_pSelectedItem->Text)) ) {_pGameDir->setLoad(true);m_pSelectedItem->SubItems[2]->Text = "Yes";}}private: System::Void noToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {if ( _pGameDir->findDir(_S(m_pSelectedItem->Text)) ) {_pGameDir->setLoad(false);m_pSelectedItem->SubItems[2]->Text = "No";}}private: System::Void addDirectoryToolStripMenuItem1_Click(System::Object^ sender, System::EventArgs^ e) {this->AddNewDir();}private: System::Void contextMenuStrip2_Opening(System::Object^ sender, System::ComponentModel::CancelEventArgs^ e) {// clear all but top itemsfor ( int i = (this->contextMenuStrip2->Items->Count - 1); i >= 2; --i )this->contextMenuStrip2->Items->RemoveAt(i);// add any unadded directoriesSystem::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Options::typeid));for ( SStringList *str = m_sDirs->Head(); str; str = str->next ){if ( !_pGameDir->isDir(m_pP->GetGameExe()->GetProperDir(str->str.ToString())) ) {ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();newItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"testDirToolStripMenuItem.Image")));newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;newItem->Text = SystemStringFromCyString(str->str) + " (" + SystemStringFromCyString(str->data) + ")";newItem->Tag = SystemStringFromCyString(str->str);newItem->Click += gcnew System::EventHandler(this, &Options::testDirToolStripMenuItem_Click);this->contextMenuStrip2->Items->Add(newItem);}}this->toolStripSeparator3->Visible = true;if ( this->contextMenuStrip2->Items->Count == 2 )this->toolStripSeparator3->Visible = false;else{this->contextMenuStrip2->Items->Add(gcnew System::Windows::Forms::ToolStripSeparator());ToolStripMenuItem ^newItem = gcnew ToolStripMenuItem();newItem->Image = (cli::safe_cast<System::Drawing::Image^ >(resources->GetObject(L"testDirToolStripMenuItem1.Image")));newItem->ImageScaling = System::Windows::Forms::ToolStripItemImageScaling::None;newItem->Text = "Add All Directories";newItem->Click += gcnew System::EventHandler(this, &Options::AllDirToolStripMenuItem_Click);this->contextMenuStrip2->Items->Add(newItem);}e->Cancel = false;}private: System::Void testDirToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {ToolStripMenuItem ^item = cli::safe_cast<ToolStripMenuItem ^>(sender);this->AddDir(Convert::ToString(item->Tag), true, false);}private: System::Void AllDirToolStripMenuItem_Click(System::Object^ sender, System::EventArgs^ e) {bool load = false;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 )load = true;for ( SStringList *str = m_sDirs->Head(); str; str = str->next )this->AddDir(SystemStringFromCyString(str->str), false, load);}};}