Re: [Mono-dev] Mono 1.1.17 has been released.

2006-08-30 Thread damien churchill








 

 









From: damien churchill 
Sent: 30 August 2006 08:11
To: 'Justin Dearing'
Subject: RE: [Mono-dev] Mono
1.1.17 has been released.



 

Yeah if you
write your program in classes then it’s easy enough just to make a gui
for both web and desktop using asp/gtk whatever.

 









From:
[EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Justin Dearing
Sent: 30 August 2006 08:00
To:
mono-devel-list@lists.ximian.com
Subject: Re: [Mono-dev] Mono
1.1.17 has been released.



 





Don't mean to start a flame war here, but if you want the write once
run anywhere in a browser. If you can't do it in AJAX, do it in flash.

Secondly, have you heard of ASP.NET, The
equivilant of JSP for .NET. Mono's support is pretty good. 
 





 

Aside from needing C for
linux kernel programming,
what would even be better then "write once, run anywhere", 
is
"write for any purpose, write once, run anywhere"
and unfortunately mono has not provided a means to use it as a browser
plugin like Java. For me i could go for just a plugin to Firefox (linux
and Win32), wouldnt even need it to support IE.
Until this can occur, a programmer still has to Java or (active x
plugin), to achieve  web page integration.
Unfortunately not having this is a huge barrier to some people adopting 
mono.
Providing this (as even MS .Net doesn't seem to provide web page plugin
ability of .Net) would put Mono over the top, and likely bring many more
contributors on board making Mono grow much faster.


-tl












___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] App_Code

2006-09-19 Thread damien churchill
Title: Re: [Mono-dev] App_Code






you don't actually have to 
compile the code for the 'Assembly="xx.cs"' to work. I've got it working fine 
with just source files. admittedly still breaks under 
windows,


From: [EMAIL PROTECTED] 
on behalf of Nick HoddinottSent: Tue 19/09/2006 09:19To: 
Tomasz KubackiCc: mono-devel-list@lists.ximian.comSubject: 
Re: [Mono-dev] App_Code

Hi,> I know someone asked it befere, but i still 
haven't found solution.> How to make my asp.net 2.0 web page 
'automagically' compile dll'sI've haven't found a solution as yet. I 
started looking at the monocode, but have had limited time recently. It's 
something I hope torevisit soon.Of course, you can get your 
application to run by compiling the codein your App_Code dir to a dll, then 
adding 'Assembly="xx.dll'attributes to your code. This will then break your 
'automagic' compileon Windows. :(Solution I've toyed with 
are- Writing the auto compiliation of App_Code feature for 
mono.Obviously the best, but needs some planning, and knowledge of 
theexisting code.- Moing your code base back to a compiled in 
advance model. Not too desirable.- Adding an ugly hack (for your own 
use) to System.Web.Compiliation toexpect the type to be found in 
YourAppName.dll.When I get chance to work on this further I'll post 
here. I might tryan ugly hack first, upload the patched dll to my site, then 
attempt areal solution. :)Regards,Nick 
H___Mono-devel-list mailing 
listMono-devel-list@lists.ximian.comhttp://lists.ximian.com/mailman/listinfo/mono-devel-list


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Mono on Ubuntu

2006-10-03 Thread Damien Churchill
It's easy enough to compile it from source and it works fine.
I've been doing that for a fair while now. Installs it to /usr/local (or
wherever you choose) and adds all the necessary progs/libs to the path.

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Andrea
Grandi
Sent: 03 October 2006 18:32
To: mono-devel-list@lists.ximian.com
Subject: Re: [Mono-dev] Mono on Ubuntu

Hi,

> Does anyone know how to get I get the latest version of Mono on
Ubuntu?
> I have it installed via Synaptic but it's showing version 1.1.13.6 and
> if I'm not mistaken the latest is 1.1.18...

latest development versione is 1.1.17
I'm using Ubuntu dapper too and I've to say that is worse than hell
about Mono support :(

If you try to use the binary release and install it under /opt/ for
example you have a lot of imcompatibility with other system libs
because you have to include /opt/mono in the path and this causes
problems to oher applications. I wasn't able to compile neither fspot
or beagle for example and other apps crashed.

My only solution (for the moment) will be use another PC with OpenSuse
10.1 so there will not be any problem (off coursewith Suse
Mono).

It would be great if someone would keep the Mono repositories for
Ubuntu updated.

Thanks.

-- 
Andrea Grandi
email: [EMAIL PROTECTED]
website: http://www.ptlug.org
FON: FONero #69387
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] app_code autocompilation

2006-11-07 Thread Damien Churchill








I was just
wondering if anyone has any information on whether any implementation of this
has got past just being thought of. There was a small talk of it a while ago.
Anything come of it?






___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Patch to HttpApplicationFactory.cs, improves App_Code compilation

2007-01-11 Thread Damien Churchill
This adds a watcher to pick up when a file in the App_Code folder has been 
modified, and on modification causes a recompile.
There is probably a better way of doing it but I figured may as well submit 
what i did. Feel free to rip it apart.

Damien
--- clean/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-11 18:03:43.0 +
+++ hacked/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-11 18:08:52.0 +
@@ -77,6 +77,9 @@
 		Hashtable app_event_handlers;
 #if !TARGET_JVM
 		FileSystemWatcher app_file_watcher;
+#if NET_2_0
+		FileSystemWatcher app_code_watcher;
+#endif
 		FileSystemWatcher bin_watcher;
 		FileSystemWatcher config_watcher;
 #endif
@@ -233,10 +236,27 @@
 config_watcher.EnableRaisingEvents = false;
 			if (bin_watcher != null)
 bin_watcher.EnableRaisingEvents = false;
+#if NET_2_0
+			if (app_code_watcher != null)
+app_code_watcher.EnableRaisingEvents = false;
+#endif
 			if (app_file_watcher != null)
 app_file_watcher.EnableRaisingEvents = false;
 			HttpRuntime.UnloadAppDomain ();
 		}
+#if NET_2_0
+		void OnAppCodeFileRenamed (object sender, RenamedEventArgs args)
+		{
+			OnAppCodeFileChanged (sender, args);
+		}
+		
+		void OnAppCodeFileChanged (object sender, FileSystemEventArgs args)
+		{
+			AppCodeCompiler acc = new AppCodeCompiler ();
+			acc.Compile ();
+			OnAppFileChanged (sender, args);
+		}
+#endif
 #endif
 
 		internal static void AttachEvents (HttpApplication app)
@@ -461,6 +481,15 @@
 		RenamedEventHandler reh = new RenamedEventHandler (factory.OnAppFileRenamed);
 		// We watch bin or bin/*.dll if the directory exists
 		factory.bin_watcher = CreateWatcher (bin, fseh, reh);
+#if NET_2_0
+		string app_code = context.Server.MapPath(@"App_Code");
+		if (Directory.Exists (app_code))
+			app_code = Path.Combine (app_code, "*.cs");
+
+		fseh = new FileSystemEventHandler (factory.OnAppCodeFileChanged);
+		reh = new RenamedEventHandler (factory.OnAppCodeFileRenamed);
+		factory.app_code_watcher = CreateWatcher (app_code, fseh, reh);
+#endif
 #endif
 		app = factory.FireOnAppStart (context);
 		factory.app_start_needed = false;
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


Re: [Mono-dev] Patch to HttpApplicationFactory.cs, improves App_Code compilation

2007-01-11 Thread Damien Churchill
Yeah I did half have that at the back of my head when I was doing it,
I'll give it a go and see what I come up with. Also I'm thinking of
making it so it does the same when you edit a codebehind file for
.net2 as well, unless there is some reason for why it doesn't happen
now?


-Original Message-
From: [EMAIL PROTECTED] on behalf of Marek Habersack
Sent: Thu 11/01/2007 18:26
To: mono-devel-list@lists.ximian.com
Subject: Re: [Mono-dev] Patch to HttpApplicationFactory.cs, improves App_Code 
compilation
 
On Thu, 11 Jan 2007 18:10:05 -, "Damien Churchill"
<[EMAIL PROTECTED]> scribbled:

Hello Damien,
> This adds a watcher to pick up when a file in the App_Code folder has
> been modified, and on modification causes a recompile. There is
> probably a better way of doing it but I figured may as well submit
> what i did. Feel free to rip it apart.
The patch looks OK, but the reaction to any change App_Code and below
should be an application restart. And since App_Code is only one of a
whole group of folders which should application restart when changed
(the others are App_Browsers, App_GlobalResources, App_LocalResources -
an unknown number of them), it would make sense to provide a more
generic and dynamic solution which could encompass all the above
folders. I have it on my todo list, but I won't mind if you beat me to
implementing it :)
Thanks for sending the patch,

regards,

marek


___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list


[Mono-dev] Patch Review for HttpApplicationFactory.cs

2007-01-15 Thread Damien Churchill
Following Marek's advice I have improved on the previous patch updating
the folder watching to cause an application restart.
--- svn/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-15 20:33:52.0 +
+++ mcs/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-15 20:32:45.0 +
@@ -67,18 +67,18 @@
 		}
 #else
 		static HttpApplicationFactory theFactory = new HttpApplicationFactory();
-#endif
+#endif
+
 
-		MethodInfo session_end;
+MethodInfo session_end;
 		bool needs_init = true;
 		bool app_start_needed = true;
 		Type app_type;
 		HttpApplicationState app_state;
 		Hashtable app_event_handlers;
-#if !TARGET_JVM
-		FileSystemWatcher app_file_watcher;
-		FileSystemWatcher bin_watcher;
-		FileSystemWatcher config_watcher;
+#if !TARGET_JVM
+static ArrayList watchers = new ArrayList();
+static object watchers_lock = new object();
 #endif
 		Stack available = new Stack ();
 		Stack available_for_end = new Stack ();
@@ -221,22 +221,6 @@
 
 			return watcher;
 		}
-
-		void OnAppFileRenamed (object sender, RenamedEventArgs args)
-		{
-			OnAppFileChanged (sender, args);
-		}
-
-		void OnAppFileChanged (object sender, FileSystemEventArgs args)
-		{
-			if (config_watcher != null)
-config_watcher.EnableRaisingEvents = false;
-			if (bin_watcher != null)
-bin_watcher.EnableRaisingEvents = false;
-			if (app_file_watcher != null)
-app_file_watcher.EnableRaisingEvents = false;
-			HttpRuntime.UnloadAppDomain ();
-		}
 #endif
 
 		internal static void AttachEvents (HttpApplication app)
@@ -415,18 +399,19 @@
 	app_state = new HttpApplicationState ();
 }
 
-#if !TARGET_JVM
-FileSystemEventHandler fseh = new FileSystemEventHandler (OnAppFileChanged);
-RenamedEventHandler reh = new RenamedEventHandler (OnAppFileRenamed);
-app_file_watcher = CreateWatcher (app_file, fseh, reh);
-
-string config_file = Path.Combine (physical_app_path, "Web.config");
-if (!File.Exists (config_file))
-	config_file = Path.Combine (physical_app_path, "web.config");
-if (!File.Exists (config_file))
-	config_file = Path.Combine (physical_app_path, "Web.Config");
-
-config_watcher = CreateWatcher (config_file, fseh, reh);
+#if !TARGET_JVM
+app_file = "Global.asax";
+if (!File.Exists(Path.Combine(physical_app_path, app_file)))
+app_file =  "global.asax";
+
+			WatchLocationForRestart("", app_file);
+
+if (File.Exists(Path.Combine(physical_app_path, "Web.config")))
+WatchLocationForRestart("","Web.config");
+if (File.Exists(Path.Combine(physical_app_path, "web.config")))
+WatchLocationForRestart("","web.config");
+if (File.Exists(Path.Combine(physical_app_path, "Web.Config")))
+WatchLocationForRestart("","Web.Config");
 #endif
 needs_init = false;
 
@@ -453,16 +438,16 @@
 lock (factory) {
 	if (factory.app_start_needed) {
 #if !TARGET_JVM
-		string bin = HttpRuntime.BinDirectory;
-		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, fseh, reh);
-#endif
-		app = factory.FireOnAppStart (context);
+		WatchLocationForRestart("bin", "*.dll");
+#if NET_2_0 && !TARGET_J2EE
+WatchLocationForRestart("App_Code", "*.cs");
+WatchLocationForRestart("App_Browsers", "*.cs");
+WatchLocationForRestart("App_GlobalResources", "*.cs");
+#endif
+#endif
+
+
+app = factory.FireOnAppStart (context);
 		factory.app_start_needed = false;
 		return app;
 	}
@@ -517,7 +502,53 @@
 
 		internal static bool ContextAvailable {
 			get { return theFactory != null && !theFactory.app_start_needed; }
-		}
+		}
+
+internal static bool WatchLocationForRestart(string virtualPath, string filter)
+{
+// map the path to the physical one
+string physicalPath = HttpRuntime.AppDomainAppPath;
+physicalPath = Path.Combine(physicalPath, virtualPath);
+
+if (Directory.Exists(physicalPath) || File.Exists(physicalPath))
+{
+physicalPath = Path.Combine(physicalPath, filter);
+
+// create the watcher
+FileSystemEventHandler fseh = new FileSystemEventHandler(OnFileChanged);
+RenamedEventHandler reh = new RenamedEventHandler(OnFileRenamed);
+FileSystemWatcher watcher = CreateWatcher(physicalPath, fseh, reh);
+
+lock (watchers_lock)
+{
+	watchers.Add(watcher);
+

[Mono-dev] Revised Patch

2007-01-15 Thread Damien Churchill
Ok, done as suggested, also added an overloaded method for just a filter
in the root of the virtual path to be watched.
--- svn_clean/mcs/class/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-15 21:25:40.0 +
+++ mcs/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-15 23:31:13.0 +
@@ -67,18 +67,18 @@
 		}
 #else
 		static HttpApplicationFactory theFactory = new HttpApplicationFactory();
-#endif
+#endif
+
 
-		MethodInfo session_end;
+MethodInfo session_end;
 		bool needs_init = true;
 		bool app_start_needed = true;
 		Type app_type;
 		HttpApplicationState app_state;
 		Hashtable app_event_handlers;
-#if !TARGET_JVM
-		FileSystemWatcher app_file_watcher;
-		FileSystemWatcher bin_watcher;
-		FileSystemWatcher config_watcher;
+#if !TARGET_JVM
+static ArrayList watchers = new ArrayList();
+static object watchers_lock = new object();
 #endif
 		Stack available = new Stack ();
 		Stack available_for_end = new Stack ();
@@ -221,22 +221,6 @@
 
 			return watcher;
 		}
-
-		void OnAppFileRenamed (object sender, RenamedEventArgs args)
-		{
-			OnAppFileChanged (sender, args);
-		}
-
-		void OnAppFileChanged (object sender, FileSystemEventArgs args)
-		{
-			if (config_watcher != null)
-config_watcher.EnableRaisingEvents = false;
-			if (bin_watcher != null)
-bin_watcher.EnableRaisingEvents = false;
-			if (app_file_watcher != null)
-app_file_watcher.EnableRaisingEvents = false;
-			HttpRuntime.UnloadAppDomain ();
-		}
 #endif
 
 		internal static void AttachEvents (HttpApplication app)
@@ -415,18 +399,25 @@
 	app_state = new HttpApplicationState ();
 }
 
-#if !TARGET_JVM
-FileSystemEventHandler fseh = new FileSystemEventHandler (OnAppFileChanged);
-RenamedEventHandler reh = new RenamedEventHandler (OnAppFileRenamed);
-app_file_watcher = CreateWatcher (app_file, fseh, reh);
-
-string config_file = Path.Combine (physical_app_path, "Web.config");
-if (!File.Exists (config_file))
-	config_file = Path.Combine (physical_app_path, "web.config");
-if (!File.Exists (config_file))
-	config_file = Path.Combine (physical_app_path, "Web.Config");
-
-config_watcher = CreateWatcher (config_file, fseh, reh);
+#if !TARGET_JVM
+app_file = "Global.asax";
+if (!File.Exists(Path.Combine(physical_app_path, app_file)))
+app_file =  "global.asax";
+
+			WatchLocationForRestart(app_file);
+			
+if (File.Exists(Path.Combine(physical_app_path, "Web.config")))
+{
+WatchLocationForRestart("Web.config");
+}
+else if (File.Exists(Path.Combine(physical_app_path, "web.config")))
+{
+WatchLocationForRestart("web.config");
+}
+else if (File.Exists(Path.Combine(physical_app_path, "Web.Config")))
+{
+	WatchLocationForRestart("Web.Config");
+}
 #endif
 needs_init = false;
 
@@ -453,16 +444,16 @@
 lock (factory) {
 	if (factory.app_start_needed) {
 #if !TARGET_JVM
-		string bin = HttpRuntime.BinDirectory;
-		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, fseh, reh);
-#endif
-		app = factory.FireOnAppStart (context);
+		WatchLocationForRestart("bin", "*.dll");
+#if NET_2_0 && !TARGET_J2EE
+WatchLocationForRestart("App_Code", "*.cs");
+WatchLocationForRestart("App_Browsers", "*.cs");
+WatchLocationForRestart("App_GlobalResources", "*.cs");
+#endif
+#endif
+
+
+app = factory.FireOnAppStart (context);
 		factory.app_start_needed = false;
 		return app;
 	}
@@ -518,6 +509,57 @@
 		internal static bool ContextAvailable {
 			get { return theFactory != null && !theFactory.app_start_needed; }
 		}
+		
+		internal static bool WatchLocationForRestart(string filter)
+{
+return WatchLocationForRestart("", filter);
+}
+
+internal static bool WatchLocationForRestart(string virtualPath, string filter)
+{
+// map the path to the physical one
+string physicalPath = HttpRuntime.AppDomainAppPath;
+physicalPath = Path.Combine(physicalPath, virtualPath);
+
+if (Directory.Exists(physicalPath) || File.Exists(physicalPath))
+{
+physicalPath = Path.Combine(physicalPath, filter);
+
+// create the watcher
+FileSystemEventHandler fseh = new FileSystemEventHandler(OnFileChanged);
+RenamedEv

[Mono-dev] Code Review (again)

2007-01-16 Thread Damien Churchill

--- mcs/class/System.Web/System.Web/HttpApplicationFactory.cs	2007-01-16 10:00:49.0 +
+++ ../../HttpApplicationFactory.cs	2007-01-16 09:59:04.0 +
@@ -68,17 +68,17 @@
 #else
 		static HttpApplicationFactory theFactory = new HttpApplicationFactory();
 #endif
+
 
-		MethodInfo session_end;
+MethodInfo session_end;
 		bool needs_init = true;
 		bool app_start_needed = true;
 		Type app_type;
 		HttpApplicationState app_state;
 		Hashtable app_event_handlers;
 #if !TARGET_JVM
-		FileSystemWatcher app_file_watcher;
-		FileSystemWatcher bin_watcher;
-		FileSystemWatcher config_watcher;
+static ArrayList watchers = new ArrayList();
+static object watchers_lock = new object();
 #endif
 		Stack available = new Stack ();
 		Stack available_for_end = new Stack ();
@@ -221,22 +221,6 @@
 
 			return watcher;
 		}
-
-		void OnAppFileRenamed (object sender, RenamedEventArgs args)
-		{
-			OnAppFileChanged (sender, args);
-		}
-
-		void OnAppFileChanged (object sender, FileSystemEventArgs args)
-		{
-			if (config_watcher != null)
-config_watcher.EnableRaisingEvents = false;
-			if (bin_watcher != null)
-bin_watcher.EnableRaisingEvents = false;
-			if (app_file_watcher != null)
-app_file_watcher.EnableRaisingEvents = false;
-			HttpRuntime.UnloadAppDomain ();
-		}
 #endif
 
 		internal static void AttachEvents (HttpApplication app)
@@ -416,17 +400,18 @@
 }
 
 #if !TARGET_JVM
-FileSystemEventHandler fseh = new FileSystemEventHandler (OnAppFileChanged);
-RenamedEventHandler reh = new RenamedEventHandler (OnAppFileRenamed);
-app_file_watcher = CreateWatcher (app_file, fseh, reh);
-
-string config_file = Path.Combine (physical_app_path, "Web.config");
-if (!File.Exists (config_file))
-	config_file = Path.Combine (physical_app_path, "web.config");
-if (!File.Exists (config_file))
-	config_file = Path.Combine (physical_app_path, "Web.Config");
-
-config_watcher = CreateWatcher (config_file, fseh, reh);
+		app_file = "Global.asax";
+		if (!File.Exists(Path.Combine(physical_app_path, app_file)))
+		app_file =  "global.asax";
+
+WatchLocationForRestart(app_file);
+	
+		if (File.Exists(Path.Combine(physical_app_path, "Web.config")))
+			WatchLocationForRestart("Web.config");
+		else if (File.Exists(Path.Combine(physical_app_path, "web.config")))
+			WatchLocationForRestart("web.config");
+		else if (File.Exists(Path.Combine(physical_app_path, "Web.Config")))
+			WatchLocationForRestart("Web.Config");
 #endif
 needs_init = false;
 
@@ -453,16 +438,14 @@
 lock (factory) {
 	if (factory.app_start_needed) {
 #if !TARGET_JVM
-		string bin = HttpRuntime.BinDirectory;
-		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, fseh, reh);
+		WatchLocationForRestart("bin", "*.dll");
+#if NET_2_0 && !TARGET_J2EE
+			WatchLocationForRestart("App_Code", "");
+			WatchLocationForRestart("App_Browsers", "");
+			WatchLocationForRestart("App_GlobalResources", "");
 #endif
-		app = factory.FireOnAppStart (context);
+#endif
+			app = factory.FireOnAppStart (context);
 		factory.app_start_needed = false;
 		return app;
 	}
@@ -518,6 +501,51 @@
 		internal static bool ContextAvailable {
 			get { return theFactory != null && !theFactory.app_start_needed; }
 		}
+		
+		internal static bool WatchLocationForRestart(string filter)
+	{
+	return WatchLocationForRestart("", filter);
+	}
+
+	internal static bool WatchLocationForRestart(string virtualPath, string filter)
+		{
+	// map the path to the physical one
+	string physicalPath = HttpRuntime.AppDomainAppPath;
+	physicalPath = Path.Combine(physicalPath, virtualPath);
+
+	if (Directory.Exists(physicalPath) || File.Exists(physicalPath)) {
+	physicalPath = Path.Combine(physicalPath, filter);
+
+	// create the watcher
+	FileSystemEventHandler fseh = new FileSystemEventHandler(OnFileChanged);
+	RenamedEventHandler reh = new RenamedEventHandler(OnFileRenamed);
+	FileSystemWatcher watcher = CreateWatcher(physicalPath, fseh, reh);
+	
+	lock (watchers_lock) {
+		watchers.Add(watcher);
+	}
+	return true;
+	} else {
+	return false;
+	

[Mono-dev] System.Net.Mail

2007-01-18 Thread Damien Churchill
I've attached the class I was using to send mail.

I had to modify a part of SmtpClient to allow this to work with exim.
After looking at SmtpClient it appears that it always sends the AUTH
command despite not it been given credentials, which would then throw
"503 AUTH command used when not advertised".

To get around this I set useDefaultCredentials to false and the set of
the property to just `useDefaultCredentials = value;`

I have yet to test this properly though but does at least fix the exim
issue.
using System;
using System.Configuration;
using System.Net;
using System.Net.Mail;

/// 
/// Summary description for Mail
/// 
public class Mail
{
private SmtpClient smtpClient = new SmtpClient("neptune.digitalnetworks.co.uk");
private MailMessage message = new MailMessage();

public class Address
{
public string Email;
public string DisplayName;

public Address()
{
Email = "";
DisplayName = "";
}
}

public string Subject
{
set { message.Subject = value; }
get { return message.Subject; }
}

public string Body
{
set { message.Body = value; }
get { return message.Body; }
}

public Address From
{
set
{
if (value.Email != null)
{
MailAddress address;
if (value.DisplayName != null)
{
address = new MailAddress(value.Email.Trim(), value.DisplayName.Trim());
}
else
{
address = new MailAddress(value.Email.Trim());
}
message.From = address;
}
}
get
{
Address address = new Address();
address.Email = message.From.Address;
address.DisplayName = message.From.DisplayName;
return address;
}
}

public void AddRecipient(Address address)
{
try
{
if (address.Email != null)
{
MailAddress mailAddress = new MailAddress(address.Email);
if (address.DisplayName != null)
{
mailAddress = new MailAddress(address.Email, address.DisplayName);
}
message.To.Add(mailAddress);
}
}
catch (Exception ex)
{
DigiSite.Logger.HandleError(ex);
}
}

public bool Send()
{
try
{
message.IsBodyHtml = true;
			smtpClient.UseDefaultCredentials = false;
			smtpClient.Credentials = null;
message.Subject = ConfigurationManager.AppSettings["Email Prefix"] + message.Subject;
smtpClient.Send(message);
return true;

}
catch (Exception ex)
{
DigiSite.Logger.HandleError(ex);
return false;
}
}
}
___
Mono-devel-list mailing list
Mono-devel-list@lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list