diff --git a/AssetStudio/AssetsManager.cs b/AssetStudio/AssetsManager.cs index fe6f293..835ed88 100644 --- a/AssetStudio/AssetsManager.cs +++ b/AssetStudio/AssetsManager.cs @@ -270,7 +270,7 @@ namespace AssetStudio assetsFile.originalPath = originalPath; if (assetBundleUnityVer != null && assetsFile.header.m_Version < SerializedFileFormatVersion.Unknown_7) { - assetsFile.SetVersion(assetBundleUnityVer); + assetsFile.version = assetBundleUnityVer; } CheckStrippedVersion(assetsFile, assetBundleUnityVer); assetsFileList.Add(assetsFile); @@ -487,7 +487,7 @@ namespace AssetStudio } if (specifiedUnityVersion != null) { - assetsFile.SetVersion(SpecifyUnityVersion); + assetsFile.version = SpecifyUnityVersion; } } diff --git a/AssetStudio/SerializedFile.cs b/AssetStudio/SerializedFile.cs index e10c38b..af6183c 100644 --- a/AssetStudio/SerializedFile.cs +++ b/AssetStudio/SerializedFile.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; using System.IO; -using System.Linq; -using System.Text.RegularExpressions; namespace AssetStudio { @@ -19,7 +17,6 @@ namespace AssetStudio public SerializedFileHeader header; private byte m_FileEndianess; - public string unityVersion = "2.5.0f5"; public BuildTarget m_TargetPlatform = BuildTarget.UnknownPlatform; private bool m_EnableTypeTree = true; public List m_Types; @@ -71,8 +68,11 @@ namespace AssetStudio } if (header.m_Version >= SerializedFileFormatVersion.Unknown_7) { - unityVersion = reader.ReadStringToNull(); - SetVersion(new UnityVersion(unityVersion)); + version = new UnityVersion(reader.ReadStringToNull()); + } + else + { + version = new UnityVersion(2, 5, 0); } if (header.m_Version >= SerializedFileFormatVersion.Unknown_8) { @@ -216,15 +216,6 @@ namespace AssetStudio //reader.AlignStream(16); } - public void SetVersion(UnityVersion unityVer) - { - if (unityVer != null && !unityVer.IsStripped) - { - unityVersion = unityVer.FullVersion; - version = unityVer; - } - } - private SerializedType ReadSerializedType(bool isRefType) { var type = new SerializedType(); diff --git a/AssetStudio/UnityVersion.cs b/AssetStudio/UnityVersion.cs index 6c2ac0d..ae62d52 100644 --- a/AssetStudio/UnityVersion.cs +++ b/AssetStudio/UnityVersion.cs @@ -38,7 +38,7 @@ namespace AssetStudio { int[] ver = Regex.Matches(version, @"\d+").Cast().Select(x => int.Parse(x.Value)).ToArray(); (Major, Minor, Patch) = (ver[0], ver[1], ver[2]); - if (ver.Length == 4) + if (ver.Length >= 4) Build = ver[3]; FullVersion = version; } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index 8eb896d..13edb3a 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -266,7 +266,7 @@ namespace AssetStudioGUI var typeMap = await Task.Run(() => BuildClassStructure()); productName = string.IsNullOrEmpty(productName) ? "no productName" : productName; - Text = $"{guiTitle} - {productName} - {assetsManager.assetsFileList[0].unityVersion} - {assetsManager.assetsFileList[0].m_TargetPlatform}"; + Text = $"{guiTitle} - {productName} - {assetsManager.assetsFileList[0].version} - {assetsManager.assetsFileList[0].m_TargetPlatform}"; assetListView.VirtualListSize = visibleAssets.Count; @@ -278,7 +278,7 @@ namespace AssetStudioGUI classesListView.BeginUpdate(); foreach (var version in typeMap) { - var versionGroup = new ListViewGroup(version.Key); + var versionGroup = new ListViewGroup(version.Key.FullVersion); classesListView.Groups.Add(versionGroup); foreach (var uclass in version.Value) diff --git a/AssetStudioGUI/Studio.cs b/AssetStudioGUI/Studio.cs index 34542f2..9ac0237 100644 --- a/AssetStudioGUI/Studio.cs +++ b/AssetStudioGUI/Studio.cs @@ -429,12 +429,12 @@ namespace AssetStudioGUI return (productName, treeNodeCollection); } - public static Dictionary> BuildClassStructure() + public static Dictionary> BuildClassStructure() { - var typeMap = new Dictionary>(); + var typeMap = new Dictionary>(); foreach (var assetsFile in assetsManager.assetsFileList) { - if (typeMap.TryGetValue(assetsFile.unityVersion, out var curVer)) + if (typeMap.TryGetValue(assetsFile.version, out var curVer)) { foreach (var type in assetsFile.m_Types.Where(x => x.m_Type != null)) { @@ -458,7 +458,7 @@ namespace AssetStudioGUI } items[key] = new TypeTreeItem(key, type.m_Type); } - typeMap.Add(assetsFile.unityVersion, items); + typeMap.Add(assetsFile.version, items); } } return typeMap;