Changed plugin namespace to avoid collision with Playnite. Added basic PowerShell helper.
parent
b2ffdb9f23
commit
508150abdc
|
@ -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
|
||||
{
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<ProjectGuid>{F9EB13D4-8FD9-4095-B934-F7EC681E6901}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>LANCommander.Playnite.Extension</RootNamespace>
|
||||
<AssemblyName>LANCommander.Playnite.Extension</AssemblyName>
|
||||
<RootNamespace>LANCommander.PlaynitePlugin</RootNamespace>
|
||||
<AssemblyName>LANCommander.PlaynitePlugin</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
|
@ -51,6 +51,9 @@
|
|||
</Reference>
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\PowerShellStandard.Library.5.1.1\lib\net452\System.Management.Automation.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Memory.4.5.4\lib\net461\System.Memory.dll</HintPath>
|
||||
</Reference>
|
||||
|
@ -87,6 +90,7 @@
|
|||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="PowerShellRuntime.cs" />
|
||||
<Compile Include="UninstallController.cs" />
|
||||
<Compile Include="InstallController.cs" />
|
||||
<Compile Include="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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<UserControl x:Class="LANCommander.Playnite.Extension.PlayniteSettingsView"
|
||||
<UserControl x:Class="LANCommander.PlaynitePlugin.PlayniteSettingsView"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
|
|
@ -15,7 +15,7 @@ using System.Windows.Media.Imaging;
|
|||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace LANCommander.Playnite.Extension
|
||||
namespace LANCommander.PlaynitePlugin
|
||||
{
|
||||
public partial class PlayniteSettingsView : UserControl
|
||||
{
|
||||
|
|
|
@ -0,0 +1,45 @@
|
|||
using Playnite.SDK.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management.Automation;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace LANCommander.PlaynitePlugin
|
||||
{
|
||||
internal class PowerShellRuntime
|
||||
{
|
||||
public void RunScript(string script, Dictionary<string, object> 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<string, object>()
|
||||
{
|
||||
{ "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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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("")]
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
<UserControl x:Class="LANCommander.Playnite.Extension.Views.Authentication"
|
||||
<UserControl x:Class="LANCommander.PlaynitePlugin.Views.Authentication"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:sys="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:ViewModels="clr-namespace:LANCommander.Playnite.Extension.ViewModels"
|
||||
xmlns:ViewModels="clr-namespace:LANCommander.PlaynitePlugin.ViewModels"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="130" d:DesignWidth="275" d:DataContext="{d:DesignInstance Type=ViewModels:Authentication, IsDesignTimeCreatable=True}">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
|
|
|
@ -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
|
||||
{
|
||||
|
|
|
@ -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
|
|
@ -2,6 +2,7 @@
|
|||
<packages>
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="5.0.0" targetFramework="net462" />
|
||||
<package id="PlayniteSDK" version="6.8.0" targetFramework="net462" />
|
||||
<package id="PowerShellStandard.Library" version="5.1.1" targetFramework="net462" />
|
||||
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
|
||||
<package id="SharpZipLib" version="1.4.1" targetFramework="net462" />
|
||||
<package id="System.Buffers" version="4.5.1" targetFramework="net462" />
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -57,4 +57,6 @@
|
|||
</TypeScriptCompile>
|
||||
</ItemGroup>
|
||||
|
||||
<ProjectExtensions><VisualStudio><UserProperties /></VisualStudio></ProjectExtensions>
|
||||
|
||||
</Project>
|
||||
|
|
Loading…
Reference in New Issue