private static void RenameSubFiles(DirectoryInfo value, string startAppend) { FileInfo[] fileInfos = value.GetFiles(); foreach (FileInfo fileInfo in fileInfos) { ApkProcessLogic.OutPut("【I】" + fileInfo.DirectoryName + "\\" + fileInfo.Name + " 重命名为:" + startAppend + fileInfo.Name); string preName = fileInfo.DirectoryName + "\\" + fileInfo.Name; string newName = fileInfo.DirectoryName + "\\" + startAppend + fileInfo.Name; File.Move(preName, newName); } }
public static void DeletFile(string UnpackPath, string relativePath) { String file = UnpackPath + "\\" + relativePath; if (File.Exists(file)) { ApkProcessLogic.OutPut("【I】---------------------------"); ApkProcessLogic.OutPut("【I】删除" + relativePath); File.Delete(file); } }
public static void DeletDir(string UnpackPath, string relativePath) { String dir = UnpackPath + "\\" + relativePath; if (Directory.Exists(dir)) { ApkProcessLogic.OutPut("【I】---------------------------"); ApkProcessLogic.OutPut("【I】删除" + relativePath + "所在目录 " + dir); Directory.Delete(dir, true); } }
public static void RenameFile(string UnpackPath, string relativePath, string newRelativePath) { String file = UnpackPath + "\\" + relativePath; String newfile = UnpackPath + "\\" + newRelativePath; if (File.Exists(newfile)) { File.Delete(newfile); } if (File.Exists(file)) { ApkProcessLogic.OutPut("【I】---------------------------"); ApkProcessLogic.OutPut("【I】重命名AndroidManifest.xml为manifest.txt"); File.Move(file, newfile); } }
public static void MoveDir(string source, string dest) { if (File.Exists(dest)) { Directory.Delete(dest, true); } string destParentDir = dest.Substring(0, dest.LastIndexOf("\\")); checkDir(destParentDir); if (Directory.Exists(source)) { ApkProcessLogic.OutPut("【I】---------------------------"); ApkProcessLogic.OutPut("【I】移动目录" + source + " -> " + dest); Directory.Move(source, dest); } }
public static void CopyFile(string source, string dest) { if (File.Exists(dest)) { File.Delete(dest); } string destDir = Path.GetDirectoryName(dest); checkDir(destDir); if (File.Exists(source)) { ApkProcessLogic.OutPut("【I】---------------------------"); ApkProcessLogic.OutPut("【I】复制文件" + source + " -> " + dest); File.Copy(source, dest, true); } }
private static void RenameValues(String UnpackPath) { string resDir = UnpackPath + "\\res"; ApkProcessLogic.OutPut("【I】---------------------------"); ApkProcessLogic.OutPut("【I】重命名" + resDir + "\\value目录下所有文件"); if (Directory.Exists(resDir)) { DirectoryInfo dir = new DirectoryInfo(resDir); DirectoryInfo[] valueDirs = dir.GetDirectories(); foreach (DirectoryInfo value in valueDirs) { string name = value.Name; if (name.Equals("values") || name.StartsWith("values-")) { RenameSubFiles(value, "ltsdk_"); } } } }
private static void OutPut(String info) { ApkProcessLogic.OutPut(info); }