You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
- Retooled some turnkey device management (DeviceInfo now knows its platform, so we don't need to associate a platform externally) - Changed Control command to use Gauntlet devices to do the PowerOn etc type stuff since there is already support for device control in Gauntlet. Now Turnkey is more of an interactive/scriptable frontend to Gauntlet - Allow for a platform to do a manual Sdk installation, which doesn't depend on finding a Turnkey file source - Allow for a platform SDK to return custom versions. This is solely used by platform-specific code #rb brandon.schaefer [CL 15201829 by Josh Adams in ue5-main branch]
62 lines
1.6 KiB
C#
62 lines
1.6 KiB
C#
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using AutomationTool;
|
|
using UnrealBuildTool;
|
|
using System.Linq;
|
|
using Gauntlet;
|
|
|
|
namespace Turnkey.Commands
|
|
{
|
|
class Control : TurnkeyCommand
|
|
{
|
|
private delegate void PerformOperation(ITargetDevice Device);
|
|
|
|
protected override void Execute(string[] CommandOptions)
|
|
{
|
|
List<DeviceInfo> Devices = TurnkeyUtils.GetDevicesFromCommandLineOrUser(CommandOptions, null);
|
|
if (Devices == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
Dictionary<string, PerformOperation> Ops = new Dictionary<string, PerformOperation>();
|
|
Ops.Add("Connect", x => x.Connect());
|
|
Ops.Add("Disconnect", x => x.Disconnect());
|
|
Ops.Add("PowerOn", x => x.PowerOn());
|
|
Ops.Add("PowerOff", x => x.PowerOff());
|
|
Ops.Add("Reboot", x => x.Reboot());
|
|
|
|
bool bWasScripted = false;
|
|
// break if the GetGenericOption was scripted, otherwise we would loop forever
|
|
while (!bWasScripted)
|
|
{
|
|
string Operation = TurnkeyUtils.GetGenericOption(CommandOptions, Ops.Keys.ToList(), "Operation", out bWasScripted);
|
|
if (Operation == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
foreach (DeviceInfo Device in Devices)
|
|
{
|
|
TurnkeyUtils.Log($"Performing {Operation} on {Device.Platform}@{Device.Name}:");
|
|
|
|
try
|
|
{
|
|
ITargetDevice GauntletDevice = TurnkeyGauntletUtils.GetGauntletDevice(Device);
|
|
if (GauntletDevice != null)
|
|
{
|
|
Ops[Operation](GauntletDevice);
|
|
}
|
|
}
|
|
catch (Exception Ex)
|
|
{
|
|
TurnkeyUtils.Log($"Operation {Operation} failed : {Ex.Message}\n");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|