Dees Troy | 3be70a8 | 2013-10-22 14:25:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | Copyright 2012 bigbiff/Dees_Troy TeamWin |
| 3 | This file is part of TWRP/TeamWin Recovery Project. |
| 4 | |
| 5 | TWRP is free software: you can redistribute it and/or modify |
| 6 | it under the terms of the GNU General Public License as published by |
| 7 | the Free Software Foundation, either version 3 of the License, or |
| 8 | (at your option) any later version. |
| 9 | |
| 10 | TWRP is distributed in the hope that it will be useful, |
| 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | GNU General Public License for more details. |
| 14 | |
| 15 | You should have received a copy of the GNU General Public License |
| 16 | along with TWRP. If not, see <http://www.gnu.org/licenses/>. |
| 17 | */ |
Dees_Troy | 812660f | 2012-09-20 09:55:17 -0400 | [diff] [blame] | 18 | |
| 19 | #ifndef _OPENRECOVERYSCRIPT_HPP |
| 20 | #define _OPENRECOVERYSCRIPT_HPP |
| 21 | |
| 22 | #include <string> |
| 23 | |
| 24 | using namespace std; |
| 25 | |
Dees_Troy | 812660f | 2012-09-20 09:55:17 -0400 | [diff] [blame] | 26 | class OpenRecoveryScript |
| 27 | { |
that | 10ae24f | 2015-12-26 20:53:51 +0100 | [diff] [blame] | 28 | typedef void (*VoidFunction)(); |
| 29 | static VoidFunction call_after_cli_command; // callback to GUI after Run_CLI_Command |
| 30 | |
Dees_Troy | 812660f | 2012-09-20 09:55:17 -0400 | [diff] [blame] | 31 | static int check_for_script_file(); // Checks to see if the ORS file is present in /cache |
Ethan Yonker | 03a42f6 | 2014-08-08 11:03:51 -0500 | [diff] [blame] | 32 | static int copy_script_file(string filename); // Copies a script file to the temp folder |
Dees_Troy | 812660f | 2012-09-20 09:55:17 -0400 | [diff] [blame] | 33 | static int run_script_file(); // Executes the commands in the ORS file |
Dees_Troy | 83a3b12 | 2012-10-01 14:16:43 -0400 | [diff] [blame] | 34 | static int Install_Command(string Zip); // Installs a zip |
Dees_Troy | 812660f | 2012-09-20 09:55:17 -0400 | [diff] [blame] | 35 | static string Locate_Zip_File(string Path, string File); // Attempts to locate the zip file in storage |
Dees_Troy | 83a3b12 | 2012-10-01 14:16:43 -0400 | [diff] [blame] | 36 | static int Backup_Command(string Options); // Runs a backup |
that | 10ae24f | 2015-12-26 20:53:51 +0100 | [diff] [blame] | 37 | public: |
| 38 | static int Insert_ORS_Command(string Command); // Inserts the Command into the SCRIPT_FILE_TMP file |
Dees_Troy | 6ed34b7 | 2013-01-25 15:01:29 +0000 | [diff] [blame] | 39 | static void Run_OpenRecoveryScript(); // Starts the GUI Page for running OpenRecoveryScript |
that | 10ae24f | 2015-12-26 20:53:51 +0100 | [diff] [blame] | 40 | static int Run_OpenRecoveryScript_Action(); // Actually runs the ORS scripts for the GUI action |
| 41 | static void Call_After_CLI_Command(VoidFunction fn) { call_after_cli_command = fn; } |
| 42 | static void Run_CLI_Command(const char* command); // Runs a command for orscmd (twrp binary) |
Dees_Troy | 812660f | 2012-09-20 09:55:17 -0400 | [diff] [blame] | 43 | }; |
| 44 | |
| 45 | #endif // _OPENRECOVERYSCRIPT_HPP |