[Mono-dev] PATCH custom WebControls in skin files

Andrew Skiba andrews at mainsoft.com
Mon Apr 10 05:34:11 EDT 2006


When I use a custom web control in a skin file, then the dll holding
this control must be added to references when compiling PageTheme. The
attached patch makes this possible. As such references is already found
by parsers of individual skins, it's only necessary to add new
assemblies to the theme directory parser.

If no one objects, I will commit.

Index: ThemeDirectoryCompiler.cs
===================================================================
--- ThemeDirectoryCompiler.cs	(revision 59261)
+++ ThemeDirectoryCompiler.cs	(working copy)
@@ -62,7 +62,11 @@
 					if (!(o is ControlBuilder))
 						continue;
 					ptp.RootBuilder.AppendSubBuilder
((ControlBuilder)o);
-				}
+				}
+
+				foreach (string ass in ptfp.Assemblies)
+					if (!ptp.Assemblies.Contains
(ass))
+
ptp.AddAssemblyByFileName (ass);
 			}
 
 			PageThemeCompiler compiler = new
PageThemeCompiler (ptp);
Index: TemplateParser.cs
===================================================================
--- TemplateParser.cs	(revision 59261)
+++ TemplateParser.cs	(working copy)
@@ -390,6 +390,20 @@
 			}
 		}
 
+		internal virtual Assembly AddAssemblyByFileName (string
filename)
+		{
+			try {
+				Assembly assembly = Assembly.LoadFrom
(filename);
+				AddAssembly (assembly, true);
+				return assembly;
+			}
+			catch (Exception e)
+			{
+				ThrowParseException ("Assembly file " +
filename + " not found", e);
+				return null; //never gets here, only to
satisfy the compiler
+			}
+		}
+
 		internal virtual Assembly AddAssemblyByName (string
name)
 		{
 			if (anames == null)



More information about the Mono-devel-list mailing list