Files
CydandClaude Opus 4.8 548550b312 Initial commit: TeslaSuite monorepo (TeslaConsole + TeslaLauncher)
Co-locate the two cockpit-pod projects into a single repository:

- Console/  : TeslaConsole, the net48 WinForms operator console (decompiled
              reconstruction) plus its differential + catalog test suite.
- Launcher/ : TeslaLauncher, the net6 pod-side Service + Agent rewrite.

Adds a combined TeslaSuite.sln, root README documenting the shared wire
contract (and its current duplication, the main follow-up), and a root
.gitignore. Histories were not preserved per request; this is a fresh start
from the current working state of both projects.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-29 14:43:28 -05:00

86 lines
2.1 KiB
C#

using System.Collections.Generic;
using System.Xml;
namespace TeslaConsole.RedPlanet;
public class Scenario
{
private string mKey;
private string mName;
private Dictionary<string, RPMap> mMaps = new Dictionary<string, RPMap>();
private Dictionary<string, RPVehicle> mVehicles = new Dictionary<string, RPVehicle>();
private Dictionary<string, string> mTimesOfDay = new Dictionary<string, string>();
private Dictionary<string, string> mWeather = new Dictionary<string, string>();
public string Key => mKey;
public string Name => mName;
public Dictionary<string, RPMap> Maps => mMaps;
public Dictionary<string, RPVehicle> Vehicles => mVehicles;
public Dictionary<string, string> TimesOfDay => mTimesOfDay;
public Dictionary<string, string> Weather => mWeather;
internal Scenario(XmlNode scenarioNode)
{
mKey = scenarioNode.Name;
mName = scenarioNode.Attributes["name"].InnerText;
List<KeyValuePair<string, string>> list = new List<KeyValuePair<string, string>>();
foreach (XmlNode childNode in scenarioNode.ChildNodes)
{
if (childNode.Name == "invalid")
{
list.Add(new KeyValuePair<string, string>(childNode.Attributes["type"].InnerText, childNode.Attributes["key"].InnerText));
}
}
foreach (RPMap value in RPConfig.Maps.Values)
{
if (!IsInvalid("map", value.Key, list))
{
mMaps.Add(value.Key, value);
}
}
foreach (RPVehicle value2 in RPConfig.Vehicles.Values)
{
if (!IsInvalid("vehicle", value2.Key, list))
{
mVehicles.Add(value2.Key, value2);
}
}
foreach (KeyValuePair<string, string> item in RPConfig.TimesOfDay)
{
if (!IsInvalid("time", item.Key, list))
{
mTimesOfDay.Add(item.Key, item.Value);
}
}
foreach (KeyValuePair<string, string> item2 in RPConfig.Weather)
{
if (!IsInvalid("weather", item2.Key, list))
{
mWeather.Add(item2.Key, item2.Value);
}
}
}
private static bool IsInvalid(string type, string value, List<KeyValuePair<string, string>> invalid)
{
foreach (KeyValuePair<string, string> item in invalid)
{
if (item.Key == type && item.Value == value)
{
return true;
}
}
return false;
}
}