Beispiel #1
0
 private void bwGetUE_DoWork(object sender, DoWorkEventArgs e)
 {
     if (!AutoLeadClient.connected)
     {
         return;
     }
     if (this.scriptDelegate != null)
     {
         this.isRunning = true;
         while (this.isRunning)
         {
             if (AutoLeadClient.send("{\"cmd\":\"getCurrentUE\", \"type\":\"" + (object)this.type + "\"}"))
             {
                 this.result = AutoLeadClient.receive();
                 this.scriptDelegate.DynamicInvoke((object)this.result);
             }
         }
     }
     else if (AutoLeadClient.send("{\"cmd\":\"getCurrentUE\", \"type\":\"" + (object)this.type + "\"}"))
     {
         this.result = AutoLeadClient.receive();
         this.lbText.Invoke(new Action(delegate
         {
             base.Close();
         }));
     }
 }
Beispiel #2
0
 internal static void Gohome()
 {
     if (!AutoLeadClient.send(Operation.jss.Serialize((object)new Dictionary <string, object>()
     {
         ["cmd"] = (object)"gohome"
     })))
     {
         return;
     }
     AutoLeadClient.receive();
 }
Beispiel #3
0
 internal static void Killapp(string id)
 {
     if (!AutoLeadClient.send(Operation.jss.Serialize((object)new Dictionary <string, object>()
     {
         ["cmd"] = (object)"killapp",
         ["app_id"] = (object)id
     })))
     {
         return;
     }
     AutoLeadClient.receive();
 }
Beispiel #4
0
        public void CheckConnectDevice()
        {
            if (frmMain.sttconnect)
            {
                return;
            }
            int    error  = 0;
            string serial = (string)null;
            int    num    = 0;

            while (!AutoLeadClient.connect(frmMain.ipreconnect, frmMain.keyreconnect, out error, out serial))
            {
                ++num;
            }
            frmMain.sttconnect = true;
        }
Beispiel #5
0
        public bool _isAppRunning(string name)
        {
            Dictionary <string, object> dictionary1 = new Dictionary <string, object>();

            dictionary1["cmd"] = (object)"topmostappsystem";
            bool flag = false;

            if (AutoLeadClient.send(Operation.jss.Serialize((object)dictionary1)))
            {
                string input = AutoLeadClient.receive();
                Dictionary <string, object> dictionary2 = Operation.jss.Deserialize <Dictionary <string, object> >(input);
                if (Convert.ToInt32(dictionary2["result"]) == 1 && dictionary2["id"].ToString().Equals(name))
                {
                    flag = true;
                }
            }
            return(flag);
        }
Beispiel #6
0
        private void btRefresh_Click(object sender, EventArgs e)
        {
            bool FTPAddress = AutoLeadClient.connected;

            if (FTPAddress)
            {
                bool savefile = AutoLeadClient.send("{\"cmd\":\"apps\"}");
                if (savefile)
                {
                    string result   = AutoLeadClient.receive();
                    bool   username = result != null;
                    if (username)
                    {
                        this.cbApps.Invoke(new Action(delegate
                        {
                            this.updateAppsList(result);
                        }));
                    }
                }
            }
        }
Beispiel #7
0
        private void bwMain_DoWork(object sender, DoWorkEventArgs e)
        {
            if (!AutoLeadClient.connected)
            {
                return;
            }
            this.isRunning = true;
            while (this.isRunning)
            {
                if (AutoLeadClient.send("{\"cmd\":\"getCurrentUE\", \"type\":\"" + (object)this.type + "\"}"))
                {
                    this.result = AutoLeadClient.receive();
                    double secs = DateTime.Now.Subtract(this.time).TotalSeconds;
                    this.time = DateTime.Now;
                    this.lbText.Invoke(new Action(delegate
                    {
                        Dictionary <string, object> dictionary = this.jss.Deserialize <Dictionary <string, object> >(this.result);
                        switch (Convert.ToInt32(dictionary["type"]))
                        {
                        case 1:
                            ListViewItem listViewItem1 = new ListViewItem();
                            listViewItem1.Text         = "wait(" + (object)secs + ")";
                            if (!this.pause)
                            {
                                this.lvScript.Items.Add(listViewItem1);
                            }
                            ListViewItem listViewItem2 = new ListViewItem();
                            double num1        = Convert.ToDouble(dictionary["x1"]);
                            double num2        = Convert.ToDouble(dictionary["y1"]);
                            double num3        = Convert.ToDouble(dictionary["duration"]);
                            listViewItem2.Text = "touch(" + (object)num1 + "," + (object)num2 + "," + (object)num3 + ")";
                            if (this.pause)
                            {
                                break;
                            }
                            this.lvScript.Items.Add(listViewItem2);
                            break;

                        case 2:
                            ListViewItem listViewItem3 = new ListViewItem();
                            listViewItem3.Text         = "wait(" + (object)secs + ")";
                            if (!this.pause)
                            {
                                this.lvScript.Items.Add(listViewItem3);
                            }
                            ListViewItem listViewItem4 = new ListViewItem();
                            double num4        = Convert.ToDouble(dictionary["x1"]);
                            double num5        = Convert.ToDouble(dictionary["y1"]);
                            double num6        = Convert.ToDouble(dictionary["x2"]);
                            double num7        = Convert.ToDouble(dictionary["y2"]);
                            double num8        = Convert.ToDouble(dictionary["duration"]);
                            listViewItem4.Text = "swipe(" + (object)num4 + "," + (object)num5 + "," + (object)num6 + "," + (object)num7 + "," + (object)num8 + ")";
                            if (!this.pause)
                            {
                                this.lvScript.Items.Add(listViewItem4);
                            }
                            break;
                        }
                    }));
                }
            }
        }
Beispiel #8
0
        public static bool executeScript(string script1Line, out bool result, Operation operation)
        {
            script1Line = script1Line.Trim();
            if (script1Line.Length == 0)
            {
                result = true;
                return(true);
            }
            if (script1Line.StartsWith(";"))
            {
                result = true;
                return(true);
            }
            string str1 = script1Line.Trim();
            string str2;

            if (str1.IndexOf("=") >= 0 && str1.IndexOf("open_url") < 0)
            {
                str2 = Split.tachchuoi(str1, "=")[0];
                str1 = Split.tachchuoi(str1, "=")[1];
            }
            else
            {
                str2 = "";
            }
            string cmd;
            float  x1;
            float  y1;
            float  x2;
            float  y2;
            string text;
            double duration;
            string text2;
            int    count;
            bool   flag1 = GlobalConfig.parseScript(str1, out cmd, out x1, out y1, out x2, out y2, out text, out duration, out text2, out count);

            if (str1.IndexOf("rep") >= 0)
            {
                flag1 = true;
                try
                {
                    string str3 = Split.tachchuoi(str1, ":")[1];
                    for (int index = 0; index < frmMain.ScriptListRep.Count <ListScript>(); ++index)
                    {
                        if (frmMain.ScriptListRep[index].bien == str3)
                        {
                            text = frmMain.ScriptListRep[index].text;
                            cmd  = "text";
                        }
                    }
                }
                catch
                {
                }
            }
            string input1 = (string)null;

            frmMain.ScriptListRep.Add(new ListScript()
            {
                bien = str2,
                text = text
            });
            if (!flag1)
            {
                result = false;
            }
            else
            {
                if (cmd.Equals("wait"))
                {
                    Thread.Sleep((int)((double)x1 * 1000.0));
                    result = true;
                    return(true);
                }
                if (cmd.Equals("rd"))
                {
                    frmMain.Cmdrequest("sudo " + ScriptsCore.KeyboradGet(text, ""));
                    input1 = "{\"result\":\"1\"}";
                }
                else if (cmd.Equals("touch"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":1, \"x1\":" + (object)x1 + ", \"y1\":" + (object)y1 + ", \"duration\":" + (object)duration + "}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else if (cmd.Equals("rand_touch"))
                {
                    double num = duration / (double)count;
                    for (int index = 0; index < count; ++index)
                    {
                        if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":1, \"x1\":" + (object)ScriptsCore.GetRandomNumber((double)x1, (double)x2) + ", \"y1\":" + (object)ScriptsCore.GetRandomNumber((double)y1, (double)y2) + ", \"duration\":" + (object)0 + "}"))
                        {
                            input1 = AutoLeadClient.receive();
                        }
                        Thread.Sleep((int)num * 1000);
                    }
                }
                else if (cmd.Equals("swipe"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":2, \"x1\":" + (object)x1 + ", \"y1\":" + (object)y1 + ", \"x2\":" + (object)x2 + ", \"y2\":" + (object)y2 + ", \"duration\":" + (object)duration + "}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else if (cmd.Equals("text"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":3, \"text\":\"" + text + "\"}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else if (cmd.Equals("exit"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":4, \"text\":\"" + text + "\"}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else if (cmd.Equals("backup"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":5, \"name\":\"" + text + "\",\"app_id\":\"" + text2 + "\"}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else if (cmd.Equals("restore"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":6, \"name\":\"" + text + "\",\"app_id\":\"" + text2 + "\"}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else if (cmd.Equals("wipe"))
                {
                    Console.WriteLine("{\"cmd\":\"sendUE\", \"type\":7 ,\"app_id\":\"" + text + "\" }");
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":7 ,\"app_id\":\"" + text + "\" }"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                    Thread.Sleep(2000);
                }
                else if (cmd.Equals("delete"))
                {
                    if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":8, \"name\":\"" + text + "\",\"app_id\":\"" + text2 + "\"}"))
                    {
                        input1 = AutoLeadClient.receive();
                    }
                }
                else
                {
                    if (cmd.Equals("end"))
                    {
                        result = true;
                        return(false);
                    }
                    if (cmd.Equals("open_url"))
                    {
                        frmMain.Cmdrequest("killall -9 lsd");
                        Thread.Sleep(1000);
                        if (AutoLeadClient.send(new JavaScriptSerializer().Serialize((object)new Dictionary <string, object>()
                        {
                            ["cmd"] = (object)"openURL",
                            ["url"] = (object)text
                        })))
                        {
                            input1 = AutoLeadClient.receive();
                        }
                    }
                    else if (cmd.Equals("bksafari"))
                    {
                        if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":10 }"))
                        {
                            input1 = AutoLeadClient.receive();
                        }
                    }
                    else if (cmd.Equals("rssafari"))
                    {
                        if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":11 }"))
                        {
                            input1 = AutoLeadClient.receive();
                        }
                    }
                    else if (cmd.Equals("open_app"))
                    {
                        if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":12, \"app_id\":\"" + text + "\"}"))
                        {
                            input1 = AutoLeadClient.receive();
                        }
                        if (frmMain.rrsselect == true)
                        {
                            Thread.Sleep(10000);
                            if (AutoLeadClient.send("{\"cmd\":\"sendUE\", \"type\":12, \"app_id\":\"" + text + "\"}"))
                            {
                                input1 = AutoLeadClient.receive();
                            }
                        }
                    }
                    else if (cmd.Equals("checkip") && AutoLeadClient.send("{\"cmd\":\"get_public_ip\" }"))
                    {
                        string input2 = AutoLeadClient.receive();
                        string str3   = ScriptsCore.jss.Deserialize <Dictionary <string, object> >(input2)[nameof(result)].ToString();
                        bool   flag2;
                        if (str3 == null || GlobalConfig.currentPublicIP == null)
                        {
                            result = false;
                            flag2  = true;
                        }
                        else
                        {
                            result = str3.Equals(GlobalConfig.currentPublicIP);
                            flag2  = true;
                        }
                        return(flag2);
                    }
                }
                if (input1 != null)
                {
                    Dictionary <string, object> dictionary = ScriptsCore.jss.Deserialize <Dictionary <string, object> >(input1);
                    result = Convert.ToInt32(dictionary[nameof(result)]) == 1;
                    flag1  = true;
                }
                else
                {
                    result = false;
                    flag1  = false;
                }
            }
            return(flag1);
        }
Beispiel #9
0
        public void execute(out bool end, int countrun, bool setRRS)
        {
            if (this.type == Operation.OperationType.Script2Operation)
            {
                if (File.Exists(LocalConfig.getCurrentConfig().configDirectory() + "/Scripts/" + this.appScriptOperationAppName.Replace(Operation.CurrentAppName, Operation.__g_var_appName)))
                {
                    string str = File.ReadAllText(LocalConfig.getCurrentConfig().configDirectory() + "/Scripts/" + this.appScriptOperationAppName.Replace(Operation.CurrentAppName, Operation.__g_var_appName));
                    if (str != null)
                    {
                        this.scripts = GlobalConfig.splitToLines(str);
                    }
                }
                else
                {
                    Operation.__g_var_appId   = frmMain.Appid;
                    Operation.__g_var_appName = frmMain.AppnameDefault;
                    if (File.Exists(LocalConfig.getCurrentConfig().configDirectory() + "/Scripts/" + this.appScriptOperationAppName.Replace(Operation.CurrentAppName, Operation.__g_var_appName)))
                    {
                        string str = File.ReadAllText(LocalConfig.getCurrentConfig().configDirectory() + "/Scripts/" + this.appScriptOperationAppName.Replace(Operation.CurrentAppName, Operation.__g_var_appName));
                        if (str != null)
                        {
                            this.scripts = GlobalConfig.splitToLines(str);
                        }
                    }
                }
                bool result1 = false;
                end = false;
                frmMain.BoolstartTimer1 = true;
                for (int index = 0; index < this.scripts.Length; ++index)
                {
                    this.CheckConnectDevice();
                    if (AutoLeadClient.send(Operation.jss.Serialize((object)new Dictionary <string, object>()
                    {
                        ["cmd"] = (object)"topmostappsystem"
                    })) && AutoLeadClient.receive().IndexOf(Operation.idapp_open) < 0)
                    {
                        string script1Line = "open_app(" + Operation.idapp_open + ")";
                        try
                        {
                            bool result2;
                            ScriptsCore.executeScript(script1Line, out result2);
                        }
                        catch
                        {
                        }
                    }
                    string script1Line1 = this.scripts[index].Replace(Operation.CurrentAppName, Operation.__g_var_appName).Replace(Operation.CurrentAppId, Operation.__g_var_appId);
                    if (script1Line1 != null && script1Line1 != "")
                    {
                        frmMain.sttScript2 = script1Line1;
                        if (script1Line1 == "capcharAli")
                        {
                            frmMain.FindAli();
                            script1Line1 = "text(\"" + Capchar.Getcapchar() + "\")";
                        }
                        if (script1Line1 == "downChMavrochain")
                        {
                            frmMain.FindMavrochain();
                            script1Line1 = "";
                        }
                        if (script1Line1 == "capcharMavrochain")
                        {
                            script1Line1 = "rd(\"" + Capchar.Getcapchar() + "\")";
                        }
                        this.CheckConnectDevice();
                        ScriptsCore.executeScript(script1Line1, out result1, this);
                    }
                }
                frmMain.BoolstartTimer1 = false;
            }
            else if (this.type == Operation.OperationType.ScriptOperation && this._description.IndexOf("Script RRS") >= 0)
            {
                bool result1 = false;
                end = false;
                frmMain.BoolstartTimer1 = true;
                for (int index = 0; index < this.scripts.Length; ++index)
                {
                    this.CheckConnectDevice();
                    if (AutoLeadClient.send(Operation.jss.Serialize((object)new Dictionary <string, object>()
                    {
                        ["cmd"] = (object)"topmostappsystem"
                    })) && AutoLeadClient.receive().IndexOf(frmMain.idappRRS) < 0)
                    {
                        string script1Line = "open_app(" + frmMain.idappRRS + ")";
                        try
                        {
                            bool result2;
                            ScriptsCore.executeScript(script1Line, out result2);
                        }
                        catch
                        {
                        }
                    }
                    string script1Line1 = this.scripts[index].Replace(Operation.CurrentAppName, Operation.__g_var_appName).Replace(Operation.CurrentAppId, Operation.__g_var_appId);
                    if (script1Line1 != null && script1Line1 != "")
                    {
                        frmMain.sttScript2 = script1Line1;
                        this.CheckConnectDevice();
                        ScriptsCore.executeScript(script1Line1, out result1, this);
                    }
                }
                frmMain.BoolstartTimer1 = false;
            }
            else if (this.type == Operation.OperationType.WaitForAppStoreOperation)
            {
                try
                {
                    end = false;
                    this.checkASFlag = true;
                    this.checkAS     = new Thread(new ThreadStart(this._check_appstore));
                    this.checkAS.Start();
                    while (this.timeout > 0)
                    {
                        if (!frmMain.sttconnect)
                        {
                            end = true;
                            break;
                        }
                        Thread.Sleep(1000);
                        if (this.checkASResult != null)
                        {
                            break;
                        }
                    }
                    this.checkASFlag = false;
                    while (this.checkAS.IsAlive)
                    {
                        if (!frmMain.sttconnect)
                        {
                            end = true;
                            break;
                        }
                        Thread.Sleep(1000);
                    }
                    if (this.checkASResult == null)
                    {
                        end = true;
                    }
                    this.checkAS = (Thread)null;
                }
                catch (Exception ex)
                {
                    if (this.checkAS != null && this.checkAS.IsAlive)
                    {
                        this.checkAS.Abort();
                    }
                    throw ex;
                }
            }
            else if (this.type == Operation.OperationType.OpenDetectedAppOperation)
            {
                end = false;
                if (frmMain.bool_detectapp)
                {
                    Dictionary <string, object> dictionary = new Dictionary <string, object>();
                    dictionary["cmd"] = (object)"topmostappsystem";
                    string url = (string)null;
                    if (AutoLeadClient.send(Operation.jss.Serialize((object)dictionary)))
                    {
                        string input = AutoLeadClient.receive();
                        this.checkASResult = Operation.jss.Deserialize <Dictionary <string, object> >(input);
                        url = this.checkASResult["url"].ToString();
                        if (url.Length > 0)
                        {
                            Operation.__g_var_detectedAppId = AppURLToAppID.AppIDFromURL(url);
                            if (Operation.__g_var_detectedAppId.Length <= 0)
                            {
                                Operation.__g_var_detectedAppId = AppURLToAppID.AppIDFromSiteLee(url);
                            }
                        }
                    }
                    if (Operation.__g_var_detectedAppId.Length > 0)
                    {
                        List <Listapp> list = frmMain.ListappInstall.Where <Listapp>((Func <Listapp, bool>)(c => c.app_id == Operation.__g_var_detectedAppId)).ToList <Listapp>();
                        if (list.Count <Listapp>() > 0)
                        {
                            Operation.nameapp_open = list[0].app_name;
                            if (!frmMain.bool_sml)
                            {
                                if (frmMain.Appid != Operation.__g_var_detectedAppId)
                                {
                                    end = true;
                                }
                                else
                                {
                                    string script1Line = "open_app(" + Operation.__g_var_detectedAppId + ")";
                                    Operation.idapp_open = Operation.__g_var_detectedAppId;
                                    try
                                    {
                                        bool result;
                                        ScriptsCore.executeScript(script1Line, out result);
                                    }
                                    catch
                                    {
                                    }
                                }
                            }
                            else
                            {
                                string script1Line = "open_app(" + Operation.__g_var_detectedAppId + ")";
                                Operation.idapp_open = Operation.__g_var_detectedAppId;
                                try
                                {
                                    bool result;
                                    ScriptsCore.executeScript(script1Line, out result);
                                }
                                catch
                                {
                                }
                            }
                        }
                        else
                        {
                            end = true;
                        }
                    }
                    else
                    {
                        int num1 = (int)MessageBox.Show(url + " \r\n Nhấn OK để copy link app");
                        if (!frmMain.bool_sml)
                        {
                            int num2 = (int)MessageBox.Show("App này không nhận dạng được, bỏ chọn phần 'Nhận dạng app'");
                        }
                        end = true;
                    }
                }
                else
                {
                    Operation.__g_var_detectedAppId = frmMain.Appid;
                    string script1Line = "open_app(" + Operation.__g_var_detectedAppId + ")";
                    Operation.idapp_open   = Operation.__g_var_detectedAppId;
                    Operation.nameapp_open = frmMain.AppnameDefault;
                    try
                    {
                        bool result;
                        ScriptsCore.executeScript(script1Line, out result);
                    }
                    catch
                    {
                    }
                }
            }
            else if (this.type == Operation.OperationType.GetRunningAppOperation)
            {
                Operation.__g_var_appId   = Operation.idapp_open;
                Operation.__g_var_appName = Operation.nameapp_open;
                end = false;
            }
            else if (this.type == Operation.OperationType.FakeInfoOperation)
            {
                Dictionary <string, object> dictionary;
                while (true)
                {
                    end                      = false;
                    dictionary               = new Dictionary <string, object>();
                    dictionary["cmd"]        = (object)"fake_info";
                    dictionary["listapp_id"] = (object)this.fakeAppId;
                    if (this.fakeSet)
                    {
                        if (Operation.dict.Count <= 0)
                        {
                            Operation.dict = FakeInfoCore.get();
                        }
                        if (Operation.dict.Count > 0)
                        {
                            if (!Operation.CheckinfoFake(Operation.dict))
                            {
                                Operation.dict.Clear();
                            }
                            else
                            {
                                break;
                            }
                        }
                        else
                        {
                            goto label_101;
                        }
                    }
                    else
                    {
                        goto label_101;
                    }
                }
                if (frmMain.bool_fakelangnoIP)
                {
                    Operation.dict["lang"] = (object)Split.tachchuoi(frmMain.langnoIP, "|")[0];
                }
                Operation.dict["setfakegeo"]    = !frmMain.bool_fakegeo ? (object)"0" : (object)"1";
                Operation.dict["setfakeUa"]     = !frmMain.bool_fakeUA ? (object)"0" : (object)"1";
                Operation.dict["setfakescreen"] = !frmMain.bool_fakescreen ? (object)"0" : (object)"1";
                dictionary["info"] = (object)Operation.dict;
label_101:
                if (!AutoLeadClient.send(Operation.jss.Serialize((object)dictionary)))
                {
                    return;
                }
                string input = AutoLeadClient.receive();
                if (Convert.ToInt32(Operation.jss.Deserialize <Dictionary <string, object> >(input)["result"]) != 1)
                {
                    throw new Exception("ERROR. [" + this.description() + "] return [False]");
                }
                Thread.Sleep(1000);
            }
            else if (this.type == Operation.OperationType.SetupProxyOperation)
            {
                end = false;
                try
                {
                    string[] strArray = GlobalConfig.stringSplit(this.ipWithLocation, ",");
                    if (strArray.Length >= 3)
                    {
                        string country = strArray[1].Trim();
                        strArray[2].Trim();
                        if (country.Equals("TAIWAN"))
                        {
                            country = "TAIWAN, PROVINCE OF CHINA";
                        }
                        if (country.Equals("BOLIVIA"))
                        {
                            country = "BOLIVIA, PLURINATIONAL STATE OF";
                        }
                        if (country.Equals("IRAN"))
                        {
                            country = "IRAN, ISLAMIC REPUBLIC OF";
                        }
                        if (country.Equals("IRAN"))
                        {
                            country = "IRAN, ISLAMIC REPUBLIC OF";
                        }
                        if (country.Equals("KOREA"))
                        {
                            country = "KOREA, REPUBLIC OF";
                        }
                        if (country.Equals("KOREA"))
                        {
                            country = "KOREA, REPUBLIC OF";
                        }
                        if (country.Equals("MACEDONIA"))
                        {
                            country = "MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF";
                        }
                        if (country.Equals("MOLDOVA"))
                        {
                            country = "MOLDOVA, REPUBLIC OF";
                        }
                        if (country.Equals("PALESTINE"))
                        {
                            country = "PALESTINE, STATE OF";
                        }
                        string str1   = strArray[0].Trim();
                        string str2   = this.ipWithLocation.Replace(str1, "").Replace(", " + country, "").Trim();
                        string region = str2.Length != 0 ? str2.Remove(0, 1).Trim() : (string)null;
                        this.frm.setupProxy(this.tool, str1, country, region, this.previousSshInfo);
                    }
                }
                catch (Exception ex)
                {
                }
                if (GlobalConfig.currentPublicIP == null)
                {
                    throw new Exception("ERROR. Could not execute [" + this.description() + "]");
                }
            }
            else if (this.type == Operation.OperationType.ChangeIPOperation)
            {
                if (!setRRS)
                {
                    Operation.dict.Clear();
                }
                end = false;
                try
                {
                    this.frm.changeIP();
                }
                catch (Exception ex)
                {
                }
                if (GlobalConfig.currentPublicIP == null)
                {
                    throw new Exception("ERROR. Could not execute [" + this.description() + "]");
                }
            }
            else if (this.type == Operation.OperationType.AppScriptOperation)
            {
                end = false;
                new Dictionary <string, object>()["cmd"] = (object)"topmostappsystem";
                if (!this._isAppRunning(this.appScriptOperationAppName))
                {
                    return;
                }
                bool result = false;
                end = false;
                for (int index = 0; index < this.scripts.Length; ++index)
                {
                    this.CheckConnectDevice();
                    string script1Line = this.scripts[index].Replace(Operation.CurrentAppName, Operation.__g_var_appName).Replace(Operation.CurrentAppId, Operation.__g_var_appId);
                    if (this._isAppRunning(this.appScriptOperationAppName))
                    {
                        if (!ScriptsCore.executeScript(script1Line, out result, this))
                        {
                            if (!result)
                            {
                                throw new Exception("ERROR. Could not execute [" + this.description() + "]");
                            }
                            end = true;
                            break;
                        }
                        if (!result)
                        {
                            throw new Exception("ERROR. [" + this.description() + "] return [False]");
                        }
                    }
                    else
                    {
                        break;
                    }
                }
            }
            else if (this.type == Operation.OperationType.ScriptOperation && this._description.IndexOf("Restore") >= 0)
            {
                bool result = false;
                end = false;
                for (int index = 0; index < this.scripts.Length; ++index)
                {
                    string script1Line = this.scripts[index].Replace(Operation.CurrentAppName, Operation.__g_var_appName).Replace(Operation.CurrentAppId, Operation.__g_var_appId).Replace(" ", "");
                    if (script1Line != null && script1Line != "")
                    {
                        ScriptsCore.executeScript(script1Line, out result, this);
                        frmMain.RestoreRRS(Split.tachchuoi(this.scripts[index].Replace("restore(", "").Replace(",<current_appid>)", ""), ",")[0]);
                        Thread.Sleep(3000);
                        result = true;
                        end    = false;
                    }
                }
            }
            else
            {
                bool result = false;
                end = false;
                for (int index1 = 0; index1 < this.scripts.Length; ++index1)
                {
                    string script1Line = this.scripts[index1].Replace(Operation.CurrentAppName, Operation.__g_var_appName).Replace(Operation.CurrentAppId, Operation.__g_var_appId);
                    if (script1Line == "exit()")
                    {
                        script1Line = "";
                        Operation.__g_var_appName = "";
                        Operation.__g_var_appId   = "";
                    }
                    if (script1Line == "downChMavrochain")
                    {
                        frmMain.FindMavrochain();
                        script1Line = "";
                    }
                    if (script1Line == "capcharMavrochain")
                    {
                        script1Line = "rd(\"" + Capchar.Getcapchar() + "\")";
                    }
                    if (script1Line != null && script1Line != "")
                    {
                        if (script1Line.IndexOf("backup") >= 0)
                        {
                            if (script1Line.IndexOf("backuprrs") >= 0)
                            {
                                string str1 = script1Line.Replace("backuprrs", "backup").Replace(" ", "");
                                string str2 = Split.tachchuoi(str1, ",")[0].Replace("backup(", "");
                                frmMain.WipeOlRRSlee(str2);
                                ScriptsCore.executeScript(str1, out result, this);
                                frmMain.BKRRS(str2, true);
                                result = true;
                                end    = false;
                                break;
                            }
                            for (int index2 = 0; index2 < frmMain.ListVitriBk.Count; ++index2)
                            {
                                if (frmMain.ListVitriBk[index2].vitri == countrun)
                                {
                                    string str = script1Line.Replace(" ", "");
                                    ScriptsCore.executeScript(str, out result, this);
                                    frmMain.BKRRS(Split.tachchuoi(str, ",")[0].Replace("backup(", ""), false);
                                    frmMain.UpRRSFtp();
                                    result = true;
                                    end    = false;
                                    break;
                                }
                            }
                            result = true;
                            end    = false;
                        }
                        else if (!ScriptsCore.executeScript(script1Line, out result, this))
                        {
                            if (!result)
                            {
                                throw new Exception("ERROR. Could not execute [" + this.description() + "]");
                            }
                            end = true;
                            break;
                        }
                        if (!result)
                        {
                            throw new Exception("ERROR. [" + this.description() + "] return [False]");
                        }
                    }
                }
            }
        }
Beispiel #10
0
 private void _check_appstore()
 {
     try
     {
         int appstoreInterval = this.appstoreInterval;
         Thread.Sleep(3000);
         while (this.checkASFlag)
         {
             if (appstoreInterval <= 0 && this.appstoreXy)
             {
                 appstoreInterval = this.appstoreInterval;
                 bool result = false;
                 try
                 {
                     ScriptsCore.executeScript("touch(" + frmMain.Xapp + "," + frmMain.Yapp + "," + (object)0 + ")", out result);
                 }
                 catch
                 {
                 }
             }
             Dictionary <string, object> dictionary1 = new Dictionary <string, object>();
             dictionary1["cmd"] = (object)"topmostappsystem";
             if (AutoLeadClient.send(Operation.jss.Serialize((object)dictionary1)))
             {
                 string input1 = AutoLeadClient.receive();
                 if (input1 != null)
                 {
                     Dictionary <string, object> dictionary2 = Operation.jss.Deserialize <Dictionary <string, object> >(input1);
                     if (Convert.ToInt32(dictionary2["result"]) != 1)
                     {
                         bool result;
                         ScriptsCore.executeScript("open_url(" + frmMain.linkoff + ",)", out result);
                     }
                     else if (dictionary2.ContainsKey("id"))
                     {
                         if (dictionary2["id"].ToString().Equals("com.apple.AppStore") && frmMain.bool_checkRunAppstore && AutoLeadClient.send(Operation.jss.Serialize((object)dictionary1)))
                         {
                             Thread.Sleep(5000);
                             string input2 = AutoLeadClient.receive();
                             this.checkASResult = Operation.jss.Deserialize <Dictionary <string, object> >(input2);
                             break;
                         }
                         if (dictionary2["id"].ToString().Equals(frmMain.Appid) && !frmMain.bool_checkRunAppstore && AutoLeadClient.send(Operation.jss.Serialize((object)dictionary1)))
                         {
                             Thread.Sleep(2000);
                             string input2 = AutoLeadClient.receive();
                             this.checkASResult = Operation.jss.Deserialize <Dictionary <string, object> >(input2);
                             break;
                         }
                         if (dictionary2["id"].ToString().Equals("com.apple.mobilesafari") && frmMain.bool_TouchSF)
                         {
                             bool result = false;
                             try
                             {
                                 ScriptsCore.executeScript("touch(" + frmMain.Xsf + "," + frmMain.Ysf + "," + (object)0 + ")", out result);
                                 for (int index = 0; index < 5; ++index)
                                 {
                                     ScriptsCore.executeScript("touch(" + frmMain.Xsf + "," + frmMain.Ysf + "," + (object)0 + ")", out result);
                                     Thread.Sleep(100);
                                 }
                             }
                             catch (Exception ex)
                             {
                             }
                         }
                         else if (dictionary2["id"].ToString().IndexOf("com.apple.mobilesafari") < 0)
                         {
                             bool result;
                             ScriptsCore.executeScript("open_url(" + frmMain.linkoff + ",)", out result);
                         }
                     }
                 }
             }
             Thread.Sleep(1000);
             Console.WriteLine("Check => False");
             appstoreInterval -= 2;
         }
     }
     catch (Exception ex)
     {
         bool sttconnect = frmMain.sttconnect;
         Console.WriteLine((object)ex);
     }
 }