public TreeNode AddType <T>() where T : IType { T NewObject = (T)Activator.CreateInstance(typeof(T), this); AIPoints.Add(NewObject); TreeNode NewNode = NewObject.PopulateTreeNode(); RequestPrimitiveBatchUpdate(); return(NewNode); }
public void ReadFromFile(BinaryReader reader) { Unk02 = reader.ReadInt32(); Unk03 = reader.ReadInt32(); Unk04 = reader.ReadInt16(); // NB: This could actually "Type2". PartName = StringHelpers.ReadString16(reader); Unk05 = reader.ReadInt32(); KynogonString = StringHelpers.ReadString16(reader); Unk01 = StringHelpers.ReadString16(reader); ConstAIWorldPart = StringHelpers.ReadString16(reader); // TODO: This could just be a bool such as - 'if not empty' Unk06 = reader.ReadByte(); if (Unk06 != 1) { throw new Exception("unk06 was not 1"); } // Read AIPoints int unkCount = reader.ReadInt32(); for (int i = 0; i < unkCount; i++) { ushort TypeID = reader.ReadUInt16(); IType Point = AIWorld_Factory.ConstructByTypeID(this, TypeID); Point.Read(reader); AIPoints.Add(Point); } // Read footer data OriginStream = StringHelpers.ReadString(reader); uint originFileSize = reader.ReadUInt32(); Unk8 = reader.ReadUInt32(); Unk9 = reader.ReadUInt32(); Unk10 = reader.ReadUInt32(); DebugWriteToFile(); }