Correcting a lot of bugs
continuous-integration/drone/push Build is failing Details

pull/26/head
Matheo HERSAN 2 years ago
parent 5ea4e1ab41
commit 388bf26297

@ -6,8 +6,8 @@ namespace MangaMap;
public partial class App : Application
{
public Manager MyManager { get; private set; } = new Manager(new Stub.Stub()); //pour utiliser le stub comme moyen de persistance.
//public Manager MyManager { get; private set; } = new Manager(new Stub.DataContract());
//public Manager MyManager { get; private set; } = new Manager(new Stub.Stub()); //pour utiliser le stub comme moyen de persistance.
public Manager MyManager { get; private set; } = new Manager(new Stub.DataContract());
public Admin MyAdmin { get; private set; } = new Admin("test", "test@test.ts", "Pseudo_test");

@ -39,33 +39,35 @@ namespace MangaMap.Stub
return (data.Oeuvres, data.Utilisateurs);
}
public void sauvegarder(List<Oeuvre> o, List<Utilisateur> u)
{
var serializer = new DataContractSerializer(typeof(DataToPersist));
if(!Directory.Exists(FilePath))
{
Debug.WriteLine("Directory doesn't exist.");
Directory.CreateDirectory(FilePath);
}
/*using (Stream s = File.Create(Path.Combine(FilePath, FileName)))
{
serializer.WriteObject(s, o); //Version d'enregistrement des données sans indentation.
}*/
DataToPersist data = new DataToPersist();
data.Oeuvres = o;
data.Utilisateurs = u;
var settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName)))
{
using (XmlWriter w = XmlWriter.Create(tw, settings))
{
serializer.WriteObject(w, data); //Version d'enregistrement des données avec indentation.
}
}
public void sauvegarder(List<Oeuvre> o, List<Utilisateur> u)
{
var serializer = new DataContractSerializer(typeof(DataToPersist));
DataToPersist data;
if (File.Exists(Path.Combine(FilePath, FileName)))
{
using (Stream s = File.OpenRead(Path.Combine(FilePath, FileName)))
{
data = serializer.ReadObject(s) as DataToPersist;
}
}
else
{
data = new DataToPersist();
}
// Ajouter le nouvel utilisateur à la liste existante
data.Utilisateurs.Add(u.Last());
var settings = new XmlWriterSettings() { Indent = true };
using (TextWriter tw = File.CreateText(Path.Combine(FilePath, FileName)))
{
using (XmlWriter w = XmlWriter.Create(tw, settings))
{
serializer.WriteObject(w, data); // Enregistrer toutes les données dans le fichier
}
}
}
}
}

@ -62,9 +62,12 @@ public partial class signUpPage : ContentPage
{
Utilisateur util = new Utilisateur(email, pseudo, password, nom, prénom, age);
my_manager.Utilisateurs.Add(util);
my_manager.sauvegarder();
await Navigation.PushAsync(new homePage());
return;
}
}
bool IsPasswordStrong(string password)

Loading…
Cancel
Save