namespace Giants.Launcher
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
public static class RenderInfoExtensions
{
///
/// Disambiguates renderers with the same name by adding the file name.
///
public static IList Disambiguate(this IList rendererInfos)
{
foreach (var group in rendererInfos.GroupBy(x => x.Name))
{
if (group.Count() > 1)
{
foreach (var rendererInfo in group)
{
rendererInfo.Name = $"{rendererInfo.Name} ({Path.GetFileName(rendererInfo.FilePath)})";
}
}
}
return rendererInfos;
}
}
}