Exemple #1
0
    /// <summary>
    /// 获取系统拷贝内容
    /// </summary>
    void GetSytemCopy()
    {
        var workdir = Environment.CurrentDirectory + "/python/";
        var results = EdtUtil.RunCmd("python", workdir + "HelloWorld.py " + @"D:\G66UI\ui\project\" /*ReadTargetDirectory()*/ + " " + arg, workdir);

        //Debug.Log("python output: " + results[0]);
        //Debug.Log("python error: " + results[1]);
        if (results[1].Contains("Python was not found") && !textAnim.activeSelf)
        {
            StartCoroutine(settipsAnim());
            Debug.Log("找不到Python或缺少'win32clipboard'请查看操作文档");
        }
        if (results[1].Contains("Specified clipboard format is not available"))
        {
            copyTxt.text = "亲 复制失败,再试一次吧!";
        }
        else if (string.Empty == results[1])
        {
            copyTxt.text = "搜索完毕!找到" + (results[0].Split('\n').Length - 1) + "条数据";
        }
        for (int i = 0; i < results[0].Split('\n').Length - 1; i++)
        {
            //Debug.Log(i + "::::" + results[0].Split('\n')[i].Replace("\'", "\""));
            string     rec   = results[0].Split('\n')[i];
            GameObject games = smallpool.pop();
            ItemInfo   json  = JsonUtility.FromJson <ItemInfo>(rec.Replace("\'", "\""));
            games.GetComponent <ListPre>().InitInfo(json.name, json.path, smallpool);
            games.transform.SetParent(smallpoolParent);
            gamesList.Add(games);
        }

        // c#抛出异常
        if (results[0].LastIndexOf("Error") > 0)
        {
            copyTxt.text = "python Error";
            throw new System.Exception("python Error");
        }
    }