Ejemplo n.º 1
0
        void CopyCmdExecuted(object target, ExecutedRoutedEventArgs e)
        {
            TreeView tv = e.OriginalSource as TreeView;

            string copyContent = String.Empty;

            if (tv.SelectedItem is DiffPolicyInfo)
            {
                DiffPolicyInfo dpInf = (DiffPolicyInfo)tv.SelectedItem;
                copyContent = dpInf.Name;
            }
            else if (tv.SelectedItem is BaseDiffViewItem)
            {
                BaseDiffViewItem dpI = (BaseDiffViewItem)tv.SelectedItem;
                copyContent = dpI.Name;
            }

            try
            {
                Clipboard.SetData(DataFormats.Text, copyContent);
            }
            catch
            {
            }
        }
Ejemplo n.º 2
0
        public bool FilterListView(Object item)
        {
            DiffPolicyInfo policy = (DiffPolicyInfo)item;

            return((FilterText.Text.Length < 1 || (policy.Name.ToLower().Contains(FilterText.Text.ToLower()))) &&
                   ((FilterAssign.IsChecked == true && policy.AssignmentsDifferenceInfo.Assignmments.Count > 0) ||
                    (FilterGPT.IsChecked == true && policy.SecEditDifferenceInfo.Sections.Count > 0) ||
                    (FilterLinks.IsChecked == true && policy.LinkageDifferenceInfo.Linkages.Count > 0) ||
                    (FilterWMI.IsChecked == true && policy.WMIDifferenceInfo.WMIItems.Count > 0) ||
                    (FilterPref.IsChecked == true && (policy.PreferenceDifferenceInfo.nodeItems.Count > 0 || policy.MachinePreferenceDifferenceInfo.nodeItems.Count > 0)) ||
                    (FilterReg.IsChecked == true && (policy.MachineRegDifferenceInfo.Items.Count > 0 || policy.UserRegDifferenceInfo.Items.Count > 0)) ||
                    (FilterIEAK.IsChecked == true && (policy.IEAKDifferenceInfo.Sections.Count > 0 || policy.IEAKMachineDifferenceInfo.Sections.Count > 0))
                   ));
        }
Ejemplo n.º 3
0
        //public void OpenDBBackupSet(int DBBackupID)
        //{
        //   Policies = DB.GetPolicies(DBBackupID);
        //   BackupSetID = DBBackupID;

        //   System.Data.DataSet rsDS = DB.GetAllRegSettings(DBBackupID,-1);
        //   System.Data.DataSet sedDS = DB.GetAllSecEditSectionData(DBBackupID,-1);
        //   System.Data.DataSet ieakDS = DB.GetAllIEAKData(DBBackupID,false,-1);
        //   System.Data.DataSet ieakMachineDS = DB.GetAllIEAKData(DBBackupID, true,-1);

        //   System.Data.DataSet wmiDS = DB.GetAllWMIFilters(DBBackupID, -1);
        //   System.Data.DataSet linkDS = DB.GetAllLinks(DBBackupID, -1);
        //   System.Data.DataSet assDS = DB.GetAllAssignments(DBBackupID, -1);

        //   System.Data.DataSet prefDS = DB.GetAllPreferenceNodes(DBBackupID, -1);
        //   System.Data.DataSet propDS = DB.GetAllPreferenceProperties(DBBackupID, -1);

        //   int Current = 0;

        //   foreach (Policy pol in Policies)
        //   {
        //       Current++;
        //       LogProgress(Policies.Count, Current, pol.Name);

        //       int PolcyBackupID = DB.GetPoliciesBackupID(DBBackupID, pol.GUID);


        //       sedDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID;
        //       ieakDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID;
        //       wmiDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID;
        //       linkDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID;
        //       assDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID;

        //       rsDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID + " AND  PolType = 'User'" ;
        //       pol.PolicyFiles.Add(DB.GetPoliciesPolicyFile(rsDS));
        //       pol.PolicyFiles[pol.PolicyFiles.Count - 1].Type = PolicyFile.POLICY_FILE_TYPE_USER;

        //       rsDS.Tables[0].DefaultView.RowFilter = "policyBackupID = " + PolcyBackupID + " AND  PolType = 'Machine'";
        //       pol.PolicyFiles.Add(DB.GetPoliciesPolicyFile(rsDS));
        //       pol.PolicyFiles[pol.PolicyFiles.Count - 1].Type = PolicyFile.POLICY_FILE_TYPE_MACHINE;

        //       pol.AppliedTo = DB.GetPoliciesAssignments(assDS, pol);
        //       pol.LinkedTo = DB.GetPoliciesLinks(linkDS, pol);
        //       pol.WMIFilters = DB.GetPoliciesWMIFilters(wmiDS, pol);

        //       pol.SecEditFileData = DB.GetPoliciesSecEditSectionData(sedDS);
        //       pol.IEAKFileData = DB.GetPoliciesIEAKData(ieakDS);
        //       pol.IEAKMachineFileData = DB.GetPoliciesIEAKData(ieakMachineDS);

        //       pol.PreferencesFiles = DB.GetPolicyPreferences(prefDS, propDS,0,"policyBackupID = " + PolcyBackupID + " AND Type = 0");
        //       pol.MachinePreferencesFiles = DB.GetPolicyPreferences(prefDS, propDS, 0, "policyBackupID = " + PolcyBackupID + " AND Type = 1");

        //   }

        //   CanSaveToDB = false;
        //}

        //public bool CreateDBBackupSet()
        //{
        //    //int DomainID = DB.AddDomainID("Delete.Me.Domain");
        //    int DomainID = DB.AddDomainID(GPOM.GetDomainName());
        //    BackupSetID = DB.AddBackupSet(DomainID);

        //    int Current = 0;

        //    foreach (Policy pol in Policies)
        //    {
        //        Current++;
        //        LogProgress(Policies.Count, Current, pol.Name);

        //        int PolicyBackupID = DB.AddPolicyBackupID(BackupSetID, pol.Name, pol.GUID,pol.Version,pol.Date);

        //        foreach (PolicyFile pf in pol.PolicyFiles)
        //        {
        //            foreach(PolicyItem pi in pf.PolicyItems)
        //            {
        //                DB.AddPolicyRegSetting(PolicyBackupID, pf.StringType,
        //                    pi.Key,pi.Value,pi.Data,pi.StringType);
        //            }
        //        }

        //        foreach (AssignmentItem Assignment in pol.AppliedTo)
        //        {
        //            DB.AddPolicyAssignment(PolicyBackupID, Assignment.Assignment);
        //        }

        //        foreach (LinkageItem Link in pol.LinkedTo)
        //        {
        //            DB.AddPolicyLinkage(PolicyBackupID, Link.Linkage);
        //        }

        //        foreach (WMIItem WMIFilter in pol.WMIFilters)
        //        {
        //            DB.AddPolicyWMIFilter(PolicyBackupID, WMIFilter.WMIFilter);
        //        }

        //        foreach (SecEditSection Ses in pol.SecEditFileData.Sections)
        //        {
        //            foreach (SecEditValuePair Sevp in Ses.Entries)
        //            {
        //                DB.AddPolicySecEditSectionData(PolicyBackupID, Ses.Name, Sevp.Name, Sevp.Value);
        //            }
        //        }

        //        foreach (SecEditSection Ses in pol.IEAKFileData.Sections)
        //        {
        //            foreach (SecEditValuePair Sevp in Ses.Entries)
        //            {
        //                DB.AddPolicyIEAKData(PolicyBackupID, Ses.Name, Sevp.Name, Sevp.Value,false);
        //            }
        //        }

        //        foreach (SecEditSection Ses in pol.IEAKMachineFileData.Sections)
        //        {
        //            foreach (SecEditValuePair Sevp in Ses.Entries)
        //            {
        //                DB.AddPolicyIEAKData(PolicyBackupID, Ses.Name, Sevp.Name, Sevp.Value,true);
        //            }
        //        }

        //        DB.AddPolicyPreferenceData(PolicyBackupID,pol.PreferencesFiles, 0, 0);
        //        DB.AddPolicyPreferenceData(PolicyBackupID,pol.MachinePreferencesFiles, 1, 0);



        //    }

        //    return DB.SetBackupFinished(BackupSetID);
        //}

        public List <DiffPolicyInfo> Compare(PolicySet OldPolictSet, Boolean CheckPreviousReleaseVersion)
        {
            List <DiffPolicyInfo> returnValue = new List <DiffPolicyInfo>();

            int Current = 0;

            foreach (Policy pol in Policies)
            {
                Current++;
                LogProgress(Policies.Count, Current, pol.Name);


                bool PolicyFound = false;

                foreach (Policy oldPol in OldPolictSet.Policies)
                {
                    if (pol.GUID.Equals(oldPol.GUID))
                    {
                        DiffPolicyInfo DiffItems = pol.Compare(oldPol);

                        if (DiffItems.HasItems())
                        {
                            DiffItems.UpdateType = DiffPolicyInfo.UPDATED_POLICY;
                            returnValue.Add(DiffItems);
                        }

                        PolicyFound = true;
                        break;
                    }
                }

                if (!PolicyFound)
                {
                    DiffPolicyInfo DiffItems = pol.Compare(new Policy());
                    DiffItems.UpdateType = DiffPolicyInfo.NEW_POLICY;
                    returnValue.Add(DiffItems);

                    //this is required to find the previous Rel of a policy
                    //The current policies are first queried then if there isn't one found
                    //the last backup policy set is queried
                    if (CheckPreviousReleaseVersion && pol.Name.Length > 7 && pol.Name.Substring(pol.Name.Length - 7, 4).Equals("rel-", StringComparison.CurrentCultureIgnoreCase))
                    {
                        int    HighestOldPolicy   = 0;
                        Policy LastPolicyRevision = null;

                        try
                        {
                            if (pol.Name.Length > 3)
                            {
                                int CurrentPolicy = Int32.Parse(pol.Name.Substring(pol.Name.Length - 3, 3));

                                foreach (Policy curPol in Policies)
                                {
                                    if (curPol.Name.Length > 3 && curPol.Name.Substring(0, curPol.Name.Length - 3).Equals(pol.Name.Substring(0, pol.Name.Length - 3)))
                                    {
                                        int CurrentNumber = Int32.Parse(curPol.Name.Substring(curPol.Name.Length - 3, 3));

                                        if (CurrentNumber > HighestOldPolicy &&
                                            CurrentPolicy > CurrentNumber)
                                        {
                                            HighestOldPolicy   = CurrentNumber;
                                            LastPolicyRevision = curPol;
                                        }
                                    }
                                }

                                if (LastPolicyRevision == null)
                                {
                                    foreach (Policy oldPol in OldPolictSet.Policies)
                                    {
                                        if (oldPol.Name.Length > 3 && oldPol.Name.Substring(0, oldPol.Name.Length - 3).Equals(pol.Name.Substring(0, pol.Name.Length - 3)))
                                        {
                                            int CurrentNumber = Int32.Parse(oldPol.Name.Substring(oldPol.Name.Length - 3, 3));

                                            if (CurrentNumber > HighestOldPolicy &&
                                                CurrentPolicy > CurrentNumber)
                                            {
                                                HighestOldPolicy   = CurrentNumber;
                                                LastPolicyRevision = oldPol;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        finally
                        {
                        }

                        // The previous policy revision is used to duplicate deletion information
                        if (LastPolicyRevision != null)
                        {
                            DiffPolicyInfo lpDiffItems = pol.Compare(LastPolicyRevision);

                            lpDiffItems.LastRevisionName       = LastPolicyRevision.Name;
                            lpDiffItems.LastRevisionPolicyGuid = LastPolicyRevision.GUID;
                            lpDiffItems.UpdateType             = DiffPolicyInfo.PREVIOUS_REVISION_POLICY;
                            returnValue.Add(lpDiffItems);
                        }
                    }
                }
            }

            foreach (Policy oldPol in OldPolictSet.Policies)
            {
                bool PolicyFound = false;

                foreach (Policy pol in Policies)
                {
                    if (pol.GUID.Equals(oldPol.GUID))
                    {
                        PolicyFound = true;

                        break;
                    }
                }

                if (!PolicyFound)
                {
                    Policy BlankPolicy = new Policy();
                    BlankPolicy.GUID = oldPol.GUID;
                    BlankPolicy.Name = oldPol.Name;

                    DiffPolicyInfo DiffItems = BlankPolicy.Compare(oldPol);
                    DiffItems.UpdateType = DiffPolicyInfo.DELETED_POLICY;
                    returnValue.Add(DiffItems);
                }
            }

            return(returnValue);
        }
Ejemplo n.º 4
0
        public DiffPolicyInfo Compare(Policy OldPolicy)
        {
            DiffPolicyInfo returnValue = new DiffPolicyInfo();

            returnValue.PolicyGuid = GUID;
            returnValue.Name       = Name;


            if (MachinePreferencesFiles != null && OldPolicy.MachinePreferencesFiles != null)
            {
                if (OldPolicy.MachinePreferencesFiles.Count > 0)
                {
                    returnValue.Name = Name;
                }

                foreach (PolReaderXMLNode PrefNode in MachinePreferencesFiles)
                {
                    bool found = false;

                    foreach (PolReaderXMLNode oldPrefNode in OldPolicy.MachinePreferencesFiles)
                    {
                        if (PrefNode.Name.Equals(oldPrefNode.Name))
                        {
                            XmlNodeDiffInfo DiffItems = PrefNode.Compare(oldPrefNode);

                            if (DiffItems.nodeItems.Count > 0 || DiffItems.propItems.Count > 0)
                            {
                                returnValue.MachinePreferenceDifferenceInfo.Name = "Machine Preferences";
                                returnValue.MachinePreferenceDifferenceInfo.Type = XmlNodeDiffInfo.UPDATED_POLICY;
                                DiffItems.Type = XmlNodeDiffInfo.UPDATED_POLICY;
                                returnValue.MachinePreferenceDifferenceInfo.nodeItems.Add(DiffItems);
                            }

                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        returnValue.MachinePreferenceDifferenceInfo.Name = "Machine Preferences";
                        returnValue.MachinePreferenceDifferenceInfo.Type = XmlNodeDiffInfo.NEW_POLICY;

                        XmlNodeDiffInfo DiffItem = PrefNode.Compare(new PolReaderXMLNode());
                        DiffItem.Type = XmlNodeDiffInfo.NEW_POLICY;
                        returnValue.MachinePreferenceDifferenceInfo.nodeItems.Add(DiffItem);
                    }
                }

                foreach (PolReaderXMLNode oldPrefNode in OldPolicy.MachinePreferencesFiles)
                {
                    bool found = false;

                    foreach (PolReaderXMLNode PrefNode in MachinePreferencesFiles)
                    {
                        if (PrefNode.Name.Equals(oldPrefNode.Name))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        returnValue.MachinePreferenceDifferenceInfo.Name = "Machine Preferences";
                        returnValue.MachinePreferenceDifferenceInfo.Type = XmlNodeDiffInfo.UPDATED_POLICY;
                        XmlNodeDiffInfo DiffItem = new PolReaderXMLNode().Compare(oldPrefNode);

                        DiffItem.DBID = oldPrefNode.DBID;
                        DiffItem.Type = XmlNodeDiffInfo.DELETED_POLICY;
                        DiffItem.Name = oldPrefNode.Name;
                        returnValue.MachinePreferenceDifferenceInfo.nodeItems.Add(DiffItem);
                    }
                }
            }

            if (PreferencesFiles != null && OldPolicy.PreferencesFiles != null)
            {
                if (OldPolicy.MachinePreferencesFiles.Count > 0)
                {
                    returnValue.Name = Name;
                }

                foreach (PolReaderXMLNode PrefNode in PreferencesFiles)
                {
                    bool found = false;

                    foreach (PolReaderXMLNode oldPrefNode in OldPolicy.PreferencesFiles)
                    {
                        if (PrefNode.Name.Equals(oldPrefNode.Name))
                        {
                            XmlNodeDiffInfo DiffItems = PrefNode.Compare(oldPrefNode);

                            if (DiffItems.nodeItems.Count > 0 || DiffItems.propItems.Count > 0)
                            {
                                returnValue.PreferenceDifferenceInfo.Name = "User Preferences";
                                returnValue.PreferenceDifferenceInfo.Type = XmlNodeDiffInfo.UPDATED_POLICY;
                                DiffItems.Type = XmlNodeDiffInfo.UPDATED_POLICY;
                                returnValue.PreferenceDifferenceInfo.nodeItems.Add(DiffItems);
                            }

                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        returnValue.PreferenceDifferenceInfo.Name = "User Preferences";
                        returnValue.PreferenceDifferenceInfo.Type = XmlNodeDiffInfo.NEW_POLICY;

                        XmlNodeDiffInfo DiffItem = PrefNode.Compare(new PolReaderXMLNode());
                        DiffItem.Type = XmlNodeDiffInfo.NEW_POLICY;
                        returnValue.PreferenceDifferenceInfo.nodeItems.Add(DiffItem);
                    }
                }

                foreach (PolReaderXMLNode oldPrefNode in OldPolicy.PreferencesFiles)
                {
                    bool found = false;

                    foreach (PolReaderXMLNode PrefNode in PreferencesFiles)
                    {
                        if (PrefNode.Name.Equals(oldPrefNode.Name))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        returnValue.PreferenceDifferenceInfo.Name = "User Preferences";
                        returnValue.PreferenceDifferenceInfo.Type = XmlNodeDiffInfo.UPDATED_POLICY;
                        XmlNodeDiffInfo DiffItem = new PolReaderXMLNode().Compare(oldPrefNode);
                        DiffItem.Type = XmlNodeDiffInfo.DELETED_POLICY;
                        DiffItem.DBID = oldPrefNode.DBID;
                        DiffItem.Name = oldPrefNode.Name;
                        returnValue.PreferenceDifferenceInfo.nodeItems.Add(DiffItem);
                    }
                }
            }

            if (SecEditFileData != null && SecEditFileData.Sections != null &&
                OldPolicy.SecEditFileData != null && OldPolicy.SecEditFileData.Sections != null)
            {
                foreach (SecEditSection Section in SecEditFileData.Sections)
                {
                    bool found = false;

                    foreach (SecEditSection oldSection in OldPolicy.SecEditFileData.Sections)
                    {
                        if (oldSection.Name.Equals(Section.Name))
                        {
                            List <SecEditDiffValueInfo> Items = Section.Compare(oldSection);

                            if (Items.Count > 0)
                            {
                                returnValue.SecEditDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                                SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                                secEditDiffInfo.Name   = Section.Name;
                                secEditDiffInfo.Type   = SecEditDiffSectionInfo.UPDATED_POLICY_ITEM;
                                secEditDiffInfo.Values = Items;

                                returnValue.SecEditDifferenceInfo.Sections.Add(secEditDiffInfo);
                            }

                            found = true;
                            break;
                        }
                    }

                    if (!found && Section.Entries.Count > 0)
                    {
                        returnValue.SecEditDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                        SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                        secEditDiffInfo.Name   = Section.Name;
                        secEditDiffInfo.Type   = SecEditDiffSectionInfo.NEW_POLICY_ITEM;
                        secEditDiffInfo.Values = Section.Compare(new SecEditSection());

                        returnValue.SecEditDifferenceInfo.Sections.Add(secEditDiffInfo);
                    }
                }

                foreach (SecEditSection oldSection in OldPolicy.SecEditFileData.Sections)
                {
                    bool found = false;

                    foreach (SecEditSection Section in SecEditFileData.Sections)
                    {
                        if (oldSection.Name.Equals(Section.Name))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found && oldSection.Entries.Count > 0)
                    {
                        returnValue.SecEditDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                        SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                        secEditDiffInfo.Name   = oldSection.Name;
                        secEditDiffInfo.Type   = SecEditDiffSectionInfo.DELETED_POLICY_ITEM;
                        secEditDiffInfo.Values = new SecEditSection().Compare(oldSection);

                        returnValue.SecEditDifferenceInfo.Sections.Add(secEditDiffInfo);
                    }
                }
            }

            if (IEAKFileData != null && IEAKFileData.Sections != null &&
                OldPolicy.IEAKFileData != null && OldPolicy.IEAKFileData.Sections != null)
            {
                foreach (SecEditSection Section in IEAKFileData.Sections)
                {
                    bool found = false;

                    foreach (SecEditSection oldSection in OldPolicy.IEAKFileData.Sections)
                    {
                        if (oldSection.Name.Equals(Section.Name))
                        {
                            List <SecEditDiffValueInfo> Items = Section.Compare(oldSection);

                            if (Items.Count > 0)
                            {
                                returnValue.IEAKDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                                SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                                secEditDiffInfo.Name   = Section.Name;
                                secEditDiffInfo.Type   = SecEditDiffSectionInfo.UPDATED_POLICY_ITEM;
                                secEditDiffInfo.Values = Items;

                                returnValue.IEAKDifferenceInfo.Sections.Add(secEditDiffInfo);
                            }

                            found = true;
                            break;
                        }
                    }

                    if (!found && Section.Entries.Count > 0)
                    {
                        returnValue.IEAKDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                        SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                        secEditDiffInfo.Name   = Section.Name;
                        secEditDiffInfo.Type   = SecEditDiffSectionInfo.NEW_POLICY_ITEM;
                        secEditDiffInfo.Values = Section.Compare(new SecEditSection());

                        returnValue.IEAKDifferenceInfo.Sections.Add(secEditDiffInfo);
                    }
                }

                foreach (SecEditSection oldSection in OldPolicy.IEAKFileData.Sections)
                {
                    bool found = false;

                    foreach (SecEditSection Section in IEAKFileData.Sections)
                    {
                        if (oldSection.Name.Equals(Section.Name))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found && oldSection.Entries.Count > 0)
                    {
                        returnValue.IEAKDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                        SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                        secEditDiffInfo.Name   = oldSection.Name;
                        secEditDiffInfo.Type   = SecEditDiffSectionInfo.DELETED_POLICY_ITEM;
                        secEditDiffInfo.Values = new SecEditSection().Compare(oldSection);

                        returnValue.IEAKDifferenceInfo.Sections.Add(secEditDiffInfo);
                    }
                }
            }

            if (IEAKMachineFileData != null && IEAKMachineFileData.Sections != null &&
                OldPolicy.IEAKMachineFileData != null && OldPolicy.IEAKMachineFileData.Sections != null)
            {
                foreach (SecEditSection Section in IEAKMachineFileData.Sections)
                {
                    bool found = false;

                    foreach (SecEditSection oldSection in OldPolicy.IEAKMachineFileData.Sections)
                    {
                        if (oldSection.Name.Equals(Section.Name))
                        {
                            List <SecEditDiffValueInfo> Items = Section.Compare(oldSection);

                            if (Items.Count > 0)
                            {
                                returnValue.IEAKDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                                SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                                secEditDiffInfo.Name   = Section.Name;
                                secEditDiffInfo.Type   = SecEditDiffSectionInfo.UPDATED_POLICY_ITEM;
                                secEditDiffInfo.Values = Items;

                                returnValue.IEAKDifferenceInfo.Sections.Add(secEditDiffInfo);
                            }

                            found = true;
                            break;
                        }
                    }

                    if (!found && Section.Entries.Count > 0)
                    {
                        returnValue.IEAKDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                        SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                        secEditDiffInfo.Name   = Section.Name;
                        secEditDiffInfo.Type   = SecEditDiffSectionInfo.NEW_POLICY_ITEM;
                        secEditDiffInfo.Values = Section.Compare(new SecEditSection());

                        returnValue.IEAKDifferenceInfo.Sections.Add(secEditDiffInfo);
                    }
                }

                foreach (SecEditSection oldSection in OldPolicy.IEAKMachineFileData.Sections)
                {
                    bool found = false;

                    foreach (SecEditSection Section in IEAKMachineFileData.Sections)
                    {
                        if (oldSection.Name.Equals(Section.Name))
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found && oldSection.Entries.Count > 0)
                    {
                        returnValue.IEAKDifferenceInfo.Type = SecEditDiffInfo.UPDATED_POLICY_ITEM;
                        SecEditDiffSectionInfo secEditDiffInfo = new SecEditDiffSectionInfo();

                        secEditDiffInfo.Name   = oldSection.Name;
                        secEditDiffInfo.Type   = SecEditDiffSectionInfo.DELETED_POLICY_ITEM;
                        secEditDiffInfo.Values = new SecEditSection().Compare(oldSection);

                        returnValue.IEAKDifferenceInfo.Sections.Add(secEditDiffInfo);
                    }
                }
            }

            foreach (WMIItem WmiFilter in WMIFilters)
            {
                bool found = false;

                foreach (WMIItem oldWmiFilter in OldPolicy.WMIFilters)
                {
                    if (oldWmiFilter.WMIFilter.Equals(WmiFilter.WMIFilter))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    returnValue.WMIDifferenceInfo.Type = WMIDiffInfo.UPDATED_POLICY_ITEM;

                    WMIDiffInfoItem wmiItem = new WMIDiffInfoItem();
                    wmiItem.WMIQuery = WmiFilter.WMIFilter;
                    wmiItem.Type     = SecEditDiffSectionInfo.NEW_POLICY_ITEM;

                    returnValue.WMIDifferenceInfo.WMIItems.Add(wmiItem);
                }
            }

            foreach (WMIItem oldWmiFilter in OldPolicy.WMIFilters)
            {
                bool found = false;

                foreach (WMIItem WmiFilter in WMIFilters)
                {
                    if (oldWmiFilter.WMIFilter.Equals(WmiFilter.WMIFilter))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    returnValue.WMIDifferenceInfo.Type = WMIDiffInfo.UPDATED_POLICY_ITEM;

                    WMIDiffInfoItem wmiItem = new WMIDiffInfoItem();
                    wmiItem.WMIQuery = oldWmiFilter.WMIFilter;
                    wmiItem.Type     = SecEditDiffSectionInfo.DELETED_POLICY_ITEM;

                    returnValue.WMIDifferenceInfo.WMIItems.Add(wmiItem);
                }
            }



            foreach (AssignmentItem Assignment in AppliedTo)
            {
                bool found = false;

                foreach (AssignmentItem oldAssignment in OldPolicy.AppliedTo)
                {
                    if (oldAssignment.Assignment.Equals(Assignment.Assignment))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    returnValue.AssignmentsDifferenceInfo.Type = AssignmentsDiffInfo.UPDATED_POLICY_ITEM;

                    AssignmentsDiffInfoItem assignItem = new AssignmentsDiffInfoItem();
                    assignItem.Name = Assignment.Assignment;
                    assignItem.Type = AssignmentsDiffInfoItem.NEW_POLICY_ITEM;

                    returnValue.AssignmentsDifferenceInfo.Assignmments.Add(assignItem);
                }
            }

            foreach (AssignmentItem oldAssignment in OldPolicy.AppliedTo)
            {
                bool found = false;

                foreach (AssignmentItem Assignment in AppliedTo)
                {
                    if (oldAssignment.Assignment.Equals(Assignment.Assignment))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    returnValue.AssignmentsDifferenceInfo.Type = AssignmentsDiffInfo.UPDATED_POLICY_ITEM;

                    AssignmentsDiffInfoItem assignItem = new AssignmentsDiffInfoItem();
                    assignItem.Name = oldAssignment.Assignment;
                    assignItem.Type = AssignmentsDiffInfoItem.DELETED_POLICY_ITEM;

                    returnValue.AssignmentsDifferenceInfo.Assignmments.Add(assignItem);
                }
            }

            foreach (LinkageItem Linkage in LinkedTo)
            {
                bool found = false;

                foreach (LinkageItem oldLinkage in OldPolicy.LinkedTo)
                {
                    if (oldLinkage.Linkage.Equals(Linkage.Linkage))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    returnValue.LinkageDifferenceInfo.Type = LinkageDiffInfo.UPDATED_POLICY_ITEM;

                    LinkageDiffInfoItem linkItem = new LinkageDiffInfoItem();
                    linkItem.Name = Linkage.Linkage;
                    linkItem.Type = LinkageDiffInfoItem.NEW_POLICY_ITEM;

                    returnValue.LinkageDifferenceInfo.Linkages.Add(linkItem);
                }
            }

            foreach (LinkageItem oldLinkage in OldPolicy.LinkedTo)
            {
                bool found = false;

                foreach (LinkageItem Linkage in LinkedTo)
                {
                    if (oldLinkage.Linkage.Equals(Linkage.Linkage))
                    {
                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    returnValue.LinkageDifferenceInfo.Type = LinkageDiffInfo.UPDATED_POLICY_ITEM;

                    LinkageDiffInfoItem linkItem = new LinkageDiffInfoItem();
                    linkItem.Name = oldLinkage.Linkage;
                    linkItem.Type = LinkageDiffInfoItem.DELETED_POLICY_ITEM;

                    returnValue.LinkageDifferenceInfo.Linkages.Add(linkItem);
                }
            }

            foreach (PolicyFile polFile in PolicyFiles)
            {
                bool found = false;

                foreach (PolicyFile oldPolFile in OldPolicy.PolicyFiles)
                {
                    if (polFile.Type == oldPolFile.Type)
                    {
                        List <RegDiffItemInfo> DiffItems = polFile.Compare(oldPolFile);

                        if (DiffItems.Count > 0)
                        {
                            if (polFile.Type == PolicyFile.POLICY_FILE_TYPE_MACHINE)
                            {
                                returnValue.MachineRegDifferenceInfo.Type  = RegDiffInfo.UPDATED_POLICY_ITEM;
                                returnValue.MachineRegDifferenceInfo.Items = polFile.Compare(oldPolFile);
                            }
                            else if (polFile.Type == PolicyFile.POLICY_FILE_TYPE_USER)
                            {
                                returnValue.UserRegDifferenceInfo.Type  = RegDiffInfo.UPDATED_POLICY_ITEM;
                                returnValue.UserRegDifferenceInfo.Items = polFile.Compare(oldPolFile);
                            }
                        }

                        found = true;
                        break;
                    }
                }

                if (!found)
                {
                    if (polFile.Type == PolicyFile.POLICY_FILE_TYPE_MACHINE && polFile.PolicyItems.Count > 0)
                    {
                        returnValue.MachineRegDifferenceInfo.Type  = RegDiffInfo.NEW_POLICY_ITEM;
                        returnValue.MachineRegDifferenceInfo.Items = polFile.Compare(new PolicyFile());
                    }
                    else if (polFile.Type == PolicyFile.POLICY_FILE_TYPE_USER && polFile.PolicyItems.Count > 0)
                    {
                        returnValue.UserRegDifferenceInfo.Type  = RegDiffInfo.NEW_POLICY_ITEM;
                        returnValue.UserRegDifferenceInfo.Items = polFile.Compare(new PolicyFile());
                    }
                }
            }

            foreach (PolicyFile oldPolFile in OldPolicy.PolicyFiles)
            {
                bool found = false;

                foreach (PolicyFile polFile in PolicyFiles)
                {
                    if (polFile.Type == oldPolFile.Type)
                    {
                        found = true;
                    }
                }

                if (!found)
                {
                    if (oldPolFile.Type == PolicyFile.POLICY_FILE_TYPE_MACHINE && oldPolFile.PolicyItems.Count > 0)
                    {
                        returnValue.MachineRegDifferenceInfo.Type  = RegDiffInfo.DELETED_POLICY_ITEM;
                        returnValue.MachineRegDifferenceInfo.Items = new PolicyFile().Compare(oldPolFile);
                    }
                    else if (oldPolFile.Type == PolicyFile.POLICY_FILE_TYPE_USER && oldPolFile.PolicyItems.Count > 0)
                    {
                        returnValue.UserRegDifferenceInfo.Type  = RegDiffInfo.DELETED_POLICY_ITEM;
                        returnValue.UserRegDifferenceInfo.Items = new PolicyFile().Compare(oldPolFile);
                    }
                }
            }

            return(returnValue);
        }