0312 设置热更标识 logicversion 和assetversion 两个文件 的内容md5全异或取最后两个字母
| | |
| | | |
| | | public static DateTime assetsBuildTime = DateTime.MinValue; |
| | | |
| | | static Dictionary<string, AssetVersion> assetVersions = new Dictionary<string, AssetVersion>(); |
| | | public static Dictionary<string, AssetVersion> assetVersions = new Dictionary<string, AssetVersion>(); |
| | | //本地LogicBytes文件和 assetVersions 比较是否需要下载 |
| | | static Dictionary<string, AssetVersion> localAssetVersions = new Dictionary<string, AssetVersion>(); |
| | | static List<AssetVersion> priorDownLoadAssetVersions = new List<AssetVersion>(); |
| | |
| | | public readonly static string USER_ACCOUNT = Application.dataPath + "UserAccount"; |
| | | public readonly static string USER_PASSWORD = Application.dataPath + "UserPassword"; |
| | | |
| | | public string hotVersion = ""; |
| | | |
| | | public bool sdkLogined |
| | | { |
| | | get; |
| | |
| | | } |
| | | } |
| | | |
| | | //logicversion 和assetversion 两个文件 的内容md5全异或取最后两个字母 |
| | | public void RefreshHotVersion() |
| | | { |
| | | try |
| | | { |
| | | string logicVersionMd5 = ""; |
| | | string assetVersionMd5 = ""; |
| | | // 初始化结果字节数组(MD5 是 16 字节) |
| | | byte[] resultBytes = new byte[16]; |
| | | foreach (var item in LocalResManager.Instance.assetVersions) |
| | | { |
| | | // 对每个 MD5 进行异或运算 |
| | | byte[] md5Bytes = HexStringToByteArray(item.Value.md5); |
| | | for (int j = 0; j < 16; j++) |
| | | { |
| | | resultBytes[j] ^= md5Bytes[j]; |
| | | } |
| | | |
| | | } |
| | | //取最后两位 |
| | | logicVersionMd5 = BitConverter.ToString(resultBytes).Replace("-", "").ToLower().Substring(14, 2); |
| | | |
| | | resultBytes = new byte[16]; |
| | | foreach (var item in AssetVersionUtility.assetVersions) |
| | | { |
| | | // 对每个 MD5 进行异或运算 |
| | | byte[] md5Bytes = HexStringToByteArray(item.Value.md5); |
| | | for (int j = 0; j < 16; j++) |
| | | { |
| | | resultBytes[j] ^= md5Bytes[j]; |
| | | } |
| | | |
| | | } |
| | | assetVersionMd5 = BitConverter.ToString(resultBytes).Replace("-", "").ToLower().Substring(14, 2); |
| | | hotVersion = logicVersionMd5 + assetVersionMd5; |
| | | Debug.Log($"RefreshHotVersion {hotVersion}"); |
| | | } |
| | | catch |
| | | { |
| | | Debug.LogError("RefreshHotVersion 错误"); |
| | | } |
| | | } |
| | | |
| | | |
| | | |
| | | // 辅助方法:十六进制字符串转字节数组 |
| | | private byte[] HexStringToByteArray(string hex) |
| | | { |
| | | byte[] bytes = new byte[hex.Length / 2]; |
| | | for (int i = 0; i < hex.Length; i += 2) |
| | | { |
| | | bytes[i / 2] = Convert.ToByte(hex.Substring(i, 2), 16); |
| | | } |
| | | return bytes; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | public C0101_tagCPlayerLogin Get0101SendPackage(H0101_tagServerPrepared _serverInfo) |
| | | { |
| | | GameNetSystem.Instance.SetIsWaitLogin(false); |
| | |
| | | { |
| | | var deviceInfo = DeviceUtility.GetDeviceModel(); |
| | | deviceInfo.Replace(" ", "").Replace("=", "").Replace("%", "").Replace("-", "").Replace("|", ""); |
| | | var versionStr = StringUtility.Concat(VersionConfig.Get().version, "_", VersionConfig.Get().buildIndex.ToString(), "_", deviceInfo); |
| | | var versionStr = StringUtility.Concat(VersionConfig.Get().version, "_", |
| | | VersionConfig.Get().buildIndex.ToString(), "_", |
| | | hotVersion, "-", deviceInfo); |
| | | |
| | | send.Extra = StringUtility.Concat(VersionConfig.Get().SpID, "|", |
| | | SDKUtils.Instance.Device.uniqueID, "|", |
| | |
| | | { |
| | | base.OnPreOpen(); |
| | | Debug.Log("打开登录窗口"); |
| | | |
| | | LoginManager.Instance.RefreshHotVersion(); |
| | | |
| | | ServerListCenter.Instance.serverSelectEvent += OnServerChange; |
| | | ServerListCenter.Instance.onServerListRefreshEvent += OnServerListRefresh; |
| | |
| | |
|
| | | var contentPrefix = StringUtility.Concat("IMEI:", DeviceUtility.GetDeviceUniquenessIdentify(), ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "Version:", StringUtility.Concat(VersionConfig.Get().version, "_",
|
| | | VersionConfig.Get().buildIndex.ToString()), Language.Id, ";");
|
| | | VersionConfig.Get().buildIndex.ToString(), "-", LoginManager.Instance.hotVersion), Language.Id, ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "Brand:", DeviceUtility.GetDeviceName(), ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "MI5:", DeviceUtility.GetDeviceModel(), ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "os_version:", DeviceUtility.GetDeviceOSLevel(), ";");
|
| | |
| | |
|
| | | var contentPrefix = StringUtility.Concat("IMEI:", DeviceUtility.GetDeviceUniquenessIdentify(), ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "Version:", StringUtility.Concat(VersionConfig.Get().version, "_",
|
| | | VersionConfig.Get().buildIndex.ToString()), Language.Id, ";");
|
| | | VersionConfig.Get().buildIndex.ToString(), "-", LoginManager.Instance.hotVersion), Language.Id, ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "Brand:", DeviceUtility.GetDeviceName(), ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "MI5:", DeviceUtility.GetDeviceModel(), ";");
|
| | | contentPrefix = StringUtility.Concat(contentPrefix, "os_version:", DeviceUtility.GetDeviceOSLevel(), ";");
|