// Token: 0x06000424 RID: 1060 RVA: 0x0001C1E0 File Offset: 0x0001A3E0 public static Action AuditTechnologiesChanges(IEnumerable <IDiscoveredObject> discoveredObjects, int nodeId) { if (!BusinessLayerSettings.Instance.EnableTechnologyPollingAssignmentsChangesAuditing) { return(delegate() { }); } Dictionary <string, ITechnology> technologies = TechnologyManager.Instance.TechnologyFactory.Items().ToDictionary((ITechnology k) => k.TechnologyID, (ITechnology v) => v, StringComparer.Ordinal); Dictionary <string, string> dictionary = (from tp in TechnologyManager.Instance.TechnologyPollingFactory.Items() where technologies.ContainsKey(tp.TechnologyID) select tp).ToDictionary((ITechnologyPolling k) => k.TechnologyPollingID, (ITechnologyPolling v) => technologies[v.TechnologyID].TargetEntity, StringComparer.Ordinal); IEnumerable <IDiscoveredObjectWithTechnology> enumerable = discoveredObjects.OfType <IDiscoveredObjectWithTechnology>(); List <TechnologyPollingAssignment> changedAssignments = new List <TechnologyPollingAssignment>(); foreach (IDiscoveredObjectWithTechnology discoveredObjectWithTechnology in enumerable) { if (dictionary.ContainsKey(discoveredObjectWithTechnology.TechnologyPollingID) && "Orion.Nodes".Equals(dictionary[discoveredObjectWithTechnology.TechnologyPollingID], StringComparison.Ordinal)) { TechnologyPollingAssignment technologyPollingAssignment = TechnologyManager.Instance.TechnologyPollingFactory.GetAssignments(discoveredObjectWithTechnology.TechnologyPollingID, new int[] { nodeId }).FirstOrDefault <TechnologyPollingAssignment>(); bool flag = technologyPollingAssignment != null && technologyPollingAssignment.Enabled; bool isSelected = discoveredObjectWithTechnology.IsSelected; if (flag != isSelected) { changedAssignments.Add(new TechnologyPollingAssignment { TechnologyPollingID = discoveredObjectWithTechnology.TechnologyPollingID, NetObjectID = nodeId, Enabled = isSelected }); } } } return(delegate() { if (changedAssignments.Count == 0) { return; } Dictionary <string, ITechnologyPolling> dictionary2 = TechnologyManager.Instance.TechnologyPollingFactory.Items().ToDictionary((ITechnologyPolling k) => k.TechnologyPollingID, (ITechnologyPolling v) => v, StringComparer.Ordinal); TechnologyPollingIndicator technologyPollingIndicator = new TechnologyPollingIndicator(); foreach (TechnologyPollingAssignment technologyPollingAssignment2 in changedAssignments) { technologyPollingIndicator.ReportTechnologyPollingAssignmentIndication(dictionary2[technologyPollingAssignment2.TechnologyPollingID], new int[] { technologyPollingAssignment2.NetObjectID }, technologyPollingAssignment2.Enabled); } }); }
public static Action AuditTechnologiesChanges( IEnumerable <IDiscoveredObject> discoveredObjects, int nodeId) { if (!BusinessLayerSettings.Instance.EnableTechnologyPollingAssignmentsChangesAuditing) { return((Action)(() => {})); } Dictionary <string, ITechnology> technologies = TechnologyManager.Instance.TechnologyFactory.Items().ToDictionary <ITechnology, string, ITechnology>((Func <ITechnology, string>)(k => k.get_TechnologyID()), (Func <ITechnology, ITechnology>)(v => v), (IEqualityComparer <string>)StringComparer.Ordinal); Dictionary <string, string> dictionary1 = TechnologyManager.Instance.TechnologyPollingFactory.Items().Where <ITechnologyPolling>((Func <ITechnologyPolling, bool>)(tp => technologies.ContainsKey(tp.get_TechnologyID()))).ToDictionary <ITechnologyPolling, string, string>((Func <ITechnologyPolling, string>)(k => k.get_TechnologyPollingID()), (Func <ITechnologyPolling, string>)(v => technologies[v.get_TechnologyID()].get_TargetEntity()), (IEqualityComparer <string>)StringComparer.Ordinal); IEnumerable <IDiscoveredObjectWithTechnology> objectWithTechnologies = ((IEnumerable)discoveredObjects).OfType <IDiscoveredObjectWithTechnology>(); List <TechnologyPollingAssignment> changedAssignments = new List <TechnologyPollingAssignment>(); using (IEnumerator <IDiscoveredObjectWithTechnology> enumerator = objectWithTechnologies.GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { IDiscoveredObjectWithTechnology current = enumerator.Current; if (dictionary1.ContainsKey(current.get_TechnologyPollingID()) && "Orion.Nodes".Equals(dictionary1[current.get_TechnologyPollingID()], StringComparison.Ordinal)) { int num1 = nodeId; TechnologyPollingAssignment pollingAssignment1 = TechnologyManager.Instance.TechnologyPollingFactory.GetAssignments(current.get_TechnologyPollingID(), new int[1] { num1 }).FirstOrDefault <TechnologyPollingAssignment>(); int num2 = pollingAssignment1 == null ? 0 : (pollingAssignment1.get_Enabled() ? 1 : 0); bool isSelected = ((IDiscoveredObject)current).get_IsSelected(); int num3 = isSelected ? 1 : 0; if (num2 != num3) { List <TechnologyPollingAssignment> pollingAssignmentList = changedAssignments; TechnologyPollingAssignment pollingAssignment2 = new TechnologyPollingAssignment(); pollingAssignment2.set_TechnologyPollingID(current.get_TechnologyPollingID()); pollingAssignment2.set_NetObjectID(num1); pollingAssignment2.set_Enabled(isSelected); pollingAssignmentList.Add(pollingAssignment2); } } } } return((Action)(() => { if (changedAssignments.Count == 0) { return; } Dictionary <string, ITechnologyPolling> dictionary2 = TechnologyManager.Instance.TechnologyPollingFactory.Items().ToDictionary <ITechnologyPolling, string, ITechnologyPolling>((Func <ITechnologyPolling, string>)(k => k.get_TechnologyPollingID()), (Func <ITechnologyPolling, ITechnologyPolling>)(v => v), (IEqualityComparer <string>)StringComparer.Ordinal); TechnologyPollingIndicator pollingIndicator = new TechnologyPollingIndicator(); using (List <TechnologyPollingAssignment> .Enumerator enumerator = changedAssignments.GetEnumerator()) { while (enumerator.MoveNext()) { TechnologyPollingAssignment current = enumerator.Current; pollingIndicator.ReportTechnologyPollingAssignmentIndication(dictionary2[current.get_TechnologyPollingID()], new int[1] { current.get_NetObjectID() }, (current.get_Enabled() ? 1 : 0) != 0); } } })); }