Пример #1
0
        bool CouldBeStringDecrypterClass(ref TypeDef type)
        {
            if (type.DeclaringType != null && type.DeclaringType.HasNestedTypes)
            {
                type = type.DeclaringType;
            }

            var fields = new FieldTypes(type);

            if (fields.Exists("System.Collections.Hashtable") ||
                fields.Exists("System.Collections.Generic.Dictionary`2<System.Int32,System.String>") ||
                fields.Exactly(fields3x))
            {
                if (type.FindStaticConstructor() == null)
                {
                    return(false);
                }
            }
            else if (fields.Exactly(fields1x) || fields.Exactly(fields2x))
            {
            }
            else
            {
                return(false);
            }

            var methods = new List <MethodDef>(DotNetUtils.GetNormalMethods(type));

            if (methods.Count == 0)
            {
                return(false);
            }
            var method = methods[0];

            if (!DotNetUtils.IsMethod(method, "System.String", "(System.Int32)"))
            {
                return(false);
            }
            if (!method.IsStatic || !method.HasBody)
            {
                return(false);
            }

            return(true);
        }