Exemple #1
0
 public override Nodo Clone()
 {
     Flusso f = new Flusso(name, null, true);
     f.propertyDefinitions = propertyDefinitions;
     f.protocolname = protocolname;
     f.abilitazione = abilitazione;
     f.propertyValues = (PropertyList)propertyValues.Clone();
     return f;
 }
Exemple #2
0
 internal void addVarNodeGPRJ(string path, Dictionary<string, string> props)
 {
     string[] pathFields = path.Split(';');
     Nodo actualNode = this, nextNode = null;
     for (int i = 0; i < pathFields.Length; i++)
     {
         nextNode = actualNode.Children.FirstOrDefault(x => x.name == pathFields[i]);
         if (nextNode != null)
         {
             actualNode = nextNode;
             continue;
         }
         else if (i != pathFields.Length - 1)
         {
             actualNode.Append(nextNode = new VarNodo(pathFields[i], actualNode, true));
         }
         else {
             switch (props["Tipo"])
             {
                 case "Nodo":
                     actualNode.Append(nextNode = new VarNodo(pathFields[i], actualNode, Boolean.Parse(props["Enabled"].ToLower())));
                     break;
                 case "Variabile":
                     actualNode.Append(nextNode = new Variable(pathFields[i], actualNode, Boolean.Parse(props["Enabled"]), Int32.Parse(props["Addres"])));
                     break;
                 case "Protocollo":
                     actualNode.Append(nextNode = new Flusso(pathFields[i], actualNode, Boolean.Parse(props["Enabled"])));
                     Flusso f = nextNode as Flusso;
                     f.ProtocolName = props["SottoTipo"];
                     if (f.ProtocolDefs == null)
                     {
                         var pname = VarDefinitions.Map.Keys.FirstOrDefault(x => Regex.IsMatch(props["SottoTipo"], x, RegexOptions.IgnoreCase));
                         if (pname != null)
                             f.ProtocolName = pname;
                         else
                         {
                             Logger.Log("Protocollo non trovato per il flusso " + f.Path, "Red");
                             continue;
                         }
                     }
                     foreach (var pt in f.ProtocolDefs)
                     {
                         if (!pt.Value.Visibile) continue;
                         string v = null;
                         if (props.ContainsKey(pt.Value.NomeSalvato))
                             v = props[pt.Value.NomeSalvato];
                         f.propertylist.Add(new PropertyItem(pt.Value.NomeVisualizzato, v, pt.Value));
                     }
                     break;
             }
         }
         actualNode = nextNode;
     }
 }