|
|
@ -1,4 +1,5 @@
|
|
|
|
using System;
|
|
|
|
using Model.Stub;
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
using System.Runtime.Serialization;
|
|
|
@ -10,16 +11,72 @@ namespace Model.Serializer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class XML_Serializer : IDataManager
|
|
|
|
public class XML_Serializer : IDataManager
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
public string Chemin { get; set; }
|
|
|
|
public XML_Serializer()
|
|
|
|
public XML_Serializer()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
StubManager stubManager = new StubManager();
|
|
|
|
|
|
|
|
Chemin = Directory.GetCurrentDirectory();
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./personnage.xml"))==false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetPersonnage(stubManager.GetPersonnages().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetBateau(stubManager.GetBateaux().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetFDD(stubManager.GetFruits().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetBestiaire(stubManager.GetBestiaires().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetEquipage(stubManager.GetEquipages().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetIle(stubManager.GetIles().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public XML_Serializer(string path)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Chemin= path;
|
|
|
|
|
|
|
|
StubManager stubManager = new StubManager();
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./personnage.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetPersonnage(stubManager.GetPersonnages().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./bateau.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetBateau(stubManager.GetBateaux().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./fruitdudemon.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetFDD(stubManager.GetFruits().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./bestiaire.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetBestiaire(stubManager.GetBestiaires().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./equipage.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetEquipage(stubManager.GetEquipages().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
if (File.Exists(Path.Combine(Chemin, "./ile.xml")) == false)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
SetIle(stubManager.GetIles().ToList());
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void SetPersonnage(List<Personnage> listePerso)
|
|
|
|
public void SetPersonnage(List<Personnage> listePerso)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Personnage>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Personnage>));
|
|
|
|
string xmlFile = "personnage.xml";
|
|
|
|
string xmlFile = "personnage.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -36,7 +93,7 @@ namespace Model.Serializer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
|
|
|
|
string xmlFile = "fruitdudemon.xml";
|
|
|
|
string xmlFile = "fruitdudemon.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -54,7 +111,7 @@ namespace Model.Serializer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
|
|
|
|
string xmlFile = "bestiaire.xml";
|
|
|
|
string xmlFile = "bestiaire.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -72,7 +129,7 @@ namespace Model.Serializer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Equipage>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Equipage>));
|
|
|
|
string xmlFile = "equipage.xml";
|
|
|
|
string xmlFile = "equipage.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -90,7 +147,7 @@ namespace Model.Serializer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Ile>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Ile>));
|
|
|
|
string xmlFile = "ile.xml";
|
|
|
|
string xmlFile = "ile.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -108,7 +165,7 @@ namespace Model.Serializer
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bateau>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bateau>));
|
|
|
|
string xmlFile = "bateau.xml";
|
|
|
|
string xmlFile = "bateau.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
XmlWriterSettings settings = new XmlWriterSettings() { Indent = true };
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
using (TextWriter tw = File.CreateText(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -127,7 +184,7 @@ namespace Model.Serializer
|
|
|
|
List<Bateau> listeBateau = new List<Bateau>();
|
|
|
|
List<Bateau> listeBateau = new List<Bateau>();
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bateau>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bateau>));
|
|
|
|
string xmlFile = "bateau.xml";
|
|
|
|
string xmlFile = "bateau.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
|
|
|
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -141,7 +198,7 @@ namespace Model.Serializer
|
|
|
|
List<Bestiaire> listeBest = new List<Bestiaire>();
|
|
|
|
List<Bestiaire> listeBest = new List<Bestiaire>();
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Bestiaire>));
|
|
|
|
string xmlFile = "bestiaire.xml";
|
|
|
|
string xmlFile = "bestiaire.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
|
|
|
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -154,7 +211,7 @@ namespace Model.Serializer
|
|
|
|
List<Equipage> listeEquip = new List<Equipage>();
|
|
|
|
List<Equipage> listeEquip = new List<Equipage>();
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Equipage>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Equipage>));
|
|
|
|
string xmlFile = "equipage.xml";
|
|
|
|
string xmlFile = "equipage.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
|
|
|
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -167,7 +224,7 @@ namespace Model.Serializer
|
|
|
|
List<FruitDuDemon> listeFDD = new List<FruitDuDemon>();
|
|
|
|
List<FruitDuDemon> listeFDD = new List<FruitDuDemon>();
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<FruitDuDemon>));
|
|
|
|
string xmlFile = "fruitdudemon.xml";
|
|
|
|
string xmlFile = "fruitdudemon.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
|
|
|
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -180,7 +237,7 @@ namespace Model.Serializer
|
|
|
|
List<Ile> listeIle = new List<Ile>();
|
|
|
|
List<Ile> listeIle = new List<Ile>();
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Ile>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Ile>));
|
|
|
|
string xmlFile = "ile.xml";
|
|
|
|
string xmlFile = "ile.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
|
|
|
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -193,7 +250,7 @@ namespace Model.Serializer
|
|
|
|
List<Personnage> listePerso = new List<Personnage>();
|
|
|
|
List<Personnage> listePerso = new List<Personnage>();
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Personnage>));
|
|
|
|
var serializer = new DataContractSerializer(typeof(List<Personnage>));
|
|
|
|
string xmlFile = "personnage.xml";
|
|
|
|
string xmlFile = "personnage.xml";
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Directory.GetCurrentDirectory(), "C:\\Users\\yobrugiere1\\Documents\\Ohara\\Sources\\Ohara\\Resources\\XML"));
|
|
|
|
Directory.SetCurrentDirectory(Path.Combine(Chemin, "./"));
|
|
|
|
|
|
|
|
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
using (Stream s = File.OpenRead(xmlFile))
|
|
|
|
{
|
|
|
|
{
|
|
|
|