Author: miguel
Date: 2007-06-28 15:37:20 -0400 (Thu, 28 Jun 2007)
New Revision: 80997

Modified:
   trunk/moon/tools/mopen/Makefile.am
   trunk/moon/tools/mopen/mopen.cs
Log:
Add support for loading assemblies from the given directory

Modified: trunk/moon/tools/mopen/Makefile.am
===================================================================
--- trunk/moon/tools/mopen/Makefile.am  2007-06-28 19:29:06 UTC (rev 80996)
+++ trunk/moon/tools/mopen/Makefile.am  2007-06-28 19:37:20 UTC (rev 80997)
@@ -13,7 +13,7 @@
                $(srcdir)/CompositeHelper.cs
 
 mopen.exe: $(mopen_exe_CS) ../../gtk/gtksilver.dll
-       gmcs -debug -out:mopen.exe -target:exe $(mopen_exe_CS) 
-r:../../gtk/gtksilver.dll -pkg:gtk-sharp-2.0 -pkg:silver -pkg:mono-cairo
+       gmcs -debug -out:mopen.exe -target:exe $(mopen_exe_CS) 
-r:../../gtk/gtksilver.dll -pkg:gtk-sharp-2.0 -pkg:mono-cairo -pkg:silverdesktop
 
 do_subst = sed -e 's,[EMAIL PROTECTED]@],$(moondir),g' -e 's,[EMAIL 
PROTECTED]@],$(VERSION),g' 
 

Modified: trunk/moon/tools/mopen/mopen.cs
===================================================================
--- trunk/moon/tools/mopen/mopen.cs     2007-06-28 19:29:06 UTC (rev 80996)
+++ trunk/moon/tools/mopen/mopen.cs     2007-06-28 19:37:20 UTC (rev 80997)
@@ -15,7 +15,7 @@
 //    * Implement --fixed
 //    * Make it so we can open directories that contain DIR/default.xaml
 //      and setup the managed loader to default to this location to load
-//      files from.
+//      images from. 
 //
 // The idea is that we can write XAML-based applications and launch them with
 // this thing, typing:
@@ -49,6 +49,8 @@
 using System.Windows.Input;
 using System.IO;
 using System.Collections;
+using Mono;
+using System.Reflection;
 
 class MonoOpen {
        static bool fixedwindow = false;
@@ -113,6 +115,17 @@
                GtkSilver.Init ();
                Window w = new Window (file);
 
+               string full = Path.GetFullPath (file);
+               string dir = Path.GetDirectoryName (full);
+               
+               Moonlight.RegisterLoader (delegate (string asm_file) {
+                       if (Path.IsPathRooted (asm_file)){
+                               return Assembly.LoadFile (asm_file);
+                       } else {
+                               return Assembly.LoadFile (Path.Combine (dir, 
asm_file));
+                       }
+               });
+
                if (transparent) {
                        CompositeHelper.SetRgbaColormap (w);
                        w.AppPaintable = true;

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

Reply via email to