| 1 |
< |
/* |
| 2 |
< |
AE\Mod Installer. |
| 3 |
< |
|
| 4 |
< |
Needs getPackages() now! |
| 5 |
< |
|
| 6 |
< |
*/ |
| 7 |
< |
|
| 8 |
< |
#include <string> |
| 9 |
< |
#include <iostream> |
| 10 |
< |
#include "methods.h" |
| 11 |
< |
#include <vector> |
| 12 |
< |
|
| 13 |
< |
using namespace std; |
| 14 |
< |
bool FALSE = 0; |
| 15 |
< |
bool TRUE = 0; |
| 16 |
< |
|
| 17 |
< |
int mainMenu(void) { |
| 18 |
< |
int choice = '0'; |
| 19 |
< |
bool ok = FALSE; |
| 20 |
< |
cout << "1. Install new packages\n"; |
| 21 |
< |
cout << "2. Uninstall packages\n"; |
| 22 |
< |
cout << "3. See what is installed\n"; |
| 23 |
< |
cout << "4. About AE\n"; |
| 24 |
< |
cout << "5. Quit\n\n"; |
| 25 |
< |
|
| 26 |
< |
do { |
| 27 |
< |
ok = TRUE; |
| 28 |
< |
choice = cin.get(); |
| 29 |
< |
cin.ignore(1); |
| 30 |
< |
switch(choice) { |
| 31 |
< |
case '1': |
| 32 |
< |
installPackages(); |
| 33 |
< |
break; |
| 34 |
< |
case '2': |
| 35 |
< |
uninstallPackages(); |
| 36 |
< |
break; |
| 37 |
< |
case '3': |
| 38 |
< |
//listInstalledPackages(); |
| 39 |
< |
break; |
| 40 |
< |
case '5': |
| 41 |
< |
return 0; |
| 42 |
< |
default: |
| 43 |
< |
ok = FALSE; |
| 44 |
< |
} |
| 45 |
< |
} while(ok == FALSE); |
| 46 |
< |
return 0; |
| 47 |
< |
} |
| 48 |
< |
void main(void) |
| 49 |
< |
{ |
| 50 |
< |
|
| 51 |
< |
// SetConsoleTitle("AE Installer"); windows junk, convert to SDL |
| 52 |
< |
// system("color 0A"); |
| 53 |
< |
cout << "\nWelcome to the AE installer!\n"; |
| 54 |
< |
|
| 55 |
< |
cout << "\nWhat would you like to do?\n"; |
| 56 |
< |
|
| 57 |
< |
mainMenu(); |
| 58 |
< |
|
| 59 |
< |
|
| 60 |
< |
} |
| 61 |
< |
|
| 62 |
< |
|
| 63 |
< |
void installPackages() { |
| 64 |
< |
ModPackage package; |
| 65 |
< |
vector<string> installed_packages; |
| 66 |
< |
vector<ModPackage> packages; // = getPackages() |
| 67 |
< |
vector<ModPackage>::iterator iter; |
| 68 |
< |
iter = packages.begin(); |
| 69 |
< |
|
| 70 |
< |
if (packages.empty()) { |
| 71 |
< |
cout << "Error: You have no packages!\n"; |
| 72 |
< |
return; |
| 73 |
< |
} |
| 74 |
< |
|
| 75 |
< |
cout << "Detecting installed packages...\n"; |
| 76 |
< |
|
| 77 |
< |
for(int i = 0; i < packages.size();) { |
| 78 |
< |
package = *iter; |
| 79 |
< |
if(!package.isInstalled){ |
| 80 |
< |
packages.erase(iter); |
| 81 |
< |
} |
| 82 |
< |
else { |
| 83 |
< |
i++; |
| 84 |
< |
iter++; |
| 85 |
< |
} |
| 86 |
< |
|
| 87 |
< |
} |
| 88 |
< |
|
| 89 |
< |
if (packages.empty()) { |
| 90 |
< |
cout << "Error: You have no installed packages!\n"; |
| 91 |
< |
return; |
| 92 |
< |
} |
| 93 |
< |
|
| 94 |
< |
//listInstalledPackages(packages); |
| 95 |
< |
|
| 96 |
< |
} |
| 97 |
< |
void uninstallPackages() { |
| 98 |
< |
; |
| 99 |
< |
} |
| 100 |
< |
|
| 101 |
< |
void getInstalledPackages() { |
| 102 |
< |
; |
| 103 |
< |
} |
| 1 |
> |
/* |
| 2 |
> |
AE\Mod Installer. |
| 3 |
> |
|
| 4 |
> |
Needs getPackages() now! |
| 5 |
> |
|
| 6 |
> |
*/ |
| 7 |
> |
|
| 8 |
> |
#include <string> |
| 9 |
> |
#include <iostream> |
| 10 |
> |
#include "methods.h" |
| 11 |
> |
#include <vector> |
| 12 |
> |
|
| 13 |
> |
using namespace std; |
| 14 |
> |
bool FALSE = 0; |
| 15 |
> |
bool TRUE = 0; |
| 16 |
> |
|
| 17 |
> |
|
| 18 |
> |
int main(void) |
| 19 |
> |
{ |
| 20 |
> |
|
| 21 |
> |
// SetConsoleTitle("AE Installer"); windows junk, convert to SDL |
| 22 |
> |
// system("color 0A"); |
| 23 |
> |
cout << "\nWelcome to the AE installer!\n"; |
| 24 |
> |
|
| 25 |
> |
cout << "\nWhat would you like to do?\n"; |
| 26 |
> |
|
| 27 |
> |
return mainMenu(); |
| 28 |
> |
|
| 29 |
> |
|
| 30 |
> |
} |
| 31 |
> |
|
| 32 |
> |
int mainMenu(void) { |
| 33 |
> |
int choice = '0'; |
| 34 |
> |
bool ok = FALSE; |
| 35 |
> |
cout << "1. Install new packages\n"; |
| 36 |
> |
cout << "2. Uninstall packages\n"; |
| 37 |
> |
cout << "3. See what is installed\n"; |
| 38 |
> |
cout << "4. About AE\n"; |
| 39 |
> |
cout << "5. Quit\n\n"; |
| 40 |
> |
|
| 41 |
> |
do { |
| 42 |
> |
ok = TRUE; |
| 43 |
> |
choice = cin.get(); |
| 44 |
> |
cin.ignore(1); |
| 45 |
> |
switch(choice) { |
| 46 |
> |
case '1': |
| 47 |
> |
installPackages(); |
| 48 |
> |
break; |
| 49 |
> |
case '2': |
| 50 |
> |
uninstallPackages(); |
| 51 |
> |
break; |
| 52 |
> |
case '3': |
| 53 |
> |
//listInstalledPackages(); |
| 54 |
> |
break; |
| 55 |
> |
case '5': |
| 56 |
> |
return 0; |
| 57 |
> |
default: |
| 58 |
> |
ok = FALSE; |
| 59 |
> |
} |
| 60 |
> |
} while(ok == FALSE); |
| 61 |
> |
return 0; |
| 62 |
> |
} |
| 63 |
> |
|
| 64 |
> |
|
| 65 |
> |
void installPackages() { |
| 66 |
> |
ModPackage package; |
| 67 |
> |
vector<string> installed_packages; |
| 68 |
> |
vector<ModPackage> packages; // = getPackages() |
| 69 |
> |
vector<ModPackage>::iterator iter; |
| 70 |
> |
iter = packages.begin(); |
| 71 |
> |
|
| 72 |
> |
if (packages.empty()) { |
| 73 |
> |
cout << "Error: You have no packages!\n"; |
| 74 |
> |
return; |
| 75 |
> |
} |
| 76 |
> |
|
| 77 |
> |
cout << "Detecting installed packages...\n"; |
| 78 |
> |
|
| 79 |
> |
for(int i = 0; i < packages.size();) { |
| 80 |
> |
package = *iter; |
| 81 |
> |
if(!package.isInstalled){ |
| 82 |
> |
packages.erase(iter); |
| 83 |
> |
} |
| 84 |
> |
else { |
| 85 |
> |
i++; |
| 86 |
> |
iter++; |
| 87 |
> |
} |
| 88 |
> |
|
| 89 |
> |
} |
| 90 |
> |
|
| 91 |
> |
if (packages.empty()) { |
| 92 |
> |
cout << "Error: You have no installed packages!\n"; |
| 93 |
> |
return; |
| 94 |
> |
} |
| 95 |
> |
|
| 96 |
> |
//listInstalledPackages(packages); |
| 97 |
> |
|
| 98 |
> |
} |
| 99 |
> |
void uninstallPackages() { |
| 100 |
> |
; |
| 101 |
> |
} |
| 102 |
> |
|
| 103 |
> |
void getInstalledPackages() { |
| 104 |
> |
; |
| 105 |
> |
} |