Beispiel #1
0
        public static string GetBundleMD5(VersionConfig streamingVersionConfig, string bundleName)
        {
            string path = Path.Combine(PathHelper.AppHotfixResPath, bundleName);

            if (File.Exists(path))
            {
                return(MD5Helper.FileMD5(path));
            }

            if (streamingVersionConfig.FileInfoDict.ContainsKey(bundleName))
            {
                return(streamingVersionConfig.FileInfoDict[bundleName].MD5);
            }

            return("");
        }
Beispiel #2
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));
            }

            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   = 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();
        }
Beispiel #3
0
        static BuildAssemblieEditor()
        {
            Directory.CreateDirectory(s_ScriptAssembliesDir);

            if (File.Exists(s_ScriptAssembliesMd5FilePath))
            {
                string oldMD5 = File.ReadAllText(s_ScriptAssembliesMd5FilePath);
                string newMD5 = "";
                foreach (var t in s_OriginDllDirs)
                {
                    newMD5 += MD5Helper.FileMD5(t);
                }

                if (newMD5 == oldMD5)
                {
                    return;
                }

                BuildMuteAssembly();

                using (StreamWriter file = File.CreateText(s_ScriptAssembliesMd5FilePath))
                {
                    file.Write(newMD5);
                }
            }
            else
            {
                BuildMuteAssembly();
                using (StreamWriter file = File.CreateText(s_ScriptAssembliesMd5FilePath))
                {
                    string newMD5 = "";
                    foreach (var t in s_OriginDllDirs)
                    {
                        newMD5 += MD5Helper.FileMD5(t).ToString();
                    }

                    file.Write(newMD5);
                }
            }
        }
Beispiel #4
0
        private static void GenerateVersionProto(string dir, VersionConfig versionProto, string relativePath)
        {
            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);
            }
        }