Subversion Repositories spk

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
36 cycrow 1
#include "../stdafx.h"
2
#include "SelectFilesystem.h"
3
 
4
namespace Creator {
5
 
6
	void SelectFilesystem::update()
7
	{
8
		for ( int i = 1; i <= m_iHighestGame; i++ ) {
9
			for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
10
				int game = gd->sGame.GetToken(" ", 1, 1).ToInt();
11
				if ( i == game ) {
12
					this->comboBox1->Items->Add(SystemStringFromCyString(gd->sGame.GetToken(" ", 2)));
13
					break;
14
				}
15
			}
16
		}
17
 
18
		this->comboBox1->SelectedIndex = this->comboBox1->Items->Count - 1;
19
	}
20
 
21
	void SelectFilesystem::selectedGame()
22
	{
23
		this->comboBox2->Items->Clear();
24
 
25
		for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
26
			int game = gd->sGame.GetToken(" ", 1, 1).ToInt();
27
			if ( game == this->comboBox1->SelectedIndex + 1 ) {
28
				this->comboBox2->Items->Add(SystemStringFromCyString(gd->sDir));
29
			}
30
		}
31
 
32
		this->comboBox2->SelectedIndex = 0;
33
	}
34
 
35
	void SelectFilesystem::selectedDir()
36
	{
37
		this->comboBox3->Items->Clear();
38
 
39
		this->comboBox3->Items->Add(":: No Mod ::");
40
 
41
		String ^dir = this->comboBox2->Items[this->comboBox2->SelectedIndex]->ToString();
42
		dir += "\\mods";
43
		if ( System::IO::Directory::Exists(dir) ) {
44
			cli::array<String ^> ^dirList = System::IO::Directory::GetFiles(dir, "*.cat");
45
			for ( int i = 0; i < dirList->Length; i++ ) {
46
				this->comboBox3->Items->Add(System::IO::FileInfo(dirList[i]).Name->Replace(System::IO::FileInfo(dirList[i]).Extension, ""));
47
			}
48
		}
49
 
50
		this->comboBox3->SelectedIndex = 0;
51
	}
52
 
53
	SGameDir *SelectFilesystem::gameDir()
54
	{
55
		for ( SGameDir *gd = m_pGameDir->First(); gd; gd = m_pGameDir->Next() ) {
56
			if ( gd->sDir.Compare(CyStringFromSystemString(this->comboBox2->Items[this->comboBox2->SelectedIndex]->ToString())) ) {
57
				return gd;
58
			}
59
		}
60
 
61
		return NULL;
62
	}
63
 
64
	String ^SelectFilesystem::gameMod()
65
	{
66
		if ( this->comboBox3->SelectedIndex == 0 ) return nullptr;
67
		return this->comboBox3->Items[this->comboBox3->SelectedIndex]->ToString();
68
	}
69
}