This does a very basic job of bundling a PowerShell runtime into the SDK. Previously, scripts had been run by spawning a separate PowerShell process and feeding the script into it. This was nothing better than a hack and meant that PowerShell had to be separately installed on the machine it's executing on. This should open up the opportunity for scripts to run on other platforms. There's still some things that need to be figured out. Some sort of console output as well as a debugging mode would be highly beneficial for those that wish to actively develop scripts for their games.
23 lines
665 B
C#
23 lines
665 B
C#
using LANCommander.SDK;
|
|
using LANCommander.SDK.Helpers;
|
|
using System;
|
|
using System.Management.Automation;
|
|
|
|
namespace LANCommander.SDK.PowerShell.Cmdlets
|
|
{
|
|
[Cmdlet(VerbsCommon.Get, "GameManifest")]
|
|
[OutputType(typeof(GameManifest))]
|
|
public class GetGameManifestCmdlet : Cmdlet
|
|
{
|
|
[Parameter(Mandatory = true, Position = 0, ValueFromPipeline = true, ValueFromPipelineByPropertyName = true)]
|
|
public string Path { get; set; }
|
|
|
|
[Parameter(Mandatory = true)]
|
|
public Guid Id { get; set; }
|
|
|
|
protected override void ProcessRecord()
|
|
{
|
|
WriteObject(ManifestHelper.Read(Path, Id));
|
|
}
|
|
}
|
|
}
|