I don't like the design of the two aforementioned assembly
attributes, because I have no way to prevent someone from
calling my IExtensionApplication.Initialize member through
reflection. My simple test code shows that I can find every
single loaded assembly, and invoke its Initialize() function.
That's not good. How can I make my Initialize() function
callable from no place other than the runtime?
This might work, but I don't like it at all:
public void Initialize()
{
string caller = Assembly.GetCallingAssembly().GetName().Name;
if( string.Compare(caller, "acdbmgd") != 0 )
throw new InvalidOperationException("Get lost, Bozo.");
foreach( Assembly asm in AppDomain.CurrentDomain.GetAssemblies() )
if( asm.IsDefined(typeof(ExtensionApplicationInfoAttribute), false) )
ProcessAssembly( asm );
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com