diff --git a/LANCommander.Playnite.Extension/InstallController.cs b/LANCommander.Playnite.Extension/InstallController.cs index ab8bbf6..5d9053b 100644 --- a/LANCommander.Playnite.Extension/InstallController.cs +++ b/LANCommander.Playnite.Extension/InstallController.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Core; -namespace LANCommander.Playnite.Extension +namespace LANCommander.PlaynitePlugin { public class LANCommanderInstallController : InstallController { diff --git a/LANCommander.Playnite.Extension/LANCommander.Playnite.Extension.csproj b/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj similarity index 94% rename from LANCommander.Playnite.Extension/LANCommander.Playnite.Extension.csproj rename to LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj index 284400b..e174a31 100644 --- a/LANCommander.Playnite.Extension/LANCommander.Playnite.Extension.csproj +++ b/LANCommander.Playnite.Extension/LANCommander.PlaynitePlugin.csproj @@ -7,8 +7,8 @@ {F9EB13D4-8FD9-4095-B934-F7EC681E6901} Library Properties - LANCommander.Playnite.Extension - LANCommander.Playnite.Extension + LANCommander.PlaynitePlugin + LANCommander.PlaynitePlugin v4.6.2 512 true @@ -51,6 +51,9 @@ + + ..\packages\PowerShellStandard.Library.5.1.1\lib\net452\System.Management.Automation.dll + ..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll @@ -87,6 +90,7 @@ + diff --git a/LANCommander.Playnite.Extension/LANCommanderClient.cs b/LANCommander.Playnite.Extension/LANCommanderClient.cs index 6ec361f..f69ddb2 100644 --- a/LANCommander.Playnite.Extension/LANCommanderClient.cs +++ b/LANCommander.Playnite.Extension/LANCommanderClient.cs @@ -10,7 +10,7 @@ using System.Net; using System.Text; using System.Threading.Tasks; -namespace LANCommander.Playnite.Extension +namespace LANCommander.PlaynitePlugin { internal class LANCommanderClient { diff --git a/LANCommander.Playnite.Extension/PlayniteClient.cs b/LANCommander.Playnite.Extension/PlayniteClient.cs index b4db8a6..db60e26 100644 --- a/LANCommander.Playnite.Extension/PlayniteClient.cs +++ b/LANCommander.Playnite.Extension/PlayniteClient.cs @@ -5,7 +5,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LANCommander.Playnite.Extension +namespace LANCommander.PlaynitePlugin { public class PlayniteClient : LibraryClient { diff --git a/LANCommander.Playnite.Extension/PlayniteLibraryPlugin.cs b/LANCommander.Playnite.Extension/PlayniteLibraryPlugin.cs index d5d4fae..9cee66e 100644 --- a/LANCommander.Playnite.Extension/PlayniteLibraryPlugin.cs +++ b/LANCommander.Playnite.Extension/PlayniteLibraryPlugin.cs @@ -13,7 +13,7 @@ using YamlDotNet.Serialization; using YamlDotNet.Serialization.NamingConventions; using PN = Playnite; -namespace LANCommander.Playnite.Extension +namespace LANCommander.PlaynitePlugin { public class PlayniteLibraryPlugin : LibraryPlugin { diff --git a/LANCommander.Playnite.Extension/PlayniteSettings.cs b/LANCommander.Playnite.Extension/PlayniteSettings.cs index bbed2d4..3ce2e26 100644 --- a/LANCommander.Playnite.Extension/PlayniteSettings.cs +++ b/LANCommander.Playnite.Extension/PlayniteSettings.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LANCommander.Playnite.Extension +namespace LANCommander.PlaynitePlugin { public class PlayniteSettingsViewModel : ObservableObject, ISettings { diff --git a/LANCommander.Playnite.Extension/PlayniteSettingsView.xaml b/LANCommander.Playnite.Extension/PlayniteSettingsView.xaml index c421dd1..c9659d6 100644 --- a/LANCommander.Playnite.Extension/PlayniteSettingsView.xaml +++ b/LANCommander.Playnite.Extension/PlayniteSettingsView.xaml @@ -1,4 +1,4 @@ - parameters) + { + using (PowerShell ps = PowerShell.Create()) + { + ps.AddScript(script); + ps.AddParameters(parameters); + + var output = ps.Invoke(); + } + } + + public void RunInstallScript(Game game) + { + var defaultParameters = new Dictionary() + { + { "InstallDir", game.InstallDirectory }, + { "Title", game.Name }, + { "Description", game.Description }, + { "GameId", game.GameId } + }; + + var scriptPath = Path.Combine(game.InstallDirectory, "_install.ps1"); + + if (!File.Exists(scriptPath)) + throw new FileNotFoundException(scriptPath); + + var scriptContents = File.ReadAllText(scriptPath); + + RunScript(scriptPath, defaultParameters); + } + } +} diff --git a/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs b/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs index 4ea9728..003df30 100644 --- a/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs +++ b/LANCommander.Playnite.Extension/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("LANCommander.Playnite.Extension")] +[assembly: AssemblyTitle("LANCommander.PlaynitePlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("LANCommander.Playnite.Extension")] +[assembly: AssemblyProduct("LANCommander.PlaynitePlugin")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/LANCommander.Playnite.Extension/UninstallController.cs b/LANCommander.Playnite.Extension/UninstallController.cs index 929a00f..c04e80f 100644 --- a/LANCommander.Playnite.Extension/UninstallController.cs +++ b/LANCommander.Playnite.Extension/UninstallController.cs @@ -12,7 +12,7 @@ using System.Threading.Tasks; using ICSharpCode.SharpZipLib.Zip; using ICSharpCode.SharpZipLib.Core; -namespace LANCommander.Playnite.Extension +namespace LANCommander.PlaynitePlugin { public class LANCommanderUninstallController : UninstallController { diff --git a/LANCommander.Playnite.Extension/ViewModels/Authentication.cs b/LANCommander.Playnite.Extension/ViewModels/Authentication.cs index d93c4a5..9f2632a 100644 --- a/LANCommander.Playnite.Extension/ViewModels/Authentication.cs +++ b/LANCommander.Playnite.Extension/ViewModels/Authentication.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -namespace LANCommander.Playnite.Extension.ViewModels +namespace LANCommander.PlaynitePlugin.ViewModels { internal class Authentication { diff --git a/LANCommander.Playnite.Extension/Views/Authentication.xaml b/LANCommander.Playnite.Extension/Views/Authentication.xaml index 9577a0a..6cca6af 100644 --- a/LANCommander.Playnite.Extension/Views/Authentication.xaml +++ b/LANCommander.Playnite.Extension/Views/Authentication.xaml @@ -1,10 +1,10 @@ - diff --git a/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs b/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs index a037ce2..fcbfd0e 100644 --- a/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs +++ b/LANCommander.Playnite.Extension/Views/Authentication.xaml.cs @@ -15,7 +15,7 @@ using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; -namespace LANCommander.Playnite.Extension.Views +namespace LANCommander.PlaynitePlugin.Views { public partial class Authentication : UserControl { diff --git a/LANCommander.Playnite.Extension/extension.yaml b/LANCommander.Playnite.Extension/extension.yaml index b37fd3d..cd0446d 100644 --- a/LANCommander.Playnite.Extension/extension.yaml +++ b/LANCommander.Playnite.Extension/extension.yaml @@ -1,7 +1,7 @@ -Id: LANCommander.Playnite.Extension_48e1bac7-e0a0-45d7-ba83-36f5e9e959fc +Id: LANCommander.PlaynitePlugin_48e1bac7-e0a0-45d7-ba83-36f5e9e959fc Name: LANCommander Playnite Extension Author: Pat Hartl Version: 1.0 -Module: LANCommander.Playnite.Extension.dll +Module: LANCommander.PlaynitePlugin.dll Type: GameLibrary Icon: icon.png \ No newline at end of file diff --git a/LANCommander.Playnite.Extension/packages.config b/LANCommander.Playnite.Extension/packages.config index 484a323..2728830 100644 --- a/LANCommander.Playnite.Extension/packages.config +++ b/LANCommander.Playnite.Extension/packages.config @@ -2,6 +2,7 @@ + diff --git a/LANCommander.sln b/LANCommander.sln index 4f6adb2..b9ea7d4 100644 --- a/LANCommander.sln +++ b/LANCommander.sln @@ -5,9 +5,9 @@ VisualStudioVersion = 17.1.32328.378 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander", "LANCommander\LANCommander.csproj", "{C64D17A8-CDB3-4D1E-858F-6CF05B6FED4D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.Playnite.Extension", "LANCommander.Playnite.Extension\LANCommander.Playnite.Extension.csproj", "{F9EB13D4-8FD9-4095-B934-F7EC681E6901}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.PlaynitePlugin", "LANCommander.Playnite.Extension\LANCommander.PlaynitePlugin.csproj", "{F9EB13D4-8FD9-4095-B934-F7EC681E6901}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LANCommander.SDK", "LANCommander.SDK\LANCommander.SDK.csproj", "{4C2A71FD-A30B-4D62-888A-4EF843D8E506}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "LANCommander.SDK", "LANCommander.SDK\LANCommander.SDK.csproj", "{4C2A71FD-A30B-4D62-888A-4EF843D8E506}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/LANCommander/LANCommander.csproj b/LANCommander/LANCommander.csproj index 4cf90e2..72883f7 100644 --- a/LANCommander/LANCommander.csproj +++ b/LANCommander/LANCommander.csproj @@ -57,4 +57,6 @@ + +