Zigonnage

This commit is contained in:
MarcEricMartel 2023-05-05 06:36:12 -04:00
parent 241d2a6ffb
commit 3e954843b3
2 changed files with 21 additions and 21 deletions

View File

@ -3,19 +3,14 @@ using System;
using System.Collections.Generic;
using System.IO;
namespace JeuHoy_WPF_Natif.Model
{
public class GestionFichiersSorties : IGestionFichiers
{
public GestionFichiersSorties()
{
}
namespace JeuHoy_WPF_Natif.Model {
public class GestionFichiersSorties : IGestionFichiers {
public GestionFichiersSorties(){}
public List<Squelette> ChargerCoordonnees(string fichier)
{
public List<Squelette> ChargerCoordonnees(string fichier) {
StreamReader lecteur = new StreamReader(fichier);
string sLigne = "";
List<Squelette> lstSql = new List<Squelette>();
string sLigne = "";
string[] sTabElements = null;
if (!lecteur.EndOfStream) {
@ -39,14 +34,16 @@ namespace JeuHoy_WPF_Natif.Model
return lstSql;
}
public int SauvegarderCoordonnees(string fichier, List<Squelette> lstData)
{
StreamWriter sw = new StreamWriter(fichier);
sw.WriteLine(lstData.Count);
sw.WriteLine(CstApplication.SKELETONCOUNT);
public int SauvegarderCoordonnees(string fichier, List<Squelette> lstData) {
StreamWriter sw = null;
try {
sw = new StreamWriter(fichier);
} catch {
return CstApplication.ERREUR;
}
try {
sw.WriteLine(lstData.Count);
sw.WriteLine(CstApplication.SKELETONCOUNT);
foreach (Squelette s in lstData) {
foreach (double point in s.Points) {
sw.Write(point.ToString() + "\t");
@ -61,7 +58,6 @@ namespace JeuHoy_WPF_Natif.Model
sw.Flush();
sw.Close();
return CstApplication.OK;
}
}
}

View File

@ -22,7 +22,7 @@ namespace JeuHoy_WPF_Natif.Model {
JointType.Neck
};
private double[] _sque = new double[CstApplication.SKELETONCOUNT * 2];
private double[] _sque;
private string _rep = "?";
public string Reponse { get => _rep; set => _rep = value; }
@ -30,8 +30,12 @@ namespace JeuHoy_WPF_Natif.Model {
public double[] Points => _sque;
public Squelette(double[] body, string reponse) {
_sque = body;
_rep = reponse;
if (body.Length != CstApplication.SKELETONCOUNT * 2) {
_sque = new double[CstApplication.SKELETONCOUNT * 2];
} else {
_sque = body;
_rep = reponse;
}
}
}
}