/// <summary> /// Check if the android directory is exist /// </summary> /// <param name="androidpath">The path to check</param> /// <returns></returns> public static bool AndroidDirectoryExist(string androidpath) { if (BotCore.AdbCommand("ls " + androidpath + " > /dev/null 2>&1 && echo \"exists\" || echo \"not exists\"").Contains("exist")) { return(true); } else { return(false); } }
private void Button1_Click(object sender, EventArgs e) { if (comboBox1.SelectedItem != null && comboBox2.SelectedItem != null) { BotCore.AdbCommand("backup -noapk com.nubee.valkyriecrusade", devices[comboBox1.SelectedIndex]); BotCore.AdbCommand("restore backup.ab", devices[comboBox2.SelectedIndex]); } else { MessageBox.Show("Please select the devices for transfering data!"); } }
public void UnUnBotify() { try { //Remove 4 files which detect by Unbotify BotCore.AdbCommand("rm -f /system/bin/microvirtd", Variables.Controlled_Device); BotCore.AdbCommand("rm -f /system/etc/init.microvirt.sh", Variables.Controlled_Device); BotCore.AdbCommand("rm -f /system/bin/memud", Variables.Controlled_Device); BotCore.AdbCommand("rm -f /system/lib/memuguest.ko", Variables.Controlled_Device); } catch { } }
/// <summary> /// If time delay is true, means the android is now delaying over 30 seconds! /// </summary> /// <returns></returns> private static bool TimeDelay(out double delay) { try { delay = (DateTime.Parse(BotCore.AdbCommand("date").Remove(11).Remove(9)) - DateTime.Now.TimeOfDay).TimeOfDay.TotalSeconds; if (delay > 30) { return(true); } else { return(false); } } catch { delay = 0; return(false); } }
private static void _RunScript(bool KeepRunning, ScriptInterface script) { if (script != null) { do { try { if (TimeDelay(out double delay)) { Variables.ScriptLog("Time delay over 30 seconds! Trying to fix it!", Color.Red); try { string year = DateTime.Now.Year.ToString("0000"); string month = DateTime.Now.Month.ToString("00"); string day = DateTime.Now.Day.ToString("00"); string hour = DateTime.Now.Hour.ToString("00"); string minute = DateTime.Now.Minute.ToString("00"); string second = DateTime.Now.Second.ToString("00"); BotCore.AdbCommand("su 0 toolbox date -s " + year + month + day + "." + hour + minute + second); BotCore.AdbCommand("su 0 toybox date " + month + day + hour + minute + year + "." + second); } catch { Variables.ScriptLog("Failed to fix time delay! We will try to restart the emulator!", Color.Red); BotCore.RestartEmulator(); } } else { Variables.AdvanceLog("Current time delay with android is " + delay + " second(s)!"); } script.Script(); errornum = 0; } catch (Exception ex) { script.ResetScript(); if (ex is SocketException || ex is DeviceNotFoundException || ex is AdbException) { Start: try { BotCore.server.RestartServer(); } catch { Variables.ScriptLog("Adb start failed! Retrying in 3 seconds!"); BotCore.Delay(3000); goto Start; } if (!CheckDeviceOnline()) { BotCore.RestartEmulator(); } BotCore.Delay(10000); BotCore.ConnectAndroidEmulator(); continue; } else if (ex is ThreadAbortException) //Bot stopped { } else { ThrowException(ex); continue; } } }while (KeepRunning && Run); } else { throw new DllNotFoundException("No script dll found!"); } Run = false; }