private NodeAttribute ReadAttribute(NodeAttribute.DataType type)
{
switch (type)
{
case NodeAttribute.DataType.DT_String:
case NodeAttribute.DataType.DT_Path:
case NodeAttribute.DataType.DT_FixedString:
case NodeAttribute.DataType.DT_LSString:
{
var attr = new NodeAttribute(type);
attr.Value = ReadString(true);
return attr;
}
case NodeAttribute.DataType.DT_WString:
case NodeAttribute.DataType.DT_LSWString:
{
var attr = new NodeAttribute(type);
attr.Value = ReadWideString(true);
return attr;
}
case NodeAttribute.DataType.DT_TranslatedString:
{
var attr = new NodeAttribute(type);
var str = new TranslatedString();
str.Value = ReadString(true);
str.Handle = ReadString(true);
attr.Value = str;
return attr;
}
case NodeAttribute.DataType.DT_ScratchBuffer:
{
var attr = new NodeAttribute(type);
var bufferLength = reader.ReadInt32();
attr.Value = reader.ReadBytes(bufferLength);
return attr;
}
default:
return BinUtils.ReadAttribute(type, reader);
}
}