mirror of
https://gitgud.io/AbstractConcept/rimworld-animation-studio.git
synced 2024-08-15 00:43:27 +00:00
v 1.0.0
This commit is contained in:
parent
0828ecd037
commit
2998865184
9821 changed files with 90 additions and 90 deletions
|
@ -1,39 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.IO;
|
||||
using System.Xml.Serialization;
|
||||
using UnityEngine;
|
||||
|
||||
namespace RimWorldAnimationStudio
|
||||
{
|
||||
public static class XmlUtility
|
||||
{
|
||||
public static T ReadXML<T>(string path)
|
||||
{
|
||||
using (StreamReader stringReader = new StreamReader(path))
|
||||
{
|
||||
XmlSerializer serializer = new XmlSerializer(typeof(T));
|
||||
var data = (T)serializer.Deserialize(stringReader);
|
||||
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
public static void WriteXML<T>(T obj, string path)
|
||||
{
|
||||
if (obj == null || path == null || path == "")
|
||||
{ return; }
|
||||
|
||||
XmlSerializer writer = new XmlSerializer(typeof(T));
|
||||
XmlSerializerNamespaces nameSpaces = new XmlSerializerNamespaces();
|
||||
nameSpaces.Add("", "");
|
||||
|
||||
FileStream file = File.Create(path);
|
||||
writer.Serialize(file, obj, nameSpaces);
|
||||
file.Close();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue