Example #1
0
        public static InjectionConfiguration Serialize(InjectionConfiguration instance, SimpleXmlSerializerBase serializer)
        {
            instance = instance ?? new InjectionConfiguration();

            serializer.ProcessStartElement(serializer.GetXmlRootName(instance.GetType()));
            serializer.ProcessEnterChildOnRead();
            {
                serializer.ProcessWithFlags(SimpleXmlSerializerFlags.CollectionUnorderedRequired, () => {
                    serializer.ProcessUnorderedSequence(() => {
                        if (serializer.ProcessStartElement(nameof(InjecteeAssemblies)))
                        {
                            serializer.ProcessEnterChildOnRead();
                            {
                                serializer.ProcessCollectionAsReadOnly(v => instance.InjecteeAssemblies = v, () => instance.InjecteeAssemblies);
                            }
                            serializer.ProcessEndElement();
                        }

                        if (serializer.ProcessStartElement(nameof(InjectedMethods)))
                        {
                            serializer.ProcessEnterChildOnRead();
                            {
                                serializer.ProcessCollectionAsReadOnly(v => instance.InjectedMethods = v, () => instance.InjectedMethods);
                            }
                            serializer.ProcessEndElement();
                        }
                    });
                });
            }
            serializer.ProcessEndElement();

            return(instance);
        }
Example #2
0
        public static InjecteeAssembly Serialize(InjecteeAssembly instance, SimpleXmlSerializerBase serializer)
        {
            instance = instance ?? new InjecteeAssembly();

            serializer.ProcessStartElement(nameof(InjecteeAssembly));
            {
                serializer.ProcessAttributeString(nameof(AssemblyPath), s => instance.AssemblyPath = s, () => instance.AssemblyPath);
                serializer.ProcessEnterChildOnRead();

                serializer.ProcessWithFlags(SimpleXmlSerializerFlags.IsOptional | SimpleXmlSerializerFlags.CollectionUnorderedRequired, () => {
                    serializer.ProcessUnorderedSequence(() => {
                        if (serializer.ProcessStartElement(nameof(IgnoredMemberReferences)))
                        {
                            serializer.ProcessEnterChildOnRead();
                            serializer.ProcessCollectionAsReadOnly(
                                v => instance.IgnoredMemberReferences = v,
                                () => instance.IgnoredMemberReferences,
                                itemSerializer =>
                                serializer.CreateByKnownInheritors <IIgnoredMemberReference>(
                                    serializer.CurrentXmlElement.Name,
                                    itemSerializer
                                    )
                                );
                        }
                        serializer.ProcessEndElement();

                        if (serializer.ProcessStartElement(nameof(AllowedAssemblyReferences)))
                        {
                            serializer.ProcessEnterChildOnRead();
                            serializer.ProcessCollectionAsReadOnly(
                                v => instance.AllowedAssemblyReferences = v,
                                () => instance.AllowedAssemblyReferences,
                                itemSerializer =>
                                serializer.CreateByKnownInheritors <IAllowedAssemblyReference>(
                                    serializer.CurrentXmlElement.Name,
                                    itemSerializer
                                    )
                                );
                        }
                        serializer.ProcessEndElement();
                    });
                });
            }
            serializer.ProcessEndElement();

            return(instance);
        }
Example #3
0
        public static InjectionConfigurationFileInclude Serialize(InjectionConfigurationFileInclude instance, SimpleXmlSerializerBase serializer)
        {
            instance = instance ?? throw new ArgumentNullException(nameof(instance));

            serializer.ProcessStartElement(serializer.GetXmlRootName(instance.GetType()));
            {
                serializer.ProcessAttributeString(nameof(Path), s => instance.Path = s, () => instance.Path);
            }
            serializer.ProcessEnterChildOnRead();
            serializer.ProcessEndElement();

            return(instance);
        }
        public static IgnoredMemberReference Serialize(IgnoredMemberReference instance, SimpleXmlSerializerBase serializer)
        {
            instance = instance ?? new IgnoredMemberReference();

            serializer.ProcessStartElement(serializer.GetXmlRootName(instance.GetType()));
            {
                serializer.ProcessAttributeString(nameof(Filter), s => instance.Filter = s, () => instance.Filter);
                serializer.ProcessWithFlags(
                    SimpleXmlSerializerFlags.IsOptional,
                    () => {
                    serializer.ProcessFlagsEnumAttributes(kDefaultFilterOptions, s => instance.FilterFlags = s, () => instance.FilterFlags);
                });
            }
            serializer.ProcessEnterChildOnRead();
            serializer.ProcessEndElement();

            return(instance);
        }
        public static InjectedMethod Serialize(InjectedMethod instance, SimpleXmlSerializerBase serializer)
        {
            instance = instance ?? new InjectedMethod();

            serializer.ProcessStartElement(nameof(InjectedMethod));
            {
                serializer.ProcessAttributeString(nameof(AssemblyPath), s => instance.AssemblyPath     = s, () => instance.AssemblyPath);
                serializer.ProcessAttributeString(nameof(MethodFullName), s => instance.MethodFullName = s, () => instance.MethodFullName);
                serializer.ProcessWithFlags(
                    SimpleXmlSerializerFlags.IsOptional,
                    () => {
                    serializer.ProcessEnumAttribute(nameof(InjectionPosition), s => instance.InjectionPosition = s, () => instance.InjectionPosition);
                });
            }
            serializer.ProcessEnterChildOnRead();
            serializer.ProcessEndElement();

            return(instance);
        }
        public static AllowedAssemblyReference Serialize(AllowedAssemblyReference instance, SimpleXmlSerializerBase serializer)
        {
            instance = instance ?? new AllowedAssemblyReference();

            serializer.ProcessStartElement(serializer.GetXmlRootName(typeof(AllowedAssemblyReference)));
            {
                serializer.ProcessAttributeString(nameof(Name), s => instance.Name = s, () => instance.Name);
                serializer.ProcessWithFlags(
                    SimpleXmlSerializerFlags.IsOptional,
                    () => {
                    serializer.ProcessAttributeString(nameof(Path), s => instance.Path = s, () => instance.Path);
                    serializer.ProcessAttributeString(
                        nameof(StrictNameCheck),
                        s => instance.StrictNameCheck = Convert.ToBoolean(s),
                        () => Convert.ToString(instance.StrictNameCheck)
                        );
                });
            }
            serializer.ProcessEndElement();

            return(instance);
        }