示例#1
0
        /// <summary>
        /// Retrieve an Assembly Definition from the object
        /// </summary>
        /// <param name="item">the object</param>
        /// <returns>The matching Assembly Definition</returns>
        public override AssemblyDefinition GetAssemblyDefinition(object item)
        {
            IAssemblyLocation aloc = item as IAssemblyLocation;

            return(ReflectorHelper.ReflectorAssemblyLocationToCecilAssemblyDefinition(aloc));
        }
        /// <summary>
        /// Retrieve the matching assembly definition reference in the Cecil object model
        /// </summary>
        /// <param name="aloc">Reflector assembly location</param>
        /// <returns>Cecil assembly assembly definition (null if not found)</returns>
        public static AssemblyDefinition ReflectorAssemblyLocationToCecilAssemblyDefinition(IAssemblyLocation aloc)
        {
            IAssemblyContext context = PluginFactory.GetInstance().GetAssemblyContext(aloc.Location);

            if (context != null)
            {
                return(context.AssemblyDefinition);
            }

            return(null);
        }