Duplicate fix (ce2f47c11322) #U4-1366 - conflict with partial view macro engine.

This commit is contained in:
Sebastiaan Janssen
2013-01-09 13:58:55 -01:00
parent e6178efcfb
commit ce6711b587
2 changed files with 59 additions and 15 deletions

View File

@@ -49,25 +49,56 @@ namespace umbraco.cms.businesslogic.macro
EnsureInitialize();
}
public static IEnumerable<MacroEngineLanguage> GetSupportedLanguages() {
/// <summary>
/// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine
/// </summary>
/// <returns></returns>
/// <remarks>
/// Until the macro engines are rewritten, this method explicitly ignores the PartialViewMacroEngine because this method
/// is essentially just used for any macro engine that stores it's files in the ~/macroScripts folder where file extensions
/// cannot overlap.
/// </remarks>
[Obsolete("This method is not used and will be removed from the codebase in the future")]
public static IEnumerable<MacroEngineLanguage> GetSupportedLanguages()
{
var languages = new List<MacroEngineLanguage>();
foreach(var engine in GetAll()) {
foreach(string lang in engine.SupportedExtensions)
foreach (var engine in GetAll())
{
foreach (string lang in engine.SupportedExtensions)
{
if (languages.Find(t => t.Extension == lang) == null)
{
languages.Add(new MacroEngineLanguage(lang, engine.Name));
}
}
}
return languages;
}
public static IEnumerable<MacroEngineLanguage> GetSupportedUILanguages() {
/// <summary>
/// Returns a collectino of MacroEngineLanguage objects, each of which describes a file extension and an associated macro engine that
/// supports file extension lookups.
/// </summary>
/// <returns></returns>
/// <remarks>
/// The PartialViewMacroEngine will never be returned in these results because it does not support searching by file extensions. See
/// the notes in the PartialViewMacroEngine regarding this.
/// </remarks>
public static IEnumerable<MacroEngineLanguage> GetSupportedUILanguages()
{
var languages = new List<MacroEngineLanguage>();
foreach (var engine in GetAll()) {
foreach (var engine in GetAll())
{
foreach (string lang in engine.SupportedUIExtensions)
if (languages.Find(t => t.Extension == lang) == null)
{
if (languages.All(t => t.Extension != lang))
{
languages.Add(new MacroEngineLanguage(lang, engine.Name));
}
}
}
return languages.OrderBy(s => s.Extension);
}
}
public static List<IMacroEngine> GetAll()
{