Ejemplo n.º 1
0
 public LogGenerator(ITokenExtractor extractor, ITokenTransformer transformer, ISink sink, ILogger <LogGenerator> logger)
 {
     this.extractor   = extractor;
     this.transformer = transformer;
     this.sink        = sink;
     this.logger      = logger;
     this.random      = new Random();
     this.randomLock  = new Object();
 }
        public StandardPatch CreatePatch(ModuleDef module, string patchName)
        {
            StandardPatch patch = new StandardPatch(patchName ?? module.Name);

            modules     = new Dictionary <UTF8String, ModuleModification>();
            transformer = new ModuleTokenTransformer(this, module);
            foreach (CustomAttribute attribute in module.CustomAttributes.FindAll(ModuleExtensions.Required))
            {
                UTF8String name = attribute.ConstructorArguments[0].ExtractName();
                modules.Add(name, patch.Module(name, ModificationKind.FailIfMissing, (bool)attribute.ConstructorArguments[1].Value));
            }
            for (Stack <TypeDef> types = new Stack <TypeDef>(module.Types); types.Count > 0;)
            {
                TypeDef type = types.Pop();
                Populate(type);
                foreach (TypeDef nested in type.NestedTypes)
                {
                    types.Push(nested);
                }
            }
            return(patch);
        }