2026-02-07 18:58:03 -06:00
using System ;
using System.Management.Automation ;
using System.Threading ;
using System.Threading.Tasks ;
using LANCommander.Steam.Models.SteamCmdNet ;
namespace LANCommander.SDK.PowerShell.Cmdlets ;
[Cmdlet(VerbsCommon.Get, "SteamAppInfo")]
[OutputType(typeof(AppInfo))]
public class GetSteamAppInfoCmdlet : AsyncCmdlet
{
2026-05-08 02:02:33 -05:00
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true, HelpMessage = "The Steam application ID to retrieve information for.")]
2026-02-07 18:58:03 -06:00
[ValidateRange(1u, uint.MaxValue)]
public uint AppId { get ; set ; }
protected override async Task ProcessRecordAsync ( CancellationToken cancellationToken )
{
var steamStoreService = SteamServicesProvider . GetSteamWebApiService ( SessionState ) ;
try
{
var info = await steamStoreService . GetAppInfo ( AppId ) ;
if ( info = = null )
return ;
WriteObject ( info ) ;
}
catch ( Exception ex )
{
WriteError ( new ErrorRecord ( ex , "SteamAppInfoError" , ErrorCategory . OperationStopped , AppId ) ) ;
}
}
}