|
|
|
@ -5,12 +5,14 @@ using System.Runtime.Serialization.Json;
|
|
|
|
|
using System.Xml;
|
|
|
|
|
using static System.Console;
|
|
|
|
|
using Model;
|
|
|
|
|
using Microsoft.VisualBasic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
|
|
|
|
|
namespace Persistance
|
|
|
|
|
{
|
|
|
|
|
public class DataContractSerializer
|
|
|
|
|
public class DataSerializer
|
|
|
|
|
{
|
|
|
|
|
public Theque DataContractSerializer()
|
|
|
|
|
public void Serializer()
|
|
|
|
|
{
|
|
|
|
|
Theque theque = new Theque();
|
|
|
|
|
|
|
|
|
@ -23,12 +25,23 @@ namespace Persistance
|
|
|
|
|
{
|
|
|
|
|
serializer.WriteObject(s, theque);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Theque Deserializer()
|
|
|
|
|
{
|
|
|
|
|
string path = FileSystem.
|
|
|
|
|
Directory.SetCurrentDirectory();
|
|
|
|
|
string xmlFile = "theque.xml";
|
|
|
|
|
|
|
|
|
|
Theque theque2;
|
|
|
|
|
var serializer = new DataContractSerializer(typeof(Theque));
|
|
|
|
|
|
|
|
|
|
Theque theque = new Theque();
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
|
{
|
|
|
|
|
theque2 = serializer.ReadObject(s) as Theque;
|
|
|
|
|
theque = serializer.ReadObject(s) as Theque;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return theque;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|