-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update the app to use a plug-in style system where each monster forma…
…t is its own assembly (#17) * Extract and add converter specific logic to the converter classes This is a first of several commits to pluggable converter architecture. Converter logic was remove from the MonsterFileProcessor class. Each converter must be able to identify what it supports and implement the appropriate logic. * Update logic in MonsterFileProcessor to only use information provided from the converterclasses instead of hardcoded logic * Work on organizing and sperating each converter into its own assembly Move each converter into its own assembly. Move generic Monster classes into its own assembly. Fixed UI code to use parsed converter types instead of being hardcoded (WIP, mostly fixed compilation errors) Working on pluginhelper class which finds available converters on the local system * dynamically load hardcoded list of converters * Update project to .NET5 * Remove test code from pluginhelper class * Change plugin helper instance to async to ensure it's loaded all dlls before use * Fix command line usage with use of new pluginhelper class * update nuget packages * update github actions for .net 5 workload * update readme
- Loading branch information
Showing
38 changed files
with
641 additions
and
371 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
using MonsterConverterInterface.MonsterTypes; | ||
using System; | ||
|
||
namespace MonsterConverterInterface | ||
{ | ||
public enum FileSource | ||
{ | ||
LocalFiles, | ||
Web | ||
} | ||
|
||
// name, isreadsupported, and iswritesupported can all be metadataattributes should that be valuable localfile source too | ||
// none of those fields deal with function they all are for information only | ||
public interface IMonsterConverter | ||
{ | ||
string ConverterName { get; } | ||
|
||
string FileExt { get; } | ||
|
||
FileSource FileSource { get; } | ||
|
||
bool IsReadSupported { get; } | ||
|
||
bool IsWriteSupported { get; } | ||
|
||
string[] GetFilesForConversion(string directory); | ||
|
||
bool ReadMonster(string filename, out Monster monster); | ||
|
||
bool WriteMonster(string directory, ref Monster monster); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Text; | ||
using MonsterConverterInterface.MonsterTypes; | ||
|
||
namespace MonsterConverterInterface | ||
{ | ||
public abstract class MonsterConverter : IMonsterConverter | ||
{ | ||
public abstract string ConverterName { get; } | ||
|
||
public abstract string FileExt { get; } | ||
|
||
public virtual FileSource FileSource { get => FileSource.LocalFiles; } | ||
|
||
public abstract bool IsReadSupported { get; } | ||
|
||
public abstract bool IsWriteSupported { get; } | ||
|
||
public virtual string[] GetFilesForConversion(string directory) | ||
{ | ||
string searchPattern = "*." + FileExt; | ||
return Directory.GetFiles(directory, searchPattern, SearchOption.AllDirectories); | ||
} | ||
|
||
public abstract bool ReadMonster(string filename, out Monster monster); | ||
|
||
public abstract bool WriteMonster(string directory, ref Monster monster); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
app/MonsterConverterInterface/MonsterConverterInterface.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.20" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net5.0</TargetFramework> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'"> | ||
<OutputPath>..\..\bin\$(Configuration)</OutputPath> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
<OutputPath>..\..\bin\$(Configuration)</OutputPath> | ||
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.VisualStudio.Composition" Version="16.9.20" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\MonsterConverterInterface\MonsterConverterInterface.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.