Пример #1
0
 /// <summary>
 /// Configures a container for encryption with the specified converter alteration.  Every registered converter will be
 /// altered by the provided alteration.
 /// </summary>
 /// <param name="this">The container which to configure for encryption.</param>
 /// <param name="parameter">The alteration with which to alter each converter in the configuration container.</param>
 /// <returns>A configured IConfigurationContainer.</returns>
 public static IConfigurationContainer UseEncryptionAlgorithm(this IConfigurationContainer @this,
                                                              IAlteration <IConverter> parameter)
 => @this.Root
 .With <EncryptionExtension>()
 .IsSatisfiedBy(parameter)
                            ? @this
                            : @this.Extend(new EncryptionExtension(parameter));
Пример #2
0
 public AssemblyFileExists(IAlteration <string> alter)
     : base(AssemblyLocation.Default.Select(LocalFilePath.Default)
            .Select(alter)
            .Select(FilePathExists.Default)
            .Then())
 {
 }
Пример #3
0
 public EncryptionExtension(ISpecification <MemberInfo> specification, IAlteration <IConverter> alteration,
                            ICollection <MemberInfo> registered)
 {
     _specification = specification;
     _alteration    = alteration;
     Registered     = registered;
 }
Пример #4
0
 public static ITypeConfiguration <T> Alter <T>(this ITypeConfiguration <T> @this, IAlteration <T> read,
                                                IAlteration <T> write)
 {
     @this.Root.With <AlteredContentExtension>()
     .Types.Assign(Support <T> .Key, new ContentAlteration(read.Adapt(), write.Adapt()));
     return(@this);
 }
Пример #5
0
 // ReSharper disable once TooManyDependencies
 public EnumerableAwareSerializers(IsEnumerableElement specification, IContents contents,
                                   IAlteration <TypeInfo> element, ISerializers previous)
 {
     _specification = specification;
     _contents      = contents;
     _element       = element;
     _previous      = previous;
 }
Пример #6
0
 public static IMemberConfiguration <T, TMember> Alter <T, TMember>(this IMemberConfiguration <T, TMember> @this,
                                                                    IAlteration <TMember> read,
                                                                    IAlteration <TMember> write)
 {
     @this.Root.With <AlteredContentExtension>()
     .Members.Assign(@this.GetMember(), new ContentAlteration(read.Adapt(), write.Adapt()));
     return(@this);
 }
Пример #7
0
 // ReSharper disable once TooManyDependencies
 public AlteredMemberConverters(ISpecification <MemberInfo> specification, ISpecification <IConverter> assigned,
                                IAlteration <IConverter> alteration,
                                IMemberConverters converters)
 {
     _specification = specification;
     _assigned      = assigned;
     _alteration    = alteration;
     _converters    = converters;
 }
        IMemberSerializer Content(IAlteration <object> alteration, IMember profile, IMemberAccess access)
        {
            var body   = _content.Get(profile);
            var start  = new Identity <object>(profile).Adapt();
            var writer = Wrap(alteration, access, new Enclosure(start, body));
            var result = new MemberSerializer(profile, access, body, writer);

            return(result);
        }
Пример #9
0
 public AlteredMemberContents(ISpecification <MemberInfo> specification, ISpecification <IConverter> assigned,
                              IAlteration <IConverter> alteration,
                              IMemberContents contents, IConverters converters, ISerializer content)
 {
     _specification = specification;
     _assigned      = assigned;
     _alteration    = alteration;
     _contents      = contents;
     _converters    = converters;
     _content       = content;
 }
Пример #10
0
 public InnerContentServices(IListContentsSpecification specification, IInnerContentActivation activation,
                             IAlteration <IInnerContentHandler> handler, IInnerContentResult results, IMemberHandler member,
                             ICollectionContentsHandler collection, IReaderFormatter formatter)
 {
     _specification = specification;
     _activation    = activation;
     _handler       = handler;
     _results       = results;
     _member        = member;
     _collection    = collection;
     _formatter     = formatter;
 }
Пример #11
0
        IMemberSerializer Property(IAlteration <object> alteration, IConverter converter, IMember profile,
                                   IMemberAccess access)
        {
            var serializer = new ConverterProperty <object>(converter, profile).Adapt();
            var member     = new MemberSerializer(profile, access, serializer, Wrap(access, serializer));
            var runtime    = _runtime.Get(profile.Metadata);
            var property   = (IMemberSerializer) new PropertyMemberSerializer(member);

            return(runtime != null
                                       ? new RuntimeSerializer(new AlteredSpecification <object>(alteration, runtime),
                                                               property, Content(profile, access))
                                       : property);
        }
Пример #12
0
 /// <summary>
 /// Add a bitmap alteration to be applied to the object before each drawing.
 /// You can add as many as you like and they will be applied to the object in
 /// the same order they are added.
 /// </summary>
 /// <param name="p_aao"></param>
 public void AddAlteration(IAlteration p_aao)
 {
     alterations.Add(p_aao);
 }
 public AlteredSpecification(IAlteration <T> alteration, ISpecification <T> specification) : base(specification)
     => _alteration = alteration;
 public EmitBehavior(IAlteration <AllowedMemberValuesExtension> alteration) => _alteration = alteration;
Пример #15
0
 public bool IsSatisfiedBy(IAlteration <IConverter> parameter) => parameter == _alteration;
Пример #16
0
 /// <summary>
 /// Add a bitmap alteration to be applied to the object before each drawing.
 /// You can add as many as you like and they will be applied to the object in
 /// the same order they are added.
 /// </summary>
 /// <param name="p_aao"></param>
 public void AddAlteration(IAlteration p_aao)
 {
     alterations.Add(p_aao);
 }
 static IWriter Wrap(IAlteration <object> alteration, IMemberAccess access, IWriter <object> writer)
 => new AlteringWriter(alteration, new ConditionalWriter(access, writer));
Пример #18
0
 public void Add(IAlteration alteration)
 {
     mAlterations.Add(alteration);
 }
Пример #19
0
 /// <summary>
 /// Provides a way to alter converters when they are accessed by the serializer.  This provides a mechanism to
 /// decorate converters.  Alterations only occur once per converter per serializer.
 /// </summary>
 /// <param name="this">The container to configure.</param>
 /// <param name="alteration">The alteration to perform on each converter when it is accessed by the serializer.</param>
 /// <returns>The configured container.</returns>
 public static IConfigurationContainer Alter(this IConfigurationContainer @this,
                                             IAlteration <IConverter> alteration)
 => @this.Root.With <ConverterAlterationsExtension>()
 .Alterations.Apply(alteration)
 .Return(@this);
Пример #20
0
 public AlterationSelector(IAlteration <T> subject) : base(subject)
 {
 }
Пример #21
0
 public void Add(IAlteration alteration)
 {
     mAlterations.Add(alteration);
 }
Пример #22
0
 public Serializer(IAlteration <object> read, IAlteration <object> write, ContentModel.ISerializer serializer)
 {
     _read       = read;
     _write      = write;
     _serializer = serializer;
 }
Пример #23
0
 public TypeLoader(IAlteration <string> names)
 {
     _names = names;
 }
Пример #24
0
 public ConstructorQuery(IAlteration <IEnumerable <ConstructorInfo> > query, IConstructors source)
     : base(new AlteredSource <TypeInfo, IEnumerable <ConstructorInfo> >(query, source))
 {
 }
Пример #25
0
 public EncryptionExtension(IAlteration <IConverter> alteration) : this(alteration, new HashSet <MemberInfo>())
 {
 }
Пример #26
0
 public EncryptionExtension(IAlteration <IConverter> alteration, ICollection <MemberInfo> registered)
     : this(new ContainsSpecification <MemberInfo>(registered), alteration, registered)
 {
 }
Пример #27
0
 public AlterationAdapter(IAlteration <T> alteration) => _alteration = alteration;
Пример #28
0
 /// <summary>
 /// Used to alter an instance of the configured result type whenever it is encountered during the serialization or
 /// deserialization process.  This can be used in scenarios where it is desired to know when an instance of a
 /// particular type is emitted or read (for logging purposes, etc.) or, more generally, to alter it in some way
 /// (scrubbing data, etc) before it is written to the external stream or read into memory.  You can consider this as a
 /// value interception of the serialization/deserialization pipeline.
 /// </summary>
 /// <typeparam name="T">The type under configuration.</typeparam>
 /// <param name="this">The type configuration to configure.</param>
 /// <param name="read">The alteration to apply during reading.</param>
 /// <param name="write">The alteration to apply during writing.</param>
 /// <returns>The configured type configuration.</returns>
 public static ITypeConfiguration <T> Alter <T>(this ITypeConfiguration <T> @this, IAlteration <T> read,
                                                IAlteration <T> write)
 => @this.Root.With <AlteredContentExtension>()
 .Types.Apply(Support <T> .Metadata, new ContentAlteration(read.Adapt(), write.Adapt()))
 .Return(@this);
        public bool HasAlteration <T> () where T : IAlteration
        {
            IAlteration alteration = GetAlteration <T> ();

            return(alteration != null);
        }
Пример #30
0
 public static IConfigurationContainer Alter(this IConfigurationContainer @this, IAlteration <IConverter> alteration)
 {
     @this.Root.With <ConverterAlterationsExtension>()
     .Alterations.Add(alteration);
     return(@this);
 }
Пример #31
0
 public AlteredConverters(IAlteration <IConverter> alteration, IConverters converters)
 {
     _alteration = alteration;
     _converters = converters;
 }
Пример #32
0
 public static IConfigurationContainer OptimizeConverters(this IConfigurationContainer @this,
                                                          IAlteration <IConverter> optimizations)
 => @this.Alter(optimizations);