convert ChecksumModule into a Plugin to take advantage of plugin discovery architecture
This commit is contained in:
parent
e998f2cd12
commit
cfceb9e32a
@ -20,13 +20,14 @@
|
||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
using System;
|
||||
using MBS.Framework;
|
||||
|
||||
namespace UniversalEditor.Checksum
|
||||
{
|
||||
/// <summary>
|
||||
/// Provides the minimal functionality required to create a checksum calculation module.
|
||||
/// </summary>
|
||||
public abstract class ChecksumModule
|
||||
public abstract class ChecksumPlugin : Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// The name of this checksum calculation module.
|
||||
@ -75,7 +75,7 @@ namespace UniversalEditor.Checksum.Modules.Adler32
|
||||
/// </remarks>
|
||||
/// <see cref="ICSharpCode.SharpZipLib.Zip.Compression.Streams.InflaterInputStream"/>
|
||||
/// <see cref="ICSharpCode.SharpZipLib.Zip.Compression.Streams.DeflaterOutputStream"/>
|
||||
public sealed class Adler32ChecksumModule : ChecksumModule
|
||||
public sealed class Adler32ChecksumModule : ChecksumPlugin
|
||||
{
|
||||
public override string Name
|
||||
{
|
||||
|
||||
@ -64,7 +64,7 @@ namespace UniversalEditor.Checksum.Modules.CRC32
|
||||
/// the information needed to generate CRC's on data a byte at a time for all
|
||||
/// combinations of CRC register values and incoming bytes.
|
||||
/// </summary>
|
||||
public sealed class CRC32ChecksumModule : ChecksumModule
|
||||
public sealed class CRC32ChecksumModule : ChecksumPlugin
|
||||
{
|
||||
const uint CrcSeed = 0xFFFFFFFF;
|
||||
|
||||
|
||||
@ -43,7 +43,7 @@ namespace UniversalEditor.Checksum.Modules.StrangeCRC
|
||||
/// <summary>
|
||||
/// Bzip2 checksum algorithm
|
||||
/// </summary>
|
||||
public class StrangeCRCChecksumModule : ChecksumModule
|
||||
public class StrangeCRCChecksumModule : ChecksumPlugin
|
||||
{
|
||||
public override string Name { get { return "StrangeCRC"; } }
|
||||
|
||||
|
||||
@ -42,12 +42,18 @@
|
||||
<Reference Include="System.Core" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ChecksumModule.cs" />
|
||||
<Compile Include="ChecksumPlugin.cs" />
|
||||
<Compile Include="Modules\Adler32\Adler32ChecksumModule.cs" />
|
||||
<Compile Include="Modules\CRC32\CRC32ChecksumModule.cs" />
|
||||
<Compile Include="Modules\StrangeCRC\StrangeCRCChecksumModule.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
|
||||
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
|
||||
<Name>MBS.Framework</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
|
||||
@ -1025,7 +1025,7 @@ namespace ICSharpCode.SharpZipLib.BZip2
|
||||
|
||||
int bsBuff;
|
||||
int bsLive;
|
||||
ChecksumModule mCrc = new StrangeCRCChecksumModule();
|
||||
ChecksumPlugin mCrc = new StrangeCRCChecksumModule();
|
||||
|
||||
bool[] inUse = new bool[256];
|
||||
int nInUse;
|
||||
|
||||
@ -2052,7 +2052,7 @@ namespace ICSharpCode.SharpZipLib.BZip2
|
||||
int bytesOut;
|
||||
int bsBuff;
|
||||
int bsLive;
|
||||
ChecksumModule mCrc = new StrangeCRCChecksumModule();
|
||||
ChecksumPlugin mCrc = new StrangeCRCChecksumModule();
|
||||
|
||||
bool[] inUse = new bool[256];
|
||||
int nInUse;
|
||||
|
||||
@ -137,6 +137,10 @@
|
||||
<Project>{0F7D5BD4-7970-412F-ABD7-0A098BB01ACE}</Project>
|
||||
<Name>UniversalEditor.Checksum</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\MBS.Framework\MBS.Framework\MBS.Framework.csproj">
|
||||
<Project>{00266B21-35C9-4A7F-A6BA-D54D7FDCC25C}</Project>
|
||||
<Name>MBS.Framework</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="Modules\Store\" />
|
||||
|
||||
@ -73,7 +73,7 @@ namespace UniversalEditor.Plugins.Shadowflare.DataFormats.FileSystem.SMA
|
||||
}
|
||||
}
|
||||
|
||||
Checksum.ChecksumModule crc = new Checksum.Modules.StrangeCRC.StrangeCRCChecksumModule();
|
||||
Checksum.ChecksumPlugin crc = new Checksum.Modules.StrangeCRC.StrangeCRCChecksumModule();
|
||||
|
||||
protected override void SaveInternal(ObjectModel objectModel)
|
||||
{
|
||||
|
||||
@ -26,7 +26,7 @@ namespace UniversalEditor.Checksum.Modules.GCF
|
||||
/// <summary>
|
||||
/// Implements module for calculating checksum used in Valve GCF archives.
|
||||
/// </summary>
|
||||
public class GCFChecksumModule : ChecksumModule
|
||||
public class GCFChecksumModule : ChecksumPlugin
|
||||
{
|
||||
public override string Name
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user