Refactor: Split ISO9660.

This commit is contained in:
2017-10-08 20:41:54 +01:00
parent 32dc6cb630
commit 9a178d1456
10 changed files with 548 additions and 283 deletions

View File

@@ -48,7 +48,6 @@
<Compile Include="FAT.cs" />
<Compile Include="FFS.cs" />
<Compile Include="HPFS.cs" />
<Compile Include="ISO9660.cs" />
<Compile Include="MinixFS.cs" />
<Compile Include="NTFS.cs" />
<Compile Include="ODS.cs" />
@@ -137,6 +136,14 @@
<Compile Include="Locus.cs" />
<Compile Include="dump.cs" />
<Compile Include="MicroDOS.cs" />
<Compile Include="ISO9660\Dir.cs" />
<Compile Include="ISO9660\File.cs" />
<Compile Include="ISO9660\Info.cs" />
<Compile Include="ISO9660\ISO9660.cs" />
<Compile Include="ISO9660\Structs.cs" />
<Compile Include="ISO9660\Xattr.cs" />
<Compile Include="ISO9660\Extent.cs" />
<Compile Include="ISO9660\Super.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
<ItemGroup>
@@ -179,6 +186,7 @@
<Folder Include="AppleMFS\" />
<Folder Include="CPM\" />
<Folder Include="AppleDOS\" />
<Folder Include="ISO9660\" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.LGPL">
@@ -194,7 +202,7 @@
<Properties>
<Policies>
<TextStylePolicy FileWidth="120" TabWidth="4" IndentWidth="4" RemoveTrailingWhitespace="True" NoTabsAfterNonTabs="False" EolMarker="Native" TabsToSpaces="True" scope="text/x-csharp" />
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" scope="text/x-csharp" />
<CSharpFormattingPolicy IndentBlock="True" IndentBraces="False" IndentSwitchSection="True" IndentSwitchCaseSection="True" LabelPositioning="OneLess" NewLinesForBracesInTypes="True" NewLinesForBracesInMethods="True" NewLinesForBracesInProperties="True" NewLinesForBracesInAccessors="True" NewLinesForBracesInAnonymousMethods="True" NewLinesForBracesInControlBlocks="True" NewLinesForBracesInAnonymousTypes="True" NewLinesForBracesInObjectCollectionArrayInitializers="True" NewLinesForBracesInLambdaExpressionBody="True" NewLineForElse="True" NewLineForCatch="True" NewLineForFinally="True" NewLineForMembersInObjectInit="True" NewLineForMembersInAnonymousTypes="True" NewLineForClausesInQuery="True" SpacingAfterMethodDeclarationName="False" SpaceWithinMethodDeclarationParenthesis="False" SpaceBetweenEmptyMethodDeclarationParentheses="False" SpaceAfterMethodCallName="False" SpaceWithinMethodCallParentheses="False" SpaceBetweenEmptyMethodCallParentheses="False" SpaceAfterControlFlowStatementKeyword="False" SpaceWithinExpressionParentheses="False" SpaceWithinCastParentheses="False" SpaceWithinOtherParentheses="False" SpaceAfterCast="False" SpacesIgnoreAroundVariableDeclaration="False" SpaceBeforeOpenSquareBracket="False" SpaceBetweenEmptySquareBrackets="False" SpaceWithinSquareBrackets="False" SpaceAfterColonInBaseTypeDeclaration="True" SpaceAfterComma="True" SpaceAfterDot="False" SpaceAfterSemicolonsInForStatement="True" SpaceBeforeColonInBaseTypeDeclaration="True" SpaceBeforeComma="False" SpaceBeforeDot="False" SpaceBeforeSemicolonsInForStatement="False" SpacingAroundBinaryOperator="Single" WrappingPreserveSingleLine="True" WrappingKeepStatementsOnSingleLine="True" PlaceSystemDirectiveFirst="True" scope="text/x-csharp" />
<DotNetNamingPolicy DirectoryNamespaceAssociation="PrefixedHierarchical" ResourceNamePolicy="MSBuild" />
<StandardHeader IncludeInNewFiles="True" Text="/***************************************************************************&#xA;The Disc Image Chef&#xA;----------------------------------------------------------------------------&#xA; &#xA;Filename : ${FileName}&#xA;Author(s) : ${AuthorName} &lt;${AuthorEmail}&gt;&#xA;&#xA;Component : Component&#xA; &#xA;--[ Description ] ----------------------------------------------------------&#xA; &#xA; Description&#xA; &#xA;--[ License ] --------------------------------------------------------------&#xA; &#xA; This library is free software; you can redistribute it and/or modify&#xA; it under the terms of the GNU Lesser General Public License as&#xA; published by the Free Software Foundation; either version 2.1 of the&#xA; License, or (at your option) any later version.&#xA;&#xA; This library is distributed in the hope that it will be useful, but&#xA; WITHOUT ANY WARRANTY; without even the implied warranty of&#xA; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU&#xA; Lesser General Public License for more details.&#xA;&#xA; You should have received a copy of the GNU Lesser General Public&#xA; License along with this library; if not, see &lt;http://www.gnu.org/licenses/&gt;.&#xA;&#xA;----------------------------------------------------------------------------&#xA;Copyright © 2011-${Year} ${CopyrightHolder}&#xA;****************************************************************************/" />
</Policies>

View File

@@ -0,0 +1,48 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Dir.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660 : Filesystem
{
public override Errno ReadLink(string path, ref string dest)
{
return Errno.NotImplemented;
}
public override Errno ReadDir(string path, ref List<string> contents)
{
return Errno.NotImplemented;
}
}
}

View File

@@ -0,0 +1,42 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Extent.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660 : Filesystem
{
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
{
return Errno.NotImplemented;
}
}
}

View File

@@ -0,0 +1,52 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : File.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660 : Filesystem
{
public override Errno GetAttributes(string path, ref FileAttributes attributes)
{
return Errno.NotImplemented;
}
public override Errno Read(string path, long offset, long size, ref byte[] buf)
{
return Errno.NotImplemented;
}
public override Errno Stat(string path, ref FileEntryInfo stat)
{
return Errno.NotImplemented;
}
}
}

View File

@@ -0,0 +1,58 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ISO9660.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
using System;
using System.Text;
using DiscImageChef.CommonTypes;
namespace DiscImageChef.Filesystems.ISO9660
{
// This is coded following ECMA-119.
// TODO: Differentiate ISO Level 1, 2, 3 and ISO 9660:1999
// TODO: Apple extensiones, requires XA or advance RR interpretation.
public partial class ISO9660 : Filesystem
{
public ISO9660()
{
Name = "ISO9660 Filesystem";
PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8");
CurrentEncoding = Encoding.ASCII;
}
public ISO9660(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "ISO9660 Filesystem";
PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8");
if(encoding == null)
CurrentEncoding = Encoding.ASCII;
}
}
}

View File

@@ -2,14 +2,14 @@
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ISO9660.cs
// Filename : Info.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : ISO 9660 filesystem plugin.
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies the ISO 9660 filesystem and shows information.
// Description
//
// --[ License ] --------------------------------------------------------------
//
@@ -29,136 +29,18 @@
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
namespace DiscImageChef.Filesystems
namespace DiscImageChef.Filesystems.ISO9660
{
// This is coded following ECMA-119.
// TODO: Differentiate ISO Level 1, 2, 3 and ISO 9660:1999
// TODO: Apple extensiones, requires XA or advance RR interpretation.
// TODO: Needs a major rewrite
public class ISO9660Plugin : Filesystem
public partial class ISO9660 : Filesystem
{
//static bool alreadyLaunched;
public ISO9660Plugin()
{
Name = "ISO9660 Filesystem";
PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8");
CurrentEncoding = Encoding.ASCII;
}
public ISO9660Plugin(ImagePlugins.ImagePlugin imagePlugin, Partition partition, Encoding encoding)
{
Name = "ISO9660 Filesystem";
PluginUUID = new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8");
if(encoding == null)
CurrentEncoding = Encoding.ASCII;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct PrimaryVolumeDescriptor
{
public byte type;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[] id;
public byte version;
// Only used in SVDs
public byte flags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] system_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] volume_id;
public ulong reserved2;
public ulong volume_space_size;
// Only used in SVDs
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] escape_sequences;
public uint volume_set_size;
public uint volume_sequence_number;
public uint logical_block_size;
public ulong path_table_size;
public uint type_1_path_table;
public uint opt_type_1_path_table;
public uint type_m_path_table;
public uint opt_type_m_path_table;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 34)]
public byte[] root_directory_record;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] volume_set_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] publisher_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] preparer_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] application_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
public byte[] copyright_file_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
public byte[] abstract_file_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
public byte[] bibliographic_file_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] creation_date;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] modification_date;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] expiration_date;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] effective_date;
public byte file_structure_version;
public byte reserved4;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
public byte[] application_data;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)]
public byte[] reserved5;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BootRecord
{
public byte type;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[] id;
public byte version;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] system_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] boot_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1977)]
public byte[] boot_use;
}
struct DecodedVolumeDescriptor
{
public string SystemIdentifier;
public string VolumeIdentifier;
public string VolumeSetIdentifier;
public string PublisherIdentifier;
public string DataPreparerIdentifier;
public string ApplicationIdentifier;
public DateTime CreationTime;
public bool HasModificationTime;
public DateTime ModificationTime;
public bool HasExpirationTime;
public DateTime ExpirationTime;
public bool HasEffectiveTime;
public DateTime EffectiveTime;
}
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, Partition partition)
{
/* if (alreadyLaunched)
return false;
alreadyLaunched = true;*/
byte VDType;
// ISO9660 is designed for 2048 bytes/sector devices
@@ -505,161 +387,5 @@ namespace DiscImageChef.Filesystems
information = ISOMetadata.ToString();
}
static DecodedVolumeDescriptor DecodeJolietDescriptor(PrimaryVolumeDescriptor jolietvd)
{
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor();
decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).TrimEnd().Trim(new[] { '\u0000' });
if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39)
decodedVD.CreationTime = DateTime.MinValue;
else
decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date);
if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39)
{
decodedVD.HasModificationTime = false;
}
else
{
decodedVD.HasModificationTime = true;
decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(jolietvd.modification_date);
}
if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39)
{
decodedVD.HasExpirationTime = false;
}
else
{
decodedVD.HasExpirationTime = true;
decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(jolietvd.expiration_date);
}
if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39)
{
decodedVD.HasEffectiveTime = false;
}
else
{
decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(jolietvd.effective_date);
}
return decodedVD;
}
static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd)
{
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor();
decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' });
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
decodedVD.CreationTime = DateTime.MinValue;
else
decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date);
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00)
{
decodedVD.HasModificationTime = false;
}
else
{
decodedVD.HasModificationTime = true;
decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(pvd.modification_date);
}
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00)
{
decodedVD.HasExpirationTime = false;
}
else
{
decodedVD.HasExpirationTime = true;
decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(pvd.expiration_date);
}
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00)
{
decodedVD.HasEffectiveTime = false;
}
else
{
decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(pvd.effective_date);
}
return decodedVD;
}
public override Errno Mount()
{
return Errno.NotImplemented;
}
public override Errno Mount(bool debug)
{
return Errno.NotImplemented;
}
public override Errno Unmount()
{
return Errno.NotImplemented;
}
public override Errno MapBlock(string path, long fileBlock, ref long deviceBlock)
{
return Errno.NotImplemented;
}
public override Errno GetAttributes(string path, ref FileAttributes attributes)
{
return Errno.NotImplemented;
}
public override Errno ListXAttr(string path, ref List<string> xattrs)
{
return Errno.NotImplemented;
}
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
{
return Errno.NotImplemented;
}
public override Errno Read(string path, long offset, long size, ref byte[] buf)
{
return Errno.NotImplemented;
}
public override Errno ReadDir(string path, ref List<string> contents)
{
return Errno.NotImplemented;
}
public override Errno StatFs(ref FileSystemInfo stat)
{
return Errno.NotImplemented;
}
public override Errno Stat(string path, ref FileEntryInfo stat)
{
return Errno.NotImplemented;
}
public override Errno ReadLink(string path, ref string dest)
{
return Errno.NotImplemented;
}
}
}
}

View File

@@ -0,0 +1,226 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
using System;
using System.Runtime.InteropServices;
using System.Text;
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660 : Filesystem
{
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct PrimaryVolumeDescriptor
{
public byte type;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[] id;
public byte version;
// Only used in SVDs
public byte flags;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] system_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] volume_id;
public ulong reserved2;
public ulong volume_space_size;
// Only used in SVDs
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] escape_sequences;
public uint volume_set_size;
public uint volume_sequence_number;
public uint logical_block_size;
public ulong path_table_size;
public uint type_1_path_table;
public uint opt_type_1_path_table;
public uint type_m_path_table;
public uint opt_type_m_path_table;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 34)]
public byte[] root_directory_record;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] volume_set_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] publisher_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] preparer_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte[] application_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
public byte[] copyright_file_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
public byte[] abstract_file_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 37)]
public byte[] bibliographic_file_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] creation_date;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] modification_date;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] expiration_date;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 17)]
public byte[] effective_date;
public byte file_structure_version;
public byte reserved4;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 512)]
public byte[] application_data;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 653)]
public byte[] reserved5;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct BootRecord
{
public byte type;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 5)]
public byte[] id;
public byte version;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] system_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
public byte[] boot_id;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 1977)]
public byte[] boot_use;
}
struct DecodedVolumeDescriptor
{
public string SystemIdentifier;
public string VolumeIdentifier;
public string VolumeSetIdentifier;
public string PublisherIdentifier;
public string DataPreparerIdentifier;
public string ApplicationIdentifier;
public DateTime CreationTime;
public bool HasModificationTime;
public DateTime ModificationTime;
public bool HasExpirationTime;
public DateTime ExpirationTime;
public bool HasEffectiveTime;
public DateTime EffectiveTime;
}
static DecodedVolumeDescriptor DecodeJolietDescriptor(PrimaryVolumeDescriptor jolietvd)
{
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor();
decodedVD.SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).TrimEnd().Trim(new[] { '\u0000' });
decodedVD.ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).TrimEnd().Trim(new[] { '\u0000' });
if(jolietvd.creation_date[0] < 0x31 || jolietvd.creation_date[0] > 0x39)
decodedVD.CreationTime = DateTime.MinValue;
else
decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(jolietvd.creation_date);
if(jolietvd.modification_date[0] < 0x31 || jolietvd.modification_date[0] > 0x39)
{
decodedVD.HasModificationTime = false;
}
else
{
decodedVD.HasModificationTime = true;
decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(jolietvd.modification_date);
}
if(jolietvd.expiration_date[0] < 0x31 || jolietvd.expiration_date[0] > 0x39)
{
decodedVD.HasExpirationTime = false;
}
else
{
decodedVD.HasExpirationTime = true;
decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(jolietvd.expiration_date);
}
if(jolietvd.effective_date[0] < 0x31 || jolietvd.effective_date[0] > 0x39)
{
decodedVD.HasEffectiveTime = false;
}
else
{
decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(jolietvd.effective_date);
}
return decodedVD;
}
static DecodedVolumeDescriptor DecodeVolumeDescriptor(PrimaryVolumeDescriptor pvd)
{
DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor();
decodedVD.SystemIdentifier = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.VolumeIdentifier = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.VolumeSetIdentifier = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.PublisherIdentifier = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim(new[] { '\0' });
decodedVD.ApplicationIdentifier = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim(new[] { '\0' });
if(pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
decodedVD.CreationTime = DateTime.MinValue;
else
decodedVD.CreationTime = DateHandlers.ISO9660ToDateTime(pvd.creation_date);
if(pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00)
{
decodedVD.HasModificationTime = false;
}
else
{
decodedVD.HasModificationTime = true;
decodedVD.ModificationTime = DateHandlers.ISO9660ToDateTime(pvd.modification_date);
}
if(pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00)
{
decodedVD.HasExpirationTime = false;
}
else
{
decodedVD.HasExpirationTime = true;
decodedVD.ExpirationTime = DateHandlers.ISO9660ToDateTime(pvd.expiration_date);
}
if(pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00)
{
decodedVD.HasEffectiveTime = false;
}
else
{
decodedVD.HasEffectiveTime = true;
decodedVD.EffectiveTime = DateHandlers.ISO9660ToDateTime(pvd.effective_date);
}
return decodedVD;
}
}
}

View File

@@ -0,0 +1,57 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Super.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660 : Filesystem
{
public override Errno Mount()
{
return Errno.NotImplemented;
}
public override Errno Mount(bool debug)
{
return Errno.NotImplemented;
}
public override Errno Unmount()
{
return Errno.NotImplemented;
}
public override Errno StatFs(ref FileSystemInfo stat)
{
return Errno.NotImplemented;
}
}
}

View File

@@ -0,0 +1,48 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Xattr.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Component
//
// --[ Description ] ----------------------------------------------------------
//
// Description
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library 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
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2017 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
namespace DiscImageChef.Filesystems.ISO9660
{
public partial class ISO9660 : Filesystem
{
public override Errno ListXAttr(string path, ref List<string> xattrs)
{
return Errno.NotImplemented;
}
public override Errno GetXattr(string path, string xattr, ref byte[] buf)
{
return Errno.NotImplemented;
}
}
}

View File

@@ -142,7 +142,7 @@ namespace DiscImageChef.Tests.Filesystems
Assert.AreEqual(mediatypes[i], image.ImageInfo.mediaType, testfiles[i]);
Assert.AreEqual(sectors[i], image.ImageInfo.sectors, testfiles[i]);
Assert.AreEqual(sectorsize[i], image.ImageInfo.sectorSize, testfiles[i]);
Filesystem fs = new ISO9660Plugin();
Filesystem fs = new DiscImageChef.Filesystems.ISO9660.ISO9660();
Partition wholePart = new Partition
{
Name = "Whole device",