Add required metadata for installed games such as InstallDirectory to properly enable menu items

dashboard
Pat Hartl 2023-01-16 11:32:47 -06:00
parent 1f332339eb
commit 702bdeb97f
4 changed files with 34 additions and 3 deletions

View File

@ -85,7 +85,7 @@ namespace LANCommander.PlaynitePlugin
var metadata = new GameMetadata()
{
IsInstalled = existingGame != null,
IsInstalled = false,
Name = manifest.Title,
SortingName = manifest.SortTitle,
Description = manifest.Description,
@ -93,9 +93,24 @@ namespace LANCommander.PlaynitePlugin
ReleaseDate = new ReleaseDate(manifest.ReleasedOn),
//Version = game.Archives.OrderByDescending(a => a.CreatedOn).FirstOrDefault().Version,
Icon = new MetadataFile(iconUri.ToString()),
Genres = new HashSet<MetadataProperty>()
GameActions = game.Actions.Select(a => new PN.SDK.Models.GameAction()
{
Name = a.Name,
Arguments = a.Arguments,
Path = a.Path,
WorkingDir = a.WorkingDirectory,
IsPlayAction = a.PrimaryAction
}).ToList()
};
if (existingGame != null)
{
metadata.IsInstalled = true;
metadata.Version = existingGame.Version;
metadata.InstallDirectory = existingGame.InstallDirectory;
metadata.InstallSize = existingGame.InstallSize;
}
if (manifest.Genre != null && manifest.Genre.Count() > 0)
metadata.Genres = new HashSet<MetadataProperty>(manifest.Genre.Select(g => new MetadataNameProperty(g)));

View File

@ -51,7 +51,7 @@ namespace LANCommander.PlaynitePlugin
{
try
{
Dispatcher.Invoke(new Action(() =>
Dispatcher.Invoke(new System.Action(() =>
{
if (antecedent.Result == false)
{

View File

@ -0,0 +1,15 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace LANCommander.SDK.Models
{
public class Action
{
public string Name { get; set; }
public string Arguments { get; set; }
public string Path { get; set; }
public string WorkingDirectory { get; set; }
public bool PrimaryAction { get; set; }
}
}

View File

@ -10,6 +10,7 @@ namespace LANCommander.SDK.Models
public string DirectoryName { get; set; }
public string Description { get; set; }
public DateTime ReleasedOn { get; set; }
public virtual IEnumerable<Action> Actions { get; set; }
public virtual IEnumerable<Tag> Tags { get; set; }
public virtual Company Publisher { get; set; }
public virtual Company Developer { get; set; }