From 6038c2b30427a42f6128474feae0b05a92e25e9e Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sat, 29 Apr 2017 08:43:43 +0100 Subject: [PATCH] Added code to retrieve metadata from media images using DiscImageChef libraries. --- osrepodbmgr.sln | 48 + osrepodbmgr/ChangeLog | 14 + osrepodbmgr/Checksum.cs | 551 ++++++++++ osrepodbmgr/Core.cs | 3 + osrepodbmgr/DetectImageFormat.cs | 111 ++ osrepodbmgr/DicCore.cs | 959 +++++++++++++++++- osrepodbmgr/PluginBase.cs | 137 +++ osrepodbmgr/dlgMetadata.cs | 129 ++- osrepodbmgr/gtk-gui/gui.stetic | 30 +- .../gtk-gui/osrepodbmgr.dlgMetadata.cs | 152 +-- osrepodbmgr/osrepodbmgr.csproj | 34 +- 11 files changed, 2053 insertions(+), 115 deletions(-) create mode 100644 osrepodbmgr/Checksum.cs create mode 100644 osrepodbmgr/DetectImageFormat.cs create mode 100644 osrepodbmgr/PluginBase.cs diff --git a/osrepodbmgr.sln b/osrepodbmgr.sln index 4cd29c9..1c7d3f0 100644 --- a/osrepodbmgr.sln +++ b/osrepodbmgr.sln @@ -9,6 +9,22 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Helpers", "Di EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Console", "DiscImageChef\DiscImageChef.Console\DiscImageChef.Console.csproj", "{CCAA7AFE-C094-4D82-A66D-630DE8A3F545}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.DiscImages", "DiscImageChef\DiscImageChef.DiscImages\DiscImageChef.DiscImages.csproj", "{74032CBC-339B-42F3-AF6F-E96C261F3E6A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Filesystems", "DiscImageChef\DiscImageChef.Filesystems\DiscImageChef.Filesystems.csproj", "{D7016DF2-5A5E-4524-B40D-BA2D59576688}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Filters", "DiscImageChef\DiscImageChef.Filters\DiscImageChef.Filters.csproj", "{D571B8EF-903D-4353-BDD5-B834F9F029EF}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Partitions", "DiscImageChef\DiscImageChef.Partitions\DiscImageChef.Partitions.csproj", "{DA7AB65D-B5BA-4003-8893-A51BB071BA2F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.CommonTypes", "DiscImageChef\DiscImageChef.CommonTypes\DiscImageChef.CommonTypes.csproj", "{F2B84194-26EB-4227-B1C5-6602517E85AE}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Claunia.RsrcFork", "DiscImageChef\Claunia.RsrcFork\Claunia.RsrcFork\Claunia.RsrcFork.csproj", "{CA231ED3-0C78-496C-AAFE-D085F6E9BEC6}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Decoders", "DiscImageChef\DiscImageChef.Decoders\DiscImageChef.Decoders.csproj", "{0BEB3088-B634-4289-AE17-CDF2D25D00D5}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DiscImageChef.Metadata", "DiscImageChef\DiscImageChef.Metadata\DiscImageChef.Metadata.csproj", "{9F213318-5CB8-4066-A757-074489C9F818}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x86 = Debug|x86 @@ -31,6 +47,38 @@ Global {CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Debug|x86.Build.0 = Debug|Any CPU {CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Release|x86.ActiveCfg = Release|Any CPU {CCAA7AFE-C094-4D82-A66D-630DE8A3F545}.Release|x86.Build.0 = Release|Any CPU + {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Debug|x86.ActiveCfg = Debug|Any CPU + {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Debug|x86.Build.0 = Debug|Any CPU + {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Release|x86.ActiveCfg = Release|Any CPU + {74032CBC-339B-42F3-AF6F-E96C261F3E6A}.Release|x86.Build.0 = Release|Any CPU + {D7016DF2-5A5E-4524-B40D-BA2D59576688}.Debug|x86.ActiveCfg = Debug|Any CPU + {D7016DF2-5A5E-4524-B40D-BA2D59576688}.Debug|x86.Build.0 = Debug|Any CPU + {D7016DF2-5A5E-4524-B40D-BA2D59576688}.Release|x86.ActiveCfg = Release|Any CPU + {D7016DF2-5A5E-4524-B40D-BA2D59576688}.Release|x86.Build.0 = Release|Any CPU + {D571B8EF-903D-4353-BDD5-B834F9F029EF}.Debug|x86.ActiveCfg = Debug|Any CPU + {D571B8EF-903D-4353-BDD5-B834F9F029EF}.Debug|x86.Build.0 = Debug|Any CPU + {D571B8EF-903D-4353-BDD5-B834F9F029EF}.Release|x86.ActiveCfg = Release|Any CPU + {D571B8EF-903D-4353-BDD5-B834F9F029EF}.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 + {F2B84194-26EB-4227-B1C5-6602517E85AE}.Release|x86.Build.0 = Release|Any CPU + {CA231ED3-0C78-496C-AAFE-D085F6E9BEC6}.Debug|x86.ActiveCfg = Debug|Any CPU + {CA231ED3-0C78-496C-AAFE-D085F6E9BEC6}.Debug|x86.Build.0 = Debug|Any CPU + {CA231ED3-0C78-496C-AAFE-D085F6E9BEC6}.Release|x86.ActiveCfg = Release|Any CPU + {CA231ED3-0C78-496C-AAFE-D085F6E9BEC6}.Release|x86.Build.0 = Release|Any CPU + {0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Debug|x86.ActiveCfg = Debug|Any CPU + {0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Debug|x86.Build.0 = Debug|Any CPU + {0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Release|x86.ActiveCfg = Release|Any CPU + {0BEB3088-B634-4289-AE17-CDF2D25D00D5}.Release|x86.Build.0 = Release|Any CPU + {9F213318-5CB8-4066-A757-074489C9F818}.Debug|x86.ActiveCfg = Debug|Any CPU + {9F213318-5CB8-4066-A757-074489C9F818}.Debug|x86.Build.0 = Debug|Any CPU + {9F213318-5CB8-4066-A757-074489C9F818}.Release|x86.ActiveCfg = Release|Any CPU + {9F213318-5CB8-4066-A757-074489C9F818}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(MonoDevelopProperties) = preSolution Policies = $0 diff --git a/osrepodbmgr/ChangeLog b/osrepodbmgr/ChangeLog index 55ed6e1..3be0827 100644 --- a/osrepodbmgr/ChangeLog +++ b/osrepodbmgr/ChangeLog @@ -1,3 +1,17 @@ +2017-04-29 Natalia Portillo + + * Core.cs: + * DicCore.cs: + * Checksum.cs: + * PluginBase.cs: + * dlgMetadata.cs: + * gtk-gui/gui.stetic: + * osrepodbmgr.csproj: + * DetectImageFormat.cs: + * gtk-gui/osrepodbmgr.dlgMetadata.cs: + Added code to retrieve metadata from media images using + DiscImageChef libraries. + 2017-04-29 Natalia Portillo * Core.cs: diff --git a/osrepodbmgr/Checksum.cs b/osrepodbmgr/Checksum.cs new file mode 100644 index 0000000..4edb96d --- /dev/null +++ b/osrepodbmgr/Checksum.cs @@ -0,0 +1,551 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Checksum.cs +// Author(s) : Natalia Portillo +// +// Component : Core methods. +// +// --[ Description ] ---------------------------------------------------------- +// +// Methods to checksum data. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2016 Natalia Portillo +// ****************************************************************************/ + +using System.Collections.Generic; +using DiscImageChef.Checksums; +using Schemas; +using System.Threading; + +namespace osrepodbmgr +{ + class Checksum + { + Adler32Context adler32ctx; + CRC16Context crc16ctx; + CRC32Context crc32ctx; + CRC64Context crc64ctx; + MD5Context md5ctx; + RIPEMD160Context ripemd160ctx; + SHA1Context sha1ctx; + SHA256Context sha256ctx; + SHA384Context sha384ctx; + SHA512Context sha512ctx; + SpamSumContext ssctx; + + Thread adlerThread; + Thread crc16Thread; + Thread crc32Thread; + Thread crc64Thread; + Thread md5Thread; + Thread ripemd160Thread; + Thread sha1Thread; + Thread sha256Thread; + Thread sha384Thread; + Thread sha512Thread; + Thread spamsumThread; + + adlerPacket adlerPkt; + crc16Packet crc16Pkt; + crc32Packet crc32Pkt; + crc64Packet crc64Pkt; + md5Packet md5Pkt; + ripemd160Packet ripemd160Pkt; + sha1Packet sha1Pkt; + sha256Packet sha256Pkt; + sha384Packet sha384Pkt; + sha512Packet sha512Pkt; + spamsumPacket spamsumPkt; + + internal Checksum() + { + adler32ctx = new Adler32Context(); + crc16ctx = new CRC16Context(); + crc32ctx = new CRC32Context(); + crc64ctx = new CRC64Context(); + md5ctx = new MD5Context(); + ripemd160ctx = new RIPEMD160Context(); + sha1ctx = new SHA1Context(); + sha256ctx = new SHA256Context(); + sha384ctx = new SHA384Context(); + sha512ctx = new SHA512Context(); + ssctx = new SpamSumContext(); + + adlerThread = new Thread(updateAdler); + crc16Thread = new Thread(updateCRC16); + crc32Thread = new Thread(updateCRC32); + crc64Thread = new Thread(updateCRC64); + md5Thread = new Thread(updateMD5); + ripemd160Thread = new Thread(updateRIPEMD160); + sha1Thread = new Thread(updateSHA1); + sha256Thread = new Thread(updateSHA256); + sha384Thread = new Thread(updateSHA384); + sha512Thread = new Thread(updateSHA512); + spamsumThread = new Thread(updateSpamSum); + + adlerPkt = new adlerPacket(); + crc16Pkt = new crc16Packet(); + crc32Pkt = new crc32Packet(); + crc64Pkt = new crc64Packet(); + md5Pkt = new md5Packet(); + ripemd160Pkt = new ripemd160Packet(); + sha1Pkt = new sha1Packet(); + sha256Pkt = new sha256Packet(); + sha384Pkt = new sha384Packet(); + sha512Pkt = new sha512Packet(); + spamsumPkt = new spamsumPacket(); + + adler32ctx.Init(); + adlerPkt.context = adler32ctx; + crc16ctx.Init(); + crc16Pkt.context = crc16ctx; + crc32ctx.Init(); + crc32Pkt.context = crc32ctx; + crc64ctx.Init(); + crc64Pkt.context = crc64ctx; + md5ctx.Init(); + md5Pkt.context = md5ctx; + ripemd160ctx.Init(); + ripemd160Pkt.context = ripemd160ctx; + sha1ctx.Init(); + sha1Pkt.context = sha1ctx; + sha256ctx.Init(); + sha256Pkt.context = sha256ctx; + sha384ctx.Init(); + sha384Pkt.context = sha384ctx; + sha512ctx.Init(); + sha512Pkt.context = sha512ctx; + ssctx.Init(); + spamsumPkt.context = ssctx; + } + + internal void Update(byte[] data) + { + adlerPkt.data = data; + adlerThread.Start(adlerPkt); + crc16Pkt.data = data; + crc16Thread.Start(crc16Pkt); + crc32Pkt.data = data; + crc32Thread.Start(crc32Pkt); + crc64Pkt.data = data; + crc64Thread.Start(crc64Pkt); + md5Pkt.data = data; + md5Thread.Start(md5Pkt); + ripemd160Pkt.data = data; + ripemd160Thread.Start(ripemd160Pkt); + sha1Pkt.data = data; + sha1Thread.Start(sha1Pkt); + sha256Pkt.data = data; + sha256Thread.Start(sha256Pkt); + sha384Pkt.data = data; + sha384Thread.Start(sha384Pkt); + sha512Pkt.data = data; + sha512Thread.Start(sha512Pkt); + spamsumPkt.data = data; + spamsumThread.Start(spamsumPkt); + + while(adlerThread.IsAlive || crc16Thread.IsAlive || + crc32Thread.IsAlive || crc64Thread.IsAlive || + md5Thread.IsAlive || ripemd160Thread.IsAlive || + sha1Thread.IsAlive || sha256Thread.IsAlive || + sha384Thread.IsAlive || sha512Thread.IsAlive || + spamsumThread.IsAlive) + { + } + + adlerThread = new Thread(updateAdler); + crc16Thread = new Thread(updateCRC16); + crc32Thread = new Thread(updateCRC32); + crc64Thread = new Thread(updateCRC64); + md5Thread = new Thread(updateMD5); + ripemd160Thread = new Thread(updateRIPEMD160); + sha1Thread = new Thread(updateSHA1); + sha256Thread = new Thread(updateSHA256); + sha384Thread = new Thread(updateSHA384); + sha512Thread = new Thread(updateSHA512); + spamsumThread = new Thread(updateSpamSum); + } + + internal List End() + { + List chks = new List(); + + ChecksumType chk = new ChecksumType(); + chk.type = ChecksumTypeType.adler32; + chk.Value = adler32ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.crc16; + chk.Value = crc16ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.crc32; + chk.Value = crc32ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.crc64; + chk.Value = crc64ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.md5; + chk.Value = md5ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.ripemd160; + chk.Value = ripemd160ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha1; + chk.Value = sha1ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha256; + chk.Value = sha256ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha384; + chk.Value = sha384ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha512; + chk.Value = sha512ctx.End(); + chks.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.spamsum; + chk.Value = ssctx.End(); + chks.Add(chk); + + return chks; + } + + internal static List GetChecksums(byte[] data) + { + Adler32Context adler32ctxData = new Adler32Context(); + CRC16Context crc16ctxData = new CRC16Context(); + CRC32Context crc32ctxData = new CRC32Context(); + CRC64Context crc64ctxData = new CRC64Context(); + MD5Context md5ctxData = new MD5Context(); + RIPEMD160Context ripemd160ctxData = new RIPEMD160Context(); + SHA1Context sha1ctxData = new SHA1Context(); + SHA256Context sha256ctxData = new SHA256Context(); + SHA384Context sha384ctxData = new SHA384Context(); + SHA512Context sha512ctxData = new SHA512Context(); + SpamSumContext ssctxData = new SpamSumContext(); + + Thread adlerThreadData = new Thread(updateAdler); + Thread crc16ThreadData = new Thread(updateCRC16); + Thread crc32ThreadData = new Thread(updateCRC32); + Thread crc64ThreadData = new Thread(updateCRC64); + Thread md5ThreadData = new Thread(updateMD5); + Thread ripemd160ThreadData = new Thread(updateRIPEMD160); + Thread sha1ThreadData = new Thread(updateSHA1); + Thread sha256ThreadData = new Thread(updateSHA256); + Thread sha384ThreadData = new Thread(updateSHA384); + Thread sha512ThreadData = new Thread(updateSHA512); + Thread spamsumThreadData = new Thread(updateSpamSum); + + adlerPacket adlerPktData = new adlerPacket(); + crc16Packet crc16PktData = new crc16Packet(); + crc32Packet crc32PktData = new crc32Packet(); + crc64Packet crc64PktData = new crc64Packet(); + md5Packet md5PktData = new md5Packet(); + ripemd160Packet ripemd160PktData = new ripemd160Packet(); + sha1Packet sha1PktData = new sha1Packet(); + sha256Packet sha256PktData = new sha256Packet(); + sha384Packet sha384PktData = new sha384Packet(); + sha512Packet sha512PktData = new sha512Packet(); + spamsumPacket spamsumPktData = new spamsumPacket(); + + adler32ctxData.Init(); + adlerPktData.context = adler32ctxData; + crc16ctxData.Init(); + crc16PktData.context = crc16ctxData; + crc32ctxData.Init(); + crc32PktData.context = crc32ctxData; + crc64ctxData.Init(); + crc64PktData.context = crc64ctxData; + md5ctxData.Init(); + md5PktData.context = md5ctxData; + ripemd160ctxData.Init(); + ripemd160PktData.context = ripemd160ctxData; + sha1ctxData.Init(); + sha1PktData.context = sha1ctxData; + sha256ctxData.Init(); + sha256PktData.context = sha256ctxData; + sha384ctxData.Init(); + sha384PktData.context = sha384ctxData; + sha512ctxData.Init(); + sha512PktData.context = sha512ctxData; + ssctxData.Init(); + spamsumPktData.context = ssctxData; + + adlerPktData.data = data; + adlerThreadData.Start(adlerPktData); + crc16PktData.data = data; + crc16ThreadData.Start(crc16PktData); + crc32PktData.data = data; + crc32ThreadData.Start(crc32PktData); + crc64PktData.data = data; + crc64ThreadData.Start(crc64PktData); + md5PktData.data = data; + md5ThreadData.Start(md5PktData); + ripemd160PktData.data = data; + ripemd160ThreadData.Start(ripemd160PktData); + sha1PktData.data = data; + sha1ThreadData.Start(sha1PktData); + sha256PktData.data = data; + sha256ThreadData.Start(sha256PktData); + sha384PktData.data = data; + sha384ThreadData.Start(sha384PktData); + sha512PktData.data = data; + sha512ThreadData.Start(sha512PktData); + spamsumPktData.data = data; + spamsumThreadData.Start(spamsumPktData); + + while(adlerThreadData.IsAlive || crc16ThreadData.IsAlive || + crc32ThreadData.IsAlive || crc64ThreadData.IsAlive || + md5ThreadData.IsAlive || ripemd160ThreadData.IsAlive || + sha1ThreadData.IsAlive || sha256ThreadData.IsAlive || + sha384ThreadData.IsAlive || sha512ThreadData.IsAlive || + spamsumThreadData.IsAlive) + { + } + + List dataChecksums = new List(); + ChecksumType chk; + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.adler32; + chk.Value = adler32ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.crc16; + chk.Value = crc16ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.crc32; + chk.Value = crc32ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.crc64; + chk.Value = crc64ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.md5; + chk.Value = md5ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.ripemd160; + chk.Value = ripemd160ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha1; + chk.Value = sha1ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha256; + chk.Value = sha256ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha384; + chk.Value = sha384ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.sha512; + chk.Value = sha512ctxData.End(); + dataChecksums.Add(chk); + + chk = new ChecksumType(); + chk.type = ChecksumTypeType.spamsum; + chk.Value = ssctxData.End(); + dataChecksums.Add(chk); + + return dataChecksums; + } + + #region Threading helpers + + struct adlerPacket + { + public Adler32Context context; + public byte[] data; + } + + struct crc16Packet + { + public CRC16Context context; + public byte[] data; + } + + struct crc32Packet + { + public CRC32Context context; + public byte[] data; + } + + struct crc64Packet + { + public CRC64Context context; + public byte[] data; + } + + /*struct fletcher16Packet + { + public Fletcher16Context context; + public byte[] data; + } + + struct fletcher32Packet + { + public Fletcher32Context context; + public byte[] data; + }*/ + + struct md5Packet + { + public MD5Context context; + public byte[] data; + } + + struct ripemd160Packet + { + public RIPEMD160Context context; + public byte[] data; + } + + struct sha1Packet + { + public SHA1Context context; + public byte[] data; + } + + struct sha256Packet + { + public SHA256Context context; + public byte[] data; + } + + struct sha384Packet + { + public SHA384Context context; + public byte[] data; + } + + struct sha512Packet + { + public SHA512Context context; + public byte[] data; + } + + struct spamsumPacket + { + public SpamSumContext context; + public byte[] data; + } + + static void updateAdler(object packet) + { + ((adlerPacket)packet).context.Update(((adlerPacket)packet).data); + } + + static void updateCRC16(object packet) + { + ((crc16Packet)packet).context.Update(((crc16Packet)packet).data); + } + + static void updateCRC32(object packet) + { + ((crc32Packet)packet).context.Update(((crc32Packet)packet).data); + } + + static void updateCRC64(object packet) + { + ((crc64Packet)packet).context.Update(((crc64Packet)packet).data); + } + + /*static void updateFletcher16(object packet) + { + ((fletcher16Packet)packet).context.Update(((fletcher16Packet)packet).data); + } + + static void updateFletcher32(object packet) + { + ((fletcher32Packet)packet).context.Update(((fletcher32Packet)packet).data); + }*/ + + static void updateMD5(object packet) + { + ((md5Packet)packet).context.Update(((md5Packet)packet).data); + } + + static void updateRIPEMD160(object packet) + { + ((ripemd160Packet)packet).context.Update(((ripemd160Packet)packet).data); + } + + static void updateSHA1(object packet) + { + ((sha1Packet)packet).context.Update(((sha1Packet)packet).data); + } + + static void updateSHA256(object packet) + { + ((sha256Packet)packet).context.Update(((sha256Packet)packet).data); + } + + static void updateSHA384(object packet) + { + ((sha384Packet)packet).context.Update(((sha384Packet)packet).data); + } + + static void updateSHA512(object packet) + { + ((sha512Packet)packet).context.Update(((sha512Packet)packet).data); + } + + static void updateSpamSum(object packet) + { + ((spamsumPacket)packet).context.Update(((spamsumPacket)packet).data); + } + + #endregion Threading helpers + } +} + diff --git a/osrepodbmgr/Core.cs b/osrepodbmgr/Core.cs index 42adae7..8edd009 100644 --- a/osrepodbmgr/Core.cs +++ b/osrepodbmgr/Core.cs @@ -899,6 +899,9 @@ namespace osrepodbmgr FileStream jfs = new FileStream(Path.Combine(destinationFolder, destinationFile + ".json"), FileMode.CreateNew, FileAccess.Write); jms.CopyTo(jfs); jfs.Close(); + + xms.Position = 0; + jms.Position = 0; } zipCounter = 0; diff --git a/osrepodbmgr/DetectImageFormat.cs b/osrepodbmgr/DetectImageFormat.cs new file mode 100644 index 0000000..caeab63 --- /dev/null +++ b/osrepodbmgr/DetectImageFormat.cs @@ -0,0 +1,111 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : DetectImageFormat.cs +// Author(s) : Natalia Portillo +// +// Component : Main program loop. +// +// --[ Description ] ---------------------------------------------------------- +// +// Detects disc image format. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2016 Natalia Portillo +// ****************************************************************************/ +using System; +using DiscImageChef.Filters; +using DiscImageChef.ImagePlugins; + +namespace osrepodbmgr +{ + public static class ImageFormat + { + public static ImagePlugin Detect(Filter imageFilter) + { + try + { + ImagePlugin _imageFormat; + PluginBase plugins = new PluginBase(); + plugins.RegisterAllPlugins(); + + _imageFormat = null; + + // Check all but RAW plugin + foreach(ImagePlugin _imageplugin in plugins.ImagePluginsList.Values) + { + if(_imageplugin.PluginUUID != new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) + { + try + { + Console.WriteLine("Format detection: Trying plugin {0}", _imageplugin.Name); + if(_imageplugin.IdentifyImage(imageFilter)) + { + _imageFormat = _imageplugin; + break; + } + } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + { + } + } + } + + // Check only RAW plugin + if(_imageFormat == null) + { + foreach(ImagePlugin _imageplugin in plugins.ImagePluginsList.Values) + { + if(_imageplugin.PluginUUID == new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) + { + try + { + Console.WriteLine("Format detection: Trying plugin {0}", _imageplugin.Name); + if(_imageplugin.IdentifyImage(imageFilter)) + { + _imageFormat = _imageplugin; + break; + } + } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + { + } + } + } + } + + // Still not recognized + if(_imageFormat == null) + { + return null; + } + + return _imageFormat; + } + catch + { + return null; + } + } + } +} diff --git a/osrepodbmgr/DicCore.cs b/osrepodbmgr/DicCore.cs index a03825e..c732b02 100644 --- a/osrepodbmgr/DicCore.cs +++ b/osrepodbmgr/DicCore.cs @@ -25,22 +25,965 @@ // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // +using System; +using DiscImageChef.Filters; +using Schemas; +using System.IO; +using System.Collections.Generic; +using DiscImageChef.CommonTypes; +using DiscImageChef.ImagePlugins; +using DiscImageChef.PartPlugins; +using DiscImageChef.Filesystems; +using DiscImageChef.Decoders.PCMCIA; + namespace osrepodbmgr { public static partial class Core { - public static void AddDisc() + public static void AddMedia() { - // TODO: Call DiscImageChef - if(Failed != null) - Failed("Not yet implemented"); + if(string.IsNullOrWhiteSpace(MainClass.selectedFile)) + { + if(Failed != null) + Failed("There is no file set"); + return; + } + + string filesPath; + + if(!string.IsNullOrEmpty(MainClass.tmpFolder) && Directory.Exists(MainClass.tmpFolder)) + filesPath = MainClass.tmpFolder; + else + filesPath = MainClass.path; + + string selectedFile = Path.Combine(filesPath, MainClass.selectedFile); + + if(!File.Exists(selectedFile)) + { + if(Failed != null) + Failed("Selected file does not exist"); + return; + } + + CICMMetadataType sidecar = new CICMMetadataType(); + PluginBase plugins = new PluginBase(); + plugins.RegisterAllPlugins(); + ImagePlugin _imageFormat; + + long maxProgress = 4; + long currentProgress = 0; + + FiltersList filtersList = new FiltersList(); + + if(UpdateProgress != null) + UpdateProgress(null, "Detecting image filter", 1, maxProgress); + + Filter inputFilter = filtersList.GetFilter(selectedFile); + + + if(inputFilter == null) + { + if(Failed != null) + Failed("Cannot open specified file."); + return; + } + + try + { + if(UpdateProgress != null) + UpdateProgress(null, "Detecting image format", 2, maxProgress); + _imageFormat = ImageFormat.Detect(inputFilter); + + if(_imageFormat == null) + { + if(Failed != null) + Failed("Image format not identified, not proceeding with analysis."); + return; + } + + try + { + if(!_imageFormat.OpenImage(inputFilter)) + { + if(Failed != null) + Failed("Unable to open image format\n" + + "No error given"); + return; + } + } + catch(Exception ex) + { + if(Failed != null) + Failed(string.Format("Unable to open image format\n" + + "Error: {0}", ex.Message)); + return; + } + + FileInfo fi = new FileInfo(selectedFile); + FileStream fs = new FileStream(selectedFile, FileMode.Open, FileAccess.Read); + + Checksum imgChkWorker = new Checksum(); + + if(UpdateProgress != null) + UpdateProgress(null, "Hashing image file", 3, maxProgress); + + byte[] data; + long position = 0; + while(position < (fi.Length - 1048576)) + { + data = new byte[1048576]; + fs.Read(data, 0, 1048576); + + if(UpdateProgress2 != null) + UpdateProgress2(null, string.Format("{0} of {1}", position, fi.Length), position, fi.Length); + + imgChkWorker.Update(data); + + position += 1048576; + } + + data = new byte[fi.Length - position]; + fs.Read(data, 0, (int)(fi.Length - position)); + + if(UpdateProgress2 != null) + UpdateProgress2(null, string.Format("{0} of {1}", position, fi.Length), position, fi.Length); + + imgChkWorker.Update(data); + + fs.Close(); + + List imgChecksums = imgChkWorker.End(); + + if(UpdateProgress2 != null) + UpdateProgress2(null, null, 0, 0); + + switch(_imageFormat.ImageInfo.xmlMediaType) + { + case XmlMediaType.OpticalDisc: + { + maxProgress = 4 + _imageFormat.ImageInfo.readableMediaTags.Count + _imageFormat.GetTracks().Count; + + if(UpdateProgress != null) + UpdateProgress(null, "Hashing image file", 3, maxProgress); + + sidecar.OpticalDisc = new OpticalDiscType[1]; + sidecar.OpticalDisc[0] = new OpticalDiscType(); + sidecar.OpticalDisc[0].Checksums = imgChecksums.ToArray(); + sidecar.OpticalDisc[0].Image = new ImageType(); + sidecar.OpticalDisc[0].Image.format = _imageFormat.GetImageFormat(); + sidecar.OpticalDisc[0].Image.offset = 0; + sidecar.OpticalDisc[0].Image.offsetSpecified = true; + sidecar.OpticalDisc[0].Image.Value = Path.GetFileName(selectedFile); + sidecar.OpticalDisc[0].Size = fi.Length; + sidecar.OpticalDisc[0].Sequence = new SequenceType(); + if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) + { + sidecar.OpticalDisc[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence(); + sidecar.OpticalDisc[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence(); + } + else + { + sidecar.OpticalDisc[0].Sequence.MediaSequence = 1; + sidecar.OpticalDisc[0].Sequence.TotalMedia = 1; + } + sidecar.OpticalDisc[0].Sequence.MediaTitle = _imageFormat.GetImageName(); + + MediaType dskType = _imageFormat.ImageInfo.mediaType; + + currentProgress = 3; + + foreach(MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags) + { + currentProgress++; + if(UpdateProgress != null) + UpdateProgress(null, string.Format("Hashing file containing {0}", tagType), currentProgress, maxProgress); + + switch(tagType) + { + case MediaTagType.CD_ATIP: + sidecar.OpticalDisc[0].ATIP = new DumpType(); + sidecar.OpticalDisc[0].ATIP.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)).ToArray(); + sidecar.OpticalDisc[0].ATIP.Size = _imageFormat.ReadDiskTag(MediaTagType.CD_ATIP).Length; + DiscImageChef.Decoders.CD.ATIP.CDATIP? atip = DiscImageChef.Decoders.CD.ATIP.Decode(_imageFormat.ReadDiskTag(MediaTagType.CD_ATIP)); + if(atip.HasValue) + { + if(atip.Value.DDCD) + dskType = atip.Value.DiscType ? MediaType.DDCDRW : MediaType.DDCDR; + else + dskType = atip.Value.DiscType ? MediaType.CDRW : MediaType.CDR; + } + break; + case MediaTagType.DVD_BCA: + sidecar.OpticalDisc[0].BCA = new DumpType(); + sidecar.OpticalDisc[0].BCA.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_BCA)).ToArray(); + sidecar.OpticalDisc[0].BCA.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_BCA).Length; + break; + case MediaTagType.BD_BCA: + sidecar.OpticalDisc[0].BCA = new DumpType(); + sidecar.OpticalDisc[0].BCA.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.BD_BCA)).ToArray(); + sidecar.OpticalDisc[0].BCA.Size = _imageFormat.ReadDiskTag(MediaTagType.BD_BCA).Length; + break; + case MediaTagType.DVD_CMI: + sidecar.OpticalDisc[0].CMI = new DumpType(); + DiscImageChef.Decoders.DVD.CSS_CPRM.LeadInCopyright? cmi = DiscImageChef.Decoders.DVD.CSS_CPRM.DecodeLeadInCopyright(_imageFormat.ReadDiskTag(MediaTagType.DVD_CMI)); + if(cmi.HasValue) + { + switch(cmi.Value.CopyrightType) + { + case DiscImageChef.Decoders.DVD.CopyrightType.AACS: + sidecar.OpticalDisc[0].CopyProtection = "AACS"; + break; + case DiscImageChef.Decoders.DVD.CopyrightType.CSS: + sidecar.OpticalDisc[0].CopyProtection = "CSS"; + break; + case DiscImageChef.Decoders.DVD.CopyrightType.CPRM: + sidecar.OpticalDisc[0].CopyProtection = "CPRM"; + break; + } + } + sidecar.OpticalDisc[0].CMI.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_CMI)).ToArray(); + sidecar.OpticalDisc[0].CMI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_CMI).Length; + break; + case MediaTagType.DVD_DMI: + sidecar.OpticalDisc[0].DMI = new DumpType(); + sidecar.OpticalDisc[0].DMI.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI)).ToArray(); + sidecar.OpticalDisc[0].DMI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_DMI).Length; + if(DiscImageChef.Decoders.Xbox.DMI.IsXbox(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI))) + { + dskType = MediaType.XGD; + sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); + sidecar.OpticalDisc[0].Dimensions.Diameter = 120; + } + else if(DiscImageChef.Decoders.Xbox.DMI.IsXbox360(_imageFormat.ReadDiskTag(MediaTagType.DVD_DMI))) + { + dskType = MediaType.XGD2; + sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); + sidecar.OpticalDisc[0].Dimensions.Diameter = 120; + } + break; + case MediaTagType.DVD_PFI: + sidecar.OpticalDisc[0].PFI = new DumpType(); + sidecar.OpticalDisc[0].PFI.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)).ToArray(); + sidecar.OpticalDisc[0].PFI.Size = _imageFormat.ReadDiskTag(MediaTagType.DVD_PFI).Length; + DiscImageChef.Decoders.DVD.PFI.PhysicalFormatInformation? pfi = DiscImageChef.Decoders.DVD.PFI.Decode(_imageFormat.ReadDiskTag(MediaTagType.DVD_PFI)); + if(pfi.HasValue) + { + if(dskType != MediaType.XGD && + dskType != MediaType.XGD2 && + dskType != MediaType.XGD3) + { + switch(pfi.Value.DiskCategory) + { + case DiscImageChef.Decoders.DVD.DiskCategory.DVDPR: + dskType = MediaType.DVDPR; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDPRDL: + dskType = MediaType.DVDPRDL; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDPRW: + dskType = MediaType.DVDPRW; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDPRWDL: + dskType = MediaType.DVDPRWDL; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDR: + dskType = MediaType.DVDR; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDRAM: + dskType = MediaType.DVDRAM; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDROM: + dskType = MediaType.DVDROM; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.DVDRW: + dskType = MediaType.DVDRW; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.HDDVDR: + dskType = MediaType.HDDVDR; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.HDDVDRAM: + dskType = MediaType.HDDVDRAM; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.HDDVDROM: + dskType = MediaType.HDDVDROM; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.HDDVDRW: + dskType = MediaType.HDDVDRW; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.Nintendo: + dskType = MediaType.GOD; + break; + case DiscImageChef.Decoders.DVD.DiskCategory.UMD: + dskType = MediaType.UMD; + break; + } + + if(dskType == MediaType.DVDR && pfi.Value.PartVersion == 6) + dskType = MediaType.DVDRDL; + if(dskType == MediaType.DVDRW && pfi.Value.PartVersion == 3) + dskType = MediaType.DVDRWDL; + if(dskType == MediaType.GOD && pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) + dskType = MediaType.WOD; + + sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); + if(dskType == MediaType.UMD) + sidecar.OpticalDisc[0].Dimensions.Diameter = 60; + else if(pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.Eighty) + sidecar.OpticalDisc[0].Dimensions.Diameter = 80; + else if(pfi.Value.DiscSize == DiscImageChef.Decoders.DVD.DVDSize.OneTwenty) + sidecar.OpticalDisc[0].Dimensions.Diameter = 120; + } + } + break; + case MediaTagType.CD_PMA: + sidecar.OpticalDisc[0].PMA = new DumpType(); + sidecar.OpticalDisc[0].PMA.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.CD_PMA)).ToArray(); + sidecar.OpticalDisc[0].PMA.Size = _imageFormat.ReadDiskTag(MediaTagType.CD_PMA).Length; + break; + } + } + + try + { + List sessions = _imageFormat.GetSessions(); + sidecar.OpticalDisc[0].Sessions = sessions != null ? sessions.Count : 1; + } + catch + { + sidecar.OpticalDisc[0].Sessions = 1; + } + + List tracks = _imageFormat.GetTracks(); + List trksLst = null; + if(tracks != null) + { + sidecar.OpticalDisc[0].Tracks = new int[1]; + sidecar.OpticalDisc[0].Tracks[0] = tracks.Count; + trksLst = new List(); + } + + foreach(Track trk in tracks) + { + currentProgress++; + if(UpdateProgress != null) + UpdateProgress(null, string.Format("Hashing track {0}", trk.TrackSequence), currentProgress, maxProgress); + + Schemas.TrackType xmlTrk = new Schemas.TrackType(); + switch(trk.TrackType) + { + case DiscImageChef.ImagePlugins.TrackType.Audio: + xmlTrk.TrackType1 = TrackTypeTrackType.audio; + break; + case DiscImageChef.ImagePlugins.TrackType.CDMode2Form2: + xmlTrk.TrackType1 = TrackTypeTrackType.m2f2; + break; + case DiscImageChef.ImagePlugins.TrackType.CDMode2Formless: + xmlTrk.TrackType1 = TrackTypeTrackType.mode2; + break; + case DiscImageChef.ImagePlugins.TrackType.CDMode2Form1: + xmlTrk.TrackType1 = TrackTypeTrackType.m2f1; + break; + case DiscImageChef.ImagePlugins.TrackType.CDMode1: + xmlTrk.TrackType1 = TrackTypeTrackType.mode1; + break; + case DiscImageChef.ImagePlugins.TrackType.Data: + switch(sidecar.OpticalDisc[0].DiscType) + { + case "BD": + xmlTrk.TrackType1 = TrackTypeTrackType.bluray; + break; + case "DDCD": + xmlTrk.TrackType1 = TrackTypeTrackType.ddcd; + break; + case "DVD": + xmlTrk.TrackType1 = TrackTypeTrackType.dvd; + break; + case "HD DVD": + xmlTrk.TrackType1 = TrackTypeTrackType.hddvd; + break; + default: + xmlTrk.TrackType1 = TrackTypeTrackType.mode1; + break; + } + break; + } + xmlTrk.Sequence = new TrackSequenceType(); + xmlTrk.Sequence.Session = trk.TrackSession; + xmlTrk.Sequence.TrackNumber = (int)trk.TrackSequence; + xmlTrk.StartSector = (long)trk.TrackStartSector; + xmlTrk.EndSector = (long)trk.TrackEndSector; + + if(trk.Indexes.ContainsKey(0)) + { + ulong idx0; + if(trk.Indexes.TryGetValue(0, out idx0)) + xmlTrk.StartSector = (long)idx0; + } + + if(sidecar.OpticalDisc[0].DiscType == "CD" || + sidecar.OpticalDisc[0].DiscType == "GD") + { + xmlTrk.StartMSF = LbaToMsf(xmlTrk.StartSector); + xmlTrk.EndMSF = LbaToMsf(xmlTrk.EndSector); + } + else if(sidecar.OpticalDisc[0].DiscType == "DDCD") + { + xmlTrk.StartMSF = DdcdLbaToMsf(xmlTrk.StartSector); + xmlTrk.EndMSF = DdcdLbaToMsf(xmlTrk.EndSector); + } + + xmlTrk.Image = new ImageType(); + xmlTrk.Image.Value = Path.GetFileName(trk.TrackFile); + if(trk.TrackFileOffset > 0) + { + xmlTrk.Image.offset = (long)trk.TrackFileOffset; + xmlTrk.Image.offsetSpecified = true; + } + + xmlTrk.Image.format = trk.TrackFileType; + xmlTrk.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * trk.TrackRawBytesPerSector; + xmlTrk.BytesPerSector = trk.TrackBytesPerSector; + + uint sectorsToRead = 512; + + Checksum trkChkWorker = new Checksum(); + + ulong sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1); + ulong doneSectors = 0; + + while(doneSectors < sectors) + { + byte[] sector; + + if((sectors - doneSectors) >= sectorsToRead) + { + sector = _imageFormat.ReadSectorsLong(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber); + if(UpdateProgress2 != null) + UpdateProgress2(null, string.Format("Sector {0} of {1}", doneSectors, sectors), position, fi.Length); + doneSectors += sectorsToRead; + } + else + { + sector = _imageFormat.ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors), (uint)xmlTrk.Sequence.TrackNumber); + if(UpdateProgress2 != null) + UpdateProgress2(null, string.Format("Sector {0} of {1}", doneSectors, sectors), position, fi.Length); + doneSectors += (sectors - doneSectors); + } + + trkChkWorker.Update(sector); + } + + List trkChecksums = trkChkWorker.End(); + + xmlTrk.Checksums = trkChecksums.ToArray(); + + if(UpdateProgress2 != null) + UpdateProgress2(null, null, 0, 0); + + if(trk.TrackSubchannelType != TrackSubchannelType.None) + { + if(UpdateProgress != null) + UpdateProgress(null, string.Format("Hashing subchannel of track {0}", trk.TrackSequence), currentProgress, maxProgress); + + xmlTrk.SubChannel = new SubChannelType(); + xmlTrk.SubChannel.Image = new ImageType(); + switch(trk.TrackSubchannelType) + { + case TrackSubchannelType.Packed: + case TrackSubchannelType.PackedInterleaved: + xmlTrk.SubChannel.Image.format = "rw"; + break; + case TrackSubchannelType.Raw: + case TrackSubchannelType.RawInterleaved: + xmlTrk.SubChannel.Image.format = "rw_raw"; + break; + case TrackSubchannelType.Q16: + case TrackSubchannelType.Q16Interleaved: + xmlTrk.SubChannel.Image.format = "q16"; + break; + } + + if(trk.TrackFileOffset > 0) + { + xmlTrk.SubChannel.Image.offset = (long)trk.TrackSubchannelOffset; + xmlTrk.SubChannel.Image.offsetSpecified = true; + } + xmlTrk.SubChannel.Image.Value = trk.TrackSubchannelFile; + + // TODO: Packed subchannel has different size? + xmlTrk.SubChannel.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * 96; + + Checksum subChkWorker = new Checksum(); + + sectors = (ulong)(xmlTrk.EndSector - xmlTrk.StartSector + 1); + doneSectors = 0; + + while(doneSectors < sectors) + { + byte[] sector; + + if((sectors - doneSectors) >= sectorsToRead) + { + sector = _imageFormat.ReadSectorsTag(doneSectors, sectorsToRead, (uint)xmlTrk.Sequence.TrackNumber, SectorTagType.CDSectorSubchannel); + if(UpdateProgress2 != null) + UpdateProgress2(null, string.Format("Sector {0} of {1}", doneSectors, sectors), position, fi.Length); + doneSectors += sectorsToRead; + } + else + { + sector = _imageFormat.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors), (uint)xmlTrk.Sequence.TrackNumber, SectorTagType.CDSectorSubchannel); + if(UpdateProgress2 != null) + UpdateProgress2(null, string.Format("Sector {0} of {1}", doneSectors, sectors), position, fi.Length); + doneSectors += (sectors - doneSectors); + } + + subChkWorker.Update(sector); + } + + List subChecksums = subChkWorker.End(); + + xmlTrk.SubChannel.Checksums = subChecksums.ToArray(); + + if(UpdateProgress2 != null) + UpdateProgress2(null, null, 0, 0); + } + + if(UpdateProgress != null) + UpdateProgress(null, "Checking filesystems", maxProgress-1, maxProgress); + + List partitions = new List(); + + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) + { + List _partitions; + + if(_partplugin.GetInformation(_imageFormat, out _partitions)) + partitions.AddRange(_partitions); + } + + xmlTrk.FileSystemInformation = new PartitionType[1]; + if(partitions.Count > 0) + { + xmlTrk.FileSystemInformation = new PartitionType[partitions.Count]; + for(int i = 0; i < partitions.Count; i++) + { + xmlTrk.FileSystemInformation[i] = new PartitionType(); + xmlTrk.FileSystemInformation[i].Description = partitions[i].PartitionDescription; + xmlTrk.FileSystemInformation[i].EndSector = (int)(partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1); + xmlTrk.FileSystemInformation[i].Name = partitions[i].PartitionName; + xmlTrk.FileSystemInformation[i].Sequence = (int)partitions[i].PartitionSequence; + xmlTrk.FileSystemInformation[i].StartSector = (int)partitions[i].PartitionStartSector; + xmlTrk.FileSystemInformation[i].Type = partitions[i].PartitionType; + + List lstFs = new List(); + + foreach(Filesystem _plugin in plugins.PluginsList.Values) + { + try + { + if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1)) + { + string foo; + _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo); + lstFs.Add(_plugin.XmlFSType); + + if(_plugin.XmlFSType.Type == "Opera") + dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "PC Engine filesystem") + dskType = MediaType.SuperCDROM2; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") + dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") + dskType = MediaType.GOD; + } + } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + { + //DicConsole.DebugWriteLine("Create-sidecar command", "Plugin {0} crashed", _plugin.Name); + } + } + + if(lstFs.Count > 0) + xmlTrk.FileSystemInformation[i].FileSystems = lstFs.ToArray(); + } + } + else + { + xmlTrk.FileSystemInformation[0] = new PartitionType(); + xmlTrk.FileSystemInformation[0].EndSector = (int)xmlTrk.EndSector; + xmlTrk.FileSystemInformation[0].StartSector = (int)xmlTrk.StartSector; + + List lstFs = new List(); + + foreach(Filesystem _plugin in plugins.PluginsList.Values) + { + try + { + if(_plugin.Identify(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector)) + { + string foo; + _plugin.GetInformation(_imageFormat, (ulong)xmlTrk.StartSector, (ulong)xmlTrk.EndSector, out foo); + lstFs.Add(_plugin.XmlFSType); + + if(_plugin.XmlFSType.Type == "Opera") + dskType = MediaType.ThreeDO; + if(_plugin.XmlFSType.Type == "PC Engine filesystem") + dskType = MediaType.SuperCDROM2; + if(_plugin.XmlFSType.Type == "Nintendo Wii filesystem") + dskType = MediaType.WOD; + if(_plugin.XmlFSType.Type == "Nintendo Gamecube filesystem") + dskType = MediaType.GOD; + } + } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + { + //DicConsole.DebugWriteLine("Create-sidecar command", "Plugin {0} crashed", _plugin.Name); + } + } + + if(lstFs.Count > 0) + xmlTrk.FileSystemInformation[0].FileSystems = lstFs.ToArray(); + } + + trksLst.Add(xmlTrk); + } + + if(UpdateProgress != null) + UpdateProgress(null, "Finishing", maxProgress, maxProgress); + + if(trksLst != null) + sidecar.OpticalDisc[0].Track = trksLst.ToArray(); + + string dscType, dscSubType; + DiscImageChef.Metadata.MediaType.MediaTypeToString(dskType, out dscType, out dscSubType); + sidecar.OpticalDisc[0].DiscType = dscType; + sidecar.OpticalDisc[0].DiscSubType = dscSubType; + + if(!string.IsNullOrEmpty(_imageFormat.ImageInfo.driveManufacturer) || + !string.IsNullOrEmpty(_imageFormat.ImageInfo.driveModel) || + !string.IsNullOrEmpty(_imageFormat.ImageInfo.driveFirmwareRevision) || + !string.IsNullOrEmpty(_imageFormat.ImageInfo.driveSerialNumber)) + { + sidecar.OpticalDisc[0].DumpHardwareArray = new DumpHardwareType[1]; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Extents = new ExtentType[0]; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Extents[0].Start = 0; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Extents[0].End = (int)_imageFormat.ImageInfo.sectors; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Manufacturer = _imageFormat.ImageInfo.driveManufacturer; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Model = _imageFormat.ImageInfo.driveModel; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Firmware = _imageFormat.ImageInfo.driveFirmwareRevision; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Serial = _imageFormat.ImageInfo.driveSerialNumber; + sidecar.OpticalDisc[0].DumpHardwareArray[0].Software = new SoftwareType(); + sidecar.OpticalDisc[0].DumpHardwareArray[0].Software.Name = _imageFormat.GetImageApplication(); + sidecar.OpticalDisc[0].DumpHardwareArray[0].Software.Version = _imageFormat.GetImageApplicationVersion(); + } + + MainClass.workingDisc = sidecar.OpticalDisc[0]; + if(Finished != null) + Finished(); + return; + } + case XmlMediaType.BlockMedia: + { + maxProgress = 3 + _imageFormat.ImageInfo.readableMediaTags.Count; + if(UpdateProgress != null) + UpdateProgress(null, "Hashing image file", 3, maxProgress); + + sidecar.BlockMedia = new BlockMediaType[1]; + sidecar.BlockMedia[0] = new BlockMediaType(); + sidecar.BlockMedia[0].Checksums = imgChecksums.ToArray(); + sidecar.BlockMedia[0].Image = new ImageType(); + sidecar.BlockMedia[0].Image.format = _imageFormat.GetImageFormat(); + sidecar.BlockMedia[0].Image.offset = 0; + sidecar.BlockMedia[0].Image.offsetSpecified = true; + sidecar.BlockMedia[0].Image.Value = Path.GetFileName(selectedFile); + sidecar.BlockMedia[0].Size = fi.Length; + sidecar.BlockMedia[0].Sequence = new SequenceType(); + if(_imageFormat.GetMediaSequence() != 0 && _imageFormat.GetLastDiskSequence() != 0) + { + sidecar.BlockMedia[0].Sequence.MediaSequence = _imageFormat.GetMediaSequence(); + sidecar.BlockMedia[0].Sequence.TotalMedia = _imageFormat.GetMediaSequence(); + } + else + { + sidecar.BlockMedia[0].Sequence.MediaSequence = 1; + sidecar.BlockMedia[0].Sequence.TotalMedia = 1; + } + sidecar.BlockMedia[0].Sequence.MediaTitle = _imageFormat.GetImageName(); + + currentProgress = 3; + + foreach(MediaTagType tagType in _imageFormat.ImageInfo.readableMediaTags) + { + currentProgress++; + if(UpdateProgress != null) + UpdateProgress(null, string.Format("Hashing file containing {0}", tagType), currentProgress, maxProgress); + + switch(tagType) + { + case MediaTagType.ATAPI_IDENTIFY: + sidecar.BlockMedia[0].ATA = new ATAType(); + sidecar.BlockMedia[0].ATA.Identify = new DumpType(); + sidecar.BlockMedia[0].ATA.Identify.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY)).ToArray(); + sidecar.BlockMedia[0].ATA.Identify.Size = _imageFormat.ReadDiskTag(MediaTagType.ATAPI_IDENTIFY).Length; + break; + case MediaTagType.ATA_IDENTIFY: + sidecar.BlockMedia[0].ATA = new ATAType(); + sidecar.BlockMedia[0].ATA.Identify = new DumpType(); + sidecar.BlockMedia[0].ATA.Identify.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY)).ToArray(); + sidecar.BlockMedia[0].ATA.Identify.Size = _imageFormat.ReadDiskTag(MediaTagType.ATA_IDENTIFY).Length; + break; + case MediaTagType.PCMCIA_CIS: + byte[] cis = _imageFormat.ReadDiskTag(MediaTagType.PCMCIA_CIS); + sidecar.BlockMedia[0].PCMCIA = new PCMCIAType(); + sidecar.BlockMedia[0].PCMCIA.CIS = new DumpType(); + sidecar.BlockMedia[0].PCMCIA.CIS.Checksums = Checksum.GetChecksums(cis).ToArray(); + sidecar.BlockMedia[0].PCMCIA.CIS.Size = cis.Length; + DiscImageChef.Decoders.PCMCIA.Tuple[] tuples = CIS.GetTuples(cis); + if(tuples != null) + { + foreach(DiscImageChef.Decoders.PCMCIA.Tuple tuple in tuples) + { + if(tuple.Code == TupleCodes.CISTPL_MANFID) + { + ManufacturerIdentificationTuple manfid = CIS.DecodeManufacturerIdentificationTuple(tuple); + + if(manfid != null) + { + sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID; + sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID; + sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true; + sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true; + } + } + else if(tuple.Code == TupleCodes.CISTPL_VERS_1) + { + Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple); + + if(vers != null) + { + sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; + sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; + sidecar.BlockMedia[0].PCMCIA.Compliance = string.Format("{0}.{1}", vers.MajorVersion, vers.MinorVersion); + sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; + } + } + } + } + break; + case MediaTagType.SCSI_INQUIRY: + sidecar.BlockMedia[0].SCSI = new SCSIType(); + sidecar.BlockMedia[0].SCSI.Inquiry = new DumpType(); + sidecar.BlockMedia[0].SCSI.Inquiry.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY)).ToArray(); + sidecar.BlockMedia[0].SCSI.Inquiry.Size = _imageFormat.ReadDiskTag(MediaTagType.SCSI_INQUIRY).Length; + break; + case MediaTagType.SD_CID: + if(sidecar.BlockMedia[0].SecureDigital == null) + sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType(); + sidecar.BlockMedia[0].SecureDigital.CID = new DumpType(); + sidecar.BlockMedia[0].SecureDigital.CID.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_CID)).ToArray(); + sidecar.BlockMedia[0].SecureDigital.CID.Size = _imageFormat.ReadDiskTag(MediaTagType.SD_CID).Length; + break; + case MediaTagType.SD_CSD: + if(sidecar.BlockMedia[0].SecureDigital == null) + sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType(); + sidecar.BlockMedia[0].SecureDigital.CSD = new DumpType(); + sidecar.BlockMedia[0].SecureDigital.CSD.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_CSD)).ToArray(); + sidecar.BlockMedia[0].SecureDigital.CSD.Size = _imageFormat.ReadDiskTag(MediaTagType.SD_CSD).Length; + break; + case MediaTagType.SD_ExtendedCSD: + if(sidecar.BlockMedia[0].SecureDigital == null) + sidecar.BlockMedia[0].SecureDigital = new SecureDigitalType(); + sidecar.BlockMedia[0].SecureDigital.ExtendedCSD = new DumpType(); + sidecar.BlockMedia[0].SecureDigital.ExtendedCSD.Checksums = Checksum.GetChecksums(_imageFormat.ReadDiskTag(MediaTagType.SD_ExtendedCSD)).ToArray(); + sidecar.BlockMedia[0].SecureDigital.ExtendedCSD.Size = _imageFormat.ReadDiskTag(MediaTagType.SD_ExtendedCSD).Length; + break; + } + } + + string dskType, dskSubType; + DiscImageChef.Metadata.MediaType.MediaTypeToString(_imageFormat.ImageInfo.mediaType, out dskType, out dskSubType); + sidecar.BlockMedia[0].DiskType = dskType; + sidecar.BlockMedia[0].DiskSubType = dskSubType; + + sidecar.BlockMedia[0].Dimensions = DiscImageChef.Metadata.Dimensions.DimensionsFromMediaType(_imageFormat.ImageInfo.mediaType); + + sidecar.BlockMedia[0].LogicalBlocks = (long)_imageFormat.GetSectors(); + sidecar.BlockMedia[0].LogicalBlockSize = (int)_imageFormat.GetSectorSize(); + // TODO: Detect it + sidecar.BlockMedia[0].PhysicalBlockSize = (int)_imageFormat.GetSectorSize(); + + if(UpdateProgress != null) + UpdateProgress(null, "Checking filesystems", maxProgress - 1, maxProgress); + + List partitions = new List(); + + foreach(PartPlugin _partplugin in plugins.PartPluginsList.Values) + { + List _partitions; + + if(_partplugin.GetInformation(_imageFormat, out _partitions)) + { + partitions = _partitions; + break; + } + } + + sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[1]; + if(partitions.Count > 0) + { + sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[partitions.Count]; + for(int i = 0; i < partitions.Count; i++) + { + sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType(); + sidecar.BlockMedia[0].FileSystemInformation[i].Description = partitions[i].PartitionDescription; + sidecar.BlockMedia[0].FileSystemInformation[i].EndSector = (int)(partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1); + sidecar.BlockMedia[0].FileSystemInformation[i].Name = partitions[i].PartitionName; + sidecar.BlockMedia[0].FileSystemInformation[i].Sequence = (int)partitions[i].PartitionSequence; + sidecar.BlockMedia[0].FileSystemInformation[i].StartSector = (int)partitions[i].PartitionStartSector; + sidecar.BlockMedia[0].FileSystemInformation[i].Type = partitions[i].PartitionType; + + List lstFs = new List(); + + foreach(Filesystem _plugin in plugins.PluginsList.Values) + { + try + { + if(_plugin.Identify(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1)) + { + string foo; + _plugin.GetInformation(_imageFormat, partitions[i].PartitionStartSector, partitions[i].PartitionStartSector + partitions[i].PartitionSectors - 1, out foo); + lstFs.Add(_plugin.XmlFSType); + } + } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + { + //DicConsole.DebugWriteLine("Create-sidecar command", "Plugin {0} crashed", _plugin.Name); + } + } + + if(lstFs.Count > 0) + sidecar.BlockMedia[0].FileSystemInformation[i].FileSystems = lstFs.ToArray(); + } + } + else + { + sidecar.BlockMedia[0].FileSystemInformation[0] = new PartitionType(); + sidecar.BlockMedia[0].FileSystemInformation[0].StartSector = 0; + sidecar.BlockMedia[0].FileSystemInformation[0].EndSector = (int)(_imageFormat.GetSectors() - 1); + + List lstFs = new List(); + + foreach(Filesystem _plugin in plugins.PluginsList.Values) + { + try + { + if(_plugin.Identify(_imageFormat, 0, _imageFormat.GetSectors() - 1)) + { + string foo; + _plugin.GetInformation(_imageFormat, 0, _imageFormat.GetSectors() - 1, out foo); + lstFs.Add(_plugin.XmlFSType); + } + } +#pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body + catch +#pragma warning restore RECS0022 // A catch clause that catches System.Exception and has an empty body + { + //DicConsole.DebugWriteLine("Create-sidecar command", "Plugin {0} crashed", _plugin.Name); + } + } + + if(lstFs.Count > 0) + sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray(); + } + + // TODO: Implement support for getting CHS + if(UpdateProgress != null) + UpdateProgress(null, "Finishing", maxProgress, maxProgress); + MainClass.workingDisk = sidecar.BlockMedia[0]; + if(Finished != null) + Finished(); + return; + } + case XmlMediaType.LinearMedia: + { + if(Failed != null) + Failed("Linear media not yet supported."); + return; + } + case XmlMediaType.AudioMedia: + { + if(Failed != null) + Failed("Audio media not yet supported."); + return; + } + + } + + if(Failed != null) + Failed("Should've not arrived here."); + return; + } + catch(Exception ex) + { + if(Failed!=null) + Failed(string.Format("Error reading file: {0}\n{1}", ex.Message, ex.StackTrace)); + } } - public static void AddDisk() + static string LbaToMsf(long lba) { - // TODO: Call DiscImageChef - if(Failed != null) - Failed("Not yet implemented"); + long m, s, f; + if(lba >= -150) + { + m = (lba + 150) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 150) / 75; + lba -= s * 75; + f = lba + 150; + } + else + { + m = (lba + 450150) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 450150) / 75; + lba -= s * 75; + f = lba + 450150; + } + + return string.Format("{0}:{1:D2}:{2:D2}", m, s, f); + } + + static string DdcdLbaToMsf(long lba) + { + long h, m, s, f; + if(lba >= -150) + { + h = (lba + 150) / (75 * 60 * 60); + lba -= h * (75 * 60 * 60); + m = (lba + 150) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 150) / 75; + lba -= s * 75; + f = lba + 150; + } + else + { + h = (lba + 450150 * 2) / (75 * 60 * 60); + lba -= h * (75 * 60 * 60); + m = (lba + 450150 * 2) / (75 * 60); + lba -= m * (75 * 60); + s = (lba + 450150 * 2) / 75; + lba -= s * 75; + f = lba + 450150 * 2; + } + + return string.Format("{3}:{0:D2}:{1:D2}:{2:D2}", m, s, f, h); } } } diff --git a/osrepodbmgr/PluginBase.cs b/osrepodbmgr/PluginBase.cs new file mode 100644 index 0000000..631aec6 --- /dev/null +++ b/osrepodbmgr/PluginBase.cs @@ -0,0 +1,137 @@ +// /*************************************************************************** +// The Disc Image Chef +// ---------------------------------------------------------------------------- +// +// Filename : Plugins.cs +// Author(s) : Natalia Portillo +// +// Component : Plugins +// +// --[ Description ] ---------------------------------------------------------- +// +// Base methods for plugins. +// +// --[ License ] -------------------------------------------------------------- +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as +// published by the Free Software Foundation, either version 3 of the +// License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . +// +// ---------------------------------------------------------------------------- +// Copyright © 2011-2016 Natalia Portillo +// ****************************************************************************/ +using System; +using System.Collections.Generic; +using DiscImageChef.Filesystems; +using DiscImageChef.PartPlugins; +using DiscImageChef.ImagePlugins; +using System.Reflection; + +namespace osrepodbmgr +{ + public class PluginBase + { + public SortedDictionary PluginsList; + public SortedDictionary PartPluginsList; + public SortedDictionary ImagePluginsList; + + public PluginBase() + { + PluginsList = new SortedDictionary(); + PartPluginsList = new SortedDictionary(); + ImagePluginsList = new SortedDictionary(); + } + + public void RegisterAllPlugins() + { + Assembly assembly; + + assembly = Assembly.GetAssembly(typeof(ImagePlugin)); + + foreach(Type type in assembly.GetTypes()) + { + try + { + if(type.IsSubclassOf(typeof(ImagePlugin))) + { + ImagePlugin plugin = (ImagePlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); + RegisterImagePlugin(plugin); + } + } + catch(Exception exception) + { + Console.WriteLine("Exception {0}", exception); + } + } + + 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 {0}", exception); + } + } + + assembly = Assembly.GetAssembly(typeof(Filesystem)); + + foreach(Type type in assembly.GetTypes()) + { + try + { + if(type.IsSubclassOf(typeof(Filesystem))) + { + Filesystem plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { }); + RegisterPlugin(plugin); + } + } + catch(Exception exception) + { + Console.WriteLine("Exception {0}", exception); + } + } + } + + void RegisterImagePlugin(ImagePlugin plugin) + { + if(!ImagePluginsList.ContainsKey(plugin.Name.ToLower())) + { + ImagePluginsList.Add(plugin.Name.ToLower(), plugin); + } + } + + void RegisterPlugin(Filesystem plugin) + { + if(!PluginsList.ContainsKey(plugin.Name.ToLower())) + { + PluginsList.Add(plugin.Name.ToLower(), plugin); + } + } + + void RegisterPartPlugin(PartPlugin partplugin) + { + if(!PartPluginsList.ContainsKey(partplugin.Name.ToLower())) + { + PartPluginsList.Add(partplugin.Name.ToLower(), partplugin); + } + } + } +} diff --git a/osrepodbmgr/dlgMetadata.cs b/osrepodbmgr/dlgMetadata.cs index 4a11b8a..74c75b1 100644 --- a/osrepodbmgr/dlgMetadata.cs +++ b/osrepodbmgr/dlgMetadata.cs @@ -485,8 +485,11 @@ namespace osrepodbmgr files.Add(disk.SCSI.ModeSense.Image); if(disk.SCSI.ModeSense10 != null) files.Add(disk.SCSI.ModeSense10.Image); - foreach(EVPDType evpd in disk.SCSI.EVPD) - files.Add(evpd.Image); + if(disk.SCSI.EVPD != null) + { + foreach(EVPDType evpd in disk.SCSI.EVPD) + files.Add(evpd.Image); + } } if(disk.SecureDigital != null) { @@ -710,15 +713,17 @@ namespace osrepodbmgr notebook3.GetNthPage(5).Visible = false; notebook3.GetNthPage(6).Visible = false; notebook3.GetNthPage(8).Visible = false; - prgAddDisc.Visible = true; + prgAddDisc1.Visible = true; + prgAddDisc2.Visible = true; Core.Failed += OnDiscAddFailed; Core.Finished += OnDiscAddFinished; - Core.UpdateProgress += UpdateDiscProgress; + Core.UpdateProgress += UpdateDiscProgress1; + Core.UpdateProgress2 += UpdateDiscProgress2; MainClass.workingDisc = null; btnStopAddDisc.Visible = true; btnAddDisc.Visible = false; btnRemoveDiscs.Visible = false; - thdDisc = new Thread(Core.AddDisc); + thdDisc = new Thread(Core.AddMedia); thdDisc.Start(); } @@ -730,15 +735,27 @@ namespace osrepodbmgr OnDiscAddFailed(null); } - public void UpdateDiscProgress(string text, string inner, long current, long maximum) + public void UpdateDiscProgress1(string text, string inner, long current, long maximum) { Application.Invoke(delegate { - prgAddDisc.Text = text + inner; + prgAddDisc1.Text = text + inner; if(maximum > 0) - prgAddDisc.Fraction = current / (double)maximum; + prgAddDisc1.Fraction = current / (double)maximum; else - prgAddDisc.Pulse(); + prgAddDisc1.Pulse(); + }); + } + + public void UpdateDiscProgress2(string text, string inner, long current, long maximum) + { + Application.Invoke(delegate + { + prgAddDisc2.Text = text + inner; + if(maximum > 0) + prgAddDisc2.Fraction = current / (double)maximum; + else + prgAddDisc2.Pulse(); }); } @@ -761,10 +778,12 @@ namespace osrepodbmgr notebook3.GetNthPage(5).Visible = true; notebook3.GetNthPage(6).Visible = true; notebook3.GetNthPage(8).Visible = true; - prgAddDisc.Visible = true; + prgAddDisc1.Visible = false; + prgAddDisc2.Visible = false; Core.Failed -= OnDiscAddFailed; Core.Finished -= OnDiscAddFinished; - Core.UpdateProgress -= UpdateDiscProgress; + Core.UpdateProgress -= UpdateDiscProgress1; + Core.UpdateProgress2 -= UpdateDiscProgress2; MainClass.workingDisc = null; btnStopAddDisc.Visible = false; btnAddDisc.Visible = true; @@ -801,12 +820,18 @@ namespace osrepodbmgr files.Add(disc.DMI.Image); if(disc.LastRMD != null) files.Add(disc.LastRMD.Image); - foreach(BorderType border in disc.LeadIn) - files.Add(border.Image); + if(disc.LeadIn != null) + { + foreach(BorderType border in disc.LeadIn) + files.Add(border.Image); + } if(disc.LeadInCdText != null) files.Add(disc.LeadInCdText.Image); - foreach(BorderType border in disc.LeadOut) - files.Add(border.Image); + if(disc.LeadOut != null) + { + foreach(BorderType border in disc.LeadOut) + files.Add(border.Image); + } if(disc.MediaID != null) files.Add(disc.MediaID.Image); if(disc.PAC != null) @@ -823,8 +848,11 @@ namespace osrepodbmgr files.Add(disc.SAI.Image); if(disc.TOC != null) files.Add(disc.TOC.Image); - foreach(TrackType track in disc.Track) - files.Add(track.Image.Value); + if(disc.Track != null) + { + foreach(TrackType track in disc.Track) + files.Add(track.Image.Value); + } foreach(string file in files) { @@ -863,10 +891,12 @@ namespace osrepodbmgr notebook3.GetNthPage(5).Visible = true; notebook3.GetNthPage(6).Visible = true; notebook3.GetNthPage(8).Visible = true; - prgAddDisc.Visible = true; + prgAddDisc1.Visible = false; + prgAddDisc2.Visible = false; Core.Failed -= OnDiscAddFailed; Core.Finished -= OnDiscAddFinished; - Core.UpdateProgress -= UpdateDiscProgress; + Core.UpdateProgress -= UpdateDiscProgress1; + Core.UpdateProgress2 -= UpdateDiscProgress2; MainClass.workingDisc = null; btnStopAddDisc.Visible = false; btnAddDisc.Visible = true; @@ -902,15 +932,17 @@ namespace osrepodbmgr notebook3.GetNthPage(5).Visible = false; notebook3.GetNthPage(6).Visible = false; notebook3.GetNthPage(7).Visible = false; - prgAddDisk.Visible = true; + prgAddDisk1.Visible = true; + prgAddDisk2.Visible = true; Core.Failed += OnDiskAddFailed; Core.Finished += OnDiskAddFinished; - Core.UpdateProgress += UpdateDiskProgress; + Core.UpdateProgress += UpdateDiskProgress1; + Core.UpdateProgress2 += UpdateDiskProgress2; MainClass.workingDisk = null; btnStopAddDisk.Visible = true; btnAddDisk.Visible = false; btnRemoveDisk.Visible = false; - thdDisk = new Thread(Core.AddDisk); + thdDisk = new Thread(Core.AddMedia); thdDisk.Start(); } @@ -922,15 +954,27 @@ namespace osrepodbmgr OnDiskAddFailed(null); } - public void UpdateDiskProgress(string text, string inner, long current, long maximum) + public void UpdateDiskProgress1(string text, string inner, long current, long maximum) { Application.Invoke(delegate { - prgAddDisk.Text = text + inner; + prgAddDisk1.Text = text + inner; if(maximum > 0) - prgAddDisk.Fraction = current / (double)maximum; + prgAddDisk1.Fraction = current / (double)maximum; else - prgAddDisk.Pulse(); + prgAddDisk1.Pulse(); + }); + } + + public void UpdateDiskProgress2(string text, string inner, long current, long maximum) + { + Application.Invoke(delegate + { + prgAddDisk2.Text = text + inner; + if(maximum > 0) + prgAddDisk2.Fraction = current / (double)maximum; + else + prgAddDisk2.Pulse(); }); } @@ -953,10 +997,12 @@ namespace osrepodbmgr notebook3.GetNthPage(5).Visible = true; notebook3.GetNthPage(6).Visible = true; notebook3.GetNthPage(7).Visible = true; - prgAddDisk.Visible = true; + prgAddDisk1.Visible = false; + prgAddDisk2.Visible = false; Core.Failed -= OnDiskAddFailed; Core.Finished -= OnDiskAddFinished; - Core.UpdateProgress -= UpdateDiskProgress; + Core.UpdateProgress -= UpdateDiskProgress1; + Core.UpdateProgress2 -= UpdateDiskProgress2; MainClass.workingDisk = null; btnStopAddDisk.Visible = false; btnAddDisk.Visible = true; @@ -995,8 +1041,11 @@ namespace osrepodbmgr files.Add(disk.SCSI.ModeSense.Image); if(disk.SCSI.ModeSense10 != null) files.Add(disk.SCSI.ModeSense10.Image); - foreach(EVPDType evpd in disk.SCSI.EVPD) - files.Add(evpd.Image); + if(disk.SCSI.EVPD != null) + { + foreach(EVPDType evpd in disk.SCSI.EVPD) + files.Add(evpd.Image); + } } if(disk.SecureDigital != null) { @@ -1007,10 +1056,16 @@ namespace osrepodbmgr if(disk.SecureDigital.ExtendedCSD != null) files.Add(disk.SecureDigital.ExtendedCSD.Image); } - foreach(TapePartitionType tapePart in disk.TapeInformation) - files.Add(tapePart.Image.Value); - foreach(BlockTrackType track in disk.Track) - files.Add(track.Image.Value); + if(disk.TapeInformation != null) + { + foreach(TapePartitionType tapePart in disk.TapeInformation) + files.Add(tapePart.Image.Value); + } + if(disk.Track != null) + { + foreach(BlockTrackType track in disk.Track) + files.Add(track.Image.Value); + } if(disk.USB != null && disk.USB.Descriptors != null) files.Add(disk.USB.Descriptors.Image); @@ -1051,10 +1106,12 @@ namespace osrepodbmgr notebook3.GetNthPage(5).Visible = true; notebook3.GetNthPage(6).Visible = true; notebook3.GetNthPage(7).Visible = true; - prgAddDisk.Visible = true; + prgAddDisk1.Visible = false; + prgAddDisk2.Visible = false; Core.Failed -= OnDiskAddFailed; Core.Finished -= OnDiskAddFinished; - Core.UpdateProgress -= UpdateDiskProgress; + Core.UpdateProgress -= UpdateDiskProgress1; + Core.UpdateProgress2 -= UpdateDiskProgress2; MainClass.workingDisk = null; btnStopAddDisk.Visible = false; btnAddDisk.Visible = true; diff --git a/osrepodbmgr/gtk-gui/gui.stetic b/osrepodbmgr/gtk-gui/gui.stetic index cdc60a7..ad59d97 100644 --- a/osrepodbmgr/gtk-gui/gui.stetic +++ b/osrepodbmgr/gtk-gui/gui.stetic @@ -1236,7 +1236,7 @@ QNX/QNX/20090229/source.zip True - 0 + 7 @@ -2814,7 +2814,7 @@ QNX/QNX/20090229/source.zip - + @@ -2824,6 +2824,18 @@ QNX/QNX/20090229/source.zip False + + + + False + + + 4 + True + False + False + + 7 @@ -2980,7 +2992,7 @@ QNX/QNX/20090229/source.zip - + @@ -2990,6 +3002,18 @@ QNX/QNX/20090229/source.zip False + + + + False + + + 4 + True + False + False + + 8 diff --git a/osrepodbmgr/gtk-gui/osrepodbmgr.dlgMetadata.cs b/osrepodbmgr/gtk-gui/osrepodbmgr.dlgMetadata.cs index 4b768c7..6372f7d 100644 --- a/osrepodbmgr/gtk-gui/osrepodbmgr.dlgMetadata.cs +++ b/osrepodbmgr/gtk-gui/osrepodbmgr.dlgMetadata.cs @@ -260,7 +260,9 @@ namespace osrepodbmgr private global::Gtk.Button btnStopAddDisc; - private global::Gtk.ProgressBar prgAddDisc; + private global::Gtk.ProgressBar prgAddDisc1; + + private global::Gtk.ProgressBar prgAddDisc2; private global::Gtk.Label label22; @@ -286,7 +288,9 @@ namespace osrepodbmgr private global::Gtk.Button btnStopAddDisk; - private global::Gtk.ProgressBar prgAddDisk; + private global::Gtk.ProgressBar prgAddDisk1; + + private global::Gtk.ProgressBar prgAddDisk2; private global::Gtk.Label label32; @@ -308,7 +312,7 @@ namespace osrepodbmgr this.notebook3 = new global::Gtk.Notebook(); this.notebook3.CanFocus = true; this.notebook3.Name = "notebook3"; - this.notebook3.CurrentPage = 0; + this.notebook3.CurrentPage = 7; // Container child notebook3.Gtk.Notebook+NotebookChild this.vbox3 = new global::Gtk.VBox(); this.vbox3.Name = "vbox3"; @@ -1459,16 +1463,24 @@ namespace osrepodbmgr w120.Expand = false; w120.Fill = false; // Container child vbox11.Gtk.Box+BoxChild - this.prgAddDisc = new global::Gtk.ProgressBar(); - this.prgAddDisc.Name = "prgAddDisc"; - this.vbox11.Add(this.prgAddDisc); - global::Gtk.Box.BoxChild w121 = ((global::Gtk.Box.BoxChild)(this.vbox11[this.prgAddDisc])); + this.prgAddDisc1 = new global::Gtk.ProgressBar(); + this.prgAddDisc1.Name = "prgAddDisc1"; + this.vbox11.Add(this.prgAddDisc1); + global::Gtk.Box.BoxChild w121 = ((global::Gtk.Box.BoxChild)(this.vbox11[this.prgAddDisc1])); w121.Position = 3; w121.Expand = false; w121.Fill = false; + // Container child vbox11.Gtk.Box+BoxChild + this.prgAddDisc2 = new global::Gtk.ProgressBar(); + this.prgAddDisc2.Name = "prgAddDisc2"; + this.vbox11.Add(this.prgAddDisc2); + global::Gtk.Box.BoxChild w122 = ((global::Gtk.Box.BoxChild)(this.vbox11[this.prgAddDisc2])); + w122.Position = 4; + w122.Expand = false; + w122.Fill = false; this.notebook3.Add(this.vbox11); - global::Gtk.Notebook.NotebookChild w122 = ((global::Gtk.Notebook.NotebookChild)(this.notebook3[this.vbox11])); - w122.Position = 7; + global::Gtk.Notebook.NotebookChild w123 = ((global::Gtk.Notebook.NotebookChild)(this.notebook3[this.vbox11])); + w123.Position = 7; // Notebook tab this.label22 = new global::Gtk.Label(); this.label22.Name = "label22"; @@ -1488,18 +1500,18 @@ namespace osrepodbmgr this.lblNewDisk.Name = "lblNewDisk"; this.lblNewDisk.LabelProp = global::Mono.Unix.Catalog.GetString("Choose disk to add:"); this.hbox29.Add(this.lblNewDisk); - global::Gtk.Box.BoxChild w123 = ((global::Gtk.Box.BoxChild)(this.hbox29[this.lblNewDisk])); - w123.Position = 0; - w123.Expand = false; - w123.Fill = false; + global::Gtk.Box.BoxChild w124 = ((global::Gtk.Box.BoxChild)(this.hbox29[this.lblNewDisk])); + w124.Position = 0; + w124.Expand = false; + w124.Fill = false; // Container child hbox29.Gtk.Box+BoxChild this.cmbFilesForNewDisk = global::Gtk.ComboBox.NewText(); this.cmbFilesForNewDisk.Name = "cmbFilesForNewDisk"; this.hbox29.Add(this.cmbFilesForNewDisk); - global::Gtk.Box.BoxChild w124 = ((global::Gtk.Box.BoxChild)(this.hbox29[this.cmbFilesForNewDisk])); - w124.Position = 1; - w124.Expand = false; - w124.Fill = false; + global::Gtk.Box.BoxChild w125 = ((global::Gtk.Box.BoxChild)(this.hbox29[this.cmbFilesForNewDisk])); + w125.Position = 1; + w125.Expand = false; + w125.Fill = false; // Container child hbox29.Gtk.Box+BoxChild this.btnAddDisk = new global::Gtk.Button(); this.btnAddDisk.CanFocus = true; @@ -1508,15 +1520,15 @@ namespace osrepodbmgr this.btnAddDisk.UseUnderline = true; this.btnAddDisk.Label = "gtk-add"; this.hbox29.Add(this.btnAddDisk); - global::Gtk.Box.BoxChild w125 = ((global::Gtk.Box.BoxChild)(this.hbox29[this.btnAddDisk])); - w125.Position = 2; - w125.Expand = false; - w125.Fill = false; - this.vbox12.Add(this.hbox29); - global::Gtk.Box.BoxChild w126 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.hbox29])); - w126.Position = 0; + global::Gtk.Box.BoxChild w126 = ((global::Gtk.Box.BoxChild)(this.hbox29[this.btnAddDisk])); + w126.Position = 2; w126.Expand = false; w126.Fill = false; + this.vbox12.Add(this.hbox29); + global::Gtk.Box.BoxChild w127 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.hbox29])); + w127.Position = 0; + w127.Expand = false; + w127.Fill = false; // Container child vbox12.Gtk.Box+BoxChild this.GtkScrolledWindow8 = new global::Gtk.ScrolledWindow(); this.GtkScrolledWindow8.Name = "GtkScrolledWindow8"; @@ -1527,8 +1539,8 @@ namespace osrepodbmgr this.treeDisks.Name = "treeDisks"; this.GtkScrolledWindow8.Add(this.treeDisks); this.vbox12.Add(this.GtkScrolledWindow8); - global::Gtk.Box.BoxChild w128 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.GtkScrolledWindow8])); - w128.Position = 1; + global::Gtk.Box.BoxChild w129 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.GtkScrolledWindow8])); + w129.Position = 1; // Container child vbox12.Gtk.Box+BoxChild this.hbox28 = new global::Gtk.HBox(); this.hbox28.Name = "hbox28"; @@ -1541,11 +1553,11 @@ namespace osrepodbmgr this.btnRemoveDisk.UseUnderline = true; this.btnRemoveDisk.Label = "gtk-remove"; this.hbox28.Add(this.btnRemoveDisk); - global::Gtk.Box.BoxChild w129 = ((global::Gtk.Box.BoxChild)(this.hbox28[this.btnRemoveDisk])); - w129.PackType = ((global::Gtk.PackType)(1)); - w129.Position = 0; - w129.Expand = false; - w129.Fill = false; + global::Gtk.Box.BoxChild w130 = ((global::Gtk.Box.BoxChild)(this.hbox28[this.btnRemoveDisk])); + w130.PackType = ((global::Gtk.PackType)(1)); + w130.Position = 0; + w130.Expand = false; + w130.Fill = false; // Container child hbox28.Gtk.Box+BoxChild this.btnClearDisks = new global::Gtk.Button(); this.btnClearDisks.CanFocus = true; @@ -1554,11 +1566,11 @@ namespace osrepodbmgr this.btnClearDisks.UseUnderline = true; this.btnClearDisks.Label = "gtk-clear"; this.hbox28.Add(this.btnClearDisks); - global::Gtk.Box.BoxChild w130 = ((global::Gtk.Box.BoxChild)(this.hbox28[this.btnClearDisks])); - w130.PackType = ((global::Gtk.PackType)(1)); - w130.Position = 1; - w130.Expand = false; - w130.Fill = false; + global::Gtk.Box.BoxChild w131 = ((global::Gtk.Box.BoxChild)(this.hbox28[this.btnClearDisks])); + w131.PackType = ((global::Gtk.PackType)(1)); + w131.Position = 1; + w131.Expand = false; + w131.Fill = false; // Container child hbox28.Gtk.Box+BoxChild this.btnStopAddDisk = new global::Gtk.Button(); this.btnStopAddDisk.CanFocus = true; @@ -1567,27 +1579,35 @@ namespace osrepodbmgr this.btnStopAddDisk.UseUnderline = true; this.btnStopAddDisk.Label = "gtk-stop"; this.hbox28.Add(this.btnStopAddDisk); - global::Gtk.Box.BoxChild w131 = ((global::Gtk.Box.BoxChild)(this.hbox28[this.btnStopAddDisk])); - w131.PackType = ((global::Gtk.PackType)(1)); - w131.Position = 2; - w131.Expand = false; - w131.Fill = false; - this.vbox12.Add(this.hbox28); - global::Gtk.Box.BoxChild w132 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.hbox28])); + global::Gtk.Box.BoxChild w132 = ((global::Gtk.Box.BoxChild)(this.hbox28[this.btnStopAddDisk])); + w132.PackType = ((global::Gtk.PackType)(1)); w132.Position = 2; w132.Expand = false; w132.Fill = false; - // Container child vbox12.Gtk.Box+BoxChild - this.prgAddDisk = new global::Gtk.ProgressBar(); - this.prgAddDisk.Name = "prgAddDisk"; - this.vbox12.Add(this.prgAddDisk); - global::Gtk.Box.BoxChild w133 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.prgAddDisk])); - w133.Position = 3; + this.vbox12.Add(this.hbox28); + global::Gtk.Box.BoxChild w133 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.hbox28])); + w133.Position = 2; w133.Expand = false; w133.Fill = false; + // Container child vbox12.Gtk.Box+BoxChild + this.prgAddDisk1 = new global::Gtk.ProgressBar(); + this.prgAddDisk1.Name = "prgAddDisk1"; + this.vbox12.Add(this.prgAddDisk1); + global::Gtk.Box.BoxChild w134 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.prgAddDisk1])); + w134.Position = 3; + w134.Expand = false; + w134.Fill = false; + // Container child vbox12.Gtk.Box+BoxChild + this.prgAddDisk2 = new global::Gtk.ProgressBar(); + this.prgAddDisk2.Name = "prgAddDisk2"; + this.vbox12.Add(this.prgAddDisk2); + global::Gtk.Box.BoxChild w135 = ((global::Gtk.Box.BoxChild)(this.vbox12[this.prgAddDisk2])); + w135.Position = 4; + w135.Expand = false; + w135.Fill = false; this.notebook3.Add(this.vbox12); - global::Gtk.Notebook.NotebookChild w134 = ((global::Gtk.Notebook.NotebookChild)(this.notebook3[this.vbox12])); - w134.Position = 8; + global::Gtk.Notebook.NotebookChild w136 = ((global::Gtk.Notebook.NotebookChild)(this.notebook3[this.vbox12])); + w136.Position = 8; // Notebook tab this.label32 = new global::Gtk.Label(); this.label32.Name = "label32"; @@ -1595,14 +1615,14 @@ namespace osrepodbmgr this.notebook3.SetTabLabel(this.vbox12, this.label32); this.label32.ShowAll(); w1.Add(this.notebook3); - global::Gtk.Box.BoxChild w135 = ((global::Gtk.Box.BoxChild)(w1[this.notebook3])); - w135.Position = 0; + global::Gtk.Box.BoxChild w137 = ((global::Gtk.Box.BoxChild)(w1[this.notebook3])); + w137.Position = 0; // Internal child osrepodbmgr.dlgMetadata.ActionArea - global::Gtk.HButtonBox w136 = this.ActionArea; - w136.Name = "dialog1_ActionArea"; - w136.Spacing = 10; - w136.BorderWidth = ((uint)(5)); - w136.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); + global::Gtk.HButtonBox w138 = this.ActionArea; + w138.Name = "dialog1_ActionArea"; + w138.Spacing = 10; + w138.BorderWidth = ((uint)(5)); + w138.LayoutStyle = ((global::Gtk.ButtonBoxStyle)(4)); // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonCancel = new global::Gtk.Button(); this.buttonCancel.CanDefault = true; @@ -1612,9 +1632,9 @@ namespace osrepodbmgr this.buttonCancel.UseUnderline = true; this.buttonCancel.Label = "gtk-cancel"; this.AddActionWidget(this.buttonCancel, -6); - global::Gtk.ButtonBox.ButtonBoxChild w137 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w136[this.buttonCancel])); - w137.Expand = false; - w137.Fill = false; + global::Gtk.ButtonBox.ButtonBoxChild w139 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w138[this.buttonCancel])); + w139.Expand = false; + w139.Fill = false; // Container child dialog1_ActionArea.Gtk.ButtonBox+ButtonBoxChild this.buttonOk = new global::Gtk.Button(); this.buttonOk.CanDefault = true; @@ -1624,10 +1644,10 @@ namespace osrepodbmgr this.buttonOk.UseUnderline = true; this.buttonOk.Label = "gtk-ok"; this.AddActionWidget(this.buttonOk, -5); - global::Gtk.ButtonBox.ButtonBoxChild w138 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w136[this.buttonOk])); - w138.Position = 1; - w138.Expand = false; - w138.Fill = false; + global::Gtk.ButtonBox.ButtonBoxChild w140 = ((global::Gtk.ButtonBox.ButtonBoxChild)(w138[this.buttonOk])); + w140.Position = 1; + w140.Expand = false; + w140.Fill = false; if((this.Child != null)) { this.Child.ShowAll(); @@ -1635,6 +1655,8 @@ namespace osrepodbmgr this.DefaultWidth = 909; this.DefaultHeight = 533; this.btnStopAddDisc.Hide(); + this.prgAddDisc2.Hide(); + this.prgAddDisk2.Hide(); this.Show(); this.chkBoxUnknownReleaseType.Toggled += new global::System.EventHandler(this.OnChkBoxUnknownReleaseTypeToggled); this.chkReleaseDate.Toggled += new global::System.EventHandler(this.OnChkReleaseDateToggled); diff --git a/osrepodbmgr/osrepodbmgr.csproj b/osrepodbmgr/osrepodbmgr.csproj index 66e9457..2ac6219 100644 --- a/osrepodbmgr/osrepodbmgr.csproj +++ b/osrepodbmgr/osrepodbmgr.csproj @@ -86,12 +86,12 @@ - - cicm.cs - + + + @@ -101,6 +101,34 @@ {CC48B324-A532-4A45-87A6-6F91F7141E8D} DiscImageChef.Checksums + + {74032CBC-339B-42F3-AF6F-E96C261F3E6A} + DiscImageChef.DiscImages + + + {D7016DF2-5A5E-4524-B40D-BA2D59576688} + DiscImageChef.Filesystems + + + {D571B8EF-903D-4353-BDD5-B834F9F029EF} + DiscImageChef.Filters + + + {DA7AB65D-B5BA-4003-8893-A51BB071BA2F} + DiscImageChef.Partitions + + + {F2B84194-26EB-4227-B1C5-6602517E85AE} + DiscImageChef.CommonTypes + + + {0BEB3088-B634-4289-AE17-CDF2D25D00D5} + DiscImageChef.Decoders + + + {9F213318-5CB8-4066-A757-074489C9F818} + DiscImageChef.Metadata +