Check for potentially existing game install when importing games

This commit is contained in:
Pat Hartl 2024-02-21 23:32:47 -06:00
parent 532c219924
commit 2dd6742cd6

View file

@ -1,6 +1,7 @@
using LANCommander.PlaynitePlugin.Extensions;
using LANCommander.SDK;
using LANCommander.SDK.Extensions;
using LANCommander.SDK.Helpers;
using Playnite.SDK;
using Playnite.SDK.Models;
using System;
@ -108,6 +109,24 @@ namespace LANCommander.PlaynitePlugin
game.Name += " - Update Available";
}
if (!game.IsInstalled && String.IsNullOrWhiteSpace(game.InstallDirectory))
{
try
{
// Check for existing manifest
var possibleInstallDirectory = Path.Combine(Plugin.Settings.InstallDirectory, game.Name.SanitizeFilename());
var existingManifest = ManifestHelper.Read(possibleInstallDirectory, game.Id);
if (existingManifest != null)
{
game.IsInstalled = true;
game.InstallDirectory = possibleInstallDirectory;
}
}
catch { }
}
#region Play Sessions
if (playSessions.Count() > 0)
{