예제 #1
0
        //Extracts apk from device, saves it by package name to sideloader folder
        public static ProcessOutput getApk(string GameName)
        {
            ADB.WakeDevice();
            ProcessOutput output = new ProcessOutput("", "");

            string packageName = Sideloader.gameNameToPackageName(GameName);

            output = ADB.RunAdbCommandToString("shell pm path " + packageName);

            string apkPath = output.Output; //Get apk

            apkPath = apkPath.Remove(apkPath.Length - 1);
            apkPath = apkPath.Remove(0, 8); //remove package:
            apkPath = apkPath.Remove(apkPath.Length - 1);

            output += ADB.RunAdbCommandToString("pull " + apkPath); //pull apk

            string currApkPath = apkPath;

            while (currApkPath.Contains("/"))
            {
                currApkPath = currApkPath.Substring(currApkPath.IndexOf("/") + 1);
            }

            if (File.Exists(Environment.CurrentDirectory + "\\" + packageName + ".apk"))
            {
                File.Delete(Environment.CurrentDirectory + "\\" + packageName + ".apk");
            }

            File.Move(Environment.CurrentDirectory + "\\adb\\" + currApkPath, Environment.CurrentDirectory + "\\" + packageName + ".apk");

            return(output);
        }
예제 #2
0
        //uninstalls an app
        public static ProcessOutput UninstallGame(string GameName)
        {
            ADB.WakeDevice();
            ProcessOutput output = new ProcessOutput("", "");

            string packageName = Sideloader.gameNameToPackageName(GameName);

            DialogResult dialogResult = FlexibleMessageBox.Show($"Are you sure you want to uninstall {packageName}? this CANNOT be undone!", "WARNING!", MessageBoxButtons.YesNo);

            if (dialogResult != DialogResult.Yes)
            {
                return(output);
            }

            output = ADB.UninstallPackage(packageName);

            //remove both data and obb if there is any
            Sideloader.RemoveFolder("/sdcard/Android/obb/" + packageName);
            Sideloader.RemoveFolder("/sdcard/Android/data/" + packageName);

            return(output);
        }