95 lines
1.7 KiB
C#
95 lines
1.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Xml;
|
|
|
|
namespace DMX2
|
|
{
|
|
public class SequenceurMaitre
|
|
{
|
|
public class Ligne {
|
|
public Ligne(){}
|
|
string nom;
|
|
TimeSpan duree = TimeSpan.Zero;
|
|
Dictionary<Sequenceur,string> data = new Dictionary<Sequenceur, string>();
|
|
|
|
public string Nom {
|
|
get {
|
|
return nom;
|
|
}
|
|
set {
|
|
nom = value;
|
|
}
|
|
}
|
|
|
|
public TimeSpan Duree {
|
|
get {
|
|
return duree;
|
|
}
|
|
set {
|
|
duree = value;
|
|
}
|
|
}
|
|
|
|
public string this [Sequenceur index] {
|
|
get {
|
|
string value;
|
|
if(!data.TryGetValue(index, out value)) return string.Empty;
|
|
return value;
|
|
}
|
|
set {
|
|
if(value.Length==0) if(data.ContainsKey(index))
|
|
data.Remove(index);
|
|
else
|
|
data[index] = value;
|
|
}
|
|
}
|
|
public void Save (XmlElement parent)
|
|
{
|
|
XmlElement el = parent.OwnerDocument.CreateElement ("Ligne");
|
|
parent.AppendChild (el);
|
|
|
|
el.SetAttribute ("nom", nom);
|
|
el.SetAttribute ("duree", duree.TotalMilliseconds.ToString ());
|
|
|
|
XmlElement xmlSeq;
|
|
foreach (var val in data) {
|
|
el.AppendChild(xmlSeq=parent.OwnerDocument.CreateElement ("data"));
|
|
xmlSeq.SetAttribute("seq",val.Key.ID.ToString());
|
|
xmlSeq.SetAttribute("val",val.Value);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
List<Ligne> lignes = new List<Ligne>();
|
|
|
|
|
|
|
|
public List<Ligne> Lignes {
|
|
get {
|
|
return lignes;
|
|
}
|
|
}
|
|
|
|
public SequenceurMaitre ()
|
|
{
|
|
lignes.Add(new Ligne());
|
|
}
|
|
|
|
public void Save (XmlElement parent)
|
|
{
|
|
XmlElement el = parent.OwnerDocument.CreateElement("SequenceurMaitre");
|
|
parent.AppendChild(el);
|
|
|
|
foreach(Ligne l in lignes)
|
|
l.Save(el);
|
|
|
|
}
|
|
|
|
|
|
public static SequenceurMaitre Load (XmlElement doc)
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|