mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
Bug fixes (issues #1, 2, 3 and 6)
This commit is contained in:
parent
6b44db7400
commit
518a912ef1
156 changed files with 352 additions and 625 deletions
|
@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue