Bug fixes (issues #1, 2, 3 and 6)

This commit is contained in:
AbstractConcept 2022-10-02 00:42:07 -05:00
parent 6b44db7400
commit 518a912ef1
156 changed files with 352 additions and 625 deletions

View file

@ -5,6 +5,7 @@ using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Xml.Serialization;
using UnityEngine;
namespace RimWorldAnimationStudio
{
@ -12,11 +13,15 @@ namespace RimWorldAnimationStudio
{
public static T ReadXML<T>(string path)
{
Debug.Log("Reading data from " + path);
using (StreamReader stringReader = new StreamReader(path))
{
XmlSerializer serializer = new XmlSerializer(typeof(T));
var data = (T)serializer.Deserialize(stringReader);
return (T)serializer.Deserialize(stringReader);
Debug.Log("Read successful");
return data;
}
}
@ -25,6 +30,8 @@ namespace RimWorldAnimationStudio
if (obj == null || path == null || path == "")
{ return; }
Debug.Log("Saving data to " + path);
XmlSerializer writer = new XmlSerializer(typeof(T));
XmlSerializerNamespaces nameSpaces = new XmlSerializerNamespaces();
nameSpaces.Add("", "");
@ -32,6 +39,8 @@ namespace RimWorldAnimationStudio
FileStream file = File.Create(path);
writer.Serialize(file, obj, nameSpaces);
file.Close();
Debug.Log("Saving successful");
}
}
}