//private void OnApplicationFocus(bool focus)
    //{
    //    //更新目录
    //    UpdateFolder();
    //}

    //更新目录方法
    void UpdateFolder()
    {
        //初始输入输出目录
        string InputDir  = Application.dataPath + "/../Input/";
        string OutputDir = Application.dataPath + "/../Output/";

        //判断目录是否存在并创建
        if (!Directory.Exists(InputDir))
        {
            Directory.CreateDirectory(InputDir);
        }
        if (!Directory.Exists(OutputDir))
        {
            Directory.CreateDirectory(OutputDir);
        }

        //删除目录列表元素
        Button[] BtnList = FolderRoot.GetComponentsInChildren <Button>();
        for (int i = 0; i < BtnList.Length; i++)
        {
            Destroy(BtnList[i].gameObject);
        }

        //创建目录列表元素
        DirectoryInfo dir = new DirectoryInfo(InputDir);

        DirectoryInfo[] dii = dir.GetDirectories();
        if (dii.Length > 0)
        {
            foreach (var item in dii)
            {
                GameObject btn = Instantiate(BtnItem, FolderRoot);
                btn.GetComponentInChildren <Text>().text = item.Name;

                //添加目录按钮点击事件
                btn.GetComponent <Button>().onClick.AddListener(delegate
                {
                    //删除图片列表
                    CurrentInputPath  = item.ToString() + "/";
                    Button[] BtnList2 = FileRoot.GetComponentsInChildren <Button>();
                    for (int i = 0; i < BtnList2.Length; i++)
                    {
                        Destroy(BtnList2[i].gameObject);
                    }

                    //创建图片列表元素
                    var tmpDir         = InputDir + item.Name + "/";
                    DirectoryInfo dir2 = new DirectoryInfo(tmpDir);
                    var files          = dir2.GetFiles();
                    if (files.Length > 0)
                    {
                        List <FileInfo> filesname = new List <FileInfo>();
                        foreach (var item2 in files)
                        {
                            if (item2.Extension == ".png" || item2.Extension == ".jpg")
                            {
                                filesname.Add(item2);
                            }
                        }
                        for (int i = 0; i < filesname.Count; i++)
                        {
                            GameObject fileBtn = Instantiate(BtnItem, FileRoot);
                            fileBtn.GetComponentInChildren <Text>().text = filesname[i].Name;
                            //Destroy(fileBtn.GetComponent<Button>());
                        }
                    }
                });
            }
        }

        //删除视频列表元素
        Button[] BtnList3 = ClipRoot.GetComponentsInChildren <Button>();
        for (int i = 0; i < BtnList3.Length; i++)
        {
            Destroy(BtnList3[i].gameObject);
        }

        //创建视频列表元素
        DirectoryInfo   dir3       = new DirectoryInfo(OutputDir);
        var             files2     = dir3.GetFiles();
        List <FileInfo> filesname2 = new List <FileInfo>();

        foreach (var item in files2)
        {
            if (item.Extension == ".webm")
            {
                filesname2.Add(item);
            }
        }

        for (int i = 0; i < filesname2.Count; i++)
        {
            GameObject fileBtn = Instantiate(BtnItem, ClipRoot);
            fileBtn.GetComponentInChildren <Text>().text = filesname2[i].Name;

            //添加视频列表按钮点击事件
            fileBtn.GetComponent <Button>().onClick.AddListener(delegate
            {
                vp.source = VideoSource.Url;
                vp.url    = OutputDir + fileBtn.GetComponentInChildren <Text>().text;
                vp.Play();
            });
        }
    }
    public void RenameBtn()
    {
        DirectoryInfo   dir       = new DirectoryInfo(CurrentInputPath);
        var             files     = dir.GetFiles();
        List <FileInfo> filesname = new List <FileInfo>();

        foreach (var item in files)
        {
            if (item.Extension == ".png" || item.Extension == ".jpg")
            {
                filesname.Add(item);
            }
        }

        //foreach (var item in filesname)
        for (int i = 0; i < filesname.Count; i++)
        {
            string tmpstr = "";
            if (int.Parse(RenameInputList[2].text) == 1)
            {
                filesname[i].MoveTo(CurrentInputPath + RenameInputList[0].text + i + RenameInputList[1].text + filesname[i].Extension);
            }
            else if (int.Parse(RenameInputList[2].text) == 2)
            {
                if (i < 10)
                {
                    tmpstr = "0";
                }
                else
                {
                    tmpstr = "";
                }

                filesname[i].MoveTo(CurrentInputPath + RenameInputList[0].text + tmpstr + i + RenameInputList[1].text + filesname[i].Extension);
            }
            else if (int.Parse(RenameInputList[2].text) == 3)
            {
                if (i < 10)
                {
                    tmpstr = "00";
                }
                else if (i > 9 && i < 100)
                {
                    tmpstr = "0";
                }
                else
                {
                    tmpstr = "";
                }

                filesname[i].MoveTo(CurrentInputPath + RenameInputList[0].text + tmpstr + i + RenameInputList[1].text + filesname[i].Extension);
            }
            else if (int.Parse(RenameInputList[2].text) == 4)
            {
                if (i < 10)
                {
                    tmpstr = "000";
                }
                else if (i > 9 && i < 100)
                {
                    tmpstr = "00";
                }
                else if (i > 99 && i < 1000)
                {
                    tmpstr = "0";
                }
                else
                {
                    tmpstr = "";
                }

                filesname[i].MoveTo(CurrentInputPath + RenameInputList[0].text + tmpstr + i + RenameInputList[1].text + filesname[i].Extension);
            }
            else if (int.Parse(RenameInputList[2].text) == 5)
            {
                if (i < 10)
                {
                    tmpstr = "0000";
                }
                else if (i > 9 && i < 100)
                {
                    tmpstr = "000";
                }
                else if (i > 99 && i < 1000)
                {
                    tmpstr = "00";
                }
                else if (i > 999 && i < 10000)
                {
                    tmpstr = "0";
                }
                else
                {
                    tmpstr = "";
                }

                filesname[i].MoveTo(CurrentInputPath + RenameInputList[0].text + tmpstr + i + RenameInputList[1].text + filesname[i].Extension);
            }

            RenamePanel.gameObject.SetActive(false);

            Button[] BtnList = FileRoot.GetComponentsInChildren <Button>();
            for (int j = 0; j < BtnList.Length; j++)
            {
                Destroy(BtnList[j].gameObject);
            }

            //将参数修改为改名后的
            InputFieldList[1].text = RenameInputList[0].text + "%" + RenameInputList[2].text + "d" + RenameInputList[1].text + filesname[0].Extension;
        }
    }