wabbajack/Wabbajack.Lib/NexusApi/NexusApiUtils.cs
2020-04-10 13:32:35 -05:00

29 lines
907 B
C#

using System.Text.RegularExpressions;
using Wabbajack.Common;
namespace Wabbajack.Lib.NexusApi
{
public sealed class NexusApiUtils
{
public static string ConvertGameName(string gameName)
{
if (Regex.IsMatch(gameName, @"^[^a-z\s]+\.[^a-z\s]+$"))
return gameName;
return GameRegistry.GetByMO2ArchiveName(gameName)?.NexusName ?? gameName.ToLower();
}
public static string GetModURL(Game game, string argModId)
{
return $"https://nexusmods.com/{game.MetaData().NexusName}/mods/{argModId}";
}
public static string FixupSummary(string argSummary)
{
return argSummary.Replace("'", "'")
.Replace("<br/>", "\n\n")
.Replace("<br />", "\n\n")
.Replace("&#33;", "!");
}
}
}