示例#1
0
        private void WriteParticle(UniqueID uid, IAether particle)
        {
            string particleName = Engine.GetParticleName(particle);

            uid.Save(this);

            bool isParticleSerialized = serialisedParticles.Contains(uid);

            writer.Write(isParticleSerialized);
            if (!isParticleSerialized)
            {
                if (!uid.Equals(UniqueID.Unknown))
                {
                    serialisedParticles.Add(uid);
                }

                writer.Write(particleName); //name
                Type   particleType = particle.GetType();
                string typeName     = particleType.FullName + ", " + particleType.Assembly.GetName().Name;
                writer.Write(typeName); //type
                IAetherSerialization serialisableParticle = particle as IAetherSerialization;
                bool isSerialisableParticle = serialisableParticle != null;
                writer.Write(isSerialisableParticle); //mark whether Particle has data to serialize
                if (isSerialisableParticle)
                {
                    serialisableParticle.Save(this);
                }
            }

            return;
        }
示例#2
0
        private void WriteParticleManager(IAetherManager manager)
        {
            writer.Write(manager.Name);
            Type   managerType = manager.GetType();
            string typeName    = managerType.FullName + ", " + managerType.Assembly.GetName().Name;

            writer.Write(typeName);
            IAetherSerialization serialisableParticle = manager as IAetherSerialization;
            bool isSerialisableParticle = serialisableParticle != null;

            writer.Write(isSerialisableParticle);
            if (isSerialisableParticle)
            {
                serialisableParticle.Save(this);
            }
        }
示例#3
0
        private void WriteParticleManager(IAetherManager manager)
        {
            Type managerType = manager.GetType();

            writer.WriteStartElement("AetherParticleManager");
            writer.WriteAttributeString("Name", manager.Name);
            string typeName = managerType.FullName + ", " + managerType.Assembly.GetName().Name;

            writer.WriteAttributeString("Type", typeName);
            IAetherSerialization serialisableParticle = manager as IAetherSerialization;

            if (serialisableParticle != null)
            {
                serialisableParticle.Save(this);
            }
            writer.WriteEndElement();
        }
示例#4
0
        private void WriteParticle(UniqueID uid, IAether particle)
        {
            string particleName = Engine.GetParticleName(particle);

            if (serialisedParticles.Contains(uid))
            {
                writer.WriteStartElement("AetherParticleRef");
                writer.WriteStartAttribute("UID"); uid.Save(this); writer.WriteEndAttribute();
                if (particleName != String.Empty)
                {
                    writer.WriteAttributeString("Name", particleName);
                }
                writer.WriteEndElement();
                return;
            }
            else
            {
                Type particleType = particle.GetType();
                if (!uid.Equals(UniqueID.Unknown))
                {
                    serialisedParticles.Add(uid);
                }
                writer.WriteStartElement("AetherParticle");
                writer.WriteStartAttribute("UID"); uid.Save(this); writer.WriteEndAttribute();
                if (particleName != String.Empty)
                {
                    writer.WriteAttributeString("Name", particleName);
                }
                string typeName = particleType.FullName + ", " + particleType.Assembly.GetName().Name;
                writer.WriteAttributeString("Type", typeName);
                IAetherSerialization serialisableParticle = particle as IAetherSerialization;
                if (serialisableParticle != null)
                {
                    serialisableParticle.Save(this);
                }
                writer.WriteEndElement();
            }

            return;
        }
示例#5
0
 public void Write(string name, IAetherSerialization value)
 {
     writer.WriteStartElement(name);
     value.Save(this);
     writer.WriteEndElement();
 }
示例#6
0
 public void Write(string name, IAetherSerialization value)
 {
     //writer.Write(name);
     value.Save(this);
 }