Example #1
0
        /// <summary>
        /// Collects an id from a Compare Difference Value
        /// </summary>
        /// <param name="ids">Id collection to push to</param>
        /// <param name="value">Compare Difference Value</param>
        /// <param name="valueType">Value Type to collect</param>
        private void CollectId(List <string> ids, CompareDifferenceValue value, CompareDifferenceValue.ValueResolveType valueType)
        {
            if (value == null || value.ResolveType != valueType)
            {
                return;
            }

            ids.Add(value.Value);
        }
Example #2
0
        /// <summary>
        /// Resolves a single language key
        /// </summary>
        /// <param name="value">Value to resolve</param>
        private void ResolveSingleLanguageKey(CompareDifferenceValue value)
        {
            if (value == null || value.ResolveType != CompareDifferenceValue.ValueResolveType.LanguageKey)
            {
                return;
            }

            value.Value = _localizer[value.Value].Value;
        }
        /// <summary>
        /// Resolves a single language key
        /// </summary>
        /// <param name="value">Value to resolve</param>
        private void ResolveSingleLanguageKey(CompareDifferenceValue value)
        {
            if (value == null || value.ResolveType != CompareDifferenceValue.ValueResolveType.LanguageKey)
            {
                return;
            }

            value.Value = _localizer[value.Value, value.AdditionalValuesForLanguageKey.ToArray()].Value;
        }
Example #4
0
        /// <summary>
        /// Builds a compare difference
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="newValue">New Value</param>
        /// <param name="oldValue">Old Value</param>
        /// <param name="labelKey">Text key used for the label</param>
        /// <param name="textKey">Text key used for the text</param>
        /// <returns>Compare Difference</returns>
        private CompareDifference BuildCompareDifference(CompareDifferenceValue name, CompareDifferenceValue newValue, CompareDifferenceValue oldValue, string labelKey, string textKey)
        {
            CompareDifference difference = new CompareDifference();

            difference.Name     = name;
            difference.NewValue = newValue;
            difference.OldValue = oldValue;
            difference.LabelKey = labelKey;
            difference.TextKey  = textKey;

            return(difference);
        }
Example #5
0
        /// <summary>
        /// Fills a single item name
        /// </summary>
        /// <param name="value">Value to fill</param>
        /// <param name="itemLookup">Dictionary to grab values from</param>
        private void FillSingleItemName(CompareDifferenceValue value, Dictionary <string, StyrItem> itemLookup)
        {
            if (value == null || value.ResolveType != CompareDifferenceValue.ValueResolveType.ResolveItemName)
            {
                return;
            }

            if (itemLookup.ContainsKey(value.Value))
            {
                value.Value = itemLookup[value.Value].Name;
            }
            else
            {
                value.Value = _localizer["ItemWasDeleted"];
            }
        }
        /// <summary>
        /// Fills a single item name
        /// </summary>
        /// <param name="value">Value to fill</param>
        /// <param name="objectLookup">Dictionary to get object names from</param>
        /// <param name="objectType">Object type to resolve</param>
        /// <param name="deletedMessage">Message used if object was deleted</param>
        private void FillSingleObjectName(CompareDifferenceValue value, Dictionary <string, string> objectLookup, CompareDifferenceValue.ValueResolveType objectType, string deletedMessage)
        {
            if (value == null || value.ResolveType != objectType)
            {
                return;
            }

            if (objectLookup.ContainsKey(value.Value))
            {
                value.Value = objectLookup[value.Value];
            }
            else
            {
                value.Value = _localizer[deletedMessage];
            }
        }
Example #7
0
        /// <summary>
        /// Builds a compare difference
        /// </summary>
        /// <param name="name">Name</param>
        /// <param name="newValue">New Value</param>
        /// <param name="oldValue">Old Value</param>
        /// <param name="labelKey">Text key used for the label</param>
        /// <param name="textKey">Text key used for the text</param>
        /// <returns>Compare Difference</returns>
        private CompareDifference BuildCompareDifference(string name, object newValue, object oldValue, string labelKey, string textKey)
        {
            CompareDifferenceValue nameValueDifference = new CompareDifferenceValue(name, CompareDifferenceValue.ValueResolveType.None);

            CompareDifferenceValue newValueDifference = null;

            if (newValue != null)
            {
                newValueDifference = new CompareDifferenceValue(newValue.ToString(), CompareDifferenceValue.ValueResolveType.None);
            }

            CompareDifferenceValue oldValueDifference = null;

            if (oldValue != null)
            {
                oldValueDifference = new CompareDifferenceValue(oldValue.ToString(), CompareDifferenceValue.ValueResolveType.None);
            }

            return(BuildCompareDifference(nameValueDifference, newValueDifference, oldValueDifference, labelKey, textKey));
        }