1 |
< |
#include <string> |
2 |
< |
#include <vector> |
3 |
< |
#include <fstream> |
4 |
< |
|
5 |
< |
using namespace std; |
6 |
< |
static string SLASHSLASH = "//"; |
7 |
< |
static string DIRSLASH = "\\"; |
8 |
< |
struct ModPackage { |
9 |
< |
bool isInstalled; //replace with function |
10 |
< |
string name; |
11 |
< |
string modStringName; |
12 |
< |
int modStringVersion; |
13 |
< |
bool hasOnis; |
14 |
< |
bool hasDeltas; |
15 |
< |
bool hasBSL; |
16 |
< |
bool hasDats; |
17 |
< |
string category; |
18 |
< |
string creator; |
19 |
< |
bool isEngine; |
20 |
< |
string readme; |
21 |
< |
bool globalNeeded; |
22 |
< |
ModPackage(); |
23 |
< |
void doOutput() { |
24 |
< |
cout << "Mod: " << name; cout << "\n"; //remove this when done |
25 |
< |
cout << " String: " << modStringName << " v." << modStringVersion << "\n"; |
26 |
< |
cout << " Category: " << category << "\n"; |
27 |
< |
cout << " Creator: " << creator << "\n"; |
28 |
< |
cout << " HasOnis: " << hasOnis << "\n"; |
29 |
< |
cout << " HasBSL: " << hasBSL << "\n"; |
30 |
< |
cout << " HasDeltas: " << hasDeltas << "\n"; |
31 |
< |
cout << " HasDats: " << hasDats << "\n"; |
32 |
< |
cout << " IsEngine: " << isEngine << "\n"; |
33 |
< |
cout << " GlobalNeeded: " << globalNeeded << "\n"; |
34 |
< |
cout << " Readme: " << readme << "\n"; |
35 |
< |
cout << "\n"; |
36 |
< |
} |
37 |
< |
|
38 |
< |
}; |
39 |
< |
//Initialization |
40 |
< |
ModPackage::ModPackage() { |
41 |
< |
isInstalled = 1; //replace with function |
42 |
< |
name = ""; |
43 |
< |
modStringName = ""; |
44 |
< |
modStringVersion = 0; |
45 |
< |
hasOnis = 0; |
46 |
< |
hasDeltas = 0; |
47 |
< |
hasBSL = 0; |
48 |
< |
hasDats = 0; |
49 |
< |
category = ""; |
50 |
< |
creator = ""; |
51 |
< |
isEngine = 0; |
52 |
< |
readme = ""; |
53 |
< |
globalNeeded = 1; |
54 |
< |
// void doOutput() const |
55 |
< |
// { }; |
56 |
< |
} |
57 |
< |
|
58 |
< |
int mainMenu(); |
59 |
< |
vector<ModPackage> getPackages(); |
60 |
< |
vector<string> getInstallString(); |
61 |
< |
ModPackage fileToModPackage(fstream&); |
62 |
< |
|
63 |
< |
void installPackages(); |
64 |
< |
void uninstallPackages(); |
65 |
< |
void getInstalledPackages(); |
66 |
< |
void RecompileAll( vector<string>); |
67 |
< |
|
68 |
< |
bool getDirectoryContents(char , char &); |
69 |
< |
|
70 |
< |
//stolen token function... |
71 |
< |
void Tokenize(const string& str, |
72 |
< |
vector<string>& tokens, |
73 |
< |
const string& delimiters = " ") |
74 |
< |
{ |
75 |
< |
// Skip delimiters at beginning. |
76 |
< |
string::size_type lastPos = str.find_first_not_of(delimiters, 0); |
77 |
< |
// Find first "non-delimiter". |
78 |
< |
string::size_type pos = str.find_first_of(delimiters, lastPos); |
79 |
< |
|
80 |
< |
while (string::npos != pos || string::npos != lastPos) |
81 |
< |
{ |
82 |
< |
// Found a token, add it to the vector. |
83 |
< |
tokens.push_back(str.substr(lastPos, pos - lastPos)); |
84 |
< |
// Skip delimiters. Note the "not_of" |
85 |
< |
lastPos = str.find_first_not_of(delimiters, pos); |
86 |
< |
// Find next "non-delimiter" |
87 |
< |
pos = str.find_first_of(delimiters, lastPos); |
88 |
< |
} |
89 |
< |
} |
90 |
< |
|
1 |
> |
/* AE/Mod Installer header file */ |
2 |
> |
|
3 |
> |
#include <string> |
4 |
> |
#include <vector> |
5 |
> |
#include <fstream> |
6 |
> |
|
7 |
> |
using namespace std; |
8 |
> |
|
9 |
> |
static string SLASHSLASH = "//"; |
10 |
> |
static string DIRSLASH = "\\"; |
11 |
> |
|
12 |
> |
#define STRUCT_DEFS |
13 |
> |
struct ModPackage |
14 |
> |
{ |
15 |
> |
bool isInstalled; //replace with function |
16 |
> |
string name; |
17 |
> |
string modStringName; |
18 |
> |
int modStringVersion; |
19 |
> |
bool hasOnis; |
20 |
> |
bool hasDeltas; |
21 |
> |
bool hasBSL; |
22 |
> |
bool hasDats; |
23 |
> |
string category; |
24 |
> |
string creator; |
25 |
> |
bool isEngine; |
26 |
> |
string readme; |
27 |
> |
bool globalNeeded; |
28 |
> |
ModPackage(); |
29 |
> |
void doOutput() |
30 |
> |
{ |
31 |
> |
cout << "Mod: " << name; cout << "\n"; // remove this when done |
32 |
> |
cout << " String: " << modStringName << " v." << modStringVersion << "\n"; |
33 |
> |
cout << " Category: " << category << "\n"; |
34 |
> |
cout << " Creator: " << creator << "\n"; |
35 |
> |
cout << " HasOnis: " << hasOnis << "\n"; |
36 |
> |
cout << " HasBSL: " << hasBSL << "\n"; |
37 |
> |
cout << " HasDeltas: " << hasDeltas << "\n"; |
38 |
> |
cout << " HasDats: " << hasDats << "\n"; |
39 |
> |
cout << " IsEngine: " << isEngine << "\n"; |
40 |
> |
cout << " GlobalNeeded: " << globalNeeded << "\n"; |
41 |
> |
cout << " Readme: " << readme << "\n"; |
42 |
> |
cout << "\n"; |
43 |
> |
} |
44 |
> |
|
45 |
> |
}; |
46 |
> |
|
47 |
> |
#define METHOD_DEFS |
48 |
> |
// Initialization to default values |
49 |
> |
ModPackage::ModPackage() |
50 |
> |
{ |
51 |
> |
isInstalled = true; // replace with function |
52 |
> |
name = ""; |
53 |
> |
modStringName = ""; |
54 |
> |
modStringVersion = 0; |
55 |
> |
hasOnis = false; |
56 |
> |
hasDeltas = false; |
57 |
> |
hasBSL = false; |
58 |
> |
hasDats = false; |
59 |
> |
category = ""; |
60 |
> |
creator = ""; |
61 |
> |
isEngine = false; |
62 |
> |
readme = ""; |
63 |
> |
globalNeeded = true; |
64 |
> |
// void doOutput() const |
65 |
> |
// { }; |
66 |
> |
} |
67 |
> |
|
68 |
> |
#define FUNCTION_PROTOTYPES |
69 |
> |
int mainMenu(void); |
70 |
> |
int globalizeData(void); |
71 |
> |
int installPackages(void); |
72 |
> |
int uninstallPackages(void); |
73 |
> |
int listInstalledPackages(void); |
74 |
> |
int printInstallerInfo(void); |
75 |
> |
vector<ModPackage> getPackages(void); |
76 |
> |
ModPackage fileToModPackage(fstream&); |
77 |
> |
void recompileAll(vector<string>); |
78 |
> |
vector<string> getInstallString(void); |
79 |
> |
void tokenize(const string&, vector<string>&, const string& delimiters = " "); |
80 |
> |
//bool getDirectoryContents(char , char &); |