Files
Samuele Locatelli 5348d91048 Ok demo In/Out x AGB
2024-08-26 08:43:37 +02:00

37 lines
1.0 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
namespace FraMan.Core.HwInOut.AGB
{
public class DataManager
{
public static bool ReadParamOpt(string filePath, ref ParametriOpzioni decoded)
{
bool done = false;
if (File.Exists(filePath))
{
string rawXml = File.ReadAllText(filePath);
// se ho dati procedo
if (!string.IsNullOrEmpty(rawXml))
{
// deserializzo
XmlSerializer serializer = new XmlSerializer(typeof(ParametriOpzioni));
using (StringReader reader = new StringReader(rawXml))
{
decoded = (ParametriOpzioni)serializer.Deserialize(reader);
done = true;
}
}
}
return done;
}
}
}