-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathCFile.cpp
More file actions
71 lines (64 loc) · 1.6 KB
/
CFile.cpp
File metadata and controls
71 lines (64 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "CFile.h"
#include "CApplication.h"
std::vector<CSurface*> CFile::sIcons;
void CFile::Init()
{
for (int i = 0; i <= (int)Type::NONE; i++)
{
sIcons.push_back(new CSurface());
}
sIcons[(int)Type::BIN]->LoadImage("images/icon_bin.png");
sIcons[(int)Type::BMO]->LoadImage("images/icon_bmo.png");
sIcons[(int)Type::BMO1]->LoadImage("images/icon_bmo1.png");
sIcons[(int)Type::CORE]->LoadImage("images/icon_core.png");
sIcons[(int)Type::EXE]->LoadImage("images/icon_exe.png");
sIcons[(int)Type::FOLDER]->LoadImage("images/icon_folder.png");
sIcons[(int)Type::TXT]->LoadImage("images/icon_txt.png");
sIcons[(int)Type::FILE]->LoadImage("images/icon_file.png");
sIcons[(int)Type::G]->LoadImage("images/icon_g.png");
sIcons[(int)Type::Q]->LoadImage("images/icon_q.png");
sIcons[(int)Type::DTH]->LoadImage("images/icon_dth.png");
sIcons[(int)Type::JPG]->LoadImage("images/icon_jpg.png");
sIcons[(int)Type::NONE]->LoadImage("images/icon_none.png");
}
void CFile::Deinit()
{
for (int i = 0; i < sIcons.size(); i++)
{
delete(sIcons[i]);
}
}
CFile::CFile(std::string name, std::string size, Type fileType)
{
mTag = 0;
mName = name;
mSize = size;
mType = fileType;
}
CFile::CFile(std::string name, std::string size, Type fileType, int tag)
{
mTag = tag;
mName = name;
mSize = size;
mType = fileType;
}
CFile::Type CFile::MapType(std::string ext)
{
if (ext == "jpg")
{
return(CFile::Type::JPG);
}
else if (ext == "bin")
{
return(CFile::Type::BIN);
}
else if (ext == "mp4")
{
return(CFile::Type::BMO);
}
else if (ext == "exe")
{
return(CFile::Type::EXE);
}
return(CFile::Type::TXT);
}