Rev 68 | Rev 224 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
#include "../stdafx.h"#include "SelectFilesystem.h"namespace Creator {void SelectFilesystem::update(){for ( int i = 1; i <= _pGameDir->highestGame(); i++ ) {for(Utils::String dir = _pGameDir->first(); !dir.empty(); dir = _pGameDir->next()) {if ( _pGameDir->currentGame() == i ) {this->comboBox1->Items->Add(_US(_pGameDir->currentName()));break;}}}this->comboBox1->SelectedIndex = this->comboBox1->Items->Count - 1;}void SelectFilesystem::selectedGame(){this->comboBox2->Items->Clear();// find the game to match the currently selected oneint iCurrentGame = this->comboBox1->SelectedIndex + 1;Utils::String gameName = _S(this->comboBox1->SelectedItem->ToString());for ( Utils::String dir = _pGameDir->first(); !dir.empty(); dir = _pGameDir->next() ) {if ( gameName.Compare(_pGameDir->currentName()) ) {iCurrentGame = _pGameDir->currentGame();break;}}for (Utils::String dir = _pGameDir->first(iCurrentGame); !dir.empty(); dir = _pGameDir->next(iCurrentGame) ) {this->comboBox2->Items->Add(_US(dir));}this->comboBox2->SelectedIndex = (!this->comboBox2->Items->Count) ? -1 : 0;}void SelectFilesystem::selectedDir(){this->comboBox3->Items->Clear();this->comboBox3->Items->Add(":: No Mod ::");String ^dir = this->comboBox2->Items[this->comboBox2->SelectedIndex]->ToString();dir += "\\mods";if ( System::IO::Directory::Exists(dir) ) {cli::array<String ^> ^dirList = System::IO::Directory::GetFiles(dir, "*.cat");for ( int i = 0; i < dirList->Length; i++ ) {this->comboBox3->Items->Add(System::IO::FileInfo(dirList[i]).Name->Replace(System::IO::FileInfo(dirList[i]).Extension, ""));}}this->comboBox3->SelectedIndex = 0;}Utils::String SelectFilesystem::gameDir(){for ( Utils::String dir = _pGameDir->first(); !dir.empty(); dir = _pGameDir->next() ) {if ( dir.Compare(_S(this->comboBox2->Items[this->comboBox2->SelectedIndex]->ToString())) ) {_pGameDir->setSelectedDirectory(dir);return dir;}}return Utils::String::Null();}String ^SelectFilesystem::gameMod(){if ( this->comboBox3->SelectedIndex == 0 ) return nullptr;return this->comboBox3->Items[this->comboBox3->SelectedIndex]->ToString();}}