Files
Aaru/Aaru.Filters/AppleSingle.cs

555 lines
21 KiB
C#
Raw Normal View History

2017-05-19 20:28:49 +01:00
// /***************************************************************************
2020-02-27 12:31:25 +00:00
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : AppleSingle.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Filters.
//
// --[ Description ] ----------------------------------------------------------
//
// Provides a filter to open AppleSingle files.
//
// --[ 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/>.
//
// ----------------------------------------------------------------------------
2022-02-18 10:02:53 +00:00
// Copyright © 2011-2022 Natalia Portillo
// ****************************************************************************/
2017-12-19 19:33:46 +00:00
using System;
2020-07-20 07:47:12 +01:00
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
2017-12-19 19:33:46 +00:00
using System.Runtime.InteropServices;
2021-09-16 04:42:14 +01:00
using Aaru.CommonTypes.Enums;
2020-02-27 00:33:26 +00:00
using Aaru.CommonTypes.Interfaces;
2020-07-20 15:43:52 +01:00
using Aaru.Helpers;
2020-02-27 00:33:26 +00:00
using Marshal = Aaru.Helpers.Marshal;
2020-02-27 00:33:26 +00:00
namespace Aaru.Filters
{
2021-08-17 14:40:37 +01:00
/// <inheritdoc />
2020-02-29 18:03:35 +00:00
/// <summary>Decodes AppleSingle files</summary>
2020-07-20 07:47:12 +01:00
[SuppressMessage("ReSharper", "UnusedMember.Local")]
2020-07-22 13:20:25 +01:00
public sealed class AppleSingle : IFilter
{
2020-07-20 21:11:32 +01:00
const uint MAGIC = 0x00051600;
const uint VERSION = 0x00010000;
const uint VERSION2 = 0x00020000;
readonly byte[] _dosHome =
2018-08-29 22:15:43 +01:00
{
0x4D, 0x53, 0x2D, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
2020-07-20 21:11:32 +01:00
readonly byte[] _macintoshHome =
2018-08-29 22:15:43 +01:00
{
0x4D, 0x61, 0x63, 0x69, 0x6E, 0x74, 0x6F, 0x73, 0x68, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
2020-07-20 21:11:32 +01:00
readonly byte[] _osxHome =
2018-08-29 22:15:43 +01:00
{
0x4D, 0x61, 0x63, 0x20, 0x4F, 0x53, 0x20, 0x58, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
2020-07-20 21:11:32 +01:00
readonly byte[] _proDosHome =
2018-08-29 22:15:43 +01:00
{
0x50, 0x72, 0x6F, 0x44, 0x4F, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
2020-07-20 21:11:32 +01:00
readonly byte[] _unixHome =
2018-08-29 22:15:43 +01:00
{
0x55, 0x6E, 0x69, 0x78, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
2020-07-20 21:11:32 +01:00
readonly byte[] _vmsHome =
2018-08-29 22:15:43 +01:00
{
0x56, 0x41, 0x58, 0x20, 0x56, 0x4D, 0x53, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20
};
byte[] _bytes;
Entry _dataFork;
Header _header;
bool _isBytes, _isStream, _isPath;
Entry _rsrcFork;
Stream _stream;
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-08-17 21:23:10 +01:00
public string Name => "AppleSingle";
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public Guid Id => new("A69B20E8-F4D3-42BB-BD2B-4A7263394A05");
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2018-08-29 22:15:43 +01:00
public string Author => "Natalia Portillo";
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public void Close()
{
2020-07-20 21:11:32 +01:00
_bytes = null;
_stream?.Close();
_isBytes = false;
_isStream = false;
_isPath = false;
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public string BasePath { get; private set; }
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public DateTime CreationTime { get; private set; }
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public long DataForkLength => _dataFork.length;
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public Stream GetDataForkStream()
{
2020-07-20 21:11:32 +01:00
if(_dataFork.length == 0)
2020-02-29 18:03:35 +00:00
return null;
2020-07-20 21:11:32 +01:00
if(_isBytes)
2021-08-17 14:27:19 +01:00
return new OffsetStream(_bytes, _dataFork.offset, _dataFork.offset + _dataFork.length - 1);
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
if(_isStream)
2021-08-17 14:27:19 +01:00
return new OffsetStream(_stream, _dataFork.offset, _dataFork.offset + _dataFork.length - 1);
2020-07-20 21:11:32 +01:00
if(_isPath)
return new OffsetStream(BasePath, FileMode.Open, FileAccess.Read, _dataFork.offset,
2021-08-17 14:27:19 +01:00
_dataFork.offset + _dataFork.length - 1);
return null;
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public string Filename => System.IO.Path.GetFileName(BasePath);
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public DateTime LastWriteTime { get; private set; }
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public long Length => _dataFork.length + _rsrcFork.length;
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public string Path => BasePath;
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public long ResourceForkLength => _rsrcFork.length;
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public Stream GetResourceForkStream()
{
2020-07-20 21:11:32 +01:00
if(_rsrcFork.length == 0)
2020-02-29 18:03:35 +00:00
return null;
2020-07-20 21:11:32 +01:00
if(_isBytes)
2021-08-17 14:27:19 +01:00
return new OffsetStream(_bytes, _rsrcFork.offset, _rsrcFork.offset + _rsrcFork.length - 1);
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
if(_isStream)
2021-08-17 14:27:19 +01:00
return new OffsetStream(_stream, _rsrcFork.offset, _rsrcFork.offset + _rsrcFork.length - 1);
2020-07-20 21:11:32 +01:00
if(_isPath)
return new OffsetStream(BasePath, FileMode.Open, FileAccess.Read, _rsrcFork.offset,
2021-08-17 14:27:19 +01:00
_rsrcFork.offset + _rsrcFork.length - 1);
return null;
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public bool HasResourceFork => _rsrcFork.length > 0;
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public bool Identify(byte[] buffer)
{
2020-02-29 18:03:35 +00:00
if(buffer == null ||
buffer.Length < 26)
return false;
2020-07-20 21:11:32 +01:00
byte[] hdrB = new byte[26];
Array.Copy(buffer, 0, hdrB, 0, 26);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
2020-07-20 21:11:32 +01:00
return _header.magic == MAGIC && (_header.version == VERSION || _header.version == VERSION2);
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public bool Identify(Stream stream)
{
2020-02-29 18:03:35 +00:00
if(stream == null ||
stream.Length < 26)
return false;
2020-07-20 21:11:32 +01:00
byte[] hdrB = new byte[26];
stream.Seek(0, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
stream.Read(hdrB, 0, 26);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
2020-07-20 21:11:32 +01:00
return _header.magic == MAGIC && (_header.version == VERSION || _header.version == VERSION2);
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
public bool Identify(string path)
{
if(!File.Exists(path))
return false;
2020-02-29 18:03:35 +00:00
var fstream = new FileStream(path, FileMode.Open, FileAccess.Read);
if(fstream.Length < 26)
return false;
2020-07-20 21:11:32 +01:00
byte[] hdrB = new byte[26];
fstream.Read(hdrB, 0, 26);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
fstream.Close();
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
return _header.magic == MAGIC && (_header.version == VERSION || _header.version == VERSION2);
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-09-16 04:42:14 +01:00
public ErrorNumber Open(byte[] buffer)
{
2020-02-29 18:03:35 +00:00
var ms = new MemoryStream(buffer);
ms.Seek(0, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
byte[] hdrB = new byte[26];
ms.Read(hdrB, 0, 26);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
Entry[] entries = new Entry[_header.entries];
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
for(int i = 0; i < _header.entries; i++)
{
byte[] entry = new byte[12];
ms.Read(entry, 0, 12);
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
}
CreationTime = DateTime.UtcNow;
LastWriteTime = CreationTime;
2020-02-29 18:03:35 +00:00
foreach(Entry entry in entries)
switch((AppleSingleEntryID)entry.id)
{
case AppleSingleEntryID.DataFork:
2020-07-20 21:11:32 +01:00
_dataFork = entry;
2020-02-29 18:03:35 +00:00
break;
case AppleSingleEntryID.FileDates:
ms.Seek(entry.offset, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
byte[] datesB = new byte[16];
ms.Read(datesB, 0, 16);
2020-02-29 18:03:35 +00:00
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.UnixUnsignedToDateTime(dates.creationDate);
LastWriteTime = DateHandlers.UnixUnsignedToDateTime(dates.modificationDate);
2020-02-29 18:03:35 +00:00
break;
case AppleSingleEntryID.FileInfo:
ms.Seek(entry.offset, SeekOrigin.Begin);
byte[] finfo = new byte[entry.length];
ms.Read(finfo, 0, finfo.Length);
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
{
MacFileInfo macinfo = Marshal.ByteArrayToStructureBigEndian<MacFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(macinfo.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_proDosHome.SequenceEqual(_header.homeFilesystem))
{
ProDOSFileInfo prodosinfo = Marshal.ByteArrayToStructureBigEndian<ProDOSFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_unixHome.SequenceEqual(_header.homeFilesystem))
{
UnixFileInfo unixinfo = Marshal.ByteArrayToStructureBigEndian<UnixFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
LastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_dosHome.SequenceEqual(_header.homeFilesystem))
{
DOSFileInfo dosinfo = Marshal.ByteArrayToStructureBigEndian<DOSFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
LastWriteTime =
2017-12-23 03:59:48 +00:00
DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
}
2018-06-22 08:08:38 +01:00
break;
case AppleSingleEntryID.ResourceFork:
2020-07-20 21:11:32 +01:00
_rsrcFork = entry;
2020-02-29 18:03:35 +00:00
break;
}
ms.Close();
2020-07-20 21:11:32 +01:00
_isBytes = true;
_bytes = buffer;
2021-09-15 13:03:42 +01:00
2021-09-16 04:42:14 +01:00
return ErrorNumber.NoError;
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-09-16 04:42:14 +01:00
public ErrorNumber Open(Stream stream)
{
stream.Seek(0, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
byte[] hdrB = new byte[26];
stream.Read(hdrB, 0, 26);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
Entry[] entries = new Entry[_header.entries];
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
for(int i = 0; i < _header.entries; i++)
{
byte[] entry = new byte[12];
stream.Read(entry, 0, 12);
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
}
CreationTime = DateTime.UtcNow;
LastWriteTime = CreationTime;
2020-02-29 18:03:35 +00:00
foreach(Entry entry in entries)
switch((AppleSingleEntryID)entry.id)
{
case AppleSingleEntryID.DataFork:
2020-07-20 21:11:32 +01:00
_dataFork = entry;
2020-02-29 18:03:35 +00:00
break;
case AppleSingleEntryID.FileDates:
stream.Seek(entry.offset, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
byte[] datesB = new byte[16];
stream.Read(datesB, 0, 16);
2020-02-29 18:03:35 +00:00
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(dates.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(dates.modificationDate);
2020-02-29 18:03:35 +00:00
break;
case AppleSingleEntryID.FileInfo:
stream.Seek(entry.offset, SeekOrigin.Begin);
byte[] finfo = new byte[entry.length];
stream.Read(finfo, 0, finfo.Length);
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
{
MacFileInfo macinfo = Marshal.ByteArrayToStructureBigEndian<MacFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(macinfo.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_proDosHome.SequenceEqual(_header.homeFilesystem))
{
ProDOSFileInfo prodosinfo = Marshal.ByteArrayToStructureBigEndian<ProDOSFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_unixHome.SequenceEqual(_header.homeFilesystem))
{
UnixFileInfo unixinfo = Marshal.ByteArrayToStructureBigEndian<UnixFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
LastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_dosHome.SequenceEqual(_header.homeFilesystem))
{
DOSFileInfo dosinfo = Marshal.ByteArrayToStructureBigEndian<DOSFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
LastWriteTime =
2017-12-23 03:59:48 +00:00
DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
}
2018-06-22 08:08:38 +01:00
break;
case AppleSingleEntryID.ResourceFork:
2020-07-20 21:11:32 +01:00
_rsrcFork = entry;
2020-02-29 18:03:35 +00:00
break;
}
stream.Seek(0, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
_isStream = true;
_stream = stream;
2021-09-15 13:03:42 +01:00
2021-09-16 04:42:14 +01:00
return ErrorNumber.NoError;
}
2021-08-17 13:56:05 +01:00
/// <inheritdoc />
2021-09-16 04:42:14 +01:00
public ErrorNumber Open(string path)
{
2020-02-29 18:03:35 +00:00
var fs = new FileStream(path, FileMode.Open, FileAccess.Read);
fs.Seek(0, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
byte[] hdrB = new byte[26];
fs.Read(hdrB, 0, 26);
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
Entry[] entries = new Entry[_header.entries];
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
for(int i = 0; i < _header.entries; i++)
{
byte[] entry = new byte[12];
fs.Read(entry, 0, 12);
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
}
CreationTime = DateTime.UtcNow;
LastWriteTime = CreationTime;
2020-02-29 18:03:35 +00:00
foreach(Entry entry in entries)
switch((AppleSingleEntryID)entry.id)
{
case AppleSingleEntryID.DataFork:
2020-07-20 21:11:32 +01:00
_dataFork = entry;
2020-02-29 18:03:35 +00:00
break;
case AppleSingleEntryID.FileDates:
fs.Seek(entry.offset, SeekOrigin.Begin);
2020-07-20 21:11:32 +01:00
byte[] datesB = new byte[16];
fs.Read(datesB, 0, 16);
2020-02-29 18:03:35 +00:00
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(dates.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(dates.modificationDate);
2020-02-29 18:03:35 +00:00
break;
case AppleSingleEntryID.FileInfo:
fs.Seek(entry.offset, SeekOrigin.Begin);
byte[] finfo = new byte[entry.length];
fs.Read(finfo, 0, finfo.Length);
2020-02-29 18:03:35 +00:00
2020-07-20 21:11:32 +01:00
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
{
MacFileInfo macinfo = Marshal.ByteArrayToStructureBigEndian<MacFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(macinfo.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(macinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_proDosHome.SequenceEqual(_header.homeFilesystem))
{
ProDOSFileInfo prodosinfo = Marshal.ByteArrayToStructureBigEndian<ProDOSFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.MacToDateTime(prodosinfo.creationDate);
LastWriteTime = DateHandlers.MacToDateTime(prodosinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_unixHome.SequenceEqual(_header.homeFilesystem))
{
UnixFileInfo unixinfo = Marshal.ByteArrayToStructureBigEndian<UnixFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
CreationTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.creationDate);
LastWriteTime = DateHandlers.UnixUnsignedToDateTime(unixinfo.modificationDate);
}
2020-07-20 21:11:32 +01:00
else if(_dosHome.SequenceEqual(_header.homeFilesystem))
{
DOSFileInfo dosinfo = Marshal.ByteArrayToStructureBigEndian<DOSFileInfo>(finfo);
2020-02-29 18:03:35 +00:00
LastWriteTime =
2017-12-23 03:59:48 +00:00
DateHandlers.DosToDateTime(dosinfo.modificationDate, dosinfo.modificationTime);
}
2018-06-22 08:08:38 +01:00
break;
case AppleSingleEntryID.ResourceFork:
2020-07-20 21:11:32 +01:00
_rsrcFork = entry;
2020-02-29 18:03:35 +00:00
break;
}
fs.Close();
_isPath = true;
BasePath = path;
2021-09-15 13:03:42 +01:00
2021-09-16 04:42:14 +01:00
return ErrorNumber.NoError;
}
enum AppleSingleEntryID : uint
{
2020-02-29 18:03:35 +00:00
Invalid = 0, DataFork = 1, ResourceFork = 2,
RealName = 3, Comment = 4, Icon = 5,
ColorIcon = 6, FileInfo = 7, FileDates = 8,
FinderInfo = 9, MacFileInfo = 10, ProDOSFileInfo = 11,
2020-07-20 21:11:32 +01:00
DOSFileInfo = 12, ShortName = 13, AfpFileInfo = 14,
2020-02-29 18:03:35 +00:00
DirectoryID = 15
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct Header
{
2020-02-29 18:03:35 +00:00
public readonly uint magic;
public readonly uint version;
2018-06-22 08:08:38 +01:00
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
2020-02-29 18:03:35 +00:00
public readonly byte[] homeFilesystem;
public readonly ushort entries;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct Entry
{
2020-02-29 18:03:35 +00:00
public readonly uint id;
public readonly uint offset;
public readonly uint length;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct FileDates
{
2020-02-29 18:03:35 +00:00
public readonly uint creationDate;
public readonly uint modificationDate;
public readonly uint backupDate;
public readonly uint accessDate;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct MacFileInfo
{
2020-02-29 18:03:35 +00:00
public readonly uint creationDate;
public readonly uint modificationDate;
public readonly uint backupDate;
public readonly uint accessDate;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct UnixFileInfo
{
2020-02-29 18:03:35 +00:00
public readonly uint creationDate;
public readonly uint accessDate;
public readonly uint modificationDate;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct DOSFileInfo
{
2020-02-29 18:03:35 +00:00
public readonly ushort modificationDate;
public readonly ushort modificationTime;
public readonly ushort attributes;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
readonly struct ProDOSFileInfo
{
2020-02-29 18:03:35 +00:00
public readonly uint creationDate;
public readonly uint modificationDate;
public readonly uint backupDate;
public readonly ushort access;
public readonly ushort fileType;
public readonly uint auxType;
}
}
2017-12-19 20:33:03 +00:00
}