bool ProcessCDEngine(TheUPnPDeviceInfo tHistory, Uri tLocationUrl) { if ((tLocationUrl.Host.Equals(TheBaseAssets.MyServiceHostInfo.MyStationIP) && tLocationUrl.Port == TheBaseAssets.MyServiceHostInfo.MyStationPort) || !tHistory.PacketString.Contains(TheBaseAssets.MyServiceHostInfo.ApplicationName) || tLocationUrl.Host.Contains("127.0.0.1")) { return(true); } TheBaseAssets.MySYSLOG.WriteToLog(111, TSM.L(eDEBUG_LEVELS.ESSENTIALS) ? null : new TSM("UPnP", string.Format("C-DEngine Root Device Found: {0}", tHistory), eMsgLevel.l7_HostDebugMessage)); if (!TheBaseAssets.MyServiceHostInfo.DisableUPnPAutoConnect && TheBaseAssets.MyServiceHostInfo.ApplicationName.Equals(tHistory.ModelName)) { if (!string.IsNullOrEmpty(tHistory.CDEContextID)) { if (!string.IsNullOrEmpty(tHistory.CDEProvisionUrl)) { TheBaseAssets.MySettings.SetSetting("AutoProvisioningUrl", tHistory.CDEProvisionUrl); } if (!TheBaseAssets.MyScopeManager.IsScopingEnabled || (TheBaseAssets.MyScopeManager.IsScopingEnabled && !TheBaseAssets.MyScopeManager.ScopeID.Equals(TheBaseAssets.MyScopeManager.GetRealScopeID(tHistory.CDEContextID)))) //GRSI: rare { return(false); } } else { if (TheBaseAssets.MyScopeManager.IsScopingEnabled || !TheBaseAssets.MyServiceHostInfo.AllowUnscopedMesh) { return(false); } } if (!TheCommonUtils.DoesContainLocalhost(tHistory.CDEConnectUrl) && !TheCommonUtils.DoesContainLocalhost(tHistory.CDEConnectWsUrl)) { string strStationRoles = tHistory.FriendlyName; int pos = strStationRoles.LastIndexOf(':') + 1; if (!string.IsNullOrEmpty(strStationRoles) && pos >= 0) { strStationRoles = strStationRoles.Substring(pos, strStationRoles.Length - pos); string[] sRoles = strStationRoles.Split(';'); List <string> discoveredStationRoles = new List <string>(); foreach (string gt in sRoles) { discoveredStationRoles.Add(TheBaseAssets.MyScopeManager.AddScopeID(gt)); } string[] apps = TheCommonUtils.cdeSplit(tHistory.FriendlyName, " at:", false, false); string appName = "Unknown App"; if (apps != null && apps.Length > 0) { appName = apps[0].Trim(); } string tConnectUrl = tHistory.CDEConnectUrl; if (!string.IsNullOrEmpty(tHistory.CDEConnectWsUrl)) { tConnectUrl = tHistory.CDEConnectWsUrl; } TheBaseAssets.MySYSLOG.WriteToLog(112, TSM.L(eDEBUG_LEVELS.ESSENTIALS) ? null : new TSM("UPnP", $"Compatible Service Found: {tHistory.FriendlyName} {tHistory.Manufacturer} {tHistory.ModelName} {tHistory.ModelNumber} {tHistory.SerialNumber} {tConnectUrl}", eMsgLevel.l7_HostDebugMessage)); eventWSDMatchFound?.Invoke(tHistory.CDENodeID, tConnectUrl, discoveredStationRoles); TheBaseAssets.MySYSLOG.WriteToLog(113, TSM.L(eDEBUG_LEVELS.OFF) ? null : new TSM("UPnP", "New " + appName + " Station found at: " + tConnectUrl, eMsgLevel.l3_ImportantMessage)); } } } return(true); }