1234567891011121314151617181920212223242526272829303132333435363738 |
- using System;
- using BaseLibRWFile;
- namespace BaseLibRWFile
- {
- public abstract class XMLRW<T> where T : class
- {
- private static readonly object obj = new object();
- public static T Load(string file)
- {
- lock (obj)
- {
- return ClsXml.ReadXML(file, typeof(T)) as T;
- }
- }
- public static T Load(string file, Type t)
- {
- lock (obj)
- {
- return ClsXml.ReadXML(file, t) as T;
- }
- }
- public virtual void Save(string filePath)
- {
- ClsXml.WriteXML(this, filePath, this.GetType());
- }
- public virtual void SaveAs(string filePath)
- {
- ClsXml.WriteXML(this, filePath, typeof(T));
- }
- public abstract bool CheckIfNormal();
- }
- }
|