Esempio n. 1
0
        private static void GenerateVersionProto(string dir, VersionConfig versionProto, string relativePath)
        {
            //遍历输出AB包的路径 找到他下面的所有资源(文件)
            foreach (string file in Directory.GetFiles(dir))
            {
                //每个文件信息:Md5 获取它的大小 路径
                string   md5      = MD5Helper.FileMD5(file);
                FileInfo fi       = new FileInfo(file);
                long     size     = fi.Length;
                string   filePath = relativePath == "" ? fi.Name : $"{relativePath}/{fi.Name}";

                //key是文件的路径 Value文件信息
                versionProto.FileInfoDict.Add(filePath, new FileVersionInfo
                {
                    File = filePath,
                    MD5  = md5,
                    Size = size,
                });
            }

            //对资源AB包输出路径下的文件夹进行操作
            foreach (string directory in Directory.GetDirectories(dir))
            {
                //找到子文件夹 然后回调GenerateVersionProto 将文件夹路径传递进来
                DirectoryInfo dinfo = new DirectoryInfo(directory);
                string        rel   = relativePath == "" ? dinfo.Name : $"{relativePath}/{dinfo.Name}";
                GenerateVersionProto($"{dir}/{dinfo.Name}", versionProto, rel);
            }
        }
Esempio n. 2
0
        private static void GenerateVersionProto(string dir, VersionConfig versionProto, string relativePath)
        {
            foreach (string file in Directory.GetFiles(dir))
            {
                if (file.EndsWith(".manifest"))
                {
                    continue;
                }
                string   md5      = MD5Helper.FileMD5(file);
                FileInfo fi       = new FileInfo(file);
                long     size     = fi.Length;
                string   filePath = relativePath == "" ? fi.Name : $"{relativePath}/{fi.Name}";

                versionProto.FileInfoDict.Add(filePath, new FileVersionInfo
                {
                    File = filePath,
                    MD5  = md5,
                    Size = size,
                });
            }

            foreach (string directory in Directory.GetDirectories(dir))
            {
                DirectoryInfo dinfo = new DirectoryInfo(directory);
                string        rel   = relativePath == "" ? dinfo.Name : $"{relativePath}/{dinfo.Name}";
                GenerateVersionProto($"{dir}/{dinfo.Name}", versionProto, rel);
            }
        }
Esempio n. 3
0
        private static void GenerateVersionProtoForGame(string dir, string subGame, VersionConfig versionProto, string relativePath)
        {
            foreach (string file in Directory.GetFiles(dir))
            {
                // 剔除.manifest
                if (file.EndsWith(".manifest"))
                {
                    continue;
                }

                // 剔除子游戏
                bool   pass = false;
                string tmp  = file.Replace('\\', '/');
                foreach (string s in gamesDirs)
                {
                    if (tmp.Contains(s + "/"))
                    {
                        pass = true;
                        break;
                    }
                }
                if (!pass)
                {
                    continue;
                }

                string   md5      = MD5Helper.FileMD5(file);
                FileInfo fi       = new FileInfo(file);
                long     size     = fi.Length;
                string   filePath = relativePath == "" ? $"{subGame}/{fi.Name}" : $"{relativePath}/{fi.Name}";

                versionProto.FileInfoDict.Add(filePath, new FileVersionInfo
                {
                    File = filePath,
                    MD5  = md5,
                    Size = size,
                });
            }

            foreach (string directory in Directory.GetDirectories(dir))
            {
                DirectoryInfo dinfo = new DirectoryInfo(directory);
                string        rel   = relativePath == "" ? $"{subGame}/{dinfo.Name}" : $"{relativePath}/{dinfo.Name}";
                GenerateVersionProtoForGame($"{dir}/{dinfo.Name}", subGame, versionProto, rel);
            }

            string tDay = DateTime.Now.ToString("yyMMdd");

            try
            {
                var oldConfig = JsonHelper.FromJson <VersionConfig>(File.ReadAllText($"{dir}/Version.txt"));
                var oldver    = oldConfig.Version.ToString().Substring(6, 4);
                versionProto.Version = int.Parse(tDay + oldver) + 1;
            }
            catch (Exception)
            {
                versionProto.Version = int.Parse(tDay + "1000");
            }
        }
Esempio n. 4
0
    public static string GetBundleMD5(string bundleName)
    {
        string path = Path.Combine(ResourceConfig.PD_AB + ResourceConfig.Platform, bundleName);

        if (File.Exists(path))
        {
            return(MD5Helper.FileMD5(path));
        }
        return("");
    }
Esempio n. 5
0
    public static void ReadDllInfo(DllVersion dllVersion, string path)
    {
        string   md5      = MD5Helper.FileMD5(path);
        FileInfo fileInfo = new FileInfo(path);
        long     size     = fileInfo.Length;

        dllVersion.dllFile.Add(Path.GetFileName(path), new DllConfig()
        {
            md5 = md5, size = size
        });
    }
Esempio n. 6
0
    //获得指定VersionConfig对象中指定地址资源文件的MD5
    public static string GetBundleMD5(string bundleName)
    {
        string path = Path.Combine(PathHelper.AppHotfixResPath, bundleName);

        if (File.Exists(path))
        {
            //Log.Debug(bundleName+"本地文件的MD5:" + MD5Helper.FileMD5(path));
            return(MD5Helper.FileMD5(path));
        }

        return("");
    }
    /// <summary>
    /// 导出所有
    /// </summary>
    /// <param name="exportDir"></param>
    private void ExportAll(string exportDir)
    {
        //md5文件的路径
        string md5File = Path.Combine(ExcelPath, "md5.txt");

        //如果不包含md5文件 构建ExcelMD5Info
        if (!File.Exists(md5File))
        {
            this.md5Info = new ExcelMD5Info();
        }
        else
        {
            //如果包含 就读取文件的所有文本 为json格式
            //再反序列化成实体类ExcelMD5Info
            this.md5Info = MongoHelper.FromJson <ExcelMD5Info>(File.ReadAllText(md5File));
        }
        //遍历"../Excel"路径下的所有文件
        foreach (string filePath in Directory.GetFiles(ExcelPath))
        {
            //如果扩展名不是.xlsx 继续遍历下一个元素
            if (Path.GetExtension(filePath) != ".xlsx")
            {
                continue;
            }
            //临时缓存文件 忽略之
            if (Path.GetFileName(filePath).StartsWith("~"))
            {
                continue;
            }
            //如果是.xlsx文件
            //获取文件名
            string fileName = Path.GetFileName(filePath);
            //旧的md5码
            string oldMD5 = this.md5Info.Get(fileName);
            //当前的md5码
            string md5 = MD5Helper.FileMD5(filePath);
            //缓存起来
            this.md5Info.Add(fileName, md5);
            //对比md5 如果一样 则继续检查下一个元素
            if (md5 == oldMD5)
            {
                continue;
            }
            //如果不一样 则调用Export接口 filePath:文件路径 exportDir导出路径,客户端为clientPath变量的值
            Export(filePath, exportDir);
        }

        //全部遍历完 就将md5Info序列化成json 写入到md5File文件中
        File.WriteAllText(md5File, this.md5Info.ToJson());

        Log.Info("所有表导表完成");
        AssetDatabase.Refresh();
    }
Esempio n. 8
0
        private void CopyABToLocal()
        {
            if (build_SelectIndex == 1)
            {
                return;
            }

            ResVersion resVersion = new ResVersion {
                Res = new Dictionary <string, List <ResVersion.ResVersionInfo> >()
            };

            if (!resVersion.Res.ContainsKey(Define.ABsMainGroup))
            {
                resVersion.Res.Add(Define.ABsMainGroup, new List <ResVersion.ResVersionInfo>());
            }

            FileInfo fileInfo1 = new FileInfo(Path.Combine(build.OutPath, Define.ABsPathParent));

            resVersion.Res[Define.ABsMainGroup].Add(new ResVersion.ResVersionInfo()
            {
                File = Define.ABsPathParent,
                Size = fileInfo1.Length,
                MD5  = MD5Helper.FileMD5(fileInfo1.FullName)
            });

            List <string> files = new List <string> {
                Define.ABsPathParent
            };

            for (int i = 0; i < abs.Count; i++)
            {
                if (abs[i].CopyToLocal || build_SelectIndex == 2)
                {
                    files.Add(abs[i].Name);
                    if (!resVersion.Res.ContainsKey(abs[i].Group))
                    {
                        resVersion.Res.Add(abs[i].Group, new List <ResVersion.ResVersionInfo>());
                    }

                    FileInfo fileInfo = new FileInfo(Path.Combine(build.OutPath, abs[i].Name));
                    resVersion.Res[abs[i].Group].Add(new ResVersion.ResVersionInfo()
                    {
                        File = abs[i].Name,
                        Size = fileInfo.Length,
                        MD5  = MD5Helper.FileMD5(fileInfo.FullName)
                    });
                }
            }

            CopyTo(build.OutPath, build.CopyToLocalPath, files);
            GenerateVersion(resVersion, Path.Combine(build.CopyToLocalPath, "ResVersion.json"));
        }
Esempio n. 9
0
        /// <summary>
        /// 根据一个文件夹生成xml的配置文件(或zip文件)
        /// </summary>
        /// <param name="dirPath">要计算的文件夹</param>
        /// <param name="urlDom">url文件服务器上的路径,形如http://mr.xuexuesoft.com:8010/UpdateFile/</param>
        /// <param name="xmlPath">最后的结果xml文件路径(支持.xml和.zip)</param>
        public static void CreatConfigFileWithXml(string dirPath, string urlDom, string xmlPath)
        {
            OriginFolder folder = new OriginFolder();

            DirectoryInfo di = new DirectoryInfo(dirPath);

            FileInfo[] fis = di.GetFiles("*", SearchOption.AllDirectories);
            for (int i = 0; i < fis.Length; i++)
            {
                //遍历每一个文件
                FileInfo fi       = fis[i];
                FileItem fileItem = new FileItem()
                {
                    size = fi.Length
                };

                fileItem.relativePath = FileHelper.Relative(fi.FullName, dirPath); //求这个文件相对路径
                fileItem.url          = urlDom + fileItem.relativePath;
                fileItem.MD5          = MD5Helper.FileMD5(fi.FullName);            //计算md5

                //写到文件夹记录
                folder.Add(fileItem);
            }

            var xml = XmlHelper.CreatXml();

            folder.ToXml(xml.DocumentElement);            //文件夹内容挂到xml文件的根节点

            FileInfo xmlFileInfo = new FileInfo(xmlPath); //要保存的目录

            if (!xmlFileInfo.Directory.Exists)
            {
                Directory.CreateDirectory(xmlFileInfo.Directory.FullName);
            }

            if (xmlFileInfo.Extension == ".zip")//如果是zip那就保存zip文件
            {
                MemoryStream ms = new MemoryStream();
                xml.Save(ms);

                using (ZipFile zip = new ZipFile(Encoding.Default))
                {
                    ZipEntry zipEntry = new ZipEntry();
                    zip.AddEntry(xmlFileInfo.Name.Replace(".zip", ".xml"), ms.ToArray());//把xml的内存流写到zip文件
                    zip.Save(xmlFileInfo.FullName);
                }
            }
            else
            {
                xml.Save(xmlFileInfo.FullName);//保存.xml文件
            }
        }
Esempio n. 10
0
        private static void GenerateVersionProto(string dir, VersionConfig versionProto)
        {
            foreach (string file in Directory.GetFiles(dir))
            {
                string   md5  = MD5Helper.FileMD5(file);
                FileInfo fi   = new FileInfo(file);
                long     size = fi.Length;

                versionProto.FileInfoDict.Add(fi.Name, new FileVersionInfo
                {
                    File = fi.Name,
                    MD5  = md5,
                    Size = size,
                });
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 计算本地文件的MD5,标记哪些文件需要下载
 /// </summary>
 internal void CheekNeedDownload()
 {
     foreach (LocalFileItem item in fileItemClientDict.Values)
     {
         item.IsNeedDownload = true;//默认标记它需要下载
         if (File.Exists(item.targetFilePath))
         {
             item.lastTargetMD5 = MD5Helper.FileMD5(item.targetFilePath);//记录一下更新前的这个文件的md5
             if (item.lastTargetMD5 == item.fileItem.MD5)
             {
                 item.IsNeedDownload = false;//只有这一种情况不下载
             }
         }
         //就算是空文件也是要下载的
     }
 }
Esempio n. 12
0
    private void ExportAll(string exportDir)
    {
        string md5File = Path.Combine(ExcelPath, "md5.txt");
        if (!File.Exists(md5File))
        {
            this.md5Info = new ExcelMD5Info();
        }
        else
        {
            this.md5Info = MongoHelper.FromJson<ExcelMD5Info>(File.ReadAllText(md5File));
        }
        string[] files = Directory.GetFiles(ExcelPath);

        foreach (string filePath in files)
        {
            if (Path.GetExtension(filePath) != ".xlsx")
            {
                continue;
            }
            if (Path.GetFileName(filePath).StartsWith("~"))
            {
                continue;
            }
            if (!Path.GetFileNameWithoutExtension(filePath).Contains("Config"))
            {
                continue;
            }
            string fileName = Path.GetFileName(filePath);
            string oldMD5 = this.md5Info.Get(fileName);
            string md5 = MD5Helper.FileMD5(filePath);
            this.md5Info.Add(fileName, md5);
            //if (md5 == oldMD5)
            //{
            //    continue;
            //}

            Export(filePath, exportDir);
        }

        File.WriteAllText(md5File, this.md5Info.ToJson());

        Log.Info("所有表导表完成");
        AssetDatabase.Refresh();
    }
Esempio n. 13
0
        /// <summary>
        /// 用整个更新操作前后的目标文件md5比较,确保整个操作前后的文件一致。
        /// </summary>
        /// <returns></returns>
        public bool CheckTargetFileMD5BeforeAfter()
        {
            bool isCorrect = true;

            foreach (var item in localFolder.fileItemClientDict.Values)
            {
                if (!File.Exists(item.targetFilePath))
                {
                    continue;
                }

                if (item.lastTargetMD5 != MD5Helper.FileMD5(item.targetFilePath))
                {
                    isCorrect = false;
                    Log.Error("UpdateTask.CheckTargetFileMD5BeforeAfter(): 操作前目标文件和恢复后的MD5不一致 " + item.targetFilePath);
                }
            }

            return(isCorrect);
        }
    private static void ExportAll(string exportDir)
    {
        string md5File = Path.Combine(ExcelPath, "md5.txt");

        if (!File.Exists(md5File))
        {
            md5Info = new ExcelMD5Info();
        }
        else
        {
            md5Info = MongoHelper.FromJson <ExcelMD5Info>(File.ReadAllText(md5File));
        }

        foreach (string filePath in Directory.GetFiles(ExcelPath))
        {
            if (Path.GetExtension(filePath) != ".xlsx")
            {
                continue;
            }

            if (Path.GetFileName(filePath).StartsWith("~"))
            {
                continue;
            }

            string fileName = Path.GetFileName(filePath);
            string oldMD5   = md5Info.Get(fileName);
            string md5      = MD5Helper.FileMD5(filePath);
            md5Info.Add(fileName, md5);


            Export(filePath, exportDir);
        }

        File.WriteAllText(md5File, md5Info.ToJson());

        Log.Info("所有表导表完成");
        AssetDatabase.Refresh();
    }
Esempio n. 15
0
        private static void GenerateVersionProto(string dir, VersionConfig versionProto, string relativePath, bool pIsAbSec)
        {
            foreach (string file in Directory.GetFiles(dir))
            {
                string   md5      = MD5Helper.FileMD5(file);
                FileInfo fi       = new FileInfo(file);
                long     size     = fi.Length;
                string   filePath = relativePath == "" ? fi.Name : $"{relativePath}/{fi.Name}";

                versionProto.FileInfoDict.Add(filePath, new FileVersionInfo
                {
                    File = filePath,
                    MD5  = md5,
                    Size = size,
                });
            }
            foreach (string directory in Directory.GetDirectories(dir))
            {
                DirectoryInfo dinfo = new DirectoryInfo(directory);
                string        rel   = relativePath == "" ? dinfo.Name : $"{relativePath}/{dinfo.Name}";
                GenerateVersionProto($"{dir}/{dinfo.Name}", versionProto, rel, pIsAbSec);
            }
            string tDayHour = DateTime.Now.ToString("yyMMddHHmm");

            versionProto.Version    = int.Parse(tDayHour);
            versionProto.ABSecurity = pIsAbSec ? 2 : 1;//0未知,去load下, 1不使用加密   ,2加密-------若0使用不加密
            #region MyRegion
            //try
            //{//加密时,把version.txt删除了,无法记录第几次,只能使用时间记录了
            //    var oldConfig = JsonHelper.FromJson<VersionConfig>(File.ReadAllText($"{dir}/Version.txt"));
            //    var oldver = oldConfig.Version.ToString().Substring(6, 4);
            //    versionProto.Version = int.Parse(tDay + oldver) + 1;
            //}
            //catch (Exception)
            //{
            //    versionProto.Version = int.Parse(tDay + "1000");
            //}
            #endregion
        }
Esempio n. 16
0
    private static void GenerateVersionProto(string dir, string relativePath)
    {
        foreach (string file in Directory.GetFiles(dir))
        {
            string   md5      = MD5Helper.FileMD5(file);
            FileInfo fi       = new FileInfo(file);
            string   size     = fi.Length.ToString();
            string   filePath = relativePath == "" ? fi.Name : $"{relativePath}/{fi.Name}";

            versionConfig.FileInfoDict.Add(filePath, new FileVersionInfo
            {
                File = filePath,
                MD5  = md5,
                Size = size,
            });
        }

        foreach (string directory in Directory.GetDirectories(dir))
        {
            DirectoryInfo dinfo = new DirectoryInfo(directory);
            string        rel   = relativePath == "" ? dinfo.Name : $"{relativePath}/{dinfo.Name}";
            GenerateVersionProto($"{dir}/{dinfo.Name}", rel);
        }
    }
Esempio n. 17
0
        //每单个游戏都有个version
        public static void GenerateToGameVersionProto(string dir, string dirName)
        {
            VersionConfig versionProto = new VersionConfig();

            foreach (string file in Directory.GetFiles(dir))
            {
                string   md5  = MD5Helper.FileMD5(file);
                FileInfo fi   = new FileInfo(file);
                long     size = fi.Length;
                versionProto.FileInfoDict.Add(fi.Name, new FileVersionInfo
                {
                    File = fi.Name,
                    MD5  = md5,
                    Size = size,
                });
            }
            string versionPath = dir + "/" + dirName + "Version.txt";

            using (FileStream fileStream = new FileStream(versionPath, FileMode.Create))
            {
                byte[] bytes = JsonHelper.ToJson(versionProto).ToByteArray();
                fileStream.Write(bytes, 0, bytes.Length);
            }
        }
Esempio n. 18
0
        public void TestMethodMoveFile2()
        {
            ResetLog();//重设日志

            Runing.Increment.Log.Info("UnitTest1.TestMethodMoveFile2():生成xml文件");
            IDFHelper.CreatConfigFileWithXml("../Debug/", "http://127.0.0.1:22333/Debug/", "../test/IDFTest.zip");

            //FileHelper.CleanDirectory("../test/Temp");
            //FileHelper.CleanDirectory("../test/Target");
            //FileHelper.CleanDirectory("../test/Backup");

            if (Directory.Exists("../test/Target"))
            {
                FileInfo[] fis = new DirectoryInfo("../test/Target").GetFiles("*.*", SearchOption.AllDirectories);
                for (int i = 0; i < fis.Length; i++)
                {
                    if (i % 2 == 0)
                    {
                        File.Delete(fis[i].FullName);
                    }
                }
            }

            Thread.Sleep(500);

            bool isDone = false;

            IDF.Update("http://127.0.0.1:22333/test/IDFTest.zip", "../test/Temp", "../test/Target", "../test/Backup")
            .OnMoveFileDone((obj, success) =>
            {
                Runing.Increment.Log.Info("移动文件成功后回调");
                isDone = true;
            })
            .OnDownloadSuccess((obj) =>
            {
                //关闭那些程序
                //异步的移动文件
                Task.Run(() => { obj.MoveFile(); });
            })
            .OnError((e) =>
            {
                isDone = true;
            }).Go();

            while (!isDone)
            {
                Thread.Sleep(50);
            }

            var xml = XmlHelper.CreatXml();

            var          fs    = File.Open(new FileInfo("../test/IDFTest.zip").FullName, FileMode.Open, FileAccess.Read);
            ZipFile      zip   = ZipFile.Read(fs);
            ZipEntry     ze    = zip.Entries.First();//第一个实体
            MemoryStream xmlms = new MemoryStream();

            ze.Extract(xmlms);
            xmlms.Position = 0;
            xml.Load(xmlms); //从下载文件流中读xml
            OriginFolder originFolder = new OriginFolder();
            var          node         = xml.DocumentElement.SelectSingleNode("./" + typeof(OriginFolder).Name);

            originFolder.FromXml(node);//从xml文件根节点反序列化
            fs.Close();

            int index = 0;

            foreach (var item in originFolder.fileItemDict.Values)
            {
                index++;
                Runing.Increment.Log.Info($"测试{index}:测试校验文件" + item.relativePath);
                string itemTarFilePath = Path.Combine(new DirectoryInfo("../test/Target").FullName, item.relativePath);
                Assert.IsTrue(MD5Helper.FileMD5(itemTarFilePath) == item.MD5);
            }
        }
Esempio n. 19
0
        public void TestMethodRecoverFile()
        {
            ResetLog();//重设日志

            if (Directory.Exists("../test/Target"))
            {
                FileInfo[] fis = new DirectoryInfo("../test/Target").GetFiles("*", SearchOption.AllDirectories);
                for (int i = 0; i < fis.Length; i++)
                {
                    if (i % 2 == 0)
                    {
                        File.Delete(fis[i].FullName);
                    }
                }
            }
            Thread.Sleep(500);

            //干扰文件项
            var ws = File.CreateText(new FileInfo("../Debug/TestFile.txt").FullName);

            ws.Write("123456789123456789");
            ws.Close();

            ws = File.CreateText(new FileInfo("../test/Target/TestFile.txt").FullName);
            ws.Write("12345");
            ws.Close();

            Runing.Increment.Log.Info("UnitTest1.TestMethodRecoverFile():生成xml文件");
            IDFHelper.CreatConfigFileWithXml("../Debug/", "http://127.0.0.1:22333/Debug/", "../test/IDFTest.zip");

            //记录备份前目标文件的md5值
            DirectoryInfo backupBeforeDir = new DirectoryInfo("../test/Target");

            FileInfo[] backupBeforeFiles = backupBeforeDir.GetFiles("*", SearchOption.AllDirectories);
            Dictionary <string, string> backupBeforeMD5 = new Dictionary <string, string>();

            for (int i = 0; i < backupBeforeFiles.Length; i++)
            {
                FileInfo file = backupBeforeFiles[i];
                backupBeforeMD5.Add(file.FullName, MD5Helper.FileMD5(file.FullName));
            }

            bool isDone = false;

            IDF.Update("http://127.0.0.1:22333/test/IDFTest.zip", "../test/Temp", "../test/Target", "../test/Backup")
            .OnMoveFileDone((obj, success) =>
            {
                string str = File.ReadAllText(new FileInfo("../test/Target/TestFile.txt").FullName);
                Assert.IsTrue(str == "123456789123456789");

                obj.RecoverFile();
                isDone = true;
            })
            .OnDownloadSuccess((obj) =>
            {
                //关闭那些程序
                obj.MoveFile();
            })
            .OnError((e) =>
            {
                isDone = true;
            }).Go();

            while (!isDone)
            {
                Thread.Sleep(50);
            }

            //记录备份后目标文件的md5值
            Runing.Increment.Log.Info($"UnitTest1.TestMethodRecoverFile(): 开始检查备份前后的文件...");
            DirectoryInfo backupAfterDir = new DirectoryInfo("../test/Target");

            FileInfo[] backupAfterFiles = backupAfterDir.GetFiles("*", SearchOption.AllDirectories);
            Assert.IsTrue(backupBeforeMD5.Count == backupAfterFiles.Length);

            for (int i = 0; i < backupAfterFiles.Length; i++)
            {
                FileInfo file = backupAfterFiles[i];
                Assert.IsTrue(backupBeforeMD5[file.FullName] == MD5Helper.FileMD5(file.FullName));
            }

            string str2 = File.ReadAllText(new FileInfo("../test/Target/TestFile.txt").FullName);

            Assert.IsTrue(str2 == "12345");
        }
Esempio n. 20
0
    private void ExportAll()
    {
        string md5File = Path.Combine(ExcelPath, "md5.txt");

        if (!File.Exists(md5File))
        {
            this.md5Info = new ExcelMD5Info();
        }
        else
        {
            this.md5Info = MongoHelper.FromJson <ExcelMD5Info>(File.ReadAllText(md5File));
        }

        string[] tempArr = Directory.GetFiles(ExcelPath, "*.xlsx", SearchOption.AllDirectories);


        foreach (string filePath in tempArr)
        {
            if (Path.GetExtension(filePath) != ".xlsx")
            {
                continue;
            }
            if (Path.GetFileName(filePath).StartsWith("~"))
            {
                continue;
            }

            string eliminatePath = "";
            string exportDir     = "";
            switch (_excelType)
            {
            case ExcelType.Client:
                if (filePath.Contains(_publicExcelPartPath))
                {
                    exportDir = _publicExportPath;
                }
                else
                {
                    exportDir = _clientExportPath;
                }
                eliminatePath = _serverExcelPartPath;
                break;

            case ExcelType.Public:
                break;

            case ExcelType.Server:
                if (filePath.Contains(_publicExcelPartPath))
                {
                    exportDir = _publicExportPath;
                }
                else
                {
                    exportDir = _serverExportPath;
                }
                eliminatePath = _clientExcelPartPath;
                break;
            }
            if (filePath.Contains(eliminatePath))
            {
                continue;
            }

            string fileName = Path.GetFileName(filePath);
            string oldMD5   = this.md5Info.Get(fileName);
            string md5Key   = _excelType + "-" + fileName;
            string md5      = MD5Helper.FileMD5(filePath);
            this.md5Info.Add(md5Key, md5);
            if (md5 == oldMD5)
            {
                continue;
            }

            Export(filePath, exportDir);

            if (_excelType == ExcelType.Client)
            {
                string protoName  = Path.GetFileNameWithoutExtension(fileName);
                string sourcePath = Path.Combine(exportDir, $"{protoName}.txt");
                string destPath   = Path.Combine(_clientCopyPath, $"{protoName}.txt");
                if (File.Exists(destPath))
                {
                    File.Delete(destPath);
                }
                File.Copy(sourcePath, destPath);
            }

            else if (_excelType == ExcelType.Server)
            {
                string protoName  = Path.GetFileNameWithoutExtension(fileName);
                string sourcePath = Path.Combine(exportDir, $"{protoName}.txt");
                string destPath   = Path.Combine(_serverCopyPath, $"{protoName}.txt");
                if (File.Exists(destPath))
                {
                    File.Delete(destPath);
                }
                File.Copy(sourcePath, destPath);
            }
        }

        File.WriteAllText(md5File, this.md5Info.ToJson());

        Log.Info("所有表导表完成");
        AssetDatabase.Refresh();
    }