diff --git a/OculusLibrary/OculusLibraryPlugin.cs b/OculusLibrary/OculusLibraryPlugin.cs index 54e4daa..de3c9a1 100644 --- a/OculusLibrary/OculusLibraryPlugin.cs +++ b/OculusLibrary/OculusLibraryPlugin.cs @@ -59,7 +59,7 @@ public override IEnumerable GetGames() // set a default name var executableName = Path.GetFileNameWithoutExtension(executableFullPath); - var icon = $@"{oculusBasePath}zCoreData\Software\StoreAssets\{manifest.CanonicalName}_assets\icon_image.jpg"; + var icon = $@"{oculusBasePath}\..\CoreData\Software\StoreAssets\{manifest.CanonicalName}_assets\icon_image.jpg"; if (!File.Exists(icon)) { @@ -67,7 +67,7 @@ public override IEnumerable GetGames() icon = executableFullPath; } - var backgroundImage = $@"{oculusBasePath}zCoreData\Software\StoreAssets\{manifest.CanonicalName}_assets\cover_landscape_image_large.png"; + var backgroundImage = $@"{oculusBasePath}\..\CoreData\Software\StoreAssets\{manifest.CanonicalName}_assets\cover_landscape_image_large.png"; if (!File.Exists(backgroundImage)) { @@ -115,7 +115,7 @@ public override IEnumerable GetGames() return gameInfos; } - private IEnumerable GetOculusAppManifests(string oculusBasePath) + private List GetOculusAppManifests(string oculusBasePath) { logger.Debug($"Listing Oculus manifests"); @@ -125,16 +125,45 @@ private IEnumerable GetOculusAppManifests(string oculusBasePath) { logger.Info($"No Oculus game manifests found"); } - + + var manifests = new List(); + foreach (string fileName in fileEntries.Where(x => x.EndsWith(".json"))) { - var json = File.ReadAllText(fileName); - var manifest = serialiser.Deserialize(json); + try + { + if (fileName.EndsWith("_assets.json")) + { + // not interested in the asset json files + continue; + } + + var json = File.ReadAllText(fileName); + + if (string.IsNullOrWhiteSpace(json)) + { + logger.Error($"JSON file is empty ({fileName})"); + continue; + } - manifest.LaunchFile = manifest.LaunchFile.Replace("/", @"\"); + var manifest = serialiser.Deserialize(json); - yield return manifest; + if (manifest == null) + { + logger.Error($"Could not deserialise json ({fileName})"); + } + + manifest.LaunchFile = manifest?.LaunchFile?.Replace("/", @"\"); + + manifests.Add(manifest); + } + catch (Exception ex) + { + logger.Error($"Exception while processing manifest ({fileName}) : {ex}"); + } } + + return manifests; } private List GetOculusLibraryLocations(RegistryView platformView)