示例#1
0
        /// <summary>
        /// 上传未通过
        /// </summary>
        /// <param name="stm">服务端发来未通过信息</param>
        /// <param name="gnpy">任务渠道</param>
        /// <param name="appSrc">时间戳文件夹</param>
        public string Uploa(string stm, string gnpy, string appSrc)
        {
            if (stm == "无未通过报告")
            {
                return("无未通过报告");
            }
            var tempStr = stm.Substring(0, stm.Length - 1).Split(',', '-', ':');

            try
            {
                for (var i = 0; i < tempStr.Length; i += 3)
                {
                    if (DirFile.IsExistFile($@"{ProjectSite}data\script\environinit\tempDate\{tempStr[i + 1]}.xlsx"))
                    {
                        var destFilePath = $@"{ApkSite}{gnpy}\{appSrc}\excel\{tempStr[i]}";

                        RunCmdPython($@"{ProjectSite}main\pngzip\pngzip.py", $@"{ProjectSite}data\result\image\{tempStr[i + 1]}");

                        DirFile.CopyFolder($@"{ProjectSite}data\result\image\{tempStr[i + 1]}", $@"{destFilePath}\操作步骤图片");
                        DirFile.Copy($@"{ProjectSite}data\result\excel\{tempStr[i + 2]}.xlsx", $@"{destFilePath}\{tempStr[i + 2]}.xlsx");
                    }
                    else if (DirFile.IsExistDirectory($@"{ProjectSite}data\result\image\{tempStr[i + 1]}"))
                    {
                        RunCmdPython($@"{ProjectSite}main\pngzip\pngzip.py", $@"{ProjectSite}data\result\image\{tempStr[i + 1]}");
                        DirFile.CopyFolder(
                            $@"{ProjectSite}data\result\image\{tempStr[i + 1]}",
                            $@"{ApkSite}{gnpy}\{appSrc}\failed\{tempStr[i]}");
                    }
                }
            }

            catch (Exception)
            {
                // ignored
            }

            DirFile.CopyFolder($@"{ProjectSite}data\script\environinit\tempDate", $@"{ApkSite}{gnpy}\{appSrc}\tempDate");
            return("上传完成");
        }
示例#2
0
        /// <summary>下载任务资源文件</summary>
        /// <param name="gnpy">渠道名称</param>
        /// <param name="AppSrc">时间戳-任务文件夹</param>
        /// <returns></returns>
        public string DownResource(string gnpy, string AppSrc)
        {
            var str = "获取到文件:\t\n";

            var path = $@"{ApkSite}{gnpy}\{AppSrc}";

            try
            {
                var root = new DirectoryInfo(path);
                foreach (var t in root.GetFiles())
                {
                    if (Path.GetExtension(t.Name) == ".apk")
                    {
                        DirFile.Copy(t.FullName, $@"{ProjectSite}data\app\moyu.apk");
                        str = str + t + "\t\n";
                    }
                    else if (Path.GetExtension(t.Name) == ".sql")
                    {
                        DirFile.Copy(t.FullName, $@"{ProjectSite}data\sqlfile\sjmy_autotest.sql");
                        str = str + t + "\t\n";
                    }
                    else if (Path.GetExtension(t.Name) == ".zip")
                    {
                        DirFile.Copy(t.FullName, $@"{ProjectSite}data\update\zipfile\sjmy.zip");
                        SharpZip.UnpackFiles(
                            $@"{ProjectSite}data\update\zipfile\sjmy.zip",
                            $@"{ProjectSite}data\update\filezip\");
                        str = str + t + "\t\n";
                    }
                }
            }
            catch (Exception e)
            {
                return(e.ToString());
            }

            return(str + "客户端环境下载完成");
        }
示例#3
0
        public string CopyScript(string gnpy, string apkVersion)
        {
            if (gnpy == "myht")
            {
                return("脚本文件复制完成");
            }

            var sArray = apkVersion.Split('.');
            var path   = $@"{ProjectSite}data\script\AllVersion\{sArray[0]}.{sArray[1]}.X";

            if (!DirFile.IsExistDirectory(path))
            {
                var dir = new DirectoryInfo($@"{ProjectSite}data\script\AllVersion").GetDirectories("*.X");

                // 复制最大文件夹中的内容
                DirFile.CopyFolder($@"{ProjectSite}data\script\AllVersion\{DirFile.SortAsFileName(ref dir)}", path);
            }

            DirFile.CopyFolder(path, $@"{ProjectSite}data\script");
            DirFile.Copy($@"{ProjectSite}data\script\environinit\UserInfo.xml", $@"{ProjectSite}xmlconfig\UserInfo.xml");
            DirFile.Copy($@"{ProjectSite}data\script\environinit\accountid.xml", $@"{ProjectSite}xmlconfig\accountid.xml");

            return("脚本文件复制完成");
        }
示例#4
0
        /// <summary>
        /// 设置click_login图片
        /// </summary>
        /// <param name="ranking"></param>
        /// <param name="gnpy"></param>
        public void SetImage(int ranking, string gnpy)
        {
            string[] resolution = { "720x1280", "1080x1920", "1440x2560" };

            if (ranking == 1)
            {
                switch (gnpy)
                {
                case "sjmy":

                    foreach (var variable in resolution)
                    {
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\template8.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\current.png");
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\select8.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\present.png");
                    }
                    break;

                case "xsjmy":

                    foreach (var variable in resolution)
                    {
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\sjmy_xsj_first.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\3.png");
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\sjmy_xsj_firstsmall.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\5.png");
                    }
                    break;


                case "myht":
                    foreach (var variable in resolution)
                    {
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\out10.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\current.png");
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\in10.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\present.png");
                    }
                    break;
                }
            }
            else
            {
                switch (gnpy)
                {
                case "sjmy":

                    foreach (var variable in resolution)
                    {
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\template7.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\current.png");
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\select7.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\present.png");
                    }
                    break;

                case "xsjmy":

                    foreach (var variable in resolution)
                    {
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\sjmy_xsj_second.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\3.png");
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\sjmy_xsj_secondsmall.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\5.png");
                    }
                    break;

                case "myht":

                    foreach (var variable in resolution)
                    {
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\out11.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\current.png");
                        DirFile.Copy(
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\in11.png",
                            $@"{ProjectSite}data\script\common\Click_Login{variable}\present.png");
                    }
                    break;
                }
            }
        }