public PssgNodeInfo(PssgBinaryReader reader, PssgFile file)
{
attributeInfo = new SortedDictionary<int, PssgAttributeInfo>();
id = reader.ReadInt32();
name = reader.ReadPSSGString();
int attributeInfoCount = reader.ReadInt32();
PssgAttributeInfo ai;
for (int i = 0; i < attributeInfoCount; i++)
{
ai = new PssgAttributeInfo(reader);
try
{
attributeInfo.Add(ai.id, ai);
}
catch (ArgumentException ex)
{
if (MessageBox.Show("The attribute of id " + ai.id + ", named " + ai.name + ", already exists, and will not be saved. Continue?",
"PSSG Editor", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
continue;
else
throw new Exception("The attribute of id " + ai.id + ", named " + ai.name + ", already exists.");
}
file.attributeInfo[ai.id - 1] = ai;
}
}