// ============================================================================= // TeslaLauncher — Shared Models // ============================================================================= // Wire types (Tesla.Net): BinaryFormatter-compatible replicas of the original // structs from TeslaConsoleLaunchLib.dll. Field names, types, and order must // match exactly for serialization compatibility. // // IPC types (Tesla.Launcher.Shared): JSON messages between Service and Agent // over Named Pipe. These never touch the Console TCP connection. // ============================================================================= using System; using System.Reflection; using System.Runtime.Serialization; namespace Tesla.Net { /// RPC command from TeslaConsole. Function is a MethodBase of ILauncherService. [Serializable] public struct InvokeCommand { public MethodBase Function; public object[] Parameters; } /// RPC result returned to TeslaConsole. [Serializable] public struct InvokeResult { public object Result; public Exception Exception; public TimeSpan CallDuration; } /// App identifier + display name pair. [Serializable] public struct LaunchPair { public Guid LaunchKey; public string DisplayName; } /// Describes one launchable simulation application. [Serializable] public struct LaunchData { public LaunchPair LaunchPair; public string WorkingDirectory; public string ExeFile; public string Arguments; public bool AutoRestart; } /// Tracks a currently running simulation process. [Serializable] public struct LaunchedAppData { public int ProcessId; public Guid LaunchKey; } /// Complete pod state snapshot for FullUpdate RPC. [Serializable] public struct FullUpdateData { public LaunchData[] InstalledApps; public LaunchedAppData[] LaunchedApps; public float VolumeLevel; } /// Progress of an out-of-band product installation. [Serializable] public struct OutOfBandProgress { public int PercentComplete; public string Status; public bool IsCompleted; } /// Interface for BinaryFormatter MethodBase resolution. Signatures must match the original exactly. public interface ILauncherService { float VolumeLevel { get; set; } void ClearStore(); DateTime Ping(DateTime now); Guid InitiateInstallProduct(); OutOfBandProgress GetOutOfBandProgress(Guid invokeCallId); int LaunchApp(Guid launchKey); LaunchPair[] GetLaunchableApps(); void KillApp(Guid launchKey, int processId); void KillAllOfType(Guid launchKey); void KillAllApps(); void Shutdown(bool restart); LaunchedAppData[] GetLaunchedApps(); LaunchData[] GetInstalledApps(); void RemoveApp(Guid index); void InstallApp(LaunchData data); void UninstallApp(Guid launchKey); FullUpdateData FullUpdate(); } } namespace Tesla.Launcher.Shared { /// Command forwarded from the Windows Service to the Userspace Agent. public sealed class IpcMessage { public string Command { get; set; } public string LaunchKey { get; set; } public string PayloadJson { get; set; } } /// Response from the Userspace Agent back to the Windows Service. public sealed class IpcResponse { public bool Success { get; set; } public string Message { get; set; } public object Data { get; set; } } }