MD5File() public static méthode

public static MD5File ( string file ) : string
file string
Résultat string
Exemple #1
0
    static void CreateVersionFile()
    {
        string        resPath  = ExportConfigWindow.EXPORT_OUT_PATH + Path.DirectorySeparatorChar;
        StringBuilder versions = new StringBuilder();

        // string zipPath = resPath + LGameConfig.UPDATE_FILE_ZIP;
        // if (!File.Exists(zipPath))
        // {
        //     Debug.LogWarning("热更zip包不存在");
        //     return;
        // }

        Helper.forEachHandle(Application.dataPath + "/StreamingAssets", new List <string> {
            "ab"
        }, (string filename) =>
        {
            string baseName = Path.GetFileName(filename);
            string md5      = ExportAssetBundles.MD5File(filename);
            versions.Append(baseName).Append(",").Append(md5).Append("\n");
        });

        // string md5 = ExportAssetBundles.MD5File(zipPath);
        // versions.Append(LGameConfig.UPDATE_FILE_ZIP).Append(",").Append(md5);

        // 生成配置文件
        FileStream stream = new FileStream(resPath + "version.ver", FileMode.Create);

        byte[] data = Encoding.UTF8.GetBytes(versions.ToString());
        stream.Write(data, 0, data.Length);
        stream.Flush();
        stream.Close();

        Debug.Log(" 版本文件: " + resPath + "version.ver");
    }
    static void createVersionFile()
    {
        string resPath = "C:/Users/Administrator/Desktop/tmp/";

        // 获取Res文件夹下所有文件的相对路径和MD5值
        string[]      files    = Directory.GetFiles(resPath, "*", SearchOption.AllDirectories);
        StringBuilder versions = new StringBuilder();

        for (int i = 0, len = files.Length; i < len; i++)
        {
            string filePath  = files[i];
            string extension = filePath.Substring(files[i].LastIndexOf("."));
            if (extension == ".unity3d" ||
                extension == ".assetbundle")
            {
                string relativePath = filePath.Replace(resPath, "").Replace("\\", "/");
                string md5          = ExportAssetBundles.MD5File(filePath);
                versions.Append(relativePath).Append(",").Append(md5).Append("\n");
            }
        }
        // 生成配置文件
        FileStream stream = new FileStream(resPath + "version.ver", FileMode.Create);

        byte[] data = Encoding.UTF8.GetBytes(versions.ToString());
        stream.Write(data, 0, data.Length);
        stream.Flush();
        stream.Close();

        Debug.Log(" 版本文件: " + resPath + "version.ver");
    }
Exemple #3
0
    static void CreateVersionFile()
    {
        string        resPath  = ExportConfigWindow.EXPORT_OUT_PATH + Path.DirectorySeparatorChar;
        StringBuilder versions = new StringBuilder();

        string zipPath = resPath + LGameConfig.UPDATE_FILE_ZIP;

        if (!File.Exists(zipPath))
        {
            Debug.LogWarning("热更zip包不存在");
            return;
        }
        string md5 = ExportAssetBundles.MD5File(zipPath);

        versions.Append(LGameConfig.UPDATE_FILE_ZIP).Append(",").Append(md5);

        // 生成配置文件
        FileStream stream = new FileStream(resPath + "version.ver", FileMode.Create);

        byte[] data = Encoding.UTF8.GetBytes(versions.ToString());
        stream.Write(data, 0, data.Length);
        stream.Flush();
        stream.Close();

        Debug.Log(" 版本文件: " + resPath + "version.ver");
    }
Exemple #4
0
    static void CreateVersionFile()
    {
        string resPath = Application.dataPath + Path.DirectorySeparatorChar;
        // 获取Res文件夹下所有文件的相对路径和MD5值
        //string[] files = Directory.GetFiles(resPath, "*", SearchOption.AllDirectories);
        StringBuilder versions = new StringBuilder();

        //for (int i = 0, len = files.Length; i < len; i++)
        //{
        //    string filePath = files[i];
        //    string extension = filePath.Substring(files[i].LastIndexOf("."));
        //    if (extension == ".zip")
        //    {
        //        string relativePath = filePath.Replace(resPath, "").Replace("\\", "/");
        //        string md5 = ExportAssetBundles.MD5File(filePath);
        //        versions.Append(relativePath).Append(",").Append(md5).Append("\n");
        //    }
        //}
        string zipPath = resPath + LGameConfig.UPDATE_FILE_ZIP;

        if (!File.Exists(zipPath))
        {
            Debug.LogWarning("热更zip包不存在");
            return;
        }
        string md5 = ExportAssetBundles.MD5File(zipPath);

        versions.Append(LGameConfig.UPDATE_FILE_ZIP).Append(",").Append(md5);

        // 生成配置文件
        FileStream stream = new FileStream(resPath + "version.ver", FileMode.Create);

        byte[] data = Encoding.UTF8.GetBytes(versions.ToString());
        stream.Write(data, 0, data.Length);
        stream.Flush();
        stream.Close();

        Debug.Log(" 版本文件: " + resPath + "version.ver");
    }