diff --git a/README.md b/README.md index 41b5b11..22cd5ff 100755 --- a/README.md +++ b/README.md @@ -17,3 +17,4 @@ A homebrew application for the Nintendo Switch that will automatically update yo * Thanks to vgmoose for examples on using minizip in appstorenx. * Thanks to y4my4m and natinusala in the ReSwitched discord for their discussions around libcurl. +* Thanks to alex. for improving the config and other elements in FileManager. diff --git a/source/AssetManager.cpp b/source/AssetManager.cpp index 096651e..be2e482 100755 --- a/source/AssetManager.cpp +++ b/source/AssetManager.cpp @@ -20,7 +20,7 @@ using namespace std; -namespace ku { +namespace dsu { void AssetManager::dealloc() { if (AssetManager::large_button_font != NULL) TTF_CloseFont(AssetManager::large_button_font); diff --git a/source/AssetManager.hpp b/source/AssetManager.hpp index 68ac80b..95c5315 100755 --- a/source/AssetManager.hpp +++ b/source/AssetManager.hpp @@ -23,7 +23,7 @@ #include #include -namespace ku { +namespace dsu { class AssetManager { public: /* Textures */ diff --git a/source/ConfigManager.cpp b/source/ConfigManager.cpp index 80e363a..f76f786 100755 --- a/source/ConfigManager.cpp +++ b/source/ConfigManager.cpp @@ -19,7 +19,7 @@ using namespace std; -namespace ku { +namespace dsu { void ConfigManager::initialize() { config_init(&_cfg); config_init(&_internalDb); @@ -36,8 +36,8 @@ namespace ku { setting = config_setting_add(root, RECEIVED_EXFAT_WARNING_KEY.c_str(), CONFIG_TYPE_BOOL); config_setting_set_bool(setting, RECEIVED_EXFAT_WARNING_DEF); - setting = config_setting_add(root, RECEIVED_IGNORE_CONFIG_WARNING_KEY.c_str(), CONFIG_TYPE_BOOL); - config_setting_set_bool(setting, RECEIVED_IGNORE_CONFIG_WARNING_DEF); + // setting = config_setting_add(root, RECEIVED_IGNORE_CONFIG_WARNING_KEY.c_str(), CONFIG_TYPE_BOOL); + // config_setting_set_bool(setting, RECEIVED_IGNORE_CONFIG_WARNING_DEF); setting = config_setting_add(root, IGNORE_CONFIG_FILES_KEY.c_str(), CONFIG_TYPE_BOOL); config_setting_set_bool(setting, IGNORE_CONFIG_FILES_DEF); @@ -116,12 +116,10 @@ namespace ku { return _readInt(CONFIG_VERSION_KEY, CONFIG_VERSION_DEF, _cfg); } - bool ConfigManager::setFilesToIgnore(vector files) { return _appendArrayOfStrings(IGNORE_KEY, files, _cfg, CONFIG_FILENAME); } - string ConfigManager::getCurrentVersion() { return _readString(VERSION_KEY, VERSION_DEF, _internalDb); } @@ -135,9 +133,9 @@ namespace ku { return _readBoolean(RECEIVED_EXFAT_WARNING_KEY, RECEIVED_EXFAT_WARNING_DEF, _internalDb); } - bool ConfigManager::getReceivedIgnoreConfigWarning() { - return _readBoolean(RECEIVED_IGNORE_CONFIG_WARNING_KEY, RECEIVED_IGNORE_CONFIG_WARNING_DEF, _internalDb); - } + // bool ConfigManager::getReceivedIgnoreConfigWarning() { + // return _readBoolean(RECEIVED_IGNORE_CONFIG_WARNING_KEY, RECEIVED_IGNORE_CONFIG_WARNING_DEF, _internalDb); + // } bool ConfigManager::getIgnoreConfigFiles() { return _readBoolean(IGNORE_CONFIG_FILES_KEY, IGNORE_CONFIG_FILES_DEF, _internalDb); @@ -147,7 +145,6 @@ namespace ku { return _readInt(CONFIG_VERSION_KEY, CONFIG_VERSION_DEF, _internalDb); } - bool ConfigManager::setCurrentVersion(string version) { return _writeString(VERSION_KEY, version, _internalDb, INTERNAL_FILENAME); } @@ -160,9 +157,9 @@ namespace ku { return _writeBoolean(RECEIVED_EXFAT_WARNING_KEY, received, _internalDb, INTERNAL_FILENAME); } - bool ConfigManager::setReceivedIgnoreConfigWarning(bool received) { - return _writeBoolean(RECEIVED_IGNORE_CONFIG_WARNING_KEY, received, _internalDb, INTERNAL_FILENAME); - } + // bool ConfigManager::setReceivedIgnoreConfigWarning(bool received) { + // return _writeBoolean(RECEIVED_IGNORE_CONFIG_WARNING_KEY, received, _internalDb, INTERNAL_FILENAME); + // } bool ConfigManager::setIgnoreConfigFiles(bool ignore) { return _writeBoolean(IGNORE_CONFIG_FILES_KEY, ignore, _internalDb, INTERNAL_FILENAME); diff --git a/source/ConfigManager.hpp b/source/ConfigManager.hpp index 01b44cc..a1ec89d 100755 --- a/source/ConfigManager.hpp +++ b/source/ConfigManager.hpp @@ -21,7 +21,7 @@ #include #include -namespace ku { +namespace dsu { class ConfigManager { public: static void initialize(); @@ -40,14 +40,14 @@ namespace ku { static std::string getCurrentVersion(); static std::vector getInstalledFiles(); static bool getReceivedExFATWarning(); - static bool getReceivedIgnoreConfigWarning(); + // static bool getReceivedIgnoreConfigWarning(); static bool getIgnoreConfigFiles(); static int getInternalConfigVersion(); static bool setCurrentVersion(std::string version); static bool setInstalledFiles(std::vector files); static bool setReceivedExFATWarning(bool received); - static bool setReceivedIgnoreConfigWarning(bool received); + // static bool setReceivedIgnoreConfigWarning(bool received); static bool setIgnoreConfigFiles(bool ignore); private: @@ -99,8 +99,8 @@ namespace ku { static inline const std::string RECEIVED_EXFAT_WARNING_KEY = "received_exfat_warning"; static inline const bool RECEIVED_EXFAT_WARNING_DEF = false; - static inline const std::string RECEIVED_IGNORE_CONFIG_WARNING_KEY = "received_ignore_config_warning"; - static inline const bool RECEIVED_IGNORE_CONFIG_WARNING_DEF = false; + // static inline const std::string RECEIVED_IGNORE_CONFIG_WARNING_KEY = "received_ignore_config_warning"; + // static inline const bool RECEIVED_IGNORE_CONFIG_WARNING_DEF = false; static inline const std::string IGNORE_CONFIG_FILES_KEY = "ignore_config_files"; static inline const bool IGNORE_CONFIG_FILES_DEF = false; diff --git a/source/FileManager.cpp b/source/FileManager.cpp index 180c2d9..4f10454 100755 --- a/source/FileManager.cpp +++ b/source/FileManager.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "FileManager.hpp" @@ -30,24 +31,26 @@ using namespace simpleIniParser; using namespace std; +namespace fs = std::filesystem; -namespace ku +namespace dsu { - std::vector FileManager::readFile(std::string path) + vector FileManager::readFile(string path) { - std::ifstream file; - file.open(path, std::ios::in | std::ios::binary | std::ios::ate); + ifstream file; + file.open(path, ios::in | ios::binary | ios::ate); auto size = file.tellg(); - file.seekg(0, std::ios::beg); + file.seekg(0, ios::beg); - std::vector buffer(size); + vector buffer(size); file.read(buffer.data(), size); file.close(); return buffer; } + // Overwrites a file if it already exists! bool FileManager::writeFile(string filename, string data) { deleteFile(filename); @@ -67,9 +70,23 @@ namespace ku return (result == data.size()); } + bool FileManager::appendFile(string filename, string data) + { + ofstream file; + // Make sure we are only adding, not overwriting. + file.open(filename, ios_base::app); + + if(!file.is_open()) return false; + + file << data; + + file.close(); + return true; + } + bool FileManager::deleteFile(string filename) { - if (fileExists(filename)) + if (fs::exists(filename)) { return remove(filename.c_str()) == 0; } @@ -79,19 +96,34 @@ namespace ku bool FileManager::fileExists(string filename) { - FILE *file = fopen(filename.c_str(), "r"); - - if (file) - { - fflush(file); - fsync(fileno(file)); - fclose(file); - return true; - } - + if(fs::exists(filename)) return true; return false; } + // This scans all FILES in the given directory and it's respective subdirs. + vector FileManager::scanDirectoryRecursive(string path) + { + vector files; + + // First check if the dir even exists. + if(fs::exists(path)) + { + // Then make sure it's actually a directory, and not a file. All before + // iterating all of the files in the directory. + if(fs::is_directory(path)) + { + for (auto ft : fs::recursive_directory_iterator(path)) + { + if(ft.is_directory()) continue; + string path = ft.path().string(); + + files.push_back(path); + } + } + } + return files; + } + // http://stackoverflow.com/a/11366985 bool FileManager::createSubfolder(string path) { @@ -127,6 +159,7 @@ namespace ku bool FileManager::extract(string zipFilename, string destination) { unzFile unz = unzOpen(zipFilename.c_str()); + vector filesToIgnore = ConfigManager::getFilesToIgnore(); vector filesInstalled = ConfigManager::getInstalledFiles(); @@ -367,4 +400,4 @@ namespace ku unzCloseCurrentFile(unz); return 0; } -} // namespace ku +} // namespace dsu diff --git a/source/FileManager.hpp b/source/FileManager.hpp index dd0ea20..dfc72e5 100755 --- a/source/FileManager.hpp +++ b/source/FileManager.hpp @@ -21,13 +21,15 @@ #include #include -namespace ku { +namespace dsu { class FileManager { public: static std::vector readFile(std::string path); static bool writeFile(std::string filename, std::string data); static bool deleteFile(std::string filename); + static bool appendFile(std::string filename, std::string data); static bool fileExists(std::string filename); + static std::vector scanDirectoryRecursive(std::string path); static bool createSubfolder(std::string path); static bool extract(std::string filename, std::string destination); static void cleanUpFiles(); diff --git a/source/ModalView.cpp b/source/ModalView.cpp index dbad88f..a543ee3 100755 --- a/source/ModalView.cpp +++ b/source/ModalView.cpp @@ -18,7 +18,7 @@ #include "ModalView.hpp" #include "SceneDirector.hpp" -namespace ku { +namespace dsu { void ModalView::show() { SceneDirector::modal = this; } diff --git a/source/ModalView.hpp b/source/ModalView.hpp index 23f0734..2cb89b1 100755 --- a/source/ModalView.hpp +++ b/source/ModalView.hpp @@ -24,8 +24,8 @@ #include "View.hpp" -namespace ku { - class ModalView : public ku::View { +namespace dsu { + class ModalView : public dsu::View { public: std::function onDismiss; diff --git a/source/Scene.cpp b/source/Scene.cpp index 46d747a..d07866a 100755 --- a/source/Scene.cpp +++ b/source/Scene.cpp @@ -17,7 +17,7 @@ #include "Scene.hpp" -namespace ku { +namespace dsu { Scene::Scene() { _touchedView = NULL; } diff --git a/source/Scene.hpp b/source/Scene.hpp index 92d9363..7e3a47c 100755 --- a/source/Scene.hpp +++ b/source/Scene.hpp @@ -23,7 +23,7 @@ #include "View.hpp" -namespace ku { +namespace dsu { class Scene { public: Scene(); diff --git a/source/SceneDirector.cpp b/source/SceneDirector.cpp index 7a98eb4..aad9c1f 100755 --- a/source/SceneDirector.cpp +++ b/source/SceneDirector.cpp @@ -21,9 +21,9 @@ #include "ConfigManager.hpp" #include "SceneDirector.hpp" -using namespace ku::scenes; +using namespace dsu::scenes; -namespace ku +namespace dsu { SceneDirector::SceneDirector() { @@ -222,4 +222,4 @@ namespace ku SDL_RenderPresent(SceneDirector::renderer); } -} // namespace ku +} // namespace dsu diff --git a/source/SceneDirector.hpp b/source/SceneDirector.hpp index fbe3f06..8da3b95 100755 --- a/source/SceneDirector.hpp +++ b/source/SceneDirector.hpp @@ -26,7 +26,7 @@ #include "scenes/PackageDownloadScene.hpp" #include "scenes/PackageSelectScene.hpp" -namespace ku { +namespace dsu { typedef enum { SCENE_EXFAT_WARNING, SCENE_APP_UPDATE, diff --git a/source/View.cpp b/source/View.cpp index 131a1dc..39d44bd 100755 --- a/source/View.cpp +++ b/source/View.cpp @@ -17,7 +17,7 @@ #include "View.hpp" -namespace ku { +namespace dsu { View::View() { frame = { 0, 0, 0, 0 }; hidden = false; diff --git a/source/View.hpp b/source/View.hpp index 0f66749..9049609 100755 --- a/source/View.hpp +++ b/source/View.hpp @@ -20,7 +20,7 @@ #include #include -namespace ku { +namespace dsu { class View { public: SDL_Rect frame; diff --git a/source/main.cpp b/source/main.cpp index 82a4e19..5adea95 100755 --- a/source/main.cpp +++ b/source/main.cpp @@ -20,11 +20,12 @@ #include #include +#include "FileManager.hpp" #include "AssetManager.hpp" #include "ConfigManager.hpp" #include "SceneDirector.hpp" -using namespace ku; +using namespace dsu; using namespace std; using namespace swurl; @@ -33,9 +34,7 @@ int main(int argc, char **argv) SessionManager::initialize(); SessionManager::userAgent = string("DeepSea-updater/") + VERSION; - #ifdef DEBUG - nxlinkStdio(); - #endif + nxlinkStdio(); ConfigManager::initialize(); diff --git a/source/models/Action.cpp b/source/models/Action.cpp index 2124e14..c2fd1d4 100755 --- a/source/models/Action.cpp +++ b/source/models/Action.cpp @@ -19,7 +19,7 @@ using namespace std; -namespace ku::models { +namespace dsu::models { Action::Action(ActionButton actionButton, string actionText) { button = actionButton; text = actionText; diff --git a/source/models/Action.hpp b/source/models/Action.hpp index 63525fa..2bf7177 100755 --- a/source/models/Action.hpp +++ b/source/models/Action.hpp @@ -20,7 +20,7 @@ #include #include -namespace ku::models { +namespace dsu::models { typedef enum { A_BUTTON, B_BUTTON, diff --git a/source/models/Touch.cpp b/source/models/Touch.cpp index d1af8fe..c635274 100755 --- a/source/models/Touch.cpp +++ b/source/models/Touch.cpp @@ -17,5 +17,5 @@ #include "Touch.hpp" -namespace ku::models { +namespace dsu::models { } \ No newline at end of file diff --git a/source/models/Touch.hpp b/source/models/Touch.hpp index 1451977..f1f5bbe 100755 --- a/source/models/Touch.hpp +++ b/source/models/Touch.hpp @@ -17,7 +17,7 @@ #pragma once -namespace ku::models { +namespace dsu::models { class Touch { }; } \ No newline at end of file diff --git a/source/scenes/AppUpdateScene.cpp b/source/scenes/AppUpdateScene.cpp index ad3c641..b72412c 100755 --- a/source/scenes/AppUpdateScene.cpp +++ b/source/scenes/AppUpdateScene.cpp @@ -23,14 +23,14 @@ #include "../FileManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; -using namespace ku::models; -using namespace ku::views; +using namespace dsu; +using namespace dsu::models; +using namespace dsu::views; using namespace std; using namespace std::placeholders; using namespace swurl; -namespace ku::scenes +namespace dsu::scenes { AppUpdateScene::AppUpdateScene() { @@ -285,4 +285,4 @@ namespace ku::scenes { _showStatus(error, "Please restart the app to try again."); } -} // namespace ku::scenes +} // namespace dsu::scenes diff --git a/source/scenes/AppUpdateScene.hpp b/source/scenes/AppUpdateScene.hpp index 85eae61..72875ec 100755 --- a/source/scenes/AppUpdateScene.hpp +++ b/source/scenes/AppUpdateScene.hpp @@ -27,8 +27,8 @@ #include "../views/StatusView.hpp" #include "../views/UpdateView.hpp" -namespace ku::scenes { - class AppUpdateScene : public ku::Scene { +namespace dsu::scenes { + class AppUpdateScene : public dsu::Scene { public: AppUpdateScene(); ~AppUpdateScene(); @@ -37,10 +37,10 @@ namespace ku::scenes { void render(SDL_Rect rect, double dTime); private: - ku::views::HeaderView * _headerView = NULL; - ku::views::UpdateView * _updateView = NULL; - ku::views::StatusView * _statusView = NULL; - ku::views::FooterView * _footerView = NULL; + dsu::views::HeaderView * _headerView = NULL; + dsu::views::UpdateView * _updateView = NULL; + dsu::views::StatusView * _statusView = NULL; + dsu::views::FooterView * _footerView = NULL; swurl::WebRequest * _appVersionRequest = NULL; swurl::WebRequest * _appRequest = NULL; diff --git a/source/scenes/ExFatWarningScene.cpp b/source/scenes/ExFatWarningScene.cpp index ff8202f..c905420 100755 --- a/source/scenes/ExFatWarningScene.cpp +++ b/source/scenes/ExFatWarningScene.cpp @@ -21,10 +21,10 @@ #include "../ConfigManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; -using namespace ku::views; +using namespace dsu; +using namespace dsu::views; -namespace ku::scenes { +namespace dsu::scenes { ExFatWarningScene::ExFatWarningScene() { _timeSpent = -10000; _footerVisible = false; diff --git a/source/scenes/ExFatWarningScene.hpp b/source/scenes/ExFatWarningScene.hpp index 29f9306..4ab95fe 100755 --- a/source/scenes/ExFatWarningScene.hpp +++ b/source/scenes/ExFatWarningScene.hpp @@ -22,8 +22,8 @@ #include "../Scene.hpp" #include "../views/TextView.hpp" -namespace ku::scenes { - class ExFatWarningScene : public ku::Scene { +namespace dsu::scenes { + class ExFatWarningScene : public dsu::Scene { public: ExFatWarningScene(); ~ExFatWarningScene(); @@ -35,8 +35,8 @@ namespace ku::scenes { double _timeSpent; bool _footerVisible; - ku::views::TextView * _headerTextView; - ku::views::TextView * _bodyTextView; - ku::views::TextView * _footerTextView; + dsu::views::TextView * _headerTextView; + dsu::views::TextView * _bodyTextView; + dsu::views::TextView * _footerTextView; }; } diff --git a/source/scenes/PackageDownloadScene.cpp b/source/scenes/PackageDownloadScene.cpp index eca8684..2198e79 100755 --- a/source/scenes/PackageDownloadScene.cpp +++ b/source/scenes/PackageDownloadScene.cpp @@ -31,15 +31,15 @@ static __attribute__((aligned(0x1000))) u8 g_ff_page[0x1000]; static __attribute__((aligned(0x1000))) u8 g_work_page[0x1000]; -using namespace ku; -using namespace ku::models; -using namespace ku::views; +using namespace dsu; +using namespace dsu::models; +using namespace dsu::views; using namespace simpleIniParser; using namespace std; using namespace std::placeholders; using namespace swurl; -namespace ku::scenes { +namespace dsu::scenes { PackageDownloadScene::PackageDownloadScene() { SessionManager::onProgressChanged = bind(&PackageDownloadScene::_onProgressUpdate, this, _1, _2); SessionManager::onCompleted = bind(&PackageDownloadScene::_onCompleted, this, _1); diff --git a/source/scenes/PackageDownloadScene.hpp b/source/scenes/PackageDownloadScene.hpp index 35cd1da..d33f8ce 100755 --- a/source/scenes/PackageDownloadScene.hpp +++ b/source/scenes/PackageDownloadScene.hpp @@ -28,8 +28,8 @@ #include "../views/StatusView.hpp" #include "../views/UpdateView.hpp" -namespace ku::scenes { - class PackageDownloadScene : public ku::Scene { +namespace dsu::scenes { + class PackageDownloadScene : public dsu::Scene { public: PackageDownloadScene(); ~PackageDownloadScene(); @@ -38,11 +38,11 @@ namespace ku::scenes { void render(SDL_Rect rect, double dTime); private: - ku::views::HeaderView * _headerView = NULL; - ku::views::UpdateView * _updateView = NULL; - ku::views::StatusView * _statusView = NULL; - ku::views::FooterView * _footerView = NULL; - ku::views::AlertView * _restartAlertView = NULL; + dsu::views::HeaderView * _headerView = NULL; + dsu::views::UpdateView * _updateView = NULL; + dsu::views::StatusView * _statusView = NULL; + dsu::views::FooterView * _footerView = NULL; + dsu::views::AlertView * _restartAlertView = NULL; std::string _DeepSeaVersion = ""; @@ -53,7 +53,7 @@ namespace ku::scenes { void _clearIram(); void _showStatus(std::string text, std::string subtext, bool wasSuccessful); - void _onAlertViewDismiss(ku::ModalView * view, bool success); + void _onAlertViewDismiss(dsu::ModalView * view, bool success); std::string _getVersionNumber(std::string version); void _onProgressUpdate(swurl::WebRequest * request, double progress); diff --git a/source/scenes/PackageSelectScene.cpp b/source/scenes/PackageSelectScene.cpp index ad0e85f..b2d4a11 100755 --- a/source/scenes/PackageSelectScene.cpp +++ b/source/scenes/PackageSelectScene.cpp @@ -21,15 +21,16 @@ #include "../ConfigManager.hpp" #include "../SceneDirector.hpp" +#include "../FileManager.hpp" -using namespace ku; -using namespace ku::models; -using namespace ku::views; +using namespace dsu; +using namespace dsu::models; +using namespace dsu::views; using namespace std; using namespace std::placeholders; using namespace swurl; -namespace ku::scenes +namespace dsu::scenes { PackageSelectScene::PackageSelectScene() { @@ -60,7 +61,7 @@ namespace ku::scenes vector buttons; buttons.push_back("Yes"); buttons.push_back("No"); - _ignoreConfigsAlertView = new AlertView("Ignore Config Files?", "Would you like for DeepSea Updater to ignore config\nfiles? This will prevent DeepSea Updater from overwriting\nall config files except for Hekate's main config file.", buttons); + _ignoreConfigsAlertView = new AlertView("Ignore Config Files?", "Would you like for DeepSea Updater to ignore config\nfiles? This will prevent DeepSea Updater from overwriting\nall config files except for Hekate's main config file, and save the\nignored files for next time as well.", buttons); _ignoreConfigsAlertView->onDismiss = bind(&PackageSelectScene::_onAlertViewDismiss, this, _1, _2); addSubView(_headerView); @@ -141,11 +142,11 @@ namespace ku::scenes void PackageSelectScene::_showPackageSelectViews(std::string DeepSeaVersion) { - if (!ConfigManager::getReceivedIgnoreConfigWarning()) - { - _ignoreConfigsAlertView->show(); - } - + // if (!ConfigManager::getReceivedIgnoreConfigWarning()) + // { + _ignoreConfigsAlertView->show(); + // } + _updateView->hidden = true; _statusView->hidden = true; @@ -203,26 +204,30 @@ namespace ku::scenes { if (success && _ignoreConfigsAlertView->getSelectedOption() == 0) { - vector files; + vector files = FileManager::scanDirectoryRecursive("sdmc:/config"); + vector filesToIgnore = ConfigManager::getFilesToIgnore(); files.push_back("sdmc:/atmosphere/config/BCT.ini"); files.push_back("sdmc:/atmosphere/config/override_config.ini"); files.push_back("sdmc:/atmosphere/config/system_settings.ini"); files.push_back("sdmc:/bootloader/patches.ini"); files.push_back("sdmc:/bootloader/hekate_ipl.ini"); - files.push_back("sdmc:/config/hid_mitm/config.ini"); - files.push_back("sdmc:/config/sys-clk/config.ini"); - files.push_back("sdmc:/config/sys-ftpd/config.ini"); - files.push_back("sdmc:/config/sys-screenuploader/config.ini"); - files.push_back("sdmc:/config/nx-hbmenu/settings.cfg"); - files.push_back("sdmc:/config/hid_mitm/config.ini"); files.push_back("sdmc:/switch/DeepSea-Toolbox/config.json"); files.push_back("sdmc:/switch/DeepSea-Updater/internal.db"); files.push_back("sdmc:/switch/DeepSea-Updater/settings.cfg"); - ConfigManager::setFilesToIgnore(files); + + if(filesToIgnore.empty()) + { + ConfigManager::setFilesToIgnore(files); + } else { + for (auto i : filesToIgnore) + { + files.erase(remove(files.begin(), files.end(), i), files.end()); + } + } ConfigManager::setIgnoreConfigFiles(true); + } else { + ConfigManager::setIgnoreConfigFiles(false); } - - ConfigManager::setReceivedIgnoreConfigWarning(true); } // Swurl Callback Methods @@ -269,4 +274,4 @@ namespace ku::scenes { _showStatusView(error, "Please restart the app to try again."); } -} // namespace ku::scenes +} // namespace dsu::scenes diff --git a/source/scenes/PackageSelectScene.hpp b/source/scenes/PackageSelectScene.hpp index 675bcf4..6b1ff8f 100755 --- a/source/scenes/PackageSelectScene.hpp +++ b/source/scenes/PackageSelectScene.hpp @@ -28,8 +28,8 @@ #include "../views/UpdateView.hpp" #include "../views/AlertView.hpp" -namespace ku::scenes { - class PackageSelectScene : public ku::Scene { +namespace dsu::scenes { + class PackageSelectScene : public dsu::Scene { public: PackageSelectScene(); ~PackageSelectScene(); @@ -38,12 +38,12 @@ namespace ku::scenes { void render(SDL_Rect rect, double dTime); private: - ku::views::HeaderView * _headerView = NULL; - ku::views::UpdateView * _updateView = NULL; - ku::views::StatusView * _statusView = NULL; - ku::views::ListRowView * _installRowView = NULL; - ku::views::FooterView * _footerView = NULL; - ku::views::AlertView * _ignoreConfigsAlertView = NULL; + dsu::views::HeaderView * _headerView = NULL; + dsu::views::UpdateView * _updateView = NULL; + dsu::views::StatusView * _statusView = NULL; + dsu::views::ListRowView * _installRowView = NULL; + dsu::views::FooterView * _footerView = NULL; + dsu::views::AlertView * _ignoreConfigsAlertView = NULL; swurl::WebRequest * _DeepSeaVersionRequest = NULL; @@ -51,7 +51,7 @@ namespace ku::scenes { void _showPackageSelectViews(std::string DeepSeaVersion); void _showStatusView(std::string text, std::string subtext); - void _onAlertViewDismiss(ku::ModalView * view, bool success); + void _onAlertViewDismiss(dsu::ModalView * view, bool success); void _onProgressUpdate(swurl::WebRequest * request, double progress); void _onCompleted(swurl::WebRequest * request); diff --git a/source/views/AlertButtonView.cpp b/source/views/AlertButtonView.cpp index 214b842..4fde63c 100755 --- a/source/views/AlertButtonView.cpp +++ b/source/views/AlertButtonView.cpp @@ -20,10 +20,10 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; using namespace std; -namespace ku::views { +namespace dsu::views { AlertButtonView::AlertButtonView(string title, bool hasFocus, SDL_Rect rect) { frame = rect; diff --git a/source/views/AlertButtonView.hpp b/source/views/AlertButtonView.hpp index 34366f6..8918126 100755 --- a/source/views/AlertButtonView.hpp +++ b/source/views/AlertButtonView.hpp @@ -22,7 +22,7 @@ #include "ControlView.hpp" #include "TextView.hpp" -namespace ku::views { +namespace dsu::views { class AlertButtonView : public ControlView { public: bool isLast; diff --git a/source/views/AlertView.cpp b/source/views/AlertView.cpp index 346279c..83aea42 100755 --- a/source/views/AlertView.cpp +++ b/source/views/AlertView.cpp @@ -22,10 +22,10 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; using namespace std; -namespace ku::views { +namespace dsu::views { AlertView::AlertView(string title, string message, vector buttons) { _focusSelection = 0; _alertHeight = 203; diff --git a/source/views/AlertView.hpp b/source/views/AlertView.hpp index d864585..ba96829 100755 --- a/source/views/AlertView.hpp +++ b/source/views/AlertView.hpp @@ -26,8 +26,8 @@ #include "../ModalView.hpp" #include "TextView.hpp" -namespace ku::views { - class AlertView : public ku::ModalView { +namespace dsu::views { + class AlertView : public dsu::ModalView { public: AlertView(std::string title, std::string message, std::vector buttons); ~AlertView(); diff --git a/source/views/ControlView.cpp b/source/views/ControlView.cpp index 49f35ac..264a4a3 100755 --- a/source/views/ControlView.cpp +++ b/source/views/ControlView.cpp @@ -22,9 +22,9 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; -namespace ku::views { +namespace dsu::views { SDL_Color ControlView::_generateSelectionColor() { SDL_Color color1 = AssetManager::selected_border_1; SDL_Color color2 = AssetManager::selected_border_2; diff --git a/source/views/ControlView.hpp b/source/views/ControlView.hpp index 6655305..5551bda 100755 --- a/source/views/ControlView.hpp +++ b/source/views/ControlView.hpp @@ -21,8 +21,8 @@ #include "../View.hpp" -namespace ku::views { - class ControlView : public ku::View { +namespace dsu::views { + class ControlView : public dsu::View { protected: double _timeElapsed; diff --git a/source/views/FooterView.cpp b/source/views/FooterView.cpp index a8139ed..eac6e48 100755 --- a/source/views/FooterView.cpp +++ b/source/views/FooterView.cpp @@ -20,10 +20,10 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; -using namespace ku::models; +using namespace dsu; +using namespace dsu::models; -namespace ku::views { +namespace dsu::views { FooterView::FooterView() : View() { isFocusable = false; isTouchable = false; diff --git a/source/views/FooterView.hpp b/source/views/FooterView.hpp index 1a77e03..852052e 100755 --- a/source/views/FooterView.hpp +++ b/source/views/FooterView.hpp @@ -22,16 +22,16 @@ #include "../models/Action.hpp" #include "../View.hpp" -namespace ku::views { - class FooterView : public ku::View { +namespace dsu::views { + class FooterView : public dsu::View { public: - std::list actions; + std::list actions; FooterView(); ~FooterView(); void render(SDL_Rect rect, double dTime); private: - void _renderButton(ku::models::ActionButton button, SDL_Texture * texture, SDL_Rect frame); + void _renderButton(dsu::models::ActionButton button, SDL_Texture * texture, SDL_Rect frame); }; } diff --git a/source/views/HeaderView.cpp b/source/views/HeaderView.cpp index 3fe6ad7..3e53291 100755 --- a/source/views/HeaderView.cpp +++ b/source/views/HeaderView.cpp @@ -20,9 +20,9 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; -namespace ku::views { +namespace dsu::views { HeaderView::HeaderView(string title, bool showIcon) : View() { isFocusable = false; isTouchable = false; diff --git a/source/views/HeaderView.hpp b/source/views/HeaderView.hpp index 1952332..b7c78f3 100755 --- a/source/views/HeaderView.hpp +++ b/source/views/HeaderView.hpp @@ -20,8 +20,8 @@ #include "TextView.hpp" #include "../View.hpp" -namespace ku::views { - class HeaderView : public ku::View { +namespace dsu::views { + class HeaderView : public dsu::View { public: HeaderView(std::string title, bool showIcon); ~HeaderView(); diff --git a/source/views/ImageView.cpp b/source/views/ImageView.cpp index d5bc520..c737d0a 100755 --- a/source/views/ImageView.cpp +++ b/source/views/ImageView.cpp @@ -19,9 +19,9 @@ #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; -namespace ku::views { +namespace dsu::views { ImageView::ImageView(SDL_Texture * image) : View() { _image = image; } diff --git a/source/views/ImageView.hpp b/source/views/ImageView.hpp index d462342..b2635cc 100755 --- a/source/views/ImageView.hpp +++ b/source/views/ImageView.hpp @@ -21,8 +21,8 @@ using namespace std; -namespace ku::views { - class ImageView : public ku::View { +namespace dsu::views { + class ImageView : public dsu::View { public: ImageView(SDL_Texture * image); ~ImageView(){}; diff --git a/source/views/ListRowView.cpp b/source/views/ListRowView.cpp index e262b2a..e1b3c4c 100755 --- a/source/views/ListRowView.cpp +++ b/source/views/ListRowView.cpp @@ -22,10 +22,10 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; using namespace std; -namespace ku::views { +namespace dsu::views { ListRowView::ListRowView(string primaryText, string secondaryText, ListRowStyle style) : ControlView() { isLast = false; hasCheckmark = false; diff --git a/source/views/ListRowView.hpp b/source/views/ListRowView.hpp index fce4ab9..13ff7c8 100755 --- a/source/views/ListRowView.hpp +++ b/source/views/ListRowView.hpp @@ -22,7 +22,7 @@ #include "ControlView.hpp" #include "TextView.hpp" -namespace ku::views { +namespace dsu::views { typedef enum { DEFAULT, SUBTITLE, diff --git a/source/views/ProgressBarView.cpp b/source/views/ProgressBarView.cpp index c863598..7c753f8 100755 --- a/source/views/ProgressBarView.cpp +++ b/source/views/ProgressBarView.cpp @@ -22,9 +22,9 @@ #include "../AssetManager.hpp" #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; -namespace ku::views { +namespace dsu::views { ProgressBarView::ProgressBarView() : View() { progress = 0; } diff --git a/source/views/ProgressBarView.hpp b/source/views/ProgressBarView.hpp index ef30f8d..3b83fcf 100755 --- a/source/views/ProgressBarView.hpp +++ b/source/views/ProgressBarView.hpp @@ -19,8 +19,8 @@ #include "../View.hpp" -namespace ku::views { - class ProgressBarView : public ku::View { +namespace dsu::views { + class ProgressBarView : public dsu::View { public: double progress; diff --git a/source/views/StatusView.cpp b/source/views/StatusView.cpp index e130314..2a21034 100755 --- a/source/views/StatusView.cpp +++ b/source/views/StatusView.cpp @@ -19,10 +19,10 @@ #include "../AssetManager.hpp" -using namespace ku; +using namespace dsu; using namespace std; -namespace ku::views { +namespace dsu::views { StatusView::StatusView(string text, string subtext) : View() { frame = { 0, 0, 1280, 100 }; diff --git a/source/views/StatusView.hpp b/source/views/StatusView.hpp index 2486b24..4e04cbe 100755 --- a/source/views/StatusView.hpp +++ b/source/views/StatusView.hpp @@ -24,8 +24,8 @@ using namespace std; -namespace ku::views { - class StatusView : public ku::View { +namespace dsu::views { + class StatusView : public dsu::View { public: StatusView(std::string text, std::string subtext); ~StatusView(); diff --git a/source/views/TextView.cpp b/source/views/TextView.cpp index fb4f07c..811d527 100755 --- a/source/views/TextView.cpp +++ b/source/views/TextView.cpp @@ -21,10 +21,10 @@ #include "../SceneDirector.hpp" -using namespace ku; +using namespace dsu; using namespace std; -namespace ku::views { +namespace dsu::views { TextView::TextView(TTF_Font * theFont, string theText, SDL_Color theTextColor) : View() { isFocusable = false; isTouchable = false; diff --git a/source/views/TextView.hpp b/source/views/TextView.hpp index 5426633..d0d5b72 100755 --- a/source/views/TextView.hpp +++ b/source/views/TextView.hpp @@ -23,7 +23,7 @@ #include "../View.hpp" -namespace ku::views { +namespace dsu::views { typedef enum { LEFT_ALIGN, CENTER_ALIGN, @@ -37,7 +37,7 @@ namespace ku::views { int textHeight; }; - class TextView : public ku::View { + class TextView : public dsu::View { public: TTF_Font * font; std::string text; diff --git a/source/views/UpdateView.cpp b/source/views/UpdateView.cpp index 69547ce..22eeedb 100755 --- a/source/views/UpdateView.cpp +++ b/source/views/UpdateView.cpp @@ -19,10 +19,10 @@ #include "../AssetManager.hpp" -using namespace ku; +using namespace dsu; using namespace std; -namespace ku::views { +namespace dsu::views { UpdateView::UpdateView(string text) : View() { frame = { 0, 0, 1280, 325 }; diff --git a/source/views/UpdateView.hpp b/source/views/UpdateView.hpp index ca9d550..f4b7d3a 100755 --- a/source/views/UpdateView.hpp +++ b/source/views/UpdateView.hpp @@ -24,8 +24,8 @@ #include "TextView.hpp" #include "../View.hpp" -namespace ku::views { - class UpdateView : public ku::View { +namespace dsu::views { + class UpdateView : public dsu::View { public: UpdateView(std::string text); ~UpdateView();