/// <summary> /// Extracts the WAD path keyvalue from the entities string /// </summary> /// <param name="entities"></param> /// <returns></returns> public static string ExtractWADPathKeyValue(string entities) { if (string.IsNullOrWhiteSpace(entities)) { throw new ArgumentException(nameof(entities)); } //Scan the worldspawn entity for the wad keyvalue var worldspawnData = KeyValuesParser.Parse(entities); var wadPathIndex = worldspawnData.FindIndex(kp => kp.Key == "wad"); if (wadPathIndex != -1) { return(worldspawnData[wadPathIndex].Value); } throw new InvalidOperationException("No wadpath keyvalue found"); }
/// <summary> /// Extracts the WAD path keyvalue from the entities string /// </summary> /// <param name="entities"></param> public static string ExtractWADPathKeyValue(string entities) { if (string.IsNullOrWhiteSpace(entities)) { throw new ArgumentException("Entities string must be valid", nameof(entities)); } //Scan the worldspawn entity for the wad keyvalue var worldspawnData = KeyValuesParser.Parse(entities); var wadPathIndex = worldspawnData.FindIndex(kp => kp.Key == "wad"); if (wadPathIndex != -1) { return(worldspawnData[wadPathIndex].Value); } //To match original engine behavior, return an empty string return(string.Empty); }