diff --git a/DMX-2.0.userprefs b/DMX-2.0.userprefs index d6b5fbb..a15ef10 100644 --- a/DMX-2.0.userprefs +++ b/DMX-2.0.userprefs @@ -1,6 +1,6 @@  - + @@ -8,7 +8,8 @@ - + + diff --git a/DMX-2.0/DMX-2.0.csproj b/DMX-2.0/DMX-2.0.csproj index 3d0c00f..529e71d 100644 --- a/DMX-2.0/DMX-2.0.csproj +++ b/DMX-2.0/DMX-2.0.csproj @@ -57,6 +57,7 @@ gtk-sharp-2.0 + @@ -73,6 +74,7 @@ + \ No newline at end of file diff --git a/DMX-2.0/Sequenceur.cs b/DMX-2.0/Sequenceur.cs index 1d2d834..3dc0dbc 100644 --- a/DMX-2.0/Sequenceur.cs +++ b/DMX-2.0/Sequenceur.cs @@ -1,12 +1,23 @@ using System; using System.Collections.Generic; +using System.Xml; namespace DMX2 { public abstract class Sequenceur { + + static int idmax; + + public Sequenceur (int id) + { + this.id = id; + idmax = Math.Max(id,idmax); + } + public Sequenceur () { + id = idmax++; } int id; @@ -20,11 +31,12 @@ namespace DMX2 public abstract int EtatCircuit(Circuit c); public abstract void Tick(TimeSpan time); - public static Sequenceur Load() + public static Sequenceur Load(XmlElement el) { - throw new NotImplementedException(); + return null; } - public abstract void Save(); + + public abstract XmlElement Save(); } } diff --git a/DMX-2.0/SequenceurLineaire.cs b/DMX-2.0/SequenceurLineaire.cs index 9397a26..7e8a839 100644 --- a/DMX-2.0/SequenceurLineaire.cs +++ b/DMX-2.0/SequenceurLineaire.cs @@ -1,12 +1,13 @@ using System; using System.Collections.Generic; +using System.Collections.ObjectModel; namespace DMX2 { public class SequenceurLineaire : Sequenceur { - TimeSpan timeStamp; + TimeSpan timeStamp = TimeSpan.Zero; public TimeSpan TimeStamp { get { @@ -15,37 +16,69 @@ namespace DMX2 } public class Effet { - public string Nom; - Dictionary valeurs = new Dictionary(); + + string _nom; + public Effet(string nom, Dictionary valeurs, TimeSpan duree, TimeSpan transition) + { + _nom=nom; + _valeurs = new Dictionary(valeurs); + _duree=duree; + _transition=transition; + } + public string Nom { + get { + return _nom; + } + } + + Dictionary _valeurs; public int this [Circuit index] { get { - if(!valeurs.ContainsKey(index)) - valeurs.Add(index,0); - return valeurs[index]; - } - set { - if(valeurs.ContainsKey (index)) - valeurs[index] = value; - else - valeurs.Add(index,value); + if(!_valeurs.ContainsKey(index)) + _valeurs.Add(index,0); + return _valeurs[index]; } } public void RetireCircuit(Circuit c){ - valeurs.Remove(c); + _valeurs.Remove(c); } - public TimeSpan Duree; - public TimeSpan Transition; + TimeSpan _duree =TimeSpan.Zero ; + TimeSpan _transition = TimeSpan.Zero; + public TimeSpan Duree { + get { + return _duree; + } + } + public TimeSpan Transition { + get { + return _transition; + } + } + + } List circuitsSeq = new List(); - List effets; + List effets = new List(); + + public ReadOnlyCollection Effets { + get { + return effets.AsReadOnly() ; + } + } + Effet effetcourrant=null; bool enTransition=false; - + Dictionary valeurscourantes = new Dictionary(); + Dictionary valeursinitiales = new Dictionary(); public SequenceurLineaire () { + } + + public SequenceurLineaire (int id) :base (id) + { } @@ -53,11 +86,53 @@ namespace DMX2 { if (!circuitsSeq.Contains (c)) return 0; + return valeurscourantes[c]; } public override void Tick (TimeSpan time) { + timeStamp += time; + if (enTransition) { + if(timeStamp(valeurscourantes); + enTransition = true; + timeStamp = TimeSpan.Zero; + } + + public void SauveEffet (string nom, TimeSpan duree, TimeSpan transition) + { + effets.Add(new Effet(nom, valeurscourantes,duree,transition)); + } + + public override System.Xml.XmlElement Save () + { + throw new System.NotImplementedException (); } } diff --git a/DMX-2.0/UniversDMX.cs b/DMX-2.0/UniversDMX.cs index b152b12..2b8adc5 100644 --- a/DMX-2.0/UniversDMX.cs +++ b/DMX-2.0/UniversDMX.cs @@ -7,8 +7,15 @@ namespace DMX2 public class UniversDMX { - Grada[] _gradas = new Grada[512]; + static int nb=1; + public UniversDMX() + { + Nom = "Univers DMX n°"+ nb++.ToString(); + } + + Grada[] _gradas = new Grada[512]; + public string Nom; public enum FTransfer { lineaire, log,