Пример #1
0
        public bool ReadPlaceables(Location location)
        {
            if (_root == null)
            {
                return(false);
            }

            XmlElement node = _root["Placeables"];

            if (node == null)
            {
                return(false);
            }

            if (!node.GetBoolean("IsExists"))
            {
                return(true);
            }

            Placeables placeables = new Placeables(node.ChildNodes.Count);

            foreach (XmlElement child in node.ChildNodes)
            {
                ulong value = child.GetUInt64("Value");
                placeables.Add(new Placeable(BitConverter.GetBytes(value)));
            }
            location.Placeables = placeables;

            location.SaveRequest &= ~LocationProperty.Placeables;
            location.Importable  |= LocationProperty.Placeables;
            return(true);
        }
Пример #2
0
        public void WritePlaceables(Placeables placeables)
        {
            XmlElement node = _root.EnsureChildElement("Placeables");

            node.RemoveAll();

            bool isExists = placeables != null;

            node.SetBoolean("IsExists", isExists);

            if (!isExists)
            {
                return;
            }

            foreach (Placeable placeable in placeables)
            {
                node.CreateChildElement("Placeable").SetUInt64("Value", BitConverter.ToUInt64(placeable.Unknown, 0));
            }
        }
Пример #3
0
        public bool ReadPlaceables(Location location)
        {
            ArchiveFileEntry pcbEntry = (ArchiveFileEntry)_locationDirectory.Childs.TryGetValue(_name + ".pcb");

            if (pcbEntry == null)
            {
                return(true);
            }

            using (PcbFileReader pcbReader = new PcbFileReader(pcbEntry.OpenReadableContentStream()))
            {
                Placeables placeables = new Placeables(pcbReader.Entries.Length);
                for (int i = 0; i < placeables.Capacity; i++)
                {
                    placeables.Add(new Placeable(pcbReader.Entries[i].Unknown));
                }
                location.Placeables = placeables;
            }

            location.SaveRequest &= ~LocationProperty.Placeables;
            location.Importable  &= ~LocationProperty.Placeables;
            return(true);
        }
Пример #4
0
 public void WritePlaceables(Placeables placeables)
 {
     throw new NotImplementedException();
 }