- Home /
Question by
CaKeMeaT · May 14, 2015 at 11:09 PM ·
windows store app
Windows Store App; xml, storage, and files
I am having a real hard time getting my simple XML files to work in WSA.
Apparently I cannot use System.IO due to security, and I am also having issues with XmlWriter. I would really appreciate some help, Ive read a thousand articles on the topic but the tactics I've seen seem to be outdated.
XmlWriterSettings XWsettings = new XmlWriterSettings();
XWsettings.Indent = true;
// INV ITEM
System.Xml.Serialization.XmlSerializer inv_writer = new System.Xml.Serialization.XmlSerializer(typeof(List<inv_item>));
// convert string to stream
//byte[] byteArray = Encoding.UTF8.GetBytes(inv_list);
//byte[] byteArray = Encoding.ASCII.GetBytes(contents);
//MemoryStream stream = new MemoryStream(byteArray);
// INEVENTORY
using(XmlWriter Xwriter = XmlWriter.Create("inventory.xml", XWsettings))
{
inv_writer.Serialize(Xwriter, inv_list); // Can circumvent needed FileStream object
}
// EQUIPMENT
System.Xml.Serialization.XmlSerializer eq_writer = new System.Xml.Serialization.XmlSerializer(typeof(List<equipable_item>));
using(XmlWriter Xwriter = XmlWriter.Create("equipment.xml", XWsettings))
{
eq_writer.Serialize(Xwriter, eq_list); // Can circumvent needed FileStream object
}
// GEMS
System.Xml.Serialization.XmlSerializer gem_writer = new System.Xml.Serialization.XmlSerializer(typeof(List<skill_gem>));
using(XmlWriter Xwriter = XmlWriter.Create("skillgems.xml", XWsettings))
{
gem_writer.Serialize(Xwriter, gem_list); // Can circumvent needed FileStream object
}
Comment
Your answer
