Skip to content

Commit

Permalink
fix for reading files without version attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
stephanstapel committed Nov 29, 2023
1 parent bdb7fd1 commit 3394aae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions BMECat.net/BMECatReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@ public async static Task<ProductCatalog> LoadAsync(Stream stream, BMECatExtensio
version = BMECatVersion.Version2005;
}
}
else
{
Regex fallbackRegex = new Regex("<BMECAT(.*?)>");
Match fallbackMatch = fallbackRegex.Match(xmlHeading);
if (fallbackMatch.Success && fallbackMatch.Groups.Count > 1)
{
if (fallbackMatch.Groups[1].Value.Contains("bmecat/2005"))
{
version = BMECatVersion.Version2005;
}
}
}

switch (version)
{
Expand Down

0 comments on commit 3394aae

Please sign in to comment.