public void Main(IDevice device, IAppManager app, ILogger <string> logger, Context context, ILeafUI ui, IUx ux, Dictionary <string, object> data, TextAttrManager manager) { using (ui) { ui.Show(); logger.Debug("WTF"); using (CommandExecutor executor = new CommandExecutor()) { ui.CloseButtonClicked += (s, e) => { e.CanBeClosed = true; executor.Dispose(); }; executor.To(e => ui.WriteOutput(e.Text)); executor.Adb("help"); } CoreLib.Current.TEST = false; app.RefreshExtensionView(); ui.ShowMessage("meile!"); CoreLib.Current.TEST = true; app.RefreshExtensionView(); ui.WriteLine(manager["f**k"]); ui.WriteOutput("f**k asdasjkdshadskjhkj"); ui.ShowMessage("WTF\n\n\n\n\n\nasdadas\n\n\nasdasdsahsdkajghsdakjfhsdjkaghsdfjkghjkfsdhgjkshfdjkgfhsjdgkhdskfjghjW"); bool?choice = ui.DoChoice("FUCcqwjeiwqeqehqWK"); ui.WriteLine(choice.ToString()); bool yn = ui.DoYN("FUCK2c 2rqwhewqhehqweqhwewqhejwqhewqjhqwejkqwhewqhWW"); ui.WriteLine(yn.ToString()); //object result = ui.SelectFrom(new object[] { "a", "qqdasdsadasb", "c", "a", "s", "c", "a" }, "选择你要做的SB操作"); //ui.WriteLine(result); ui.Finish(); } }
public void EntryPoint(ILeafUI ui, IDevice device, IClassTextDictionary text) { using (ui) { ui.Title = this.GetName(); ui.Show(); bool? dialogResult = null; string seleFile = null; ui.RunOnUIThread(() => { Microsoft.Win32.OpenFileDialog fileDialog = new Microsoft.Win32.OpenFileDialog(); fileDialog.Reset(); fileDialog.Title = text["title"]; fileDialog.Filter = text["filter"]; fileDialog.Multiselect = false; dialogResult = fileDialog.ShowDialog(); seleFile = fileDialog.FileName; }); if (dialogResult != true) { ui.EShutdown(); } FileInfo fileInfo = new FileInfo(seleFile); CommandExecutor executor = new CommandExecutor(); executor.OutputReceived += (s, e) => ui.WriteLine(e.Text); var result = executor.Adb(device, $"push \"{fileInfo.FullName}\" \"/sdcard/{fileInfo.Name}\""); ui.Finish(result.ExitCode); } }
private void EntryPoint(ILeafUI ui, IClassTextManager texts) { using (ui) { ui.Title = this.GetName(); ui.Show(); if (TryGetInputEndPoint(ui, texts, out IPEndPoint endpoint)) { using (var executor = new CommandExecutor()) { ui.Tip = texts["ConnectingDevice"]; ui.WriteLine(texts["ConnectingDevice"]); executor.To(e => ui.WriteOutput(e.Text)); var result = executor.Adb($"connect {endpoint.Address}:{endpoint.Port}"); if (result.Output.Contains("fail", true)) { ui.WriteLine(texts["fail"]); ui.Finish(texts["Fail"]); } else { ui.Finish(result.ExitCode); } } } else { ui.Shutdown(); } } }
public void EntryPoint(IDevice device, ILeafUI ui, TextAttrManager text, IEmbeddedFileManager emb, ITemporaryFloder tmp) { using (ui) { ui.Title = this.GetName(); ui.Icon = this.GetIconBytes(); ui.Show(); ui.Tip = text[EXTRACTING]; tmp.Create(); var filePath = Path.Combine(tmp.DirInfo.ToString(), "daemon"); var tgtFile = new FileInfo(filePath); var file = emb.Get("daemon"); ui.Tip = text[PUSHING]; file.ExtractTo(tgtFile); ui.Tip = text[PUSHING]; ICommandResult result = null; using (var executor = new CommandExecutor()) { executor.To(e => ui.WriteOutput(e.Text)); executor.Adb(device, $"push {tgtFile.FullName} /data/local/tmp/daemon"); executor.AdbShell(device, "chmod 777 /data/local/tmp/daemon"); result = executor.AdbShell(device, "./data/local/tmp/daemon &"); } ui.Finish(result.ExitCode); } }
public int PushToDevice() { DirectoryInfo dirInfo = context.Tmp.DirInfo; string path = Path.Combine(dirInfo.FullName, PATH_OF_TMP_APK); string command = $"push \"{path}\" {PATH_OF_ATMP_APK}"; return(executor.Adb(device, command).ExitCode); }
public void EntryPoint(ILeafUI ui, IDevice device, IClassTextDictionary text) { using (ui) { ui.Title = this.GetName(); ui.Icon = this.GetIconBytes(); ui.Show(); CommandExecutor executor = new CommandExecutor(); executor.OutputReceived += (s, e) => ui.WriteLine(e.Text); executor.Adb(device, "root"); var result = executor.Adb(device, "disable-verity"); if (result.ExitCode == 0 && ui.DoYN(text["reboot"])) { device.Reboot2System(); } ui.Finish(result.ExitCode); } }
public void EntryPoint(IDevice device, ILeafUI ui) { using (ui) { ui.Title = this.GetName(); ui.Icon = this.GetIconBytes(); ui.Show(); var executor = new CommandExecutor(); executor.OutputReceived += (s, e) => ui.WriteOutput(e.Text); var tmpPath = GenerateTmpPath(); var capResult = executor.AdbShell(device, $"screencap -p {tmpPath}"); if (capResult.ExitCode == 0) { executor.Adb(device, $"pull {tmpPath} \"{GetSaveTarget(ui)}\""); executor.AdbShell(device, $"rm -f {tmpPath}"); } ui.Finish(capResult.ExitCode); } }
private void Install(List <FileInfo> files) { executor.To(e => UI.WriteOutput(e.Text)); int successed = 0; int error = 0; int currentInstalling = 1; int totalCount = files.Count; SetTip(currentInstalling, totalCount); foreach (var file in files) { try { var result = executor.Adb(Device, $"install -r -t -d \"{file.FullName}\""); if (result.ExitCode == 0) { successed++; } else { error++; } } catch (Exception ex) { SLogger <EApkInstaller> .Warn("install apk failed", ex); error++; } if (currentInstalling < totalCount) { currentInstalling++; SetTip(currentInstalling, totalCount); } } ; string fmtString = Text["result_fmt"]; UI.WriteLine(string.Format(fmtString, successed, error, totalCount)); }
/// <summary> /// 连接设备信息 /// </summary> /// <param name="device"></param> /// <returns></returns> public string DeviceInfo(IDevice device) { return(_executer.Adb(device, "devices").Output); }