Esempio n. 1
0
 private void Compare()
 {
     // created on sorted superlist of ISHType/Level/FieldName so that compares are happening in a predictable order
     CreateSuperSortedList();
     foreach (string key in _sortedSuperList.Keys)
     {
         IshTypeFieldDefinition left  = _leftIshTypeFieldSetup.GetValue(key);
         IshTypeFieldDefinition right = _rightIshTypeFieldSetup.GetValue(key);
         if ((left != null) && (right != null))
         {
             int compareResult = left.CompareTo(right);
             if ((compareResult == 0) && IncludeIdentical)
             {
                 WriteObject(new IshTypeFieldDefinitionCompare(left, IshTypeFieldDefinitionCompare.Compare.Identical));
             }
             if ((compareResult != 0) && !ExcludeDifferent)
             {
                 WriteObject(new IshTypeFieldDefinitionCompare(left, IshTypeFieldDefinitionCompare.Compare.LeftDifferent));
                 WriteObject(new IshTypeFieldDefinitionCompare(right, IshTypeFieldDefinitionCompare.Compare.RightDifferent));
             }
         }
         else if ((left != null) && !ExcludeLeftUnique)
         {
             WriteObject(new IshTypeFieldDefinitionCompare(left, IshTypeFieldDefinitionCompare.Compare.LeftOnly));
         }
         else if ((right != null) && !ExcludeRightUnique)
         {
             WriteObject(new IshTypeFieldDefinitionCompare(right, IshTypeFieldDefinitionCompare.Compare.RightOnly));
         }
     }
     // for each entry in the superlist
     //   lookupLeft and lookupRight, and promote each to IshTypeFieldDefinitionCompare (with left or right enum)
     //   if (lookupLeft != null && lookupRight != null)
     //     CompareIshTypeFieldDefinition()
     //     if CompareIshTypeFieldDefinition() == true && IncludeIdentical
     //       WriteObject with equal enum
     //     if CompareIshTypeFieldDefinition() == false && !ExcludeDifferent
     //       WriteObject with diff enum
     //   else if (lookupLeft != null && !ExcludeLeftUnique)
     //       WriteObject with left enum
     //   else if (lookupRight != null && !ExcludeRightUnique)
     //       WriteObject with right enum
     //   else
     //      WriteDebug($"Comparing , in the sorted list but lookups fails.")
 }
Esempio n. 2
0
        /// <summary>
        /// Creates a management object to work with the ISHType and FieldDefinitions.
        /// </summary>
        public IshTypeFieldSetup(ILogger logger, string xmlIshFieldSetup)
        {
            _logger = logger;
            _ishTypeFieldDefinitions = new SortedDictionary <string, IshTypeFieldDefinition>();
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xmlIshFieldSetup);
            foreach (XmlNode xmlIshTypeDefinition in xmlDocument.SelectNodes("ishfieldsetup/ishtypedefinition"))
            {
                Enumerations.ISHType ishType = (Enumerations.ISHType)Enum.Parse(typeof(Enumerations.ISHType), xmlIshTypeDefinition.Attributes.GetNamedItem("name").Value);
                _logger.WriteDebug($"IshTypeFieldSetup ishType[{ishType}]");
                foreach (XmlNode xmlIshFieldDefinition in xmlIshTypeDefinition.SelectNodes("ishfielddefinition"))
                {
                    IshTypeFieldDefinition ishTypeFieldDefinition = new IshTypeFieldDefinition(_logger, ishType, (XmlElement)xmlIshFieldDefinition);
                    _ishTypeFieldDefinitions.Add(ishTypeFieldDefinition.Key, ishTypeFieldDefinition);
                }
            }
        }