-
Notifications
You must be signed in to change notification settings - Fork 0
/
Components.cpp
144 lines (125 loc) · 3.27 KB
/
Components.cpp
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#include "Components.h"
int CComponents::m_index_name = 0;
int CComponents::m_index_desc = 0;
int CComponents::m_index_type = 0;
int CComponents::m_index_requ = 0;
int CComponents::m_index_flag = 0;
const wxString CComponents::Flags[] =
{
wxT("checkablealone"),
wxT("dontinheritcheck"),
wxT("exclusive"),
wxT("fixed"),
wxT("restart"),
wxT("disablenouninstallwarning")
};
CComponents::CComponents( void)
{
//ctor
}
CComponents::~CComponents()
{
//dtor
}
void CComponents::Set( wxString Name, wxString Description)
{
m_Name = Name;
m_Description = Description;
}
void CComponents::SetName(wxString name)
{
m_Name = name;
}
void CComponents::SetDescription(wxString description)
{
m_Description = description;
}
void CComponents::SetTypes( wxString types)
{
m_Types = types;
}
void CComponents::SetExtraDiskSpace( wxString extraDiskSpace)
{
m_ExtraDiskSpaceRequired = extraDiskSpace;
}
void CComponents::SetFlags( wxString flag)
{
m_Flags = flag;
}
wxString CComponents::GetName( void)
{
return m_Name;
}
void CComponents::WriteInFile( wxTextFile* File)
{
if( !m_Name.IsEmpty() && !m_Description.IsEmpty())
{
wxString Text;
Text = _T("Name: \"") + m_Name + _T("\"; Description: \"") + m_Description + _T("\"");
if( !m_Types.IsEmpty())
Text += _T("; Types: ") + m_Types;
if( !m_ExtraDiskSpaceRequired.IsEmpty())
Text += _T("; ExtraDiskSpaceRequired: ") + m_ExtraDiskSpaceRequired;
if( !m_Flags.IsEmpty())
Text += _T("; Flags: ") + m_Flags;
CCommon::AddText(Text);
File->AddLine( Text);
}
}
void CComponents::Analize(const wxString& content, const wxString& line)
{
wxString cont = content;
wxString part;
wxString settings;
SetLinenumber(line);
while( !cont.empty())
{
part = cont.BeforeFirst(':');
settings = cont.AfterFirst(':').BeforeFirst(';');
cont = cont.AfterFirst(';');
part = part.Trim(false);
settings = settings.Trim(false);
cont = cont.Trim(false);
if( part.CmpNoCase(_T("Name")) == 0)
{
SetName(settings);
}
else if( part.CmpNoCase(_T("Description")) == 0)
{
SetDescription(settings);
}
else if( part.CmpNoCase(_T("Types")) == 0)
{
SetTypes(settings);
}
else if( part.CmpNoCase(_T("ExtraDiskSpaceRequired")) == 0)
{
SetExtraDiskSpace(settings);
}
else if( part.CmpNoCase(_T("flags")) == 0)
{
SetFlags(settings);
}
else if( CCommon::Analize(part, settings))
;
}
}
void CComponents::FillContent(wxListCtrl* liste)
{
liste->SetItem(GetIndex(), m_index_name, m_Name);
liste->SetItem(GetIndex(), m_index_desc, m_Description);
liste->SetItem(GetIndex(), m_index_type, m_Types);
liste->SetItem(GetIndex(), m_index_requ, m_ExtraDiskSpaceRequired);
liste->SetItem(GetIndex(), m_index_flag, m_Flags);
CCommon::FillContent(liste, GetIndex());
}
void CComponents::AddHeader(wxListCtrl* liste)
{
InsertHeader(liste);
m_index_name = liste->InsertColumn(liste->GetColumnCount(), _T("Name"));
m_index_desc = liste->InsertColumn(liste->GetColumnCount(), _T("Description"));
m_index_type = liste->InsertColumn(liste->GetColumnCount(), _T("Types"));
m_index_requ = liste->InsertColumn(liste->GetColumnCount(), _T("ExtraDiskSpaceRequired"));
m_index_flag = liste->InsertColumn(liste->GetColumnCount(), _T("Flags"));
CCommon::AddHeader(liste);
}