[commit] r9456 - freeswitch/trunk/src/mod/languages/mod_mono_managed
Author: michaelgg Date: Thu Sep 4 19:28:10 2008 New Revision: 9456 Modified: freeswitch/trunk/src/mod/languages/mod_mono_managed/Loader.cs Log: Allow class name only function resolution in mod_mono because some people were too lazy to fully qualify Modified: freeswitch/trunk/src/mod/languages/mod_mono_managed/Loader.cs ============================================================================== --- freeswitch/trunk/src/mod/languages/mod_mono_managed/Loader.cs (original) +++ freeswitch/trunk/src/mod/languages/mod_mono_managed/Loader.cs Thu Sep 4 19:28:10 2008 @@ -42,6 +42,8 @@ { // Stores a list of the loaded function types so we can instantiate them as needed static readonly Dictionary<string, Type> functions = new Dictionary<string, Type>(StringComparer.InvariantCultureIgnoreCase); + // Only class name. Last in wins. + static readonly Dictionary<string, Type> shortFunctions = new Dictionary<string, Type>(StringComparer.InvariantCultureIgnoreCase); #region Load/Unload @@ -86,6 +88,7 @@ if (shouldLoad) { Log.WriteLine(LogLevel.Notice, "Function {0} loaded.", t.FullName); functions.Add(t.FullName, t); + shortFunctions[t.Name] = t; } else { Log.WriteLine(LogLevel.Notice, "Function {0} requested not to be loaded.", t.FullName); @@ -137,8 +140,10 @@ { Type t; if (!functions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) { - Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName); - return null; + if (!shortFunctions.TryGetValue(fullName, out t) || !t.IsSubclassOf(typeof(TFunction))) { + Log.WriteLine(LogLevel.Error, "Could not find function {0}.", fullName); + return null; + } } return t; }
participants (1)
-
Freeswitch SVN