Rev | Line | |
---|
[278] | 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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.