/// <summary> /// Determines if we can cache the results of serializing a component. /// </summary> private bool CanCacheComponent(IDesignerSerializationManager manager, object value, PropertyDescriptorCollection props) { if (value is IComponent comp) { if (comp.Site != null) { if (comp.Site is INestedSite nestedSite && !string.IsNullOrEmpty(nestedSite.FullName)) { return(false); } } if (props is null) { props = TypeDescriptor.GetProperties(comp); } foreach (PropertyDescriptor property in props) { if (typeof(IComponent).IsAssignableFrom(property.PropertyType) && !property.Attributes.Contains(DesignerSerializationVisibilityAttribute.Hidden)) { MemberCodeDomSerializer memberSerializer = (MemberCodeDomSerializer)manager.GetSerializer(property.GetType(), typeof(MemberCodeDomSerializer)); if (memberSerializer != null && memberSerializer.ShouldSerialize(manager, value, property)) { return(false); } } } } return(true); }
private bool CanCacheComponent(IDesignerSerializationManager manager, object value, PropertyDescriptorCollection props) { IComponent component = value as IComponent; if (component != null) { if (component.Site != null) { INestedSite site = component.Site as INestedSite; if ((site != null) && !string.IsNullOrEmpty(site.FullName)) { return(false); } } if (props == null) { props = TypeDescriptor.GetProperties(component); } foreach (PropertyDescriptor descriptor in props) { if (typeof(IComponent).IsAssignableFrom(descriptor.PropertyType) && !descriptor.Attributes.Contains(DesignerSerializationVisibilityAttribute.Hidden)) { MemberCodeDomSerializer serializer = (MemberCodeDomSerializer)manager.GetSerializer(descriptor.GetType(), typeof(MemberCodeDomSerializer)); if ((serializer != null) && serializer.ShouldSerialize(manager, value, descriptor)) { return(false); } } } } return(true); }
internal ResourcePropertyMemberCodeDomSerializer(MemberCodeDomSerializer serializer, CodeDomLocalizationProvider.LanguageExtenders extender, CodeDomLocalizationModel model) { Debug.Assert(extender is not null, "Extender should have been created by now."); _serializer = serializer; _extender = extender; _model = model; }
internal ResourcePropertyMemberCodeDomSerializer(MemberCodeDomSerializer serializer, CodeDomLocalizationProvider.LanguageExtenders extender, CodeDomLocalizationModel model) { this._serializer = serializer; this._extender = extender; this._model = model; }
public ProjectResourcesMemberCodeDomSerializer(MemberCodeDomSerializer baseSerializer) { if (baseSerializer == null) throw new ArgumentNullException("baseSerializer"); this.baseSerializer = baseSerializer; }
internal ResourcePropertyMemberCodeDomSerializer(MemberCodeDomSerializer serializer, CodeDomLocalizationProvider.LanguageExtenders extender, CodeDomLocalizationModel model) { this._serializer = serializer; this._extender = extender; this._model = model; }