public IntManglerPlugin(IContextImpl context)
     : base(context)
 {
     Rng         = context.Plugin <IRngPlugin>().Get(NetfuserFactory.IntManglerName);
     _finj       = context.FeatureInjector();
     _demanglers = new List <ValueDemangler>();
 }
示例#2
0
        public Injectable(IContextImpl context, string name)
            : base(context, name)
        {
            _codecs = new List <ICodec>();
            var finj = context.FeatureInjector();

            _demanglers   = new List <ValueDemangler>();
            _subscription = Context.OfType <FeatureInjectorEvent.HaveInjectableTypes>().Subscribe(ime =>
            {
                _feature = new ValueManglingFeature(Context.TargetModule.CorLibTypes.String);
                var q    = Math.Max(Context.MappedTypes.Count / 100, Mangler.Rng.NextInt32(50, 100));
                foreach (var node in finj.Rate(_feature).OrderByDescending(r => r.Score)
                         .SelectMany(ToNodes).Take(q))
                {
                    _demanglers.Add(node);
                }
            });
        }