//Begin logcat starts two processes collecting two logcats. Both of them need to be maintained.
        //One of them is "detailedLogcat" which is collecting all info related to this PID and it will be helpful for debugging
        //The second one is "briefLogcat" which is used by this program to determine conditions and actions of TestSteps.
        //The logic is:
        // 1. Check if files exist - if yes, delete them (they may be the result of the previous run)
        // 2. Clear device's logcat
        // 3. Run new process for both logcats
        // 4. Set the path to which logcats will be copied and read
        // 5. Return logcat
        //There is a reason .bat is used here. Cmd.exe crashes and stops logging after a few minutes for unknown reasons.
        public Logcat BeginLogcat(string packagename)
        {
            //first, clean up the old files
            Helpers.DeleteFileIfExists(Settings.briefLogcatFilePath);
            Helpers.DeleteFileIfExists(Settings.detailedLogcatFilePath);

            //second, create new ones
            Logcat logcat = new Logcat();

            logcat.logs = new List <string>();
            Directory.CreateDirectory(Settings.logcatContainerDirectory);

            //clear device's logs
            CommandLineExecutor.ExecuteCommand("adb logcat -c");

            //run .bats that will start logcat
            CommandLineExecutor.ExecuteScript(ADBScriptedFunctionsSettings.GetFunctionsFilePath(ADBScriptedFunctionsSettings.EScriptedFunction.startBriefLogcat), String.Empty, String.Empty);
            CommandLineExecutor.ExecuteScript(ADBScriptedFunctionsSettings.GetFunctionsFilePath(ADBScriptedFunctionsSettings.EScriptedFunction.startDetailedLogcat), String.Empty, String.Empty);

            logcat.detailedLogcatPath = Settings.GetPathForCopy(Settings.briefLogcatFilePath);
            logcat.briefLogcatPath    = Settings.GetPathForCopy(Settings.detailedLogcatFilePath);

            return(logcat);
        }
        public void InputTap(int x, int y)
        {
            string command = "adb shell input tap " + x + " " + y;

            CommandLineExecutor.ExecuteCommand(command);
        }
        public void ExecuteInShell(string shellCommand)
        {
            string command = "adb shell " + shellCommand;

            CommandLineExecutor.ExecuteCommand(command);
        }
 public void InputBack()
 {
     CommandLineExecutor.ExecuteCommand("adb shell input keyevent 4");
 }