2019-11-04 14:32:57 +00:00
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
using Wabbajack.Common;
|
2019-09-26 20:18:41 +00:00
|
|
|
|
|
2019-10-16 03:10:34 +00:00
|
|
|
|
namespace Wabbajack.Lib.NexusApi
|
2019-09-26 20:18:41 +00:00
|
|
|
|
{
|
|
|
|
|
public sealed class NexusApiUtils
|
|
|
|
|
{
|
|
|
|
|
public static string ConvertGameName(string gameName)
|
|
|
|
|
{
|
2019-11-04 14:32:57 +00:00
|
|
|
|
if (Regex.IsMatch(gameName, @"^[^a-z\s]+\.[^a-z\s]+$"))
|
|
|
|
|
return gameName;
|
2019-09-29 00:18:42 +00:00
|
|
|
|
return GameRegistry.GetByMO2ArchiveName(gameName)?.NexusName ?? gameName.ToLower();
|
2019-09-26 20:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-11-08 01:36:01 +00:00
|
|
|
|
public static string GetModURL(Game game, string argModId)
|
2019-09-26 20:18:41 +00:00
|
|
|
|
{
|
2019-12-09 22:46:03 +00:00
|
|
|
|
return $"https://nexusmods.com/{game.MetaData().NexusName}/mods/{argModId}";
|
2019-09-26 20:18:41 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static string FixupSummary(string argSummary)
|
|
|
|
|
{
|
|
|
|
|
if (argSummary != null)
|
|
|
|
|
{
|
|
|
|
|
return argSummary.Replace("'", "'")
|
|
|
|
|
.Replace("<br/>", "\n\n")
|
|
|
|
|
.Replace("<br />", "\n\n")
|
|
|
|
|
.Replace("!", "!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return argSummary;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|