Exemplo n.º 1
0
        private static EntityData ReadEntityData(BinaryReader br)
        {
            var data = new EntityData
                {
                    Name = br.ReadCString()
                };

            br.ReadBytes(4); // Unused bytes

            data.Flags = br.ReadInt32();

            var numProperties = br.ReadInt32();
            for (var i = 0; i < numProperties; i++)
            {
                var prop = ReadProperty(br);
                data.SetPropertyValue(prop.Key, prop.Value);
            }

            br.ReadBytes(12); // More unused bytes

            return data;
        }
Exemplo n.º 2
0
 private static EntityData ReadEntityData(GenericStructure structure)
 {
     var ret = new EntityData();
     foreach (var key in structure.GetPropertyKeys())
     {
         if (ExcludedKeys.Contains(key.ToLower())) continue;
         ret.SetPropertyValue(key, structure[key]);
     }
     ret.Name = structure["classname"];
     ret.Flags = structure.PropertyInteger("spawnflags");
     return ret;
 }