Add assembly list to ext. tool Attribute, allows shipping dependencies

DBMan works again
This commit is contained in:
YoshiRulz 2020-05-05 09:25:34 +10:00
parent 2c0d6dc32e
commit 8c005e6ffa
No known key found for this signature in database
GPG Key ID: C4DE31C245353FB7
5 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,7 @@ using Community.CsharpSqlite.SQLiteClient;
namespace BizHawk.DBManTool namespace BizHawk.DBManTool
{ {
[ExternalTool("DBMan", Description = "DB Manager")] [ExternalTool("DBMan", Description = "DB Manager", LoadAssemblyFiles = new[] { "CSharp-SQLite.dll" })]
public class CustomMainForm : Form, IExternalToolForm public class CustomMainForm : Form, IExternalToolForm
{ {
public CustomMainForm() public CustomMainForm()

View File

@ -7,6 +7,7 @@
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources> <GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<NET48ExternalToolFormDependency Include="$(ProjectDir)CSharp-SQLite.dll" />
<Reference Include="CSharp-SQLite" <Reference Include="CSharp-SQLite"
HintPath="$(ProjectDir)CSharp-SQLite.dll" HintPath="$(ProjectDir)CSharp-SQLite.dll"
Private="true" /> Private="true" />

View File

@ -29,5 +29,6 @@
</ItemGroup> </ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Copy SourceFiles="$(OutputPath)$(MSBuildProjectName).dll" DestinationFolder="$(ProjectDir)../../output/ExternalTools" /> <Copy SourceFiles="$(OutputPath)$(MSBuildProjectName).dll" DestinationFolder="$(ProjectDir)../../output/ExternalTools" />
<Copy SourceFiles="@(NET48ExternalToolFormDependency)" DestinationFolder="$(ProjectDir)../../output/ExternalTools" />
</Target> </Target>
</Project> </Project>

View File

@ -98,6 +98,8 @@ namespace BizHawk.Client.Common
{ {
public string Description { get; set; } public string Description { get; set; }
public string[] LoadAssemblyFiles { get; set; }
public readonly string Name; public readonly string Name;
public ExternalToolAttribute(string name) public ExternalToolAttribute(string name)

View File

@ -95,6 +95,10 @@ namespace BizHawk.Client.EmuHawk
if (applicabilityAttrs.Count > 1) throw new ExternalToolApplicabilityAttributeBase.DuplicateException(); if (applicabilityAttrs.Count > 1) throw new ExternalToolApplicabilityAttributeBase.DuplicateException();
var toolAttribute = allAttrs.OfType<ExternalToolAttribute>().First(); var toolAttribute = allAttrs.OfType<ExternalToolAttribute>().First();
if (toolAttribute.LoadAssemblyFiles != null)
{
foreach (var depFilename in toolAttribute.LoadAssemblyFiles) Assembly.LoadFrom($"ExternalTools/{depFilename}");
}
var embeddedIconAttr = allAttrs.OfType<ExternalToolEmbeddedIconAttribute>().FirstOrDefault(); var embeddedIconAttr = allAttrs.OfType<ExternalToolEmbeddedIconAttribute>().FirstOrDefault();
if (embeddedIconAttr != null) if (embeddedIconAttr != null)
{ {