Example #1
0
        public void find()
        {
            var requiredTypes = new string[] {
                "System.Reflection.Assembly",
                "System.Object",
                "System.Int32",
                "System.String[]",
            };

            foreach (var type in module.Types)
            {
                if (type.HasEvents)
                {
                    continue;
                }
                if (!new FieldTypes(type).all(requiredTypes))
                {
                    continue;
                }

                MethodDefinition regMethod, handler;
                if (!BabelUtils.findRegisterMethod(type, out regMethod, out handler))
                {
                    continue;
                }

                var resource = BabelUtils.findEmbeddedResource(module, type);
                if (resource == null)
                {
                    continue;
                }

                var decryptMethod = findDecryptMethod(type);
                if (decryptMethod == null)
                {
                    throw new ApplicationException("Couldn't find resource type decrypt method");
                }
                resourceDecrypter.DecryptMethod = ResourceDecrypter.findDecrypterMethod(decryptMethod);
                initXorKeys(decryptMethod);

                resolverType      = type;
                registerMethod    = regMethod;
                encryptedResource = resource;
                return;
            }
        }
Example #2
0
        public void find()
        {
            var requiredTypes = new string[] {
                "System.Object",
                "System.Int32",
                "System.Collections.Hashtable",
            };
            foreach (var type in module.Types) {
                if (type.HasEvents)
                    continue;
                if (!new FieldTypes(type).exactly(requiredTypes))
                    continue;

                MethodDefinition regMethod, handler;
                if (!BabelUtils.findRegisterMethod(type, out regMethod, out handler))
                    continue;

                resolverType = type;
                registerMethod = regMethod;
                return;
            }
        }
Example #3
0
        public void find()
        {
            var requiredTypes = new string[] {
                "System.Reflection.Assembly",
                "System.Object",
                "System.Int32",
                "System.String[]",
            };

            foreach (var type in module.Types)
            {
                if (type.HasEvents)
                {
                    continue;
                }
                if (!new FieldTypes(type).exactly(requiredTypes))
                {
                    continue;
                }

                MethodDefinition regMethod, handler;
                if (!BabelUtils.findRegisterMethod(type, out regMethod, out handler))
                {
                    continue;
                }

                var resource = BabelUtils.findEmbeddedResource(module, type);
                if (resource == null)
                {
                    continue;
                }

                resolverType      = type;
                registerMethod    = regMethod;
                encryptedResource = resource;
                return;
            }
        }
        public void find()
        {
            var requiredTypes = new string[] {
                "System.Object",
                "System.Int32",
                "System.Collections.Hashtable",
            };

            foreach (var type in module.Types)
            {
                if (type.HasEvents)
                {
                    continue;
                }
                if (!new FieldTypes(type).exactly(requiredTypes))
                {
                    continue;
                }

                MethodDef regMethod, handler;
                if (!BabelUtils.findRegisterMethod(type, out regMethod, out handler))
                {
                    continue;
                }

                var decryptMethod = findDecryptMethod(type);
                if (decryptMethod == null)
                {
                    throw new ApplicationException("Couldn't find resource type decrypt method");
                }
                resourceDecrypter.DecryptMethod = ResourceDecrypter.findDecrypterMethod(decryptMethod);

                resolverType   = type;
                registerMethod = regMethod;
                return;
            }
        }