| 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 |
|
|---|