Ejemplo n.º 1
0
        private void install(string type)
        {
            UpdateDes.Text = "正在准备安装最新的病毒库...";
            au3 = new AutoItX3Lib.AutoItX3Class();								//initialize our au3 class library
            //au3.AutoItSetOption("WinDetectHiddenText", 1);
            au3.AutoItSetOption("WinTitleMatchMode", 2);						//advanced window matching
            string sPath = Environment.CurrentDirectory + @"\360upd\";

            sPath = sPath + @"360sd-upd" + type + ver + ".exe";
            //MessageBox.Show(sPath);
            au3.Run(sPath, "", au3.SW_MINIMIZE);
            au3.WinWaitActive("360杀毒");
            string title = au3.WinGetTitle("360杀毒");
            string text = au3.ControlGetText("360杀毒", "", "[CLASS:Static; INSTANCE:1]");
            if (text.Equals("在您的机器中发现未安装360杀毒, 请先安装360杀毒!"))
            {
                UpdateDes.Text = text;
                au3.Send("{ENTER}");
                downloadSd();
                installSd();
                install("");
                return;
                //downloadFile("-savapi-full");
                //install("-savapi-full");
            }
             text  = au3.ControlGetText("360杀毒", "", "[CLASS:Static]");

            if (text.Equals("您安装的是迷你版360杀毒, 请下载病毒库完整安装包!"))
            {
                UpdateDes.Text = "您安装的是迷你版360杀毒, 系统需要下载完整安装包!";
                au3.Send("{ENTER}");

                downloadFile("-savapi-full");
                install("-savapi-full");
            }

            if (title.Equals("360杀毒提示"))
            {

                text = au3.ControlGetText("360杀毒提示", "", "[CLASS:Static; INSTANCE:2]");
                //MessageBox.Show(text);
                if (text.Equals("即将关闭正在运行的360杀毒,您确认要立即更新吗?"))
                au3.Send("!y");
                au3.WinWaitActive("360杀毒", "已成功完成病毒库更新");
                au3.WinActivate("360杀毒", "已成功完成病毒库更新");
                au3.Send("!l");
            }
        }