tools: show the item's mature-content descriptors in the Workshop check
This commit is contained in:
parent
1573fba3cc
commit
88fe75414b
|
|
@ -64,13 +64,15 @@ internal static class Program
|
||||||
var item = new PublishedFileId_t(o.Item);
|
var item = new PublishedFileId_t(o.Item);
|
||||||
Console.WriteLine($"Steam account: {SteamFriends.GetPersonaName()}");
|
Console.WriteLine($"Steam account: {SteamFriends.GetPersonaName()}");
|
||||||
|
|
||||||
if (!QueryDetails(item, o.Timeout, out SteamUGCDetails_t d)) return 3;
|
if (!QueryDetails(item, o.Timeout, out SteamUGCDetails_t d, out string[] descriptors)) return 3;
|
||||||
Console.WriteLine($"Item {o.Item}: \"{d.m_rgchTitle}\"");
|
Console.WriteLine($"Item {o.Item}: \"{d.m_rgchTitle}\"");
|
||||||
Console.WriteLine($" updated {DateTimeOffset.FromUnixTimeSeconds(d.m_rtimeUpdated).ToLocalTime():yyyy-MM-dd HH:mm}");
|
Console.WriteLine($" updated {DateTimeOffset.FromUnixTimeSeconds(d.m_rtimeUpdated).ToLocalTime():yyyy-MM-dd HH:mm}");
|
||||||
Console.WriteLine($" tags {d.m_rgchTags}");
|
Console.WriteLine($" tags {d.m_rgchTags}");
|
||||||
Console.WriteLine($" size {d.m_nFileSize / 1024.0:N0} KB");
|
Console.WriteLine($" size {d.m_nFileSize / 1024.0:N0} KB");
|
||||||
Console.WriteLine($" visible {d.m_eVisibility.ToString().Replace("k_ERemoteStoragePublishedFileVisibility", "")}");
|
Console.WriteLine($" visible {d.m_eVisibility.ToString().Replace("k_ERemoteStoragePublishedFileVisibility", "")}");
|
||||||
if (d.m_bBanned) Console.WriteLine(" BANNED on Steam");
|
if (d.m_bBanned) Console.WriteLine(" BANNED on Steam");
|
||||||
|
// Mature-content descriptors hide the item page from logged-out visitors and from players who didn't opt in.
|
||||||
|
Console.WriteLine($" content {(descriptors.Length > 0 ? string.Join(", ", descriptors) : "no mature-content descriptors")}");
|
||||||
if (d.m_nConsumerAppID.m_AppId != RimWorldAppId)
|
if (d.m_nConsumerAppID.m_AppId != RimWorldAppId)
|
||||||
{
|
{
|
||||||
Console.Error.WriteLine($"The item belongs to app {d.m_nConsumerAppID.m_AppId}, not RimWorld.");
|
Console.Error.WriteLine($"The item belongs to app {d.m_nConsumerAppID.m_AppId}, not RimWorld.");
|
||||||
|
|
@ -140,9 +142,10 @@ internal static class Program
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool QueryDetails(PublishedFileId_t item, TimeSpan timeout, out SteamUGCDetails_t details)
|
private static bool QueryDetails(PublishedFileId_t item, TimeSpan timeout, out SteamUGCDetails_t details, out string[] descriptors)
|
||||||
{
|
{
|
||||||
details = default;
|
details = default;
|
||||||
|
descriptors = Array.Empty<string>();
|
||||||
UGCQueryHandle_t q = SteamUGC.CreateQueryUGCDetailsRequest(new[] { item }, 1);
|
UGCQueryHandle_t q = SteamUGC.CreateQueryUGCDetailsRequest(new[] { item }, 1);
|
||||||
bool got = false, ioFailure = false;
|
bool got = false, ioFailure = false;
|
||||||
SteamUGCQueryCompleted_t done = default;
|
SteamUGCQueryCompleted_t done = default;
|
||||||
|
|
@ -161,6 +164,10 @@ internal static class Program
|
||||||
Console.Error.WriteLine($"Steam has no item {item}: {details.m_eResult}.");
|
Console.Error.WriteLine($"Steam has no item {item}: {details.m_eResult}.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
var ids = new EUGCContentDescriptorID[8];
|
||||||
|
uint count = SteamUGC.GetQueryUGCContentDescriptors(q, 0, ids, (uint)ids.Length);
|
||||||
|
descriptors = ids.Take((int)Math.Min(count, (uint)ids.Length))
|
||||||
|
.Select(id => id.ToString().Replace("k_EUGCContentDescriptor_", "")).ToArray();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue