Beispiel #1
0
        /// <summary>
        /// 解析Apk
        /// </summary>
        public void ApkAnalysis()
        {
            try
            {
                var reader  = new ApkReader();
                var ApkPath = $@"{ApkSite}{Gnpy}\{AppSrc}";
                var Apk     = string.Empty;
                var root    = new DirectoryInfo(ApkPath);
                foreach (var t in root.GetFiles())
                {
                    if (Path.GetExtension(t.Name) == ".apk")
                    {
                        Apk     = t.FullName;
                        ApkName = t.Name;
                    }
                }

                var info = reader.Read(Apk);
                ApkPackage = info.PackageName;
                ApkVersion = info.VersionName;

                DirFile.Copy($@"{ApkSite}{Gnpy}\type1.png", $@"{ApkPath}\{Gnpy}.png");
            }
            catch (Exception ex)
            {
                ApkName = "NoAPKUploaded";

                ApkPackage = string.Empty;
                ApkVersion = string.Empty;
                //MessageBox.Show(ex.ToString());
            }
        }
Beispiel #2
0
        public bool CopyCheck(string ip, string newBase, string oldBase, string account, string password)
        {
            var drive = ip == "192.168.9.179" ? "F" : "G";

            var text   = $@"XCOPY /Y /E /C /H /S /I {drive}:\MYSQL40\data\{oldBase} {drive}:\MYSQL40\data\{newBase}";
            var cmd    = $@"wmic /node:'{ip}' /password:'******' /user:'******' process call create '{text}'";
            var runCmd = new RunCmd();
            var result = runCmd.Exe(cmd);

            if (result.IndexOf("ReturnValue = 0", StringComparison.OrdinalIgnoreCase) < 0)
            {
                return(false);
            }

            var initialDir = $@"\\{ip}\data\{oldBase}";
            var endDir     = $@"\\{ip}\data\{newBase}";

            var initialSize = DirSize(new DirectoryInfo(initialDir));


            for (var i = 0; i < 100; i++)
            {
                if (DirFile.IsExistDirectory(endDir))
                {
                    var endSize = DirSize(new DirectoryInfo(endDir));
                    if (initialSize == endSize)
                    {
                        return(true);
                    }

                    System.Threading.Thread.Sleep(2000);

                    if (i > 90)
                    {
                        break;
                    }
                }

                System.Threading.Thread.Sleep(2000);
            }
            return(false);
        }
Beispiel #3
0
        private string DecideLog()
        {
            try
            {
                if (_iniFile.IniReadValue("server", "LoadLog") == "0")
                {
                    return("本次任务无需上传log");
                }


                _sjmyHelper.RunCmdPython($@"{_sjmyHelper.ProjectSite}\data\script\servercase\sqlload.py");
                DirFile.CopyFolder($@"{_sjmyHelper.ProjectSite}\data\result\serverlog",
                                   $@"{_sjmyHelper.ApkSite}{_sjmyHelper.Gnpy}\{_sjmyHelper.AppSrc}\serverlog");

                return("本次任务log已上传,为空请检查sqlload.py脚本");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }
Beispiel #4
0
        //#region 修改账号快速登录服务器
        ///// <summary>使用MySqlData批量更新数据</summary>
        ///// <param name="severID">The sever ID.</param>
        ///// <returns></returns>
        //public int sqlUpdate(string severID)
        //{
        //    MySqlHelper.InitConnectStr("sjmy_config_nd");
        //    return MySqlHelper.ExecuteSql(
        //        $"update cq_login_record set server_id ='{severID}' where username in {channleResult}");

        //}
        //#endregion

        //#region 获取模拟器账号
        ///// <summary>
        ///// 通过xml获取的accountid 获得模拟器登录账号
        ///// </summary>
        //public void getChannel()
        //{
        //    var account = "(";
        //    var xd = new XmlDocument();
        //    //var sArray = ApkVersion.Split('.');
        //    //xd.Load($@"{ProjectSite}script\ndsdk\{sArray[0]}.{sArray[1]}.X\environinit\accountid.xml");
        //    xd.Load($@"Y:\sjmy\data\script\AllVersion\6.7.X\environinit\accountid.xml");
        //    var root = xd.DocumentElement;
        //    if (root != null)
        //        foreach (XmlNode xmlNode in root.ChildNodes)
        //        {
        //            foreach (XmlNode xmlElement in xmlNode.ChildNodes)
        //            {
        //                account = account + xmlElement.InnerText + ",";
        //            }
        //        }
        //    account = account.Substring(0, account.Length - 1) + ")";

        //    MySqlHelper.InitConnectStr("sjmy_autotest_init_ndsdk");
        //    var channle = MySqlHelper.GetDataSet(
        //        $"select channel_account from cq_user where account_id in {account}");
        //    channleResult = "(";

        //    for (var i = 0; i < channle.Tables["Table1"].Rows.Count; i++)
        //    {
        //        channleResult = channleResult + channle.Tables["Table1"].Rows[i].ItemArray[0].ToString().Remove(0, 5) + ",";
        //    }

        //    channleResult = channleResult + "883181957,938704954,934224165,934246512)";

        //    Console.WriteLine(channleResult);
        //}

        //#endregion

        #region 刷入初始库

        public bool intoSQL(string filePath)
        {
            var host     = "172.24.140.83";
            var userName = "******";
            var passWord = "******";

            if (!DirFile.IsExistFile(filePath))
            {
                return(true);
            }

            if (Gnpy != "myht")
            {
                return(MySqlHelper.IntoSQL(filePath, host, userName, passWord, "sjmy_again" + AppSrc) &&
                       MySqlHelper.IntoSQL(filePath, host, userName, passWord, "sjmy_autotest" + AppSrc));
            }

            host     = "192.168.9.179";
            userName = "******";
            passWord = "******";

            return(MySqlHelper.IntoSQL(filePath, host, userName, passWord, "myht_again" + AppSrc) &&
                   MySqlHelper.IntoSQL(filePath, host, userName, passWord, "myht_autotest" + AppSrc));
        }
Beispiel #5
0
        public string CopyServercase(string gnpy)
        {
            const string path105 = @"D:\developer\qatest\data\script\";

            try
            {
                switch (gnpy)
                {
                case "sjmy":
                    DirFile.CopyFolder(path105 + "servercase_ndsdk", path105 + "servercase");
                    break;

                case "xsjmy":
                    DirFile.CopyFolder(path105 + "servercase_xsj", path105 + "servercase");
                    break;
                }
            }
            catch (Exception e)
            {
                return(e.ToString());
            }

            return("换库脚本文件夹复制完成");
        }
Beispiel #6
0
        /// <summary>179复制需要运行的初始库</summary>
        /// <param name="gnpy">项目名称</param>
        /// <param name="AppSrc">时间戳(文件夹名称)</param>
        /// <returns></returns>
        public string CopyInitial(string gnpy, string AppSrc)
        {
            string path179 = @"\\172.24.140.83\data\";

            try
            {
                switch (gnpy)
                {
                case "sjmy":

                    if (DirFile.IsExistDirectory(path179 + "sjmy_autotest_init_ndsdk"))
                    {
                        if (!CopyCheck("172.24.140.83", $"sjmy_again{AppSrc}", "sjmy_autotest_init_ndsdk", "blacknull", "IDC2.passwd*()"))
                        {
                            return($"sjmy_again{AppSrc}复制失败");
                        }

                        if (!CopyCheck("172.24.140.83", $"sjmy_autotest{AppSrc}", "sjmy_autotest_init_ndsdk", "blacknull", "IDC2.passwd*()"))
                        {
                            return($"sjmy_autotest{AppSrc}复制失败");
                        }

                        //DirFile.CopyFolder(path179 + "sjmy_autotest_init_ndsdk", path179 + "sjmy_again" + AppSrc);
                        //DirFile.CopyFolder(path179 + "sjmy_autotest_init_ndsdk", path179 + "sjmy_autotest" + AppSrc);
                    }
                    else
                    {
                        return(path179 + "sjmy_autotest_init_ndsdk不存在");
                    }

                    break;

                case "xsjmy":
                    if (DirFile.IsExistDirectory(path179 + "sjmy_autotest_init_xsj"))
                    {
                        if (!CopyCheck("172.24.140.83", $"sjmy_again{AppSrc}", "sjmy_autotest_init_xsj", "blacknull", "IDC2.passwd*()"))
                        {
                            return($"sjmy_again{AppSrc}复制失败");
                        }

                        if (!CopyCheck("172.24.140.83", $"sjmy_autotest{AppSrc}", "sjmy_autotest_init_xsj", "blacknull", "IDC2.passwd*()"))
                        {
                            return($"sjmy_autotest{AppSrc}复制失败");
                        }
                    }
                    else
                    {
                        return("sjmy_autotest_init_xsj不存在");
                    }

                    break;

                case "myht":

                    path179 = @"\\192.168.9.179\data\";

                    if (DirFile.IsExistDirectory(path179 + "my_bak"))
                    {
                        if (!CopyCheck("192.168.9.179", $"myht_again{AppSrc}", "my_bak", "blacknull", "shangjia!@#123.idc1"))
                        {
                            DirFile.CopyFolder(path179 + "my_bak", path179 + "myht_again" + AppSrc);
                        }
                        if (!CopyCheck("192.168.9.179", $"myht_autotest{AppSrc}", "my_bak", "blacknull", "shangjia!@#123.idc1"))
                        {
                            DirFile.CopyFolder(path179 + "my_bak", path179 + "myht_autotest" + AppSrc);
                        }
                    }
                    else
                    {
                        return("my_bak不存在");
                    }
                    break;
                }
            }
            catch (Exception e)
            {
                return(e.ToString());
            }
            return("初始库复制完成");
        }