diff --git a/AVDump3CL/AVDump3CL.csproj b/AVDump3CL/AVDump3CL.csproj index e50defc..03773ce 100644 --- a/AVDump3CL/AVDump3CL.csproj +++ b/AVDump3CL/AVDump3CL.csproj @@ -5,7 +5,7 @@ netcoreapp3.1 AVD3Icon.ico AVDump3CL.Program - 3.0.8071.0 + 3.0.8072.0 3.0.0 extknot DvdKhl @@ -16,7 +16,7 @@ en Copyright © 2020 extknot AnyCPU;x64 - 3.0.8071.0 + 3.0.8072.0 Debug;Release;GithubWorkflow enable diff --git a/AVDump3Lib/AVDump3Lib.csproj b/AVDump3Lib/AVDump3Lib.csproj index 37f0f0d..c9f270d 100644 --- a/AVDump3Lib/AVDump3Lib.csproj +++ b/AVDump3Lib/AVDump3Lib.csproj @@ -13,8 +13,8 @@ en AnyCPU;x64 - 3.0.8071.0 - 3.0.8071.0 + 3.0.8072.0 + 3.0.8072.0 Debug;Release;GithubWorkflow enable diff --git a/AVDump3Lib/Information/InfoProvider/FormatInfoProvider.cs b/AVDump3Lib/Information/InfoProvider/FormatInfoProvider.cs index aa2b132..84db800 100644 --- a/AVDump3Lib/Information/InfoProvider/FormatInfoProvider.cs +++ b/AVDump3Lib/Information/InfoProvider/FormatInfoProvider.cs @@ -516,7 +516,7 @@ public override void ElaborateCheck(Stream stream) { } } public class SMILFileType : FileType { - public SMILFileType() : base("", identifier: "SMIL") { PossibleExtensions = new string[] { "smil" }; fileType = MediaProvider.MediaStreamType; } + public SMILFileType() : base("", identifier: "SMIL") { PossibleExtensions = new string[] { "smil" }; } public override void ElaborateCheck(Stream stream) { if(!IsCandidate) return; @@ -612,13 +612,36 @@ public override void ElaborateCheck(Stream stream) { if(str.IndexOf("% zerog") < 0) { IsCandidate = false; return; } } } - public class C7zFileType : FileType { public C7zFileType() : base(new byte[] { 0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C }, identifier: "compression/7z") => PossibleExtensions = new string[] { "7z" }; } - public class ZipFileType : FileType { public ZipFileType() : base(new byte[][] { new byte[] { 0x50, 0x4b, 0x03, 0x04 }, new byte[] { 0x50, 0x4b, 0x30, 0x30, 0x50, 0x4b } }, identifier: "compression/zip") => PossibleExtensions = new string[] { "zip" }; } - public class RarFileType : FileType { public RarFileType() : base(new byte[] { 0x52, 0x61, 0x72, 0x21 }, identifier: "compression/rar") => PossibleExtensions = new string[] { "rar" }; } + public class C7zFileType : FileType { + public C7zFileType() : base(new byte[] { 0x37, 0x7A, 0xBC, 0xAF, 0x27, 0x1C }, identifier: "compression/7z") => PossibleExtensions = new string[] { "7z" }; + public override void AddInfo(MetaDataProvider provider) { + if(!string.IsNullOrEmpty(identifier)) { + var container = new MetaInfoContainer(0, fileType); + provider.AddNode(container); + provider.Add(container, MediaProvider.FileTypeIdentifierType, identifier); + } + } + } + public class ZipFileType : FileType { + public ZipFileType() : base(new byte[][] { new byte[] { 0x50, 0x4b, 0x03, 0x04 }, new byte[] { 0x50, 0x4b, 0x30, 0x30, 0x50, 0x4b } }, identifier: "compression/zip") => PossibleExtensions = new string[] { "zip" }; + public override void AddInfo(MetaDataProvider provider) { + if(!string.IsNullOrEmpty(identifier)) { + provider.Add(MediaProvider.FileTypeIdentifierType, identifier); + } + } + } + public class RarFileType : FileType { + public RarFileType() : base(new byte[] { 0x52, 0x61, 0x72, 0x21 }, identifier: "compression/rar") => PossibleExtensions = new string[] { "rar" }; + public override void AddInfo(MetaDataProvider provider) { + if(!string.IsNullOrEmpty(identifier)) { + provider.Add(MediaProvider.FileTypeIdentifierType, identifier); + } + } + } public class RaFileType : FileType { public RaFileType() : base(".ra" + (char)0xfd) { PossibleExtensions = new string[] { "ra" }; fileType = MediaProvider.AudioStreamType; } } public class FlacFileType : FileType { public FlacFileType() : base("fLaC") { PossibleExtensions = new string[] { "flac" }; fileType = MediaProvider.AudioStreamType; } } public class AviFileType : FileType { public AviFileType() : base("RIFF") { PossibleExtensions = new string[] { "avi" }; fileType = MediaProvider.VideoStreamType; } public override void ElaborateCheck(Stream stream) => IsCandidate &= Check(stream, 8, "AVI LIST"); } - public class WavFileType : FileType { public WavFileType() : base(new string[] { "RIFX", "RIFF" }) => PossibleExtensions = new string[] { "wav" }; public override void ElaborateCheck(Stream stream) => IsCandidate &= Check(stream, 8, "WAVE"); } + public class WavFileType : FileType { public WavFileType() : base(new string[] { "RIFX", "RIFF" }) { PossibleExtensions = new string[] { "wav" }; fileType = MediaProvider.AudioStreamType; } public override void ElaborateCheck(Stream stream) => IsCandidate &= Check(stream, 8, "WAVE"); } public abstract class FileType : IFileType { private byte[][] magicBytesLst; diff --git a/AVDump3Lib/Information/MetaInfo/MediaProvider.cs b/AVDump3Lib/Information/MetaInfo/MediaProvider.cs index 35c9ef7..d8925e2 100644 --- a/AVDump3Lib/Information/MetaInfo/MediaProvider.cs +++ b/AVDump3Lib/Information/MetaInfo/MediaProvider.cs @@ -17,6 +17,8 @@ public abstract class MediaProvider : MetaDataProvider { public MediaProvider(string name) : base(name, MediaProviderType) { } public static readonly MetaInfoContainerType MediaProviderType = new MetaInfoContainerType("MediaProvider"); + public static readonly MetaInfoItemType FileTypeIdentifierType = new MetaInfoItemType("FileTypeIdentifier"); //TODO + public static readonly MetaInfoItemType FileSizeType = new MetaInfoItemType("FileSize", "bytes"); public static readonly MetaInfoItemType OverheadType = new MetaInfoItemType("Overhead", "bytes"); public static readonly MetaInfoItemType ContainerVersionType = new MetaInfoItemType("ContainerVersion");