Refactor read assets

Generic PPtr
Misc
This commit is contained in:
Perfare
2018-11-21 15:37:56 +08:00
parent 8c749e21e1
commit bfaa207853
45 changed files with 1135 additions and 1055 deletions
+1 -34
View File
@@ -15,7 +15,7 @@ namespace AssetStudio
public ClassIDType type;
public SerializedType serializedType;
public BuildTarget platform;
private uint m_Version;
public uint m_Version;
public int[] version => assetsFile.version;
public BuildType buildType => assetsFile.buildType;
@@ -43,38 +43,5 @@ namespace AssetStudio
{
Position = byteStart;
}
public string Dump()
{
Reset();
if (serializedType?.m_Nodes != null)
{
var sb = new StringBuilder();
TypeTreeHelper.ReadTypeString(sb, serializedType.m_Nodes, this);
return sb.ToString();
}
return null;
}
public bool HasStructMember(string name)
{
return serializedType?.m_Nodes != null && serializedType.m_Nodes.Any(x => x.m_Name == name);
}
public PPtr ReadPPtr()
{
return new PPtr
{
m_FileID = ReadInt32(),
m_PathID = m_Version < 14 ? ReadInt32() : ReadInt64(),
assetsFile = assetsFile
};
}
public byte[] GetRawData()
{
Reset();
return ReadBytes((int)byteSize);
}
}
}