Example #1
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);
                }
            }
        }
Example #2
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);
            }
        }