2006-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
authorGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 21 Aug 2006 23:34:02 +0000 (23:34 -0000)
committerGonzalo Paniagua Javier <gonzalo.mono@gmail.com>
Mon, 21 Aug 2006 23:34:02 +0000 (23:34 -0000)
* HttpApplicationFactory.cs: handle the 'renamed' event too.

svn path=/trunk/mcs/; revision=64171

mcs/class/System.Web/System.Web/ChangeLog
mcs/class/System.Web/System.Web/HttpApplicationFactory.cs

index d2b52c090a87f0710a37bff3bae3e9e5b1aeb10d..d94dc440743239bb9d6e73a668ba1c235de5c66c 100644 (file)
@@ -1,3 +1,7 @@
+2006-08-21 Gonzalo Paniagua Javier <gonzalo@ximian.com>
+
+       * HttpApplicationFactory.cs: handle the 'renamed' event too.
+
 2006-08-08  Vladimir Krasnov  <vladimirk@mainsoft.com>
 
        * HttpApplication.cs: fixed BeginProcessRequest, TARGET_JVM part
index a622a7dea959b01ccf575eaa971e35a523d142f9..7357ec6176af9f87a134b67675bc08cff8ef9da7 100644 (file)
@@ -200,7 +200,7 @@ namespace System.Web {
                }
 
 #if !TARGET_JVM
-               static FileSystemWatcher CreateWatcher (string file, FileSystemEventHandler hnd)
+               static FileSystemWatcher CreateWatcher (string file, FileSystemEventHandler hnd, RenamedEventHandler reh)
                {
                        FileSystemWatcher watcher = new FileSystemWatcher ();
 
@@ -210,12 +210,18 @@ namespace System.Web {
                        watcher.Changed += hnd;
                        watcher.Created += hnd;
                        watcher.Deleted += hnd;
+                       watcher.Renamed += reh;
 
                        watcher.EnableRaisingEvents = true;
 
                        return watcher;
                }
 
+               void OnAppFileRenamed (object sender, RenamedEventArgs args)
+               {
+                       OnAppFileChanged (sender, args);
+               }
+
                void OnAppFileChanged (object sender, FileSystemEventArgs args)
                {
                        if (bin_watcher != null)
@@ -300,7 +306,7 @@ namespace System.Web {
                        app.SetSession ((HttpSessionState) state);
                        try {
                                method.Invoke (app, new object [] {app, EventArgs.Empty});
-                       } catch (Exception e) {
+                       } catch (Exception) {
                                // Ignore
                        }
                        RecycleForSessionEnd (app);
@@ -379,8 +385,10 @@ namespace System.Web {
                                                string msg = String.Format ("Error compiling application file ({0}).", app_file);
                                                throw new ApplicationException (msg);
                                        }
-                                       
-                                       app_file_watcher = CreateWatcher (app_file, new FileSystemEventHandler (OnAppFileChanged));
+
+                                       FileSystemEventHandler fseh = new FileSystemEventHandler (OnAppFileChanged);
+                                       RenamedEventHandler reh = new RenamedEventHandler (OnAppFileRenamed);
+                                       app_file_watcher = CreateWatcher (app_file, fseh, reh);
 #endif
                                } else {
                                        app_type = typeof (System.Web.HttpApplication);
@@ -415,8 +423,10 @@ namespace System.Web {
                                                if (Directory.Exists (bin))
                                                        bin = Path.Combine (bin, "*.dll");
 
+                                               FileSystemEventHandler fseh = new FileSystemEventHandler (factory.OnAppFileChanged);
+                                               RenamedEventHandler reh = new RenamedEventHandler (factory.OnAppFileRenamed);
                                                // We watch bin or bin/*.dll if the directory exists
-                                               factory.bin_watcher = CreateWatcher (bin, new FileSystemEventHandler (factory.OnAppFileChanged));
+                                               factory.bin_watcher = CreateWatcher (bin, fseh, reh);
 #endif
                                                app = factory.FireOnAppStart (context);
                                                factory.app_start_needed = false;