/// <summary> /// 对比版本信息 /// </summary> /// <param name="dversion">版本文本</param> private void CompareVersion(string dversion) { if (File.Exists(Application.dataPath + "/RushDevelopFW/PackageConfig.json")) { //旧的版本信息 ConfigJson oldVersion = JsonUtility.FromJson <ConfigJson>(File.ReadAllText(Application.dataPath + "/RushDevelopFW/PackageConfig.json")); //新的版本信息 ConfigJson newVersion = JsonUtility.FromJson <ConfigJson>(dversion); //比较版本信息 if (oldVersion.versionNum != newVersion.versionNum) { RDUpdateManager epu = EditorWindow.GetWindow <RDUpdateManager>(); epu.versionNum = newVersion.versionNum; epu.minSize = RDUpdateManager.minResolution; epu.maxSize = RDUpdateManager.minResolution; epu.Init(); epu.Show(); } else { Debug.LogFormat("R.D.版本管理器:您当前使用的是最新版本 {0}!如有问题请联系[email protected]", oldVersion.versionNum); AssetDatabase_importPackageCompleted(newVersion.versionNum); } } }
//检索文件目录 public static void ScanFolderAndGenerateConfig() { ConfigJson config = new ConfigJson(); WriteFilePath(scanPath, config); string configTXT = JsonUtility.ToJson(config); File.WriteAllText(Application.dataPath + "/RushDevelopFW/PackageConfig.json", configTXT); AssetDatabase.Refresh(); }
/// <summary> /// 遍历每一个文件目录 /// </summary> /// <param name="path">遍历的地址</param> /// <param name="config">在config文本中,添加需要的信息</param> private static void WriteFilePath(string path, ConfigJson config) { DirectoryInfo directoryInfo = new DirectoryInfo(path); FileInfo[] fileInfos = directoryInfo.GetFiles("*", SearchOption.AllDirectories); //Debug.Log(fileInfos.Length); for (int i = 0; i < fileInfos.Length; i++) { if (fileInfos[i].Name.EndsWith(".meta")) { continue; } config.log = RDUpdateConfig.log; config.versionNum = RDUpdateConfig.CurVersionNum; config.direct.Add(fileInfos[i].FullName); } }