private void GetIdentityValues(ProccessStatusReq psr, List <XElement> parentLog, PairedValues pairedValues) { int idx = 0; List <string> identityValues = new List <string>(); foreach (PairedValue pv in pairedValues) { foreach (var pl in parentLog) { int nameCount = psr.CountChildName(pl, pv.IdentName); if (nameCount == 1) { pv.IdentValue = psr.GetChildElementValue(pl, pv.IdentName); if (pv.IdentValue.Length > 0) { break; } } else if (nameCount > 1) { identityValues = psr.GetChildElementValues(pl, pv.IdentName); pv.IdentValue = identityValues[idx]; idx++; } } } }
private void RetrieveSettings(DeviceSettings lstDS) { ProccessStatusReq psr = new ProccessStatusReq("admin", "!QAZ2wsx", txtIPAddress.Text); try { foreach (EndPoint ds in lstDS) { var epLog = psr.GetEndPointLog(ds.EndPointName, ds.ResourceURI); if (epLog != null) { ProcessParentData(psr, epLog, ds.ListParents); ds.HasValues = true; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Device Communication", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
private void ProcessParentData(ProccessStatusReq psr, XElement epLog, Parents listParents) { foreach (Parent p in listParents) { var parentLog = psr.GetElementsSelf(epLog, p.ParentName); GetIdentityValues(psr, parentLog, p.ListPairedValues); if (p.ListParents.Count > 0) { if (parentLog.Count > 0) { // if no values have been set for the device no need to recurs if (!parentLog[0].IsEmpty) { ProcessParentData(psr, parentLog[0], p.ListParents); } } //else //{ // MessageBox.Show("Improperly formatted XML data. The parentLog is hosed at: " + p.ParentName); //} } } }