@bambucha I’ve managed to get it working to read in an XML file that has been built using the pipeline (XNB) so that’s now a binary file - however it’s only good for reading as far as I can tell and you can’t write out to this format in your game - e.g. like a save game option, So it’s useful for things like Level data, or starting data - or an RPG equipment stats - the sort of stuff that won’t change.
You need to have your class in a separate dll project and reference it in the pipe line application. Here is my class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using Microsoft.Xna.Framework;
namespace Project1.Shared.Entities
{
[Serializable]
public class HistoryRegion
{
public string Key;
public int X;
public int Y;
[XmlElement("Color")]
public Color Color;
public HistoryRegion()
{
}
public HistoryRegion(string key, int x, int y, Color regionColor)
{
Key = key;
X = x;
Y = y;
Color = regionColor;
}
}
}
Here is the XML (brackets removed) I have in the content folder - Notice the Asset TYPE on the 3rd line!
?xml version=“1.0” encoding=“utf-8”?
XnaContent xmlns:ns=“Microsoft.Xna.Framework”
Asset Type=“System.Collections.Generic.List[Project1.Shared.Entities.HistoryRegion]”
Item Key1/Key X1 /X Y1 /Y Color 000066FF /Color /Item
Item Key1/Key X35 /X Y32 /Y Color FFFFFFFF /Color /Item
Item Key2/Key X32 /X Y62 /Y Color FFFFFFFF /Color /Item
/Asset
/XnaContent
I’ve recently posted a thread about the issues I was having up until this point, but actually have it building and loading the data now ![]()