Exemplo n.º 1
0
        private void TraverseRightObject(IMDTreeItem Right, ComparisonItem ParentNode)
        {
            if (Right.HasChildren())
            {
                foreach (var item in Right.ChildItems)
                {
                    AddAndFillNewNode(null, item, ParentNode);
                }
            }

            if (Right is IMDPropertyProvider)
            {
                var PropStub = ParentNode.AddStaticNode("Свойства");
                var PropProv = Right as IMDPropertyProvider;

                foreach (PropDef propDef in PropProv.Properties.Values)
                {
                    var propNode = new ComparisonItem(null, propDef.Value, propDef.Name);
                    propNode.IsDiffer = true;

                    PropStub.Items.Add(propNode);
                }

                PropStub.IsDiffer = true;
            }
        }
Exemplo n.º 2
0
        private ComparisonItem CompareProperties(IMDPropertyProvider Left, IMDPropertyProvider Right, ComparisonItem parentNode)
        {
            var PropStub = parentNode.AddStaticNode("Свойства");

            bool HasDifference = false;

            foreach (PropDef propDef in Left.Properties.Values)
            {
                if (m_CurrentMode == MatchingMode.ByName && propDef.Key == "ID")
                {
                    continue;
                }

                object  RightVal      = null;
                PropDef RightProperty = null;

                if (Right != null)
                {
                    RightVal      = Right.GetValue(propDef.Key);
                    RightProperty = Right.Properties[propDef.Key];
                }

                bool childDifference = !propDef.CompareTo(RightVal);
                HasDifference = HasDifference || childDifference;

                var newNode = new ComparisonItem(propDef, RightProperty, propDef.Name);
                newNode.IsDiffer = childDifference;

                PropStub.Items.Add(newNode);
            }

            parentNode.IsDiffer = HasDifference;
            PropStub.IsDiffer   = HasDifference;

            return(PropStub);
        }