Following my questions about storing data, it has been suggested that I could use XML but then obfuscate the file by encoding it using Base64. I like this idea, and I have a
Write it:
var sb = new StringBuilder();
var settings = new XmlWriterSettings();
//..settings
using (var writer = XmlWriter.Create(sb, settings))
{
//...
}
//http://stackoverflow.com/questions/1564718/using-stringwriter-for-xml-serialization
var encoding = new UnicodeEncoding();
string s = Convert.ToBase64String(encoding.GetBytes(sb.ToString()));
File.WriteAllText("c:\temp.txt", s);
Read it:
string readText = File.ReadAllText("c:\temp.txt");
byte[] toDecodeByte = Convert.FromBase64String(readText);
using (var stream = new MemoryStream(toDecodeByte))
{
using (XmlReader reader = XmlReader.Create(stream))
{
//.. read your xml
}
}