public override Nodo Clone() { Canale f = new Canale(name, null, true); f.propertyDefinitions = propertyDefinitions; f.protocolname = protocolname; f.abilitazione = abilitazione; f.propertyValues = (PropertyList)propertyValues.Clone(); return f; }
internal void addComCSV(List<string> groups, List<List<string>> groupMap) { Nodo n = this, m = null; string[] path = groups[0].Split(';'); string fieldString = ""; for (int i = 0; i < path.Length; i++) { m = n.Children.FirstOrDefault(x => x.Name == path[i]); if (m == null) { if (i == path.Length - 1 || String.IsNullOrWhiteSpace(path[i + 1])) { int c = 1; for (; c < groups.Count; c++) { if (!String.IsNullOrWhiteSpace(groups[c].Replace(";", ""))) { fieldString = groups[c]; break; } } m = new Canale(path[i], n, fieldString.Split(';'), groupMap[c]); n.Children.Add(m); return; } else { m = new ComNodo(path[i], n, true); n.Append(m); n = m; } } else { n = m; } } }
internal void addComNodeGPRJ(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 ComNodo(pathFields[i], actualNode, true)); } else { switch (props["Tipo"]) { case "Nodo": actualNode.Append(nextNode = new ComNodo(pathFields[i], actualNode, Boolean.Parse(props["Enabled"].ToLower()))); break; case "Comunication": actualNode.Append(nextNode = new Canale(pathFields[i], actualNode, Boolean.Parse(props["Enabled"].ToLower()))); Canale c = nextNode as Canale; c.ProtocolName = props["SottoTipo"]; if (c.ProtocolDefs == null) { var pname = ComDefinitions.Map.Keys.FirstOrDefault(x => Regex.IsMatch(props["SottoTipo"], x, RegexOptions.IgnoreCase)); if (pname != null) c.ProtocolName = pname; else { Logger.Log("Protocollo non trovato per il canale " + c.Path, "Red"); continue; } } foreach (var pt in c.ProtocolDefs) { if (!pt.Value.Visibile) continue; //if (Regex.IsMatch(pt.Value.name, "SottoTipo|Tipo|NameNodo|Enabled|PathNode|Addres|GPMExportFile|Percorso|^a$", RegexOptions.IgnoreCase)) continue; string v = null; if (props.ContainsKey(pt.Value.NomeSalvato)) v = props[pt.Value.NomeSalvato]; c.propertylist.Add(new PropertyItem(pt.Value.NomeVisualizzato, v, pt.Value)); } break; } } actualNode = nextNode; } }