Move partitions plugins to a separate library.

This commit is contained in:
2015-10-05 19:58:42 +01:00
parent 4a3583d13e
commit fda7fee90c
14 changed files with 178 additions and 40 deletions

View File

@@ -1,3 +1,8 @@
2015-10-05 Natalia Portillo <claunia@claunia.com>
* DiscImageChef.sln:
Move partitions plugins to a separate library.
2015-10-05 Natalia Portillo <claunia@claunia.com>
* DiscImageChef.sln:

View File

@@ -54,7 +54,7 @@ namespace DiscImageChef.PartPlugins
// "TS", old entry magic
const UInt16 APM_OLDENT = 0x5453;
public AppleMap(PluginBase Core)
public AppleMap()
{
Name = "Apple Partition Map";
PluginUUID = new Guid("36405F8D-4F1A-07F5-209C-223D735D6D22");
@@ -106,7 +106,7 @@ namespace DiscImageChef.PartPlugins
{
sector_size = 512;
APMFromHDDOnCD = true;
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Apple Partition Map Plugin): PM sector size is 512 bytes, but device's 2048");
}
else

View File

@@ -55,7 +55,7 @@ namespace DiscImageChef.PartPlugins
const UInt32 TypeNetBSD = 0x004E4244;
const UInt32 TypeNetBSDSwap = 0x004E4253;
public AtariPartitions(PluginBase Core)
public AtariPartitions()
{
Name = "Atari partitions";
PluginUUID = new Guid("d1dd0f24-ec39-4c4d-9072-be31919a3b5e");
@@ -102,7 +102,7 @@ namespace DiscImageChef.PartPlugins
table.badLength = BigEndianBitConverter.ToUInt32(sector, 506);
table.checksum = BigEndianBitConverter.ToUInt16(sector, 510);
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
Checksums.SHA1Context sha1Ctx = new Checksums.SHA1Context();
sha1Ctx.Init();
@@ -145,7 +145,7 @@ namespace DiscImageChef.PartPlugins
if (table.entries[i].start <= imagePlugin.GetSectors())
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
if ((table.entries[i].start + table.entries[i].length) > imagePlugin.GetSectors())
Console.WriteLine("DEBUG (Atari plugin): WARNING: End of partition goes beyond device size");
@@ -225,7 +225,7 @@ namespace DiscImageChef.PartPlugins
validTable = true;
if (extendedTable.entries[j].start <= imagePlugin.GetSectors())
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
if ((extendedTable.entries[j].start + extendedTable.entries[j].length) > imagePlugin.GetSectors())
Console.WriteLine("DEBUG (Atari plugin): WARNING: End of partition goes beyond device size");
@@ -296,7 +296,7 @@ namespace DiscImageChef.PartPlugins
{
if (table.icdEntries[i].start <= imagePlugin.GetSectors())
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
if ((table.icdEntries[i].start + table.icdEntries[i].length) > imagePlugin.GetSectors())
Console.WriteLine("DEBUG (Atari plugin): WARNING: End of partition goes beyond device size");

View File

@@ -0,0 +1,12 @@
2015-10-05 Natalia Portillo <claunia@claunia.com>
* MBR.cs:
* RDB.cs:
* NeXT.cs:
* Atari.cs:
* AppleMap.cs:
* PartPlugin.cs:
* Properties/AssemblyInfo.cs:
* DiscImageChef.Partitions.csproj:
Move partitions plugins to a separate library.

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>DiscImageChef.Partitions</RootNamespace>
<AssemblyName>DiscImageChef.Partitions</AssemblyName>
<ReleaseVersion>2.2</ReleaseVersion>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug</OutputPath>
<DefineConstants>DEBUG;</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>full</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release</OutputPath>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<ConsolePause>false</ConsolePause>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="AppleMap.cs" />
<Compile Include="Atari.cs" />
<Compile Include="MBR.cs" />
<Compile Include="NeXT.cs" />
<Compile Include="PartPlugin.cs" />
<Compile Include="RDB.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
<ProjectReference Include="..\DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj">
<Project>{F2B84194-26EB-4227-B1C5-6602517E85AE}</Project>
<Name>DiscImageChef.CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Helpers\DiscImageChef.Helpers.csproj">
<Project>{F8BDF57B-1571-4CD0-84B3-B422088D359A}</Project>
<Name>DiscImageChef.Helpers</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.DiscImages\DiscImageChef.DiscImages.csproj">
<Project>{74032CBC-339B-42F3-AF6F-E96C261F3E6A}</Project>
<Name>DiscImageChef.DiscImages</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Checksums\DiscImageChef.Checksums.csproj">
<Project>{CC48B324-A532-4A45-87A6-6F91F7141E8D}</Project>
<Name>DiscImageChef.Checksums</Name>
</ProjectReference>
</ItemGroup>
</Project>

View File

@@ -47,7 +47,7 @@ namespace DiscImageChef.PartPlugins
{
const UInt16 MBRSignature = 0xAA55;
public MBR(PluginBase Core)
public MBR()
{
Name = "Master Boot Record";
PluginUUID = new Guid("5E8A34E8-4F1A-59E6-4BF7-7EA647063A76");

View File

@@ -56,7 +56,7 @@ namespace DiscImageChef.PartPlugins
// 180
const UInt16 disktabEntrySize = 0x2C;
// 44
public NeXTDisklabel(PluginBase Core)
public NeXTDisklabel()
{
Name = "NeXT Disklabel";
PluginUUID = new Guid("246A6D93-4F1A-1F8A-344D-50187A5513A9");

View File

@@ -0,0 +1,27 @@
using System.Reflection;
using System.Runtime.CompilerServices;
// Information about this assembly is defined by the following attributes.
// Change them to the values specific to your project.
[assembly: AssemblyTitle("DiscImageChef.Partitions")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Claunia.com")]
[assembly: AssemblyProduct("")]
[assembly: AssemblyCopyright("© Claunia.com")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// The assembly version has the format "{Major}.{Minor}.{Build}.{Revision}".
// The form "{Major}.{Minor}.*" will automatically update the build and revision,
// and "{Major}.{Minor}.{Build}.*" will update just the revision.
[assembly: AssemblyVersion("1.0.*")]
// The following attributes are used to specify the signing key for the assembly,
// if desired. See the Mono documentation for more information about signing.
//[assembly: AssemblyDelaySign(false)]
//[assembly: AssemblyKeyFile("")]

View File

@@ -271,7 +271,7 @@ namespace DiscImageChef.PartPlugins
/// </summary>
const UInt32 FlagsNoAutomount = 0x00000002;
public AmigaRigidDiskBlock(PluginBase Core)
public AmigaRigidDiskBlock()
{
Name = "Amiga Rigid Disk Block";
PluginUUID = new Guid("8D72ED97-1854-4170-9CE4-6E8446FD9863");
@@ -904,12 +904,12 @@ namespace DiscImageChef.PartPlugins
byte[] tmpSector = imagePlugin.ReadSector(RDBBlock);
UInt32 magic = BigEndianBitConverter.ToUInt32(tmpSector, 0);
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Possible magic at block {0} is 0x{1:X8}", RDBBlock, magic);
if (magic == RigidDiskBlockMagic)
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Found RDB magic at block {0}", RDBBlock);
foundRDB = true;
@@ -1001,7 +1001,7 @@ namespace DiscImageChef.PartPlugins
RDB.reserved24 = BigEndianBitConverter.ToUInt32(sector, 0xF8);
RDB.reserved25 = BigEndianBitConverter.ToUInt32(sector, 0xFC);
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
Console.WriteLine("DEBUG (Amiga RDB plugin): RDB.magic = 0x{0:X8}", RDB.magic);
Console.WriteLine("DEBUG (Amiga RDB plugin): RDB.size = {0} longs, {1} bytes", RDB.size, RDB.size * 4);
@@ -1067,7 +1067,7 @@ namespace DiscImageChef.PartPlugins
nextBlock = RDB.badblock_ptr;
while (nextBlock != 0xFFFFFFFF)
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Going to block {0} in search of a BadBlock block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
@@ -1076,7 +1076,7 @@ namespace DiscImageChef.PartPlugins
if (magic != BadBlockListMagic)
break;
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Found BadBlock block");
BadBlockList chainEntry = new BadBlockList();
@@ -1090,7 +1090,7 @@ namespace DiscImageChef.PartPlugins
ulong entries = (chainEntry.size - 6) / 2;
chainEntry.blockPairs = new BadBlockEntry[entries];
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
Console.WriteLine("DEBUG (Amiga RDB plugin): chainEntry.magic = 0x{0:X8}", chainEntry.magic);
Console.WriteLine("DEBUG (Amiga RDB plugin): chainEntry.size = {0} longs, {1} bytes", chainEntry.size, chainEntry.size * 4);
@@ -1105,7 +1105,7 @@ namespace DiscImageChef.PartPlugins
chainEntry.blockPairs[i].badBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 0));
chainEntry.blockPairs[i].goodBlock = BigEndianBitConverter.ToUInt32(sector, (int)(0x18 + i * 8 + 4));
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Bad block at {0} replaced with good block at {1}",
chainEntry.blockPairs[i].badBlock, chainEntry.blockPairs[i].goodBlock);
}
@@ -1119,7 +1119,7 @@ namespace DiscImageChef.PartPlugins
nextBlock = RDB.partition_ptr;
while (nextBlock != 0xFFFFFFFF)
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Going to block {0} in search of a PartitionEntry block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
@@ -1128,7 +1128,7 @@ namespace DiscImageChef.PartPlugins
if (magic != PartitionBlockMagic)
break;
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Found PartitionEntry block");
PartitionEntry partEntry = new PartitionEntry();
@@ -1183,7 +1183,7 @@ namespace DiscImageChef.PartPlugins
partEntry.dosEnvVec.control = BigEndianBitConverter.ToUInt32(sector, 0xC8);
partEntry.dosEnvVec.bootBlocks = BigEndianBitConverter.ToUInt32(sector, 0xCC);
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
Console.WriteLine("DEBUG (Amiga RDB plugin): partEntry.magic = 0x{0:X8}", partEntry.magic);
Console.WriteLine("DEBUG (Amiga RDB plugin): partEntry.size = {0} longs, {1} bytes", partEntry.size, partEntry.size * 4);
@@ -1245,7 +1245,7 @@ namespace DiscImageChef.PartPlugins
nextBlock = RDB.fsheader_ptr;
while (nextBlock != 0xFFFFFFFF)
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Going to block {0} in search of a FileSystemHeader block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
@@ -1254,7 +1254,7 @@ namespace DiscImageChef.PartPlugins
if (magic != FilesystemHeaderMagic)
break;
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Found FileSystemHeader block");
FileSystemHeader FSHD = new FileSystemHeader();
@@ -1282,7 +1282,7 @@ namespace DiscImageChef.PartPlugins
FSHD.dnode.seglist_ptr = BigEndianBitConverter.ToUInt32(sector, 0x48);
FSHD.dnode.global_vec = BigEndianBitConverter.ToUInt32(sector, 0x4C);
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
Console.WriteLine("DEBUG (Amiga RDB plugin): FSHD.magic = 0x{0:X8}", FSHD.magic);
Console.WriteLine("DEBUG (Amiga RDB plugin): FSHD.size = {0} longs, {1} bytes", FSHD.size, FSHD.size * 4);
@@ -1313,7 +1313,7 @@ namespace DiscImageChef.PartPlugins
sha1Ctx.Init();
while (nextBlock != 0xFFFFFFFF)
{
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Going to block {0} in search of a LoadSegment block", nextBlock);
sector = imagePlugin.ReadSector(nextBlock);
@@ -1322,7 +1322,7 @@ namespace DiscImageChef.PartPlugins
if (magicSeg != LoadSegMagic)
break;
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): Found LoadSegment block");
thereAreLoadSegments = true;
@@ -1335,7 +1335,7 @@ namespace DiscImageChef.PartPlugins
loadSeg.loadData = new byte[(loadSeg.size - 5) * 4];
Array.Copy(sector, 0x14, loadSeg.loadData, 0, (loadSeg.size - 5) * 4);
if (MainClass.isDebug)
//if (MainClass.isDebug)
{
Console.WriteLine("DEBUG (Amiga RDB plugin): loadSeg.magic = 0x{0:X8}", loadSeg.magic);
Console.WriteLine("DEBUG (Amiga RDB plugin): loadSeg.size = {0} longs, {1} bytes", loadSeg.size, loadSeg.size * 4);
@@ -1352,7 +1352,7 @@ namespace DiscImageChef.PartPlugins
if (thereAreLoadSegments)
{
string loadSegSHA1 = sha1Ctx.End();
if (MainClass.isDebug)
//if (MainClass.isDebug)
Console.WriteLine("DEBUG (Amiga RDB plugin): LoadSegment data SHA1: {0}", loadSegSHA1);
}

View File

@@ -15,6 +15,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.DiscImages",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.CommonTypes", "DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj", "{F2B84194-26EB-4227-B1C5-6602517E85AE}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Partitions", "DiscImageChef.Partitions\DiscImageChef.Partitions.csproj", "{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x86 = Debug|x86
@@ -39,6 +41,10 @@ Global
{CC48B324-A532-4A45-87A6-6F91F7141E8D}.Debug|x86.Build.0 = Debug|Any CPU
{CC48B324-A532-4A45-87A6-6F91F7141E8D}.Release|x86.ActiveCfg = Release|Any CPU
{CC48B324-A532-4A45-87A6-6F91F7141E8D}.Release|x86.Build.0 = Release|Any CPU
{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}.Debug|x86.ActiveCfg = Debug|Any CPU
{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}.Debug|x86.Build.0 = Debug|Any CPU
{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}.Release|x86.ActiveCfg = Release|Any CPU
{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}.Release|x86.Build.0 = Release|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Debug|x86.ActiveCfg = Debug|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Debug|x86.Build.0 = Debug|Any CPU
{F2B84194-26EB-4227-B1C5-6602517E85AE}.Release|x86.ActiveCfg = Release|Any CPU

View File

@@ -1,3 +1,15 @@
2015-10-05 Natalia Portillo <claunia@claunia.com>
* Plugins.cs:
* PartPlugins/MBR.cs:
* PartPlugins/RDB.cs:
* PartPlugins/NeXT.cs:
* DiscImageChef.csproj:
* PartPlugins/Atari.cs:
* PartPlugins/AppleMap.cs:
* PartPlugins/PartPlugin.cs:
Move partitions plugins to a separate library.
2015-10-05 Natalia Portillo <claunia@claunia.com>
* Plugins.cs:

View File

@@ -47,12 +47,8 @@
<Compile Include="Plugins\Opera.cs" />
<Compile Include="Plugins\AppleHFS.cs" />
<Compile Include="Plugins\FAT.cs" />
<Compile Include="PartPlugins\PartPlugin.cs" />
<Compile Include="PartPlugins\AppleMap.cs" />
<Compile Include="Plugins\FFS.cs" />
<Compile Include="Plugins\AppleHFSPlus.cs" />
<Compile Include="PartPlugins\MBR.cs" />
<Compile Include="PartPlugins\NeXT.cs" />
<Compile Include="Plugins\BFS.cs" />
<Compile Include="Plugins\HPFS.cs" />
<Compile Include="Plugins\NTFS.cs" />
@@ -80,9 +76,7 @@
<Compile Include="Decoders\BD.cs" />
<Compile Include="Decoders\DVD.cs" />
<Compile Include="Plugins\ProDOS.cs" />
<Compile Include="PartPlugins\RDB.cs" />
<Compile Include="Plugins\AmigaDOS.cs" />
<Compile Include="PartPlugins\Atari.cs" />
<Compile Include="Commands\Entropy.cs" />
<Compile Include="Decoders\Floppy.cs" />
<Compile Include="DetectImageFormat.cs" />
@@ -199,5 +193,9 @@
<Project>{F2B84194-26EB-4227-B1C5-6602517E85AE}</Project>
<Name>DiscImageChef.CommonTypes</Name>
</ProjectReference>
<ProjectReference Include="..\DiscImageChef.Partitions\DiscImageChef.Partitions.csproj">
<Project>{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}</Project>
<Name>DiscImageChef.Partitions</Name>
</ProjectReference>
</ItemGroup>
</Project>

View File

@@ -60,7 +60,9 @@ namespace DiscImageChef
public void RegisterAllPlugins()
{
Assembly assembly = Assembly.GetAssembly(typeof(ImagePlugin));
Assembly assembly;
assembly = Assembly.GetAssembly(typeof(ImagePlugin));
foreach (Type type in assembly.GetTypes())
{
@@ -78,6 +80,24 @@ namespace DiscImageChef
}
}
assembly = Assembly.GetAssembly(typeof(PartPlugin));
foreach (Type type in assembly.GetTypes())
{
try
{
if (type.IsSubclassOf(typeof(PartPlugin)))
{
PartPlugin plugin = (PartPlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
RegisterPartPlugin(plugin);
}
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
}
assembly = Assembly.GetExecutingAssembly();
foreach (Type type in assembly.GetTypes())
@@ -89,12 +109,6 @@ namespace DiscImageChef
Plugin plugin = (Plugin)type.GetConstructor(new [] { typeof(PluginBase) }).Invoke(new object[] { this });
RegisterPlugin(plugin);
}
else if (type.IsSubclassOf(typeof(PartPlugin)))
{
PartPlugin partplugin = (PartPlugin)type.GetConstructor(new [] { typeof(PluginBase) }).Invoke(new object[] { this });
RegisterPartPlugin(partplugin);
}
}
catch (Exception exception)
{