Esempio n. 1
0
        private void UpdateSingle(MethodDef method)
        {
            //Update the Overrides for interface implementations
            foreach (MethodOverride methodOverride in method.Overrides)
            {
                var baseMethod = methodOverride.MethodDeclaration;

                if (RegexObfuscated.IsMatch(baseMethod.Name))
                {
                    baseMethod.Name = _srcMap[baseMethod.Name];
                }
            }

            //Update calls to methods in method bodies
            if (!method.HasBody)
            {
                return;
            }
            foreach (Instruction i in method.Body.Instructions)
            {
                if (i.Operand == null || !(i.Operand is IFullName f))
                {
                    continue;
                }

                if (RegexObfuscated.IsMatch(f.Name))
                {
                    f.Name = _srcMap[f.Name];
                }
            }
        }
        private void DecodeSingle(IFullName param)
        {
            if (!RegexObfuscated.IsMatch(param.Name))
            {
                return;
            }

            string text = _crypto.Decrypt(param.Name);

            SrcMap[param.Name] = text;
            if (param is TypeDef typeDef && text.Contains('.'))
            {
                typeDef.Namespace = text.Substring(0, text.LastIndexOf('.'));
                typeDef.Name      = text.Substring(text.LastIndexOf('.') + 1);
            }