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 void Extract() { DirectoryInfo dirInfo = storage.CacheDirectory; string path = Path.Combine(dirInfo.FullName, PATH_OF_TMP_APK); IEmbeddedFile embFile = emb.Get(Assembly.GetExecutingAssembly(), PATH_OF_EMB_APK); using FileStream fs = File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite); embFile.WriteTo(fs); }
public void Extract() { DirectoryInfo dirInfo = tmp.DirInfo; string path = Path.Combine(dirInfo.FullName, PATH_OF_TMP_APK); IEmbeddedFile embFile = emb.Get(PATH_OF_EMB_APK); using (FileStream fs = File.Open(path, FileMode.OpenOrCreate, FileAccess.ReadWrite)) { embFile.WriteTo(fs); } }