Files
TeslaSuite/Contract/Client/MockPodManagerConnection.cs
T
CydandClaude Opus 4.8 b9d8027cf6 Extract shared contract, drop BinaryFormatter wire, modernize to net8/x64
Make the Console<->Launcher system source-built and modern now that the console
is under our control and the WinXP-era pods are gone.

Contract extraction (Contract/Tesla.Contract.csproj):
- One multi-targeted (net48;net8.0-windows) source project for the RPC contract,
  replacing the vendored TeslaConsoleLaunchLib.dll and the hand-synced Tesla.Net
  replica in Launcher/LaunchModels_Shared.cs. Emits assembly TeslaConsoleLaunchLib.

SecureConfig extraction (SecureConfig/Tesla.SecureConfig.csproj):
- net48 source of the first-boot provisioning protocol (UDP beacons, OFB crypto,
  RSA key exchange), replacing the vendored TeslaSecureConfiguration.dll.

Remove BinaryFormatter from the wire (RCE sink + the reason net6 was pinned):
- Console<->Launcher RPC is now length-prefixed System.Text.Json frames
  (Contract/PodRpcProtocol.cs) over the unchanged OFB transport; dispatch by
  method name. Deleted the SerializationBinder / MethodInfoProxy machinery.
- Console-local BinaryFormatter (Site config, mission replays) intentionally
  retained: local net48 file I/O, not the network surface.

Runtime modernization:
- Launcher Service + Agent: net6 -> net8, win-x86 -> win-x64 (all pods are
  64-bit Win10). Kept the SHA1-default PBKDF2 (Console key-derivation compat)
  with SYSLIB0041 suppressed and documented.

Tests: differential suite now 73 green. Added SecureConfigCompatTests (OFB
ciphertext byte-identical to the vendored DLL) and PodRpcProtocolTests (JSON
round-trip of every request/response shape); removed the now-obsolete
BinaryFormatter byte-identity guard.

Build hygiene: per-project obj dirs (Launcher/Directory.Build.props) fix a
NuGet restore collision between the two Launcher projects sharing one folder.

NOT runtime-verified against a live pod.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-30 08:15:17 -05:00

178 lines
4.8 KiB
C#

// =============================================================================
// Tesla.Contract — Mock RPC client (net48 only)
// =============================================================================
// Reconstructed verbatim from TeslaConsoleLaunchLib.dll. An offline test/dev
// stand-in for PodManagerConnection. Not referenced by the shipping Console UI,
// but retained for parity with the original assembly surface.
// =============================================================================
using System;
using System.Collections.Generic;
using System.Net;
using System.Threading;
namespace Tesla.Net
{
public class MockPodManagerConnection : IPodManagerConnection, ILauncherService
{
public static readonly Guid RPAppGuid = new Guid("7D241B1F-AB6D-4e08-9C20-12294E743D94");
public static readonly Guid RPMRAppGuid = new Guid("8F71D5C2-38E4-413c-8E22-88CAD08774D2");
public static readonly Guid RPLCAppGuid = new Guid("57A0B3C2-D5CF-46d6-ABED-A8F4A26AB086");
public static readonly Guid MW4AppGuid = new Guid("CC8500ED-A653-45a7-BEF8-C332D30371A6");
public static readonly Guid MW4LCAppGuid = new Guid("8EE93A6C-F16A-49be-B867-37FAE9087FFF");
private bool mIsOpen;
private List<LaunchedAppData> mLaunchedApps = new List<LaunchedAppData>();
public bool IsOpen => mIsOpen;
public float VolumeLevel
{
get
{
throw new NotImplementedException();
}
set
{
throw new NotImplementedException();
}
}
public void Open(IPEndPoint remoteEndPoint, byte[] secureKey)
{
Thread.Sleep(5000);
mIsOpen = true;
}
public void Close()
{
Thread.Sleep(5000);
mIsOpen = false;
}
public Guid InstallProduct(string filename)
{
throw new NotImplementedException();
}
public void ClearStore()
{
throw new NotImplementedException();
}
public DateTime Ping(DateTime now)
{
throw new NotImplementedException();
}
public Guid InitiateInstallProduct()
{
throw new NotImplementedException();
}
public OutOfBandProgress GetOutOfBandProgress(Guid invokeCallId)
{
throw new NotImplementedException();
}
public int LaunchApp(Guid launchKey)
{
throw new NotImplementedException();
}
public LaunchPair[] GetLaunchableApps()
{
return new LaunchPair[2]
{
new LaunchPair
{
DisplayName = "BattleTech Firestorm",
LaunchKey = MW4AppGuid
},
new LaunchPair
{
DisplayName = "Red Planet",
LaunchKey = RPAppGuid
}
};
}
public void KillApp(Guid launchKey, int processId)
{
throw new NotImplementedException();
}
public void KillAllOfType(Guid launchKey)
{
throw new NotImplementedException();
}
public void KillAllApps()
{
throw new NotImplementedException();
}
public void Shutdown(bool restart)
{
throw new NotImplementedException();
}
public LaunchedAppData[] GetLaunchedApps()
{
return mLaunchedApps.ToArray();
}
public LaunchData[] GetInstalledApps()
{
return new LaunchData[2]
{
new LaunchData
{
LaunchPair = new LaunchPair
{
DisplayName = "BattleTech Firestorm",
LaunchKey = MW4AppGuid
}
},
new LaunchData
{
LaunchPair = new LaunchPair
{
DisplayName = "Red Planet",
LaunchKey = RPAppGuid
}
}
};
}
public void RemoveApp(Guid index)
{
throw new NotImplementedException();
}
public void InstallApp(LaunchData data)
{
throw new NotImplementedException();
}
public void UninstallApp(Guid launchKey)
{
throw new NotImplementedException();
}
public FullUpdateData FullUpdate()
{
FullUpdateData result = default(FullUpdateData);
result.InstalledApps = GetInstalledApps();
result.LaunchedApps = GetLaunchedApps();
result.VolumeLevel = VolumeLevel;
return result;
}
}
}