Java Code Examples for com.grarak.kerneladiutor.utils.Utils#writeFile()

The following examples show how to use com.grarak.kerneladiutor.utils.Utils#writeFile() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: JsonDB.java    From KA27 with Apache License 2.0 5 votes vote down vote up
/**
 * Write the dataset as JSON file
 */
public void commit() {
    try {
        databaseMain.put("database", databaseItems);
        Utils.writeFile(path, databaseMain.toString(), false, false);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
Example 2
Source File: Provider.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Write the dataset as JSON file
 */
public void commit() {
    try {
        mDatabaseMain.put("database", mDatabaseItems);
        Utils.writeFile(mPath, mDatabaseMain.toString(), false, false);
    } catch (JSONException e) {
        e.printStackTrace();
    }
}
 
Example 3
Source File: ExportProfile.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
public boolean export(String name) {
    if (!name.endsWith(".json")) name += ".json";
    File exportFiles = new File(Utils.getInternalDataStorage() + "/profiles");
    File file = new File(exportFiles.toString() + "/" + name);
    if (file.exists()) return false;
    exportFiles.mkdirs();
    Utils.writeFile(file.toString(), mMain.toString(), false, false);
    return true;
}
 
Example 4
Source File: ExportControl.java    From KernelAdiutor with GNU General Public License v3.0 5 votes vote down vote up
public boolean export(String name) {
    if (!name.endsWith(".json")) name += ".json";
    File exportFiles = new File(Utils.getInternalDataStorage() + "/controls");
    File file = new File(exportFiles.toString() + "/" + name);
    if (file.exists()) return false;
    exportFiles.mkdirs();
    Utils.writeFile(file.toString(), mMain.toString(), false, false);
    return true;
}
 
Example 5
Source File: AdLayout.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
public void cache(Context context) {
    Utils.writeFile(context.getFilesDir() + "/ghads.json", mJson, false, false);
}
 
Example 6
Source File: MainActivity.java    From KernelAdiutor with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    /*
     * 0: License check result
     * 1: Password check result
     */
    if (requestCode == 0) {

        /*
         * -1: Default (no license check executed)
         *  0: License check was successful
         *  1: Something went wrong when checking license
         *  2: License is invalid
         *  3: Donate apk is patched/cracked
         */
        int result = data == null ? -1 : data.getIntExtra("result", -1);
        if (result == 0) {
            try {
                ApplicationInfo applicationInfo = getPackageManager().getApplicationInfo(
                        "com.grarak.kerneladiutordonate", 0);
                Utils.writeFile(applicationInfo.dataDir + "/license",
                        Utils.encodeString(Utils.getAndroidId(this)), false, true);
            } catch (PackageManager.NameNotFoundException ignored) {
            }
        }
        launch(result);

    } else if (requestCode == 1) {

        /*
         * 0: Password is wrong
         * 1: Password is correct
         */
        if (resultCode == 1) {
            new CheckingTask(this).execute();
        } else {
            finish();
        }

    }
}