public static void SerializeToXml(List <Oddity> odditiesList, string fileName) { var xmlDevices = new NumeneraDevices() { Oddities = odditiesList, Count = odditiesList.Count }; SerializeToXml(xmlDevices, fileName); }
private static void SerializeToXml(NumeneraDevices xmlDevices, string fileName) { XmlSerializer ser = new XmlSerializer(typeof(NumeneraDevices)); using (FileStream writer = new FileStream(fileName, FileMode.Create)) //using (TextWriter writer = new StreamWriter(fileName)) { ser.Serialize(writer, xmlDevices); } }
public static void CombineAllArtefacts() { // combine them all var directory = @"E:\Documents\Tabletop RPGs\Numenera\NumeneraAppFiles\Devices\Artefacts_"; var files = new List <string>() { "Discovery.xml", "Destiny.xml", "Compendium.xml" }; var allArtefacts = new List <Artefact>(); foreach (var file in files) { var filename = directory + file; var artefacts = NumeneraXML.DeserializeArtefactsListFromXML(filename); NumeneraXML.SerializeToXml(artefacts, directory + $"{artefacts[0].Source}_fixed.xml"); allArtefacts.AddRange(artefacts); } var artefactsToSerialize = new NumeneraDevices(allArtefacts); NumeneraXML.SerializeToXml(artefactsToSerialize.Artefacts, directory + $"AllSources_{artefactsToSerialize.Artefacts.Count}.xml"); }
public static void CombineAllCyphers() { // combine them all var directory = @"E:\Documents\Tabletop RPGs\Numenera\NumeneraAppFiles\Devices\Cyphers_"; var files = new List <string>() { "Discovery.xml", "Destiny.xml", "Compendium.xml" }; var allCyphers = new List <Cypher>(); foreach (var file in files) { var filename = directory + file; var cyphers = NumeneraXML.DeserializeCyphersListFromXML(filename); NumeneraXML.SerializeToXml(cyphers, directory + $"{cyphers[0].Source}.xml"); allCyphers.AddRange(cyphers); } var cyphersToSerialize = new NumeneraDevices(allCyphers); NumeneraXML.SerializeToXml(cyphersToSerialize.Cyphers, directory + $"AllSources_{cyphersToSerialize.Cyphers.Count}.xml"); }
public static void SerializeToXml(List <Artefact> artefactsList, string fileName) { var xmlDevices = new NumeneraDevices(artefactsList); SerializeToXml(xmlDevices, fileName); }
public static void SerializeToXml(List <Cypher> cyphersList, string fileName) { var xmlDevices = new NumeneraDevices(cyphersList); SerializeToXml(xmlDevices, fileName); }