[278] | 1 | #include <string>
|
---|
[290] | 2 | #include <vector>
|
---|
[292] | 3 | #include <fstream>
|
---|
[290] | 4 |
|
---|
[278] | 5 | using namespace std;
|
---|
[298] | 6 | static string SLASHSLASH = "//";
|
---|
| 7 | static string DIRSLASH = "\\";
|
---|
[290] | 8 | struct ModPackage {
|
---|
[293] | 9 | bool isInstalled; //replace with function
|
---|
| 10 | string name;
|
---|
[294] | 11 | string modStringName;
|
---|
| 12 | int modStringVersion;
|
---|
[293] | 13 | bool hasOnis;
|
---|
| 14 | bool hasDeltas;
|
---|
| 15 | bool hasBSL;
|
---|
| 16 | bool hasDats;
|
---|
[294] | 17 | string category;
|
---|
[293] | 18 | string creator;
|
---|
| 19 | bool isEngine;
|
---|
| 20 | string readme;
|
---|
| 21 | bool globalNeeded;
|
---|
[294] | 22 | ModPackage();
|
---|
| 23 | void doOutput() {
|
---|
[298] | 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 | }
|
---|
[294] | 37 |
|
---|
[290] | 38 | };
|
---|
[294] | 39 | //Initialization
|
---|
| 40 | ModPackage::ModPackage() {
|
---|
[298] | 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 | // { };
|
---|
[294] | 56 | }
|
---|
[290] | 57 |
|
---|
| 58 | int mainMenu();
|
---|
| 59 | vector<ModPackage> getPackages();
|
---|
[298] | 60 | vector<string> getInstallString();
|
---|
[293] | 61 | ModPackage fileToModPackage(fstream&);
|
---|
[290] | 62 |
|
---|
[278] | 63 | void installPackages();
|
---|
| 64 | void uninstallPackages();
|
---|
| 65 | void getInstalledPackages();
|
---|
[298] | 66 | void RecompileAll( vector<string>);
|
---|
[278] | 67 |
|
---|
| 68 | bool getDirectoryContents(char , char &);
|
---|
| 69 |
|
---|
[298] | 70 | //stolen token function...
|
---|
[293] | 71 | void Tokenize(const string& str,
|
---|
[294] | 72 | vector<string>& tokens,
|
---|
| 73 | const string& delimiters = " ")
|
---|
[293] | 74 | {
|
---|
[294] | 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);
|
---|
[293] | 79 |
|
---|
[294] | 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 | }
|
---|
[298] | 89 | }
|
---|
| 90 |
|
---|