private void DecompileFile(string file) { _globalVariables.CurrentProjectFile.Value = file; string logPath = Path.Combine(Path.GetDirectoryName(file) ?? string.Empty, $"{Path.GetFileNameWithoutExtension(file)}_log.txt"); if (!TryCreateNewLog(logPath)) { return; } if (Apk != null) { Apk.Logging -= VisLog; } Apk = new Apktools( file, GlobalVariables.PathToResources, GlobalVariables.CurrentApktoolPath ); Apk.Logging += VisLog; if (!Apk.HasJava()) { MessBox.ShowDial(StringResources.JavaNotFoundError, StringResources.ErrorLower); return; } ClearVisLog(); bool success = false; LoadingWindow.ShowWindow( beforeStarting: () => IsBusy = true, threadActions: source => success = GlobalVariables.AppSettings.OnlyResources ? Apk.Decompile(options: "-s") : Apk.Decompile(), finishActions: () => { IsBusy = false; VisLog(LogLine); VisLog(StringResources.Finished); VisLog(LogLine); if (GlobalVariables.AppSettings.ShowNotifications) { NotificationService.Instance.ShowMessage(StringResources.DecompilationFinished); } if (success) { Application.Current.Dispatcher.InvokeAction(() => LoadFolder(_globalVariables.CurrentProjectFolder.Value, true)); } }, cancelVisibility: Visibility.Collapsed, ownerWindow: _window ); }
private void InstallFramework(string fileName) { using (BusyDisposable()) { var apktool = new Apktools(null, GlobalVariables.PathToResources, Path.Combine(GlobalVariables.PathToApktoolVersions, $"apktool_{GlobalVariables.AppSettings.ApktoolVersion}.jar")); if (!apktool.HasJava()) { MessBox.ShowDial(StringResources.JavaNotFoundError, StringResources.ErrorLower); return; } apktool.Logging += VisLog; apktool.InstallFramework(fileName); apktool.Logging -= VisLog; } }