コード例 #1
0
        public static void SerializeToXml(List <Oddity> odditiesList, string fileName)
        {
            var xmlDevices = new NumeneraDevices()
            {
                Oddities = odditiesList, Count = odditiesList.Count
            };

            SerializeToXml(xmlDevices, fileName);
        }
コード例 #2
0
        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);
            }
        }
コード例 #3
0
        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");
        }
コード例 #4
0
        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");
        }
コード例 #5
0
        public static void SerializeToXml(List <Artefact> artefactsList, string fileName)
        {
            var xmlDevices = new NumeneraDevices(artefactsList);

            SerializeToXml(xmlDevices, fileName);
        }
コード例 #6
0
        public static void SerializeToXml(List <Cypher> cyphersList, string fileName)
        {
            var xmlDevices = new NumeneraDevices(cyphersList);

            SerializeToXml(xmlDevices, fileName);
        }