private int findTimer(ArrayList timer, string name) { if (string.Compare(name, "") == 0) { return(-1); } for (int i = 0; i < timer.Count; i++) { ML2Timer timerElement = (ML2Timer)timer[i]; if (string.Compare((string)timerElement.timerName, name) == 0) { return(i); } } return(-1); }
private bool RungsSame(ArrayList rung1, ArrayList rung2) { if (rung1.Count != rung2.Count) { return(false); } for (int i = 1; i < rung1.Count - 1; i++) { Contact contact1 = (Contact)rung1[i]; Contact contact2 = (Contact)rung2[i]; if (contact1.leftLink != contact2.leftLink) { return(false); } if (contact1.bottomLink != contact2.bottomLink) { return(false); } if (contact1.topLink != contact2.topLink) { return(false); } if (contact1.NormallyClosed != contact2.NormallyClosed) { return(false); } if (contact1.x != contact2.x) { return(false); } if (contact1.y != contact2.y) { return(false); } if (string.Compare(contact1.typeOfCell, contact2.typeOfCell) != 0) { return(false); } if (string.Compare(contact1.name, contact2.name) != 0) { return(false); } } int timerNewnumber = findTimer(timersNew, rung2[rung2.Count - 1].ToString()); int timerOldnumber = findTimer(timersOld, rung1[rung1.Count - 1].ToString()); if ((timerNewnumber == -1) && (timerNewnumber == -1)) { return(true); } if (timerNewnumber == -1) { return(false); } if (timerOldnumber == -1) { return(false); } ML2Timer timerOldElement = (ML2Timer)timersOld[timerOldnumber]; ML2Timer timerNewElement = (ML2Timer)timersNew[timerNewnumber]; if ((timerOldElement.clearTime != timerNewElement.clearTime) || (timerOldElement.setTime != timerNewElement.setTime)) { return(false); } return(true); }