use list to store objects in their original order

This commit is contained in:
Perfare
2020-03-28 14:13:25 +08:00
parent c4270e186d
commit e1dc54d6d7
4 changed files with 16 additions and 8 deletions

View File

@@ -15,7 +15,8 @@ namespace AssetStudio
public string fileName;
public int[] version = { 0, 0, 0, 0 };
public BuildType buildType;
public Dictionary<long, Object> Objects;
public List<Object> Objects;
public Dictionary<long, Object> ObjectsDic;
public SerializedFileHeader header;
private EndianType m_FileEndianess;
@@ -100,6 +101,8 @@ namespace AssetStudio
//ReadObjects
int objectCount = reader.ReadInt32();
m_Objects = new List<ObjectInfo>(objectCount);
Objects = new List<Object>(objectCount);
ObjectsDic = new Dictionary<long, Object>(objectCount);
for (int i = 0; i < objectCount; i++)
{
var objectInfo = new ObjectInfo();
@@ -331,6 +334,12 @@ namespace AssetStudio
}
}
public void AddObject(Object obj)
{
Objects.Add(obj);
ObjectsDic.Add(obj.m_PathID, obj);
}
public static bool IsSerializedFile(EndianBinaryReader reader)
{
var fileSize = reader.BaseStream.Length;