|
|
|
@ -10,10 +10,10 @@ namespace WinFormControl |
|
|
|
{ |
|
|
|
internal static class XmlUtil |
|
|
|
{ |
|
|
|
static string currentPath = Directory.GetCurrentDirectory(); |
|
|
|
static string config = "Config"; |
|
|
|
public static void SerializerObjToFile(object obj, string fileName) |
|
|
|
{ |
|
|
|
fileName = Path.Combine(currentPath, fileName + ".xml"); |
|
|
|
fileName = Path.Combine(config, fileName + ".xml"); |
|
|
|
var ser = new XmlSerializer(obj.GetType()); |
|
|
|
using (var stream = File.Open(fileName, FileMode.Create)) |
|
|
|
{ |
|
|
|
@ -24,7 +24,7 @@ namespace WinFormControl |
|
|
|
public static T DeserializeFromFile<T>(string fileName) |
|
|
|
where T : new() |
|
|
|
{ |
|
|
|
fileName = Path.Combine(currentPath, fileName + ".xml"); |
|
|
|
fileName = Path.Combine(config, fileName + ".xml"); |
|
|
|
if (!File.Exists(fileName)) |
|
|
|
{ |
|
|
|
return new T(); |
|
|
|
|