|
|
@@ -7,6 +7,10 @@ using System;
|
|
|
using System.Reflection;
|
|
|
using System.IO;
|
|
|
using System.IO.Compression;
|
|
|
+using System.Security.Cryptography;
|
|
|
+using System.Text;
|
|
|
+using System.Linq;
|
|
|
+
|
|
|
|
|
|
public class CheckHotUpdateRes : EditorWindow
|
|
|
{
|
|
|
@@ -58,7 +62,7 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
//Debug.Log();
|
|
|
info = AssetDatabase.LoadAssetAtPath<CheckResWindowInfo>(path);
|
|
|
info.InitTags();
|
|
|
- curResInfo = info.GetResInfo();
|
|
|
+ curResInfo = info.GetResInfo();
|
|
|
if (curResInfo == null)
|
|
|
{
|
|
|
curResInfo = new ResInfo();
|
|
|
@@ -79,6 +83,7 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
DrowSelectFolder("旧版本文件", "选择文件路径", "选择旧版本资源MD5文件路径", ref curResInfo.OldPath);
|
|
|
DrowSelectFolder("新版本文件", "选择文件路径", "选择新版本资源MD5文件路径", ref curResInfo.NewPath);
|
|
|
DrowSelectFolder("需跟新文件输出路径", "选择文件路径", "选择需跟新文件输出路径", ref curResInfo.OutputPath);
|
|
|
+ DrowSelectFolder("ab包名基础名字文件路径", "选择文件路径", "选择ab包名基础名字文件路径", ref curResInfo.BaseNameFileInfoPath);
|
|
|
DrawInfo();
|
|
|
DrawCheckBtn();
|
|
|
|
|
|
@@ -213,6 +218,11 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
GUILayout.BeginHorizontal();
|
|
|
GUILayout.Space(60);
|
|
|
curResInfo.IsIgnore =GUILayout.Toggle(curResInfo.IsIgnore, "是否开启忽略某些文件") ;
|
|
|
+ GUILayout.Space(60);
|
|
|
+ if (GUILayout.Button("制作混淆信息"))
|
|
|
+ {
|
|
|
+ MakeAbHxNameAssets();
|
|
|
+ }
|
|
|
GUILayout.EndHorizontal();
|
|
|
}
|
|
|
private List<VersionInfoData> SerizlizeResList(byte[] data)
|
|
|
@@ -242,6 +252,14 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
|
|
|
List<VersionInfoData> newlist = GetInfoDatas(newPath);
|
|
|
ChangeResMD5(newlist);
|
|
|
+
|
|
|
+ Dictionary<string, string> abNamedic = null;
|
|
|
+ if (curResInfo.IsHx)
|
|
|
+ {
|
|
|
+ abNamedic= GetCurInfoAbNameInfos();
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
if (Oldlist != null && newlist != null)
|
|
|
{
|
|
|
int size = newlist.Count;
|
|
|
@@ -256,22 +274,26 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
|
|
|
bool isignore = false;
|
|
|
|
|
|
-
|
|
|
- RG_Ignore_Info rG_Ignore_Info = curResInfo.Rg_Essential_Infos.FindFirst(it => !it.IsIgnore && newlist[i].FullName.Contains(it.Field));
|
|
|
+ string baseName = newlist[i].FullName; ;
|
|
|
+ RG_Ignore_Info rG_Ignore_Info = null;
|
|
|
+ if (curResInfo.IsHx && abNamedic.ContainsKey(newlist[i].FullName))
|
|
|
+ {
|
|
|
+
|
|
|
+ baseName = abNamedic[newlist[i].FullName];
|
|
|
+ }
|
|
|
+ rG_Ignore_Info = curResInfo.Rg_Essential_Infos.FindFirst(it => !it.IsIgnore && baseName.Contains(it.Field));
|
|
|
|
|
|
bool isEssential = rG_Ignore_Info != null;
|
|
|
|
|
|
if (curResInfo.IsIgnore && !isEssential)
|
|
|
{
|
|
|
- string igstr = curResInfo.IgnoreFiles.FindFirst(it => it == newlist[i].FullName);
|
|
|
- rG_Ignore_Info = curResInfo.rG_Ignore_Infos.FindFirst(it => it.IsIgnore && newlist[i].FullName.Contains( it.Field));
|
|
|
+ string igstr = curResInfo.IgnoreFiles.FindFirst(it => it == baseName);
|
|
|
+ rG_Ignore_Info = curResInfo.rG_Ignore_Infos.FindFirst(it => it.IsIgnore && baseName.Contains( it.Field));
|
|
|
if (!string.IsNullOrEmpty(igstr) || rG_Ignore_Info != null)
|
|
|
{
|
|
|
isignore = true;
|
|
|
- Debug.Log("=========忽略=============" + newlist[i].FullName);
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
+ Debug.Log("=========忽略=============" + baseName);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
VersionInfoData ores = Oldlist.FindFirst(it=> it.FullName == newlist[i].FullName);
|
|
|
@@ -443,4 +465,64 @@ public class CheckHotUpdateRes : EditorWindow
|
|
|
string datapath = $"{Application.dataPath}/Content/Icons/";
|
|
|
FileHelper.CopyDir(datapath, curResInfo.OutputPath, "meta");
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ public static string GetABFileName(string abName,string s_ObscureKey)
|
|
|
+ {
|
|
|
+
|
|
|
+ try
|
|
|
+ {
|
|
|
+ using (var md5 = new MD5CryptoServiceProvider())
|
|
|
+ {
|
|
|
+ UTF8Encoding encoding = new UTF8Encoding(false);
|
|
|
+ byte[] bytes = encoding.GetBytes((abName + s_ObscureKey).ToLower());
|
|
|
+ bytes = md5.ComputeHash(bytes);
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ for (int i = 0; i < bytes.Length; i++)
|
|
|
+ {
|
|
|
+ sb.Append(bytes[i].ToString("x2"));
|
|
|
+ }
|
|
|
+ return sb.ToString();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ catch (Exception e)
|
|
|
+ {
|
|
|
+ Debug.LogException(e);
|
|
|
+ }
|
|
|
+
|
|
|
+ return abName;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void MakeAbHxNameAssets()
|
|
|
+ {
|
|
|
+ List<VersionInfoData> baseData = GetInfoDatas(curResInfo.BaseNameFileInfoPath);
|
|
|
+ AbNameHxInfo hxInfo = curResInfo.abNameHxInfo == null? new AbNameHxInfo():curResInfo.abNameHxInfo;
|
|
|
+ if (hxInfo.Infos == null)
|
|
|
+ hxInfo.Infos = new List<abNameInfo>();
|
|
|
+ foreach (var item in baseData)
|
|
|
+ {
|
|
|
+ string hxName = GetABFileName(item.FullName,curResInfo.hxKey);
|
|
|
+ abNameInfo nameInfo = new abNameInfo()
|
|
|
+ {
|
|
|
+ BaseName = item.FullName,
|
|
|
+ HxName = hxName,
|
|
|
+ };
|
|
|
+ hxInfo.Infos.Add(nameInfo);
|
|
|
+ }
|
|
|
+ curResInfo.abNameHxInfo = hxInfo;
|
|
|
+ }
|
|
|
+
|
|
|
+ public Dictionary<string,string> GetCurInfoAbNameInfos()
|
|
|
+ {
|
|
|
+ Dictionary<string, string> abinfos = new Dictionary<string, string>();
|
|
|
+
|
|
|
+ foreach (var item in curResInfo.abNameHxInfo.Infos)
|
|
|
+ {
|
|
|
+ abinfos.Add(item.HxName,item.BaseName);
|
|
|
+ }
|
|
|
+
|
|
|
+ return abinfos;
|
|
|
+ }
|
|
|
}
|