Zigonnage
This commit is contained in:
parent
241d2a6ffb
commit
3e954843b3
@ -3,19 +3,14 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
|
||||||
namespace JeuHoy_WPF_Natif.Model
|
namespace JeuHoy_WPF_Natif.Model {
|
||||||
{
|
public class GestionFichiersSorties : IGestionFichiers {
|
||||||
public class GestionFichiersSorties : IGestionFichiers
|
public GestionFichiersSorties(){}
|
||||||
{
|
|
||||||
public GestionFichiersSorties()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public List<Squelette> ChargerCoordonnees(string fichier)
|
public List<Squelette> ChargerCoordonnees(string fichier) {
|
||||||
{
|
|
||||||
StreamReader lecteur = new StreamReader(fichier);
|
StreamReader lecteur = new StreamReader(fichier);
|
||||||
string sLigne = "";
|
|
||||||
List<Squelette> lstSql = new List<Squelette>();
|
List<Squelette> lstSql = new List<Squelette>();
|
||||||
|
string sLigne = "";
|
||||||
string[] sTabElements = null;
|
string[] sTabElements = null;
|
||||||
|
|
||||||
if (!lecteur.EndOfStream) {
|
if (!lecteur.EndOfStream) {
|
||||||
@ -39,14 +34,16 @@ namespace JeuHoy_WPF_Natif.Model
|
|||||||
return lstSql;
|
return lstSql;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int SauvegarderCoordonnees(string fichier, List<Squelette> lstData)
|
public int SauvegarderCoordonnees(string fichier, List<Squelette> lstData) {
|
||||||
{
|
StreamWriter sw = null;
|
||||||
StreamWriter sw = new StreamWriter(fichier);
|
try {
|
||||||
|
sw = new StreamWriter(fichier);
|
||||||
|
} catch {
|
||||||
|
return CstApplication.ERREUR;
|
||||||
|
}
|
||||||
|
try {
|
||||||
sw.WriteLine(lstData.Count);
|
sw.WriteLine(lstData.Count);
|
||||||
sw.WriteLine(CstApplication.SKELETONCOUNT);
|
sw.WriteLine(CstApplication.SKELETONCOUNT);
|
||||||
|
|
||||||
try {
|
|
||||||
foreach (Squelette s in lstData) {
|
foreach (Squelette s in lstData) {
|
||||||
foreach (double point in s.Points) {
|
foreach (double point in s.Points) {
|
||||||
sw.Write(point.ToString() + "\t");
|
sw.Write(point.ToString() + "\t");
|
||||||
@ -61,7 +58,6 @@ namespace JeuHoy_WPF_Natif.Model
|
|||||||
sw.Flush();
|
sw.Flush();
|
||||||
sw.Close();
|
sw.Close();
|
||||||
return CstApplication.OK;
|
return CstApplication.OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -22,7 +22,7 @@ namespace JeuHoy_WPF_Natif.Model {
|
|||||||
JointType.Neck
|
JointType.Neck
|
||||||
};
|
};
|
||||||
|
|
||||||
private double[] _sque = new double[CstApplication.SKELETONCOUNT * 2];
|
private double[] _sque;
|
||||||
private string _rep = "?";
|
private string _rep = "?";
|
||||||
|
|
||||||
public string Reponse { get => _rep; set => _rep = value; }
|
public string Reponse { get => _rep; set => _rep = value; }
|
||||||
@ -30,8 +30,12 @@ namespace JeuHoy_WPF_Natif.Model {
|
|||||||
public double[] Points => _sque;
|
public double[] Points => _sque;
|
||||||
|
|
||||||
public Squelette(double[] body, string reponse) {
|
public Squelette(double[] body, string reponse) {
|
||||||
|
if (body.Length != CstApplication.SKELETONCOUNT * 2) {
|
||||||
|
_sque = new double[CstApplication.SKELETONCOUNT * 2];
|
||||||
|
} else {
|
||||||
_sque = body;
|
_sque = body;
|
||||||
_rep = reponse;
|
_rep = reponse;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user