Gestion Fichiers
This commit is contained in:
parent
5ce0a50ae1
commit
c494485a05
@ -1,4 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using JeuHoy_WPF;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
|
||||||
namespace JeuHoy_WPF_Natif.Model
|
namespace JeuHoy_WPF_Natif.Model
|
||||||
{
|
{
|
||||||
@ -10,12 +13,55 @@ namespace JeuHoy_WPF_Natif.Model
|
|||||||
|
|
||||||
public List<Squelette> ChargerCoordonnees(string fichier)
|
public List<Squelette> ChargerCoordonnees(string fichier)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
StreamReader lecteur = new StreamReader(fichier);
|
||||||
}
|
string sLigne = "";
|
||||||
|
List<Squelette> lstSql = new List<Squelette>();
|
||||||
|
string[] sTabElements = null;
|
||||||
|
|
||||||
|
if (!lecteur.EndOfStream) {
|
||||||
|
sLigne = lecteur.ReadLine();
|
||||||
|
int nbElements = Convert.ToInt32(sLigne);
|
||||||
|
|
||||||
|
sLigne = lecteur.ReadLine();
|
||||||
|
int nbAttributs = Convert.ToInt32(sLigne);
|
||||||
|
|
||||||
|
for (int i = 0; i < nbElements; i++) {
|
||||||
|
double[] doubles = new double[nbElements - 1];
|
||||||
|
sLigne = lecteur.ReadLine();
|
||||||
|
sTabElements = sLigne.Split('\t');
|
||||||
|
for (int j = 0; j < sTabElements.Length - 1; j++) {
|
||||||
|
doubles[j] = Convert.ToDouble(sTabElements[j]);
|
||||||
|
}
|
||||||
|
string rep = Convert.ToInt32(sTabElements[sTabElements.Length - 1]).ToString();
|
||||||
|
lstSql.Add(new Squelette(doubles, rep));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return lstSql;
|
||||||
|
}
|
||||||
|
|
||||||
public int SauvegarderCoordonnees(string fichier, List<Squelette> lstData)
|
public int SauvegarderCoordonnees(string fichier, List<Squelette> lstData)
|
||||||
{
|
{
|
||||||
throw new System.NotImplementedException();
|
StreamWriter sw = new StreamWriter(fichier);
|
||||||
|
|
||||||
|
sw.WriteLine(lstData.Count);
|
||||||
|
sw.WriteLine(CstApplication.SKELETONCOUNT);
|
||||||
|
|
||||||
|
try {
|
||||||
|
foreach (Squelette s in lstData) {
|
||||||
|
foreach (double point in s.Points) {
|
||||||
|
sw.Write(point.ToString() + "\t");
|
||||||
|
}
|
||||||
|
sw.Write(s.Reponse + "\r\n");
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
sw.Close();
|
||||||
|
return CstApplication.ERREUR;
|
||||||
|
}
|
||||||
|
|
||||||
|
sw.Flush();
|
||||||
|
sw.Close();
|
||||||
|
return CstApplication.OK;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -43,6 +43,11 @@ namespace JeuHoy_WPF_Natif.Model {
|
|||||||
_rep = reponse;
|
_rep = reponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Squelette(double[] body, string reponse) {
|
||||||
|
_sque = body;
|
||||||
|
_rep = reponse;
|
||||||
|
}
|
||||||
|
|
||||||
private Point GetPoint(KinectSensor sensor, CameraSpacePoint position, Vector trans) {
|
private Point GetPoint(KinectSensor sensor, CameraSpacePoint position, Vector trans) {
|
||||||
Point point = new System.Windows.Point();
|
Point point = new System.Windows.Point();
|
||||||
|
|
||||||
@ -57,7 +62,5 @@ namespace JeuHoy_WPF_Natif.Model {
|
|||||||
|
|
||||||
return Point.Subtract(point, trans);
|
return Point.Subtract(point, trans);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user