Пример #1
0
        private void Write(FieldGateway gateway, XmlElement node)
        {
            node.SetUInt16("DestinationId", gateway.DestinationId);
            if (gateway.Unknown1 != null)
            {
                node.SetInt32("Unknown1", gateway.Unknown1.Value);
            }
            if (gateway.Unknown2 != null)
            {
                node.SetInt32("Unknown2", gateway.Unknown2.Value);
            }
            node.SetInt32("Unknown3", gateway.Unknown3);

            Write(gateway.Boundary, node.CreateChildElement("Boundary"));
            Write(gateway.DestinationPoint, node.CreateChildElement("DestinationPoint"));
        }
Пример #2
0
        private FieldGateway[] ReadGateways(XmlElement node)
        {
            if (node == null)
            {
                return(null);
            }

            var result = new List <FieldGateway>(node.ChildNodes.Count);

            foreach (XmlElement child in node.ChildNodes)
            {
                Line3        boundary         = ReadLine3(child["Boundary"]);
                ushort       destinationId    = child.GetUInt16("DestinationId");
                Vector3      destinationPoint = ReadVector3(child["DestinationPoint"]);
                int?         unknown1         = child.FindInt32("Unknown1");
                int?         unknown2         = child.FindInt32("Unknown2");
                int          unknown3         = child.GetInt32("Unknown3");
                FieldGateway gateway          = new FieldGateway(boundary, destinationId, destinationPoint, unknown1, unknown2, unknown3);
                result.Add(gateway);
            }

            return(result.ToArray());
        }