Skip to content

Commit

Permalink
Merge branch 'feature/steam-ugc-legacy-check'
Browse files Browse the repository at this point in the history
  • Loading branch information
veteran29 committed May 9, 2020
2 parents fbbbabc + 3b0e969 commit 7e529e7
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 2 additions & 2 deletions Command/Download/DownloadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ protected override async Task<int> OnExecute(CommandLineApplication app)
InitializeSteam();

Console.Out.WriteLine($"Downloading item {ItemId} for app {AppId}");

if (!SteamUGC.DownloadItem(new PublishedFileId_t(ItemId), true))
{
throw new Exception($"Could not download item {ItemId}");
}

Console.Out.WriteLine($"Item {ItemId} queued for download in Steam");

return 0;
Expand Down
5 changes: 5 additions & 0 deletions Command/KpSteamCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

namespace KP_Steam_Uploader.Command
{
public enum AppIds
{
Arma = 107410,
}

[Command(
Name = "kpsteam",
ThrowOnUnexpectedArgument = false,
Expand Down
19 changes: 18 additions & 1 deletion Command/Upload/UploadCommand.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
using System;
using System.IO;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using KP_Steam_Uploader.Util;
using McMaster.Extensions.CommandLineUtils;
using Microsoft.Extensions.Logging;
using Steamworks;
Expand Down Expand Up @@ -32,8 +34,11 @@ public UploadCommand(ILogger<UploadCommand> logger, IConsole console)
{
Logger = logger;
Console = console;
SteamUgcUtil = new SteamUgc(logger);
}

protected SteamUgc SteamUgcUtil;

protected override async Task<int> OnExecute(CommandLineApplication app)
{
Logger.LogInformation("Executing UploadCommand");
Expand Down Expand Up @@ -172,7 +177,19 @@ protected async Task SteamUGCUpload()
{
throw new Exception("Item Content could not be set!");
}


var itemDetails = await SteamUgcUtil.GetSingleQueryUgcResult(ItemId);
// If uploading for Arma check for Scenario tag.
// UGC upload over scenario is most likely a mistake which we will prevent.
if (AppId == (uint)AppIds.Arma)
{
var tags = itemDetails.m_rgchTags.Split(',');
if (tags.Contains("Scenario"))
{
throw new Exception("Scenaarios can't be uploaded via UGC, use --legacy mode!");
}
}

var updateCall = SteamUGC.SubmitItemUpdate(update, ChangeNotes);

_submitItemUpdateResultTask = new TaskCompletionSource<bool>();
Expand Down

0 comments on commit 7e529e7

Please sign in to comment.