Exemple #1
0
        protected Dictionary <string, List <Tuple <string, Action, string, bool> > > DeserializeStates(XmlTextReader reader)
        {
            var    states = new Dictionary <string, List <Tuple <string, Action, string, bool> > >();
            string name   = null;

            do
            {
                var nodeType = reader.NodeType;
                if (nodeType.Equals(XmlNodeType.Element))
                {
                    switch (reader.Name)
                    {
                    case "state":
                        name         = reader.GetAttribute("name");
                        states[name] = new List <Tuple <string, Action, string, bool> >();
                        break;

                    case "enabled_label":
                        break;

                    case "transition":
                        var sourceState = name;
                        var targetState = reader.GetAttribute("destination");
                        var isUnproven  = bool.Parse(reader.GetAttribute("uncertain"));
                        var action      = new StringAction(reader.GetAttribute("label"));
                        states[name].Add(new Tuple <string, Action, string, bool>(sourceState, action, targetState, isUnproven));
                        break;
                    }
                }
            } while (reader.Read());

            return(states);
        }
Exemple #2
0
 public bool Equals(StringAction other)
 {
     return(name.Equals(other.name));
 }