/////////////////////////////////////////////////////////////////////////// public bool LoadIOConf() { try { XmlSerializer serializer = new XmlSerializer(typeof(List <List <IO_Parameter> >)); FileStream filestream = new FileStream(this.m_filename, FileMode.Open); List <List <IO_Parameter> > listIO; try { listIO = (List <List <IO_Parameter> >)serializer.Deserialize(filestream); } catch (Exception e1) { filestream.Close(); throw (e1); } filestream.Close(); for (int i = 0; i < listIO[0].Count; i++) { IO_Parameter IO = listIO[0][i]; if (parent.CumpleFiltrado(ref IO)) { IOparameters.In.Add(IO.Name, IO); } } for (int i = 0; i < listIO[1].Count; i++) { IO_Parameter IO = listIO[1][i]; if (parent.CumpleFiltrado(ref IO)) { IOparameters.Out.Add(IO.Name, IO); } } return(true); } catch (Exception e) { parent.UBSMod.Error("Error al cargar el bloque de comunicacion número " + m_id + ". Avisad a Roboconcept. " + e.Message, true); return(false); } }
public bool CumpleFiltrado(ref IO_Parameter ioParam) { bool cumple = false; foreach (IO_Parameter_Filter IOFilter in listIO_filter) { bool Existe_condicion = false; string expresion = ioParam.Name; for (int i = 0; i < IOFilter.Name.Count; i++) { MatchCollection resultado; string expresion_regular = IOFilter.Name[i]; resultado = Regex.Matches(expresion, expresion_regular); if (resultado.Count > 0) { Existe_condicion = true; } else { Existe_condicion = false; break; } } if (Existe_condicion) { int count = IOFilter.Redirections.Count; for (int i = 0; i < count; i++) { ioParam.Redirections.Add(IOFilter.Redirections[i]); } cumple = true; break; } } return(cumple); }