1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-10 17:05:37 +01:00
GiantsTools/Giants.Launcher/Renderer/RenderInfoExtensions.cs

29 lines
833 B
C#
Raw Normal View History

namespace Giants.Launcher
{
using System.Collections.Generic;
using System.IO;
using System.Linq;
public static class RenderInfoExtensions
{
/// <summary>
/// Disambiguates renderers with the same name by adding the file name.
/// </summary>
public static IList<RendererInfo> Disambiguate(this IList<RendererInfo> 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;
}
}
}