private static void SetPropertyIfPresent(IPropertyBagHolder containingObject, string propertyValue, string propertyName)
 {
     if (!string.IsNullOrWhiteSpace(propertyValue))
     {
         SetProperty(containingObject, propertyValue, propertyName);
     }
 }
        public TagsCollection(IPropertyBagHolder propertyBagHolder)
        {
            if (propertyBagHolder == null)
            {
                throw new ArgumentNullException(nameof(propertyBagHolder));
            }

            _propertyBagHolder = propertyBagHolder;
        }
Beispiel #3
0
        public void SetPropertiesFrom(IPropertyBagHolder other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }

            // We need the concrete class because the IPropertyBagHolder interface
            // doesn't expose the raw Properties array.
            PropertyBagHolder otherHolder = other as PropertyBagHolder;

            Debug.Assert(otherHolder != null);

            Properties = other.PropertyNames.Count > 0 ? new Dictionary <string, SerializedPropertyInfo>() : null;

            foreach (string propertyName in other.PropertyNames)
            {
                SerializedPropertyInfo otherInfo = otherHolder.Properties[propertyName];
                Properties[propertyName] = new SerializedPropertyInfo(otherInfo.SerializedValue, otherInfo.IsString);
            }
        }
        public static string GetCategory(this IPropertyBagHolder item)
        {
            if (item == null)
            {
                return(null);
            }

            string category = null;

            try
            {
                if (item.PropertyNames != null && item.PropertyNames.Contains(CATEGORY))
                {
                    category = item.GetProperty(CATEGORY);
                }
            }
            catch (NullReferenceException)
            {
            }

            return(category);
        }
 private static void SetProperty(IPropertyBagHolder containingObject, string propertyValue, string propertyName)
 {
     containingObject.SetProperty("microsoft/visualStudioBuildLogConverter/" + propertyName, propertyValue.Trim());
 }