Author: lluis
Date: 2006-02-16 15:06:41 -0500 (Thu, 16 Feb 2006)
New Revision: 56963

Modified:
   trunk/monodevelop/Core/src/Tools/mdhost/ChangeLog
   trunk/monodevelop/Core/src/Tools/mdhost/src/mdhost.cs
Log:
2006-02-16  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 

        * src/mdhost.cs: Preload add-ins required by the provided type.



Modified: trunk/monodevelop/Core/src/Tools/mdhost/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/Tools/mdhost/ChangeLog   2006-02-16 20:06:17 UTC 
(rev 56962)
+++ trunk/monodevelop/Core/src/Tools/mdhost/ChangeLog   2006-02-16 20:06:41 UTC 
(rev 56963)
@@ -1,3 +1,7 @@
+2006-02-16  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 
+
+       * src/mdhost.cs: Preload add-ins required by the provided type.
+
 2005-08-08  Lluis Sanchez Gual  <[EMAIL PROTECTED]> 
 
        * src/mdhost.cs: Use an internal tcp channel for communication with

Modified: trunk/monodevelop/Core/src/Tools/mdhost/src/mdhost.cs
===================================================================
--- trunk/monodevelop/Core/src/Tools/mdhost/src/mdhost.cs       2006-02-16 
20:06:17 UTC (rev 56962)
+++ trunk/monodevelop/Core/src/Tools/mdhost/src/mdhost.cs       2006-02-16 
20:06:41 UTC (rev 56963)
@@ -84,6 +84,7 @@
        
        public RemoteProcessObject CreateInstance (Type type)
        {
+               InitializeRuntime (type);
                RemoteProcessObject proc = (RemoteProcessObject) 
Activator.CreateInstance (type);
                proc.Attach (controller);
                return proc;
@@ -94,12 +95,23 @@
                try {
                        Type t = Type.GetType (fullTypeName);
                        if (t == null) throw new InvalidOperationException 
("Type not found: " + fullTypeName);
+                       InitializeRuntime (t);
                        return CreateInstance (t);
                } catch (Exception ex) {
                        throw new InvalidOperationException ("Type not found: " 
+ fullTypeName);
                }
        }
        
+       void InitializeRuntime (Type type)
+       {
+               object[] ats = type.GetCustomAttributes 
(typeof(AddinDependencyAttribute), true);
+               if (ats.Length > 0) {
+                       Runtime.Initialize ();
+                       foreach (AddinDependencyAttribute at in ats)
+                               Runtime.AddInService.PreloadAddin (null, 
at.Addin);
+               }
+       }
+       
        public RemoteProcessObject CreateInstance (string assemblyPath, string 
typeName)
        {
                Assembly asm = Assembly.LoadFrom (assemblyPath);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to