private static Script GenScript(string cmd) { var f = SpaceUtil.NewTempPath(); File.WriteAllText(f, cmd); return(new Script(f)); }
/// <summary> /// 把pathToPut的路径放入到Apk中的pathInApk路径,如果已经存在则覆盖。 /// </summary> /// <param name="inApkPath">输入的apk</param> /// <param name="outApkPath">输出的apk</param> /// <param name="pathInApk">apk中的路径</param> /// <param name="pathToPut">需要被放置的路径</param> public static void PutPathInAPK(string inApkPath, string outApkPath, string pathInApk, string pathToPut) { InitInner(); var apkDir = SpaceUtil.NewTempPath(); Logger.Log($"Unpack apk to '{apkDir}'..."); UnpackAPK(inApkPath, apkDir); // 放 Logger.Log($"Copy '{pathToPut}' to '{Path.Combine(apkDir, pathInApk)}'..."); PathUtil.CopyPath(pathToPut, Path.Combine(apkDir, pathInApk), true); Logger.Log($"Pack apk to '{outApkPath}'..."); PackAPK(apkDir, outApkPath); }