Beispiel #1
0
        /// <summary>
        /// This function creates a new RegKeyEntry, that represents the diff information;
        /// assuming that key 1 is the old information, and key 2 the new information
        ///
        /// That means:
        /// - if a key is missing in 1, it is to be added
        /// - if a key is missing in 2, it is to be removed
        /// - if a value is missing in 1, it is to be added
        /// - if a value is missing in 2, it is to be removed
        /// - if a value has changed, use the data from 2
        /// </summary>
        /// <returns>A newly created RegKeyEntry that describes the differences</returns>
        public RegKeyEntry CreateDiffKeyEntry()
        {
            RegKeyEntry result = new RegKeyEntry(null, null);

            foreach (RegKeyEntry keyMissingIn1 in MissingKeysIn1)
            {
                result.AskToAddKey(keyMissingIn1);
            }
            foreach (RegKeyEntry keyMissingIn2 in MissingKeysIn2)
            {
                result.AskToRemoveKey(keyMissingIn2);
            }
            foreach (MissingValue missingValueIn1 in MissingValuesIn1)
            {
                result.AskToAddValue(missingValueIn1.Key, missingValueIn1.Value);
            }
            foreach (MissingValue missingValueIn2 in MissingValuesIn2)
            {
                result.AskToRemoveValue(missingValueIn2.Key, missingValueIn2.Value);
            }
            foreach (DataMismatch dataMismatch in DataMismatches)
            {
                result.AskToAddValue(dataMismatch.Key, dataMismatch.Value2);
            }
            foreach (KindMismatch kindMismatch in KindMismatches)
            {
                result.AskToAddValue(kindMismatch.Key, kindMismatch.Value2);
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// This function creates a new RegKeyEntry, that represents the diff information; 
        /// assuming that key 1 is the old information, and key 2 the new information
        /// 
        /// That means:
        /// - if a key is missing in 1, it is to be added
        /// - if a key is missing in 2, it is to be removed
        /// - if a value is missing in 1, it is to be added
        /// - if a value is missing in 2, it is to be removed
        /// - if a value has changed, use the data from 2 
        /// </summary>
        /// <returns>A newly created RegKeyEntry that describes the differences</returns>
        public RegKeyEntry CreateDiffKeyEntry()
        {
            RegKeyEntry result = new RegKeyEntry(null, null);

            foreach (RegKeyEntry keyMissingIn1 in MissingKeysIn1)
            {
                result.AskToAddKey(keyMissingIn1);
            }
            foreach (RegKeyEntry keyMissingIn2 in MissingKeysIn2)
            {
                result.AskToRemoveKey(keyMissingIn2);
            }
            foreach (MissingValue missingValueIn1 in MissingValuesIn1)
            {
                result.AskToAddValue(missingValueIn1.Key, missingValueIn1.Value);
            }
            foreach (MissingValue missingValueIn2 in MissingValuesIn2)
            {
                result.AskToRemoveValue(missingValueIn2.Key, missingValueIn2.Value);
            }
            foreach (DataMismatch dataMismatch in DataMismatches)
            {
                result.AskToAddValue(dataMismatch.Key, dataMismatch.Value2);
            }
            foreach (KindMismatch kindMismatch in KindMismatches)
            {
                result.AskToAddValue(kindMismatch.Key, kindMismatch.Value2);
            }
            return result;
        }