def(void, Parse) { String path = Storage_GetCfgPath( Application_GetStorage(this->app)); if (!Path_Exists(path)) { Logger_Fatal(this->logger, $("The subscriptions file % does not exist!"), path); goto out; } File file; File_Open(&file, path, FileStatus_ReadOnly); BufferedStream stream; BufferedStream_Init(&stream, File_AsStream(&file)); BufferedStream_SetInputBuffer(&stream, 1024, 128); YAML yml; YAML_Init(&yml, 4, &BufferedStreamImpl, &stream); YAML_Parse(&yml); call(ParseSubscriptions, YAML_GetRoot(&yml)); YAML_Destroy(&yml); BufferedStream_Close(&stream); BufferedStream_Destroy(&stream); out: String_Destroy(&path); }
def(String, BuildPath, String provider) { String res = String_Format($("%/%"), this->base, provider); if (!Path_Exists(res)) { Path_Create(res); } return res; }
void TWFunc::install_htc_dumlock(void) { int need_libs = 0; if (!PartitionManager.Mount_By_Path("/system", true)) return; if (!PartitionManager.Mount_By_Path("/data", true)) return; gui_print("Installing HTC Dumlock to system...\n"); copy_file("/res/htcd/htcdumlocksys", "/system/bin/htcdumlock", 0755); if (!Path_Exists("/system/bin/flash_image")) { gui_print("Installing flash_image...\n"); copy_file("/res/htcd/flash_imagesys", "/system/bin/flash_image", 0755); need_libs = 1; } else gui_print("flash_image is already installed, skipping...\n"); if (!Path_Exists("/system/bin/dump_image")) { gui_print("Installing dump_image...\n"); copy_file("/res/htcd/dump_imagesys", "/system/bin/dump_image", 0755); need_libs = 1; } else gui_print("dump_image is already installed, skipping...\n"); if (need_libs) { gui_print("Installing libs needed for flash_image and dump_image...\n"); copy_file("/res/htcd/libbmlutils.so", "/system/lib/libbmlutils.so", 0755); copy_file("/res/htcd/libflashutils.so", "/system/lib/libflashutils.so", 0755); copy_file("/res/htcd/libmmcutils.so", "/system/lib/libmmcutils.so", 0755); copy_file("/res/htcd/libmtdutils.so", "/system/lib/libmtdutils.so", 0755); } gui_print("Installing HTC Dumlock app...\n"); mkdir("/data/app", 0777); unlink("/data/app/com.teamwin.htcdumlock*"); copy_file("/res/htcd/HTCDumlock.apk", "/data/app/com.teamwin.htcdumlock.apk", 0777); sync(); gui_print("HTC Dumlock is installed.\n"); }
def(bool, Run) { if (this->args->len == 0) { Logger_Error(&this->logger, $("No parameters specified.")); return false; } RdString filename = this->args->buf[0]; if (!Path_Exists(filename)) { Logger_Error(&this->logger, $("File '%' does not exist."), filename); return false; } RdString base = (this->args->len > 1) ? this->args->buf[1] : $("."); App app = App_New(&this->logger); App_Parse(&app, base, filename); App_Destroy(&app); return true; }