コード例 #1
0
        /// <summary>
        /// Iterate over all the methods of a given assembly and try to remove
        /// all the references to the found methods.
        /// </summary>
        /// <param name="ctx"></param>
        /// <returns></returns>
        public bool PerformRemoval(ModuleDef module)
        {
            bool returnValue = true;

            foreach (var identifiedMethods in destinationMap)
            {
                foreach (var currentIdentifiedMethod in identifiedMethods.matchingMethods)
                {
                    foreach (var currentMethod in module.GetMethods())
                    {
                        if (!identifiedMethods.matchingMethods.Contains(currentMethod))
                        {
                            returnValue |= BodyModifier.RemoveRefence(currentMethod, currentIdentifiedMethod);
                        }
                    }
                    BodyModifier.NullifyMethod(currentIdentifiedMethod);
                }
            }
            return(returnValue);
        }