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

            XmlElement node = _root["Ambient"];

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

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

            uint[] soundsIds = new uint[node.ChildNodes.Count];
            for (int i = 0; i < soundsIds.Length; i++)
            {
                soundsIds[i] = ((XmlElement)node.ChildNodes[i]).GetUInt32("Id");
            }

            Ambient result = new Ambient(soundsIds);

            location.Ambient = result;

            location.SaveRequest &= ~LocationProperty.Ambient;
            location.Importable  |= LocationProperty.Ambient;
            return(true);
        }
Пример #2
0
        public bool ReadAmbient(Location location)
        {
            ArchiveFileEntry sfxEntry = (ArchiveFileEntry)_locationDirectory.Childs.TryGetValue(_name + ".sfx");

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

            using (SfxFileReader sfxReader = new SfxFileReader(sfxEntry.OpenReadableContentStream()))
            {
                Ambient result = new Ambient(sfxReader.SoundIds);
                location.Ambient = result;
            }

            location.SaveRequest &= ~LocationProperty.Ambient;
            location.Importable  &= ~LocationProperty.Ambient;
            return(true);
        }
Пример #3
0
        public void WriteAmbient(Ambient ambient)
        {
            XmlElement node = _root.EnsureChildElement("Ambient");

            node.RemoveAll();

            bool isExists = ambient != null;

            node.SetBoolean("IsExists", isExists);

            if (!isExists)
            {
                return;
            }

            foreach (uint soundId in ambient.SoundsIds)
            {
                node.CreateChildElement("Sound").SetUInt32("Id", soundId);
            }
        }
Пример #4
0
 public void WriteAmbient(Ambient ambient)
 {
     throw new NotImplementedException();
 }