public override void Apply(IObfuscationContext context)
        {
            var typeNameGenerator = context.GetSymbolNameGenerator();

            foreach (var symbolType in Report.TypesToRename)
            {
                symbolType.NewName = typeNameGenerator.Next();

                var memberNameGenerators = new Dictionary <Type, SymbolNameGenerator>();

                foreach (var overload in symbolType.MemberOverloads)
                {
                    SymbolNameGenerator memberNameGenerator;
                    var memberType = overload.Symbols[0].Member.GetType();
                    if (!memberNameGenerators.TryGetValue(memberType, out memberNameGenerator))
                    {
                        memberNameGenerators.Add(memberType, memberNameGenerator = context.GetSymbolNameGenerator());
                    }

                    overload.NewName = memberNameGenerator.Next();
                }

                symbolType.Apply(context);
            }
        }
Esempio n. 2
0
        public void Apply(IObfuscationContext context)
        {
            foreach (var symbol in Symbols)
            {
                symbol.Member.Name = NewName;

                var method = symbol.Member as MethodDefinition;
                if (method != null)
                {
                    var generator = context.GetSymbolNameGenerator();
                    foreach (var parameter in method.Parameters)
                    {
                        parameter.Name = generator.Next();
                    }
                }
            }
        }