Skip to content

Commit

Permalink
Show the URL to the mod after publish.
Browse files Browse the repository at this point in the history
  • Loading branch information
Gwindalmir committed May 6, 2022
1 parent 6a74f3e commit 550aa57
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
24 changes: 24 additions & 0 deletions WorkshopToolCommon/Extensions/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@ public static string AsString(this VRage.Game.WorkshopId[] ids)
return result.ToString();
}

public static string AsStringURL(this VRage.Game.WorkshopId[] ids)
{
var result = new StringBuilder();

if (ids is null)
return result.ToString();

foreach (var id in ids)
{
if(id.ServiceName == "modio")
result.Append($"https://mod.io/search/id/mods/{id.Id};");
else
result.Append($"https://steamcommunity.com/sharedfiles/filedetails/?id={id.Id};");
}
result.Remove(result.Length - 1, 1);

return result.ToString();
}

public static WorkshopId[] ToWorkshopIds(this IEnumerable<ulong> ids)
{
return ids.Select(id => new VRage.Game.WorkshopId(id, MyGameService.GetDefaultUGC().ServiceName)).ToArray();
Expand All @@ -174,6 +193,11 @@ public static string AsString(this ulong[] id)
return id[0].ToString();
}

public static string AsStringURL(this ulong[] id)
{
return $"https://steamcommunity.com/sharedfiles/filedetails/?id={id[0]}";
}

public static ulong[] ToWorkshopIds(this MyWorkshopItem[] items)
{
return items?.Select(i => i.Id)?.ToArray();
Expand Down
2 changes: 1 addition & 1 deletion WorkshopToolCommon/Uploader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ public bool Publish()
}
else
{
MySandboxGame.Log.WriteLineAndConsole(string.Format("Upload/Publish success: {0}", m_modId.AsString()));
MySandboxGame.Log.WriteLineAndConsole(string.Format("Upload/Publish success: {0}", m_modId.AsStringURL()));
if (newMod)
{
if(WorkshopHelper.GenerateModInfo(m_modPath, items, m_modId, MyGameService.UserId))
Expand Down

0 comments on commit 550aa57

Please sign in to comment.