Exemple #1
0
 public static XElement SerializeImage(EditorImageContainer image)
 {
     return(new XElement("image",
                         new XAttribute("pos", XMLExtensions.Vector2ToString(image.Position)),
                         new XAttribute("rotation", image.Rotation),
                         new XAttribute("opacity", image.Opacity),
                         new XAttribute("path", image.Path),
                         new XAttribute("scale", image.Scale),
                         new XAttribute("drawtarget", image.DrawTarget.ToString())));
 }
Exemple #2
0
        public void Load(XElement element)
        {
            Clear(alsoPending: true);

            foreach (XElement subElement in element.Elements())
            {
                EditorImageContainer?tempImage = EditorImageContainer.Load(subElement);
                if (tempImage != null)
                {
                    PendingImages.Add(tempImage.Value);
                }
            }
        }
Exemple #3
0
        public void Save(XElement element)
        {
            XElement saveElement = new XElement("editorimages");

            foreach (EditorImage image in Images)
            {
                EditorImageContainer container = EditorImageContainer.ImageToContainer(image);
                saveElement.Add(EditorImageContainer.SerializeImage(container));
            }

            foreach (EditorImageContainer container in PendingImages)
            {
                saveElement.Add(EditorImageContainer.SerializeImage(container));
            }

            element.Add(saveElement);
        }