mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Aaru.Filters] Reformat and cleanup.
This commit is contained in:
@@ -58,7 +58,7 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DotNetZip" Version="1.16.0"/>
|
||||
<PackageReference Include="SharpCompress" Version="0.34.0" />
|
||||
<PackageReference Include="SharpCompress" Version="0.34.0"/>
|
||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
xmlns:s="clr-namespace:System;assembly=mscorlib"
|
||||
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
|
||||
<s:Boolean
|
||||
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||
@@ -61,10 +61,14 @@ public sealed class AppleDouble : IFilter
|
||||
string _headerPath;
|
||||
Entry _rsrcFork;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.AppleDouble_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("1B2165EE-C9DF-4B21-BBBB-9E5892B2DF4D");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -164,7 +168,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(prodosStream.Length > 26)
|
||||
{
|
||||
byte[] prodosB = new byte[26];
|
||||
var prodosB = new byte[26];
|
||||
prodosStream.EnsureRead(prodosB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(prodosB);
|
||||
prodosStream.Close();
|
||||
@@ -181,7 +185,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(unixStream.Length > 26)
|
||||
{
|
||||
byte[] unixB = new byte[26];
|
||||
var unixB = new byte[26];
|
||||
unixStream.EnsureRead(unixB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(unixB);
|
||||
unixStream.Close();
|
||||
@@ -198,7 +202,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(dosStream.Length > 26)
|
||||
{
|
||||
byte[] dosB = new byte[26];
|
||||
var dosB = new byte[26];
|
||||
dosStream.EnsureRead(dosB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(dosB);
|
||||
dosStream.Close();
|
||||
@@ -215,7 +219,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(doslStream.Length > 26)
|
||||
{
|
||||
byte[] doslB = new byte[26];
|
||||
var doslB = new byte[26];
|
||||
doslStream.EnsureRead(doslB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(doslB);
|
||||
doslStream.Close();
|
||||
@@ -232,7 +236,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(netatalkStream.Length > 26)
|
||||
{
|
||||
byte[] netatalkB = new byte[26];
|
||||
var netatalkB = new byte[26];
|
||||
netatalkStream.EnsureRead(netatalkB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(netatalkB);
|
||||
netatalkStream.Close();
|
||||
@@ -249,7 +253,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(daveStream.Length > 26)
|
||||
{
|
||||
byte[] daveB = new byte[26];
|
||||
var daveB = new byte[26];
|
||||
daveStream.EnsureRead(daveB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(daveB);
|
||||
daveStream.Close();
|
||||
@@ -266,7 +270,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(osxStream.Length > 26)
|
||||
{
|
||||
byte[] osxB = new byte[26];
|
||||
var osxB = new byte[26];
|
||||
osxStream.EnsureRead(osxB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(osxB);
|
||||
osxStream.Close();
|
||||
@@ -285,7 +289,7 @@ public sealed class AppleDouble : IFilter
|
||||
if(unarStream.Length <= 26)
|
||||
return false;
|
||||
|
||||
byte[] unarB = new byte[26];
|
||||
var unarB = new byte[26];
|
||||
unarStream.EnsureRead(unarB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(unarB);
|
||||
unarStream.Close();
|
||||
@@ -345,7 +349,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(prodosStream.Length > 26)
|
||||
{
|
||||
byte[] prodosB = new byte[26];
|
||||
var prodosB = new byte[26];
|
||||
prodosStream.EnsureRead(prodosB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(prodosB);
|
||||
prodosStream.Close();
|
||||
@@ -362,7 +366,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(unixStream.Length > 26)
|
||||
{
|
||||
byte[] unixB = new byte[26];
|
||||
var unixB = new byte[26];
|
||||
unixStream.EnsureRead(unixB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(unixB);
|
||||
unixStream.Close();
|
||||
@@ -379,7 +383,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(dosStream.Length > 26)
|
||||
{
|
||||
byte[] dosB = new byte[26];
|
||||
var dosB = new byte[26];
|
||||
dosStream.EnsureRead(dosB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(dosB);
|
||||
dosStream.Close();
|
||||
@@ -396,7 +400,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(doslStream.Length > 26)
|
||||
{
|
||||
byte[] doslB = new byte[26];
|
||||
var doslB = new byte[26];
|
||||
doslStream.EnsureRead(doslB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(doslB);
|
||||
doslStream.Close();
|
||||
@@ -413,7 +417,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(netatalkStream.Length > 26)
|
||||
{
|
||||
byte[] netatalkB = new byte[26];
|
||||
var netatalkB = new byte[26];
|
||||
netatalkStream.EnsureRead(netatalkB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(netatalkB);
|
||||
netatalkStream.Close();
|
||||
@@ -430,7 +434,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(daveStream.Length > 26)
|
||||
{
|
||||
byte[] daveB = new byte[26];
|
||||
var daveB = new byte[26];
|
||||
daveStream.EnsureRead(daveB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(daveB);
|
||||
daveStream.Close();
|
||||
@@ -447,7 +451,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(osxStream.Length > 26)
|
||||
{
|
||||
byte[] osxB = new byte[26];
|
||||
var osxB = new byte[26];
|
||||
osxStream.EnsureRead(osxB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(osxB);
|
||||
osxStream.Close();
|
||||
@@ -464,7 +468,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
if(unarStream.Length > 26)
|
||||
{
|
||||
byte[] unarB = new byte[26];
|
||||
var unarB = new byte[26];
|
||||
unarStream.EnsureRead(unarB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(unarB);
|
||||
unarStream.Close();
|
||||
@@ -481,15 +485,15 @@ public sealed class AppleDouble : IFilter
|
||||
var fs = new FileStream(_headerPath, FileMode.Open, FileAccess.Read);
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
fs.EnsureRead(hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
Entry[] entries = new Entry[_header.entries];
|
||||
var entries = new Entry[_header.entries];
|
||||
|
||||
for(int i = 0; i < _header.entries; i++)
|
||||
for(var i = 0; i < _header.entries; i++)
|
||||
{
|
||||
byte[] entry = new byte[12];
|
||||
var entry = new byte[12];
|
||||
fs.EnsureRead(entry, 0, 12);
|
||||
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
|
||||
}
|
||||
@@ -498,6 +502,7 @@ public sealed class AppleDouble : IFilter
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
foreach(Entry entry in entries)
|
||||
{
|
||||
switch((EntryId)entry.id)
|
||||
{
|
||||
case EntryId.DataFork:
|
||||
@@ -505,7 +510,7 @@ public sealed class AppleDouble : IFilter
|
||||
break;
|
||||
case EntryId.FileDates:
|
||||
fs.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] datesB = new byte[16];
|
||||
var datesB = new byte[16];
|
||||
fs.EnsureRead(datesB, 0, 16);
|
||||
|
||||
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
|
||||
@@ -516,7 +521,7 @@ public sealed class AppleDouble : IFilter
|
||||
break;
|
||||
case EntryId.FileInfo:
|
||||
fs.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] finfo = new byte[entry.length];
|
||||
var finfo = new byte[entry.length];
|
||||
fs.EnsureRead(finfo, 0, finfo.Length);
|
||||
|
||||
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
|
||||
@@ -553,6 +558,7 @@ public sealed class AppleDouble : IFilter
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_dataFork = new Entry
|
||||
{
|
||||
@@ -572,16 +578,71 @@ public sealed class AppleDouble : IFilter
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: DOSFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct DOSFileInfo
|
||||
{
|
||||
public readonly ushort modificationDate;
|
||||
public readonly ushort modificationTime;
|
||||
public readonly ushort attributes;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: Entry
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct Entry
|
||||
{
|
||||
public uint id;
|
||||
public readonly uint offset;
|
||||
public uint length;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: EntryId
|
||||
|
||||
enum EntryId : uint
|
||||
{
|
||||
Invalid = 0, DataFork = 1, ResourceFork = 2,
|
||||
RealName = 3, Comment = 4, Icon = 5,
|
||||
ColorIcon = 6, FileInfo = 7, FileDates = 8,
|
||||
FinderInfo = 9, MacFileInfo = 10, ProDOSFileInfo = 11,
|
||||
DOSFileInfo = 12, ShortName = 13, AfpFileInfo = 14,
|
||||
DirectoryID = 15
|
||||
Invalid = 0,
|
||||
DataFork = 1,
|
||||
ResourceFork = 2,
|
||||
RealName = 3,
|
||||
Comment = 4,
|
||||
Icon = 5,
|
||||
ColorIcon = 6,
|
||||
FileInfo = 7,
|
||||
FileDates = 8,
|
||||
FinderInfo = 9,
|
||||
MacFileInfo = 10,
|
||||
ProDOSFileInfo = 11,
|
||||
DOSFileInfo = 12,
|
||||
ShortName = 13,
|
||||
AfpFileInfo = 14,
|
||||
DirectoryID = 15
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: FileDates
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct FileDates
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: Header
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Header
|
||||
{
|
||||
@@ -592,22 +653,9 @@ public sealed class AppleDouble : IFilter
|
||||
public readonly ushort entries;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct Entry
|
||||
{
|
||||
public uint id;
|
||||
public readonly uint offset;
|
||||
public uint length;
|
||||
}
|
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct FileDates
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
#region Nested type: MacFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct MacFileInfo
|
||||
@@ -618,21 +666,9 @@ public sealed class AppleDouble : IFilter
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct UnixFileInfo
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint accessDate;
|
||||
public readonly uint modificationDate;
|
||||
}
|
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct DOSFileInfo
|
||||
{
|
||||
public readonly ushort modificationDate;
|
||||
public readonly ushort modificationTime;
|
||||
public readonly ushort attributes;
|
||||
}
|
||||
#region Nested type: ProDOSFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct ProDOSFileInfo
|
||||
@@ -644,4 +680,18 @@ public sealed class AppleDouble : IFilter
|
||||
public readonly ushort fileType;
|
||||
public readonly uint auxType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: UnixFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct UnixFileInfo
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint accessDate;
|
||||
public readonly uint modificationDate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -63,10 +63,14 @@ public sealed class AppleSingle : IFilter
|
||||
Entry _rsrcFork;
|
||||
Stream _stream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.AppleSingle_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("A69B20E8-F4D3-42BB-BD2B-4A7263394A05");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -102,8 +106,10 @@ public sealed class AppleSingle : IFilter
|
||||
return new OffsetStream(_stream, _dataFork.offset, _dataFork.offset + _dataFork.length - 1);
|
||||
|
||||
if(_isPath)
|
||||
{
|
||||
return new OffsetStream(BasePath, FileMode.Open, FileAccess.Read, _dataFork.offset,
|
||||
_dataFork.offset + _dataFork.length - 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -139,8 +145,10 @@ public sealed class AppleSingle : IFilter
|
||||
return new OffsetStream(_stream, _rsrcFork.offset, _rsrcFork.offset + _rsrcFork.length - 1);
|
||||
|
||||
if(_isPath)
|
||||
{
|
||||
return new OffsetStream(BasePath, FileMode.Open, FileAccess.Read, _rsrcFork.offset,
|
||||
_rsrcFork.offset + _rsrcFork.length - 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -155,7 +163,7 @@ public sealed class AppleSingle : IFilter
|
||||
buffer.Length < 26)
|
||||
return false;
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
Array.Copy(buffer, 0, hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
@@ -169,7 +177,7 @@ public sealed class AppleSingle : IFilter
|
||||
stream.Length < 26)
|
||||
return false;
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
@@ -188,7 +196,7 @@ public sealed class AppleSingle : IFilter
|
||||
if(fstream.Length < 26)
|
||||
return false;
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
fstream.EnsureRead(hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
@@ -203,15 +211,15 @@ public sealed class AppleSingle : IFilter
|
||||
var ms = new MemoryStream(buffer);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
ms.EnsureRead(hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
Entry[] entries = new Entry[_header.entries];
|
||||
var entries = new Entry[_header.entries];
|
||||
|
||||
for(int i = 0; i < _header.entries; i++)
|
||||
for(var i = 0; i < _header.entries; i++)
|
||||
{
|
||||
byte[] entry = new byte[12];
|
||||
var entry = new byte[12];
|
||||
ms.EnsureRead(entry, 0, 12);
|
||||
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
|
||||
}
|
||||
@@ -220,6 +228,7 @@ public sealed class AppleSingle : IFilter
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
foreach(Entry entry in entries)
|
||||
{
|
||||
switch((AppleSingleEntryID)entry.id)
|
||||
{
|
||||
case AppleSingleEntryID.DataFork:
|
||||
@@ -228,7 +237,7 @@ public sealed class AppleSingle : IFilter
|
||||
break;
|
||||
case AppleSingleEntryID.FileDates:
|
||||
ms.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] datesB = new byte[16];
|
||||
var datesB = new byte[16];
|
||||
ms.EnsureRead(datesB, 0, 16);
|
||||
|
||||
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
|
||||
@@ -239,7 +248,7 @@ public sealed class AppleSingle : IFilter
|
||||
break;
|
||||
case AppleSingleEntryID.FileInfo:
|
||||
ms.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] finfo = new byte[entry.length];
|
||||
var finfo = new byte[entry.length];
|
||||
ms.EnsureRead(finfo, 0, finfo.Length);
|
||||
|
||||
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
|
||||
@@ -276,6 +285,7 @@ public sealed class AppleSingle : IFilter
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ms.Close();
|
||||
_isBytes = true;
|
||||
@@ -289,15 +299,15 @@ public sealed class AppleSingle : IFilter
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
stream.EnsureRead(hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
Entry[] entries = new Entry[_header.entries];
|
||||
var entries = new Entry[_header.entries];
|
||||
|
||||
for(int i = 0; i < _header.entries; i++)
|
||||
for(var i = 0; i < _header.entries; i++)
|
||||
{
|
||||
byte[] entry = new byte[12];
|
||||
var entry = new byte[12];
|
||||
stream.EnsureRead(entry, 0, 12);
|
||||
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
|
||||
}
|
||||
@@ -306,6 +316,7 @@ public sealed class AppleSingle : IFilter
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
foreach(Entry entry in entries)
|
||||
{
|
||||
switch((AppleSingleEntryID)entry.id)
|
||||
{
|
||||
case AppleSingleEntryID.DataFork:
|
||||
@@ -314,7 +325,7 @@ public sealed class AppleSingle : IFilter
|
||||
break;
|
||||
case AppleSingleEntryID.FileDates:
|
||||
stream.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] datesB = new byte[16];
|
||||
var datesB = new byte[16];
|
||||
stream.EnsureRead(datesB, 0, 16);
|
||||
|
||||
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
|
||||
@@ -325,7 +336,7 @@ public sealed class AppleSingle : IFilter
|
||||
break;
|
||||
case AppleSingleEntryID.FileInfo:
|
||||
stream.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] finfo = new byte[entry.length];
|
||||
var finfo = new byte[entry.length];
|
||||
stream.EnsureRead(finfo, 0, finfo.Length);
|
||||
|
||||
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
|
||||
@@ -362,6 +373,7 @@ public sealed class AppleSingle : IFilter
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
_isStream = true;
|
||||
@@ -376,15 +388,15 @@ public sealed class AppleSingle : IFilter
|
||||
var fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[26];
|
||||
var hdrB = new byte[26];
|
||||
fs.EnsureRead(hdrB, 0, 26);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
Entry[] entries = new Entry[_header.entries];
|
||||
var entries = new Entry[_header.entries];
|
||||
|
||||
for(int i = 0; i < _header.entries; i++)
|
||||
for(var i = 0; i < _header.entries; i++)
|
||||
{
|
||||
byte[] entry = new byte[12];
|
||||
var entry = new byte[12];
|
||||
fs.EnsureRead(entry, 0, 12);
|
||||
entries[i] = Marshal.ByteArrayToStructureBigEndian<Entry>(entry);
|
||||
}
|
||||
@@ -393,6 +405,7 @@ public sealed class AppleSingle : IFilter
|
||||
LastWriteTime = CreationTime;
|
||||
|
||||
foreach(Entry entry in entries)
|
||||
{
|
||||
switch((AppleSingleEntryID)entry.id)
|
||||
{
|
||||
case AppleSingleEntryID.DataFork:
|
||||
@@ -401,7 +414,7 @@ public sealed class AppleSingle : IFilter
|
||||
break;
|
||||
case AppleSingleEntryID.FileDates:
|
||||
fs.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] datesB = new byte[16];
|
||||
var datesB = new byte[16];
|
||||
fs.EnsureRead(datesB, 0, 16);
|
||||
|
||||
FileDates dates = Marshal.ByteArrayToStructureBigEndian<FileDates>(datesB);
|
||||
@@ -412,7 +425,7 @@ public sealed class AppleSingle : IFilter
|
||||
break;
|
||||
case AppleSingleEntryID.FileInfo:
|
||||
fs.Seek(entry.offset, SeekOrigin.Begin);
|
||||
byte[] finfo = new byte[entry.length];
|
||||
var finfo = new byte[entry.length];
|
||||
fs.EnsureRead(finfo, 0, finfo.Length);
|
||||
|
||||
if(_macintoshHome.SequenceEqual(_header.homeFilesystem))
|
||||
@@ -449,6 +462,7 @@ public sealed class AppleSingle : IFilter
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
fs.Close();
|
||||
_isPath = true;
|
||||
@@ -457,16 +471,71 @@ public sealed class AppleSingle : IFilter
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: AppleSingleEntryID
|
||||
|
||||
enum AppleSingleEntryID : uint
|
||||
{
|
||||
Invalid = 0, DataFork = 1, ResourceFork = 2,
|
||||
RealName = 3, Comment = 4, Icon = 5,
|
||||
ColorIcon = 6, FileInfo = 7, FileDates = 8,
|
||||
FinderInfo = 9, MacFileInfo = 10, ProDOSFileInfo = 11,
|
||||
DOSFileInfo = 12, ShortName = 13, AfpFileInfo = 14,
|
||||
DirectoryID = 15
|
||||
Invalid = 0,
|
||||
DataFork = 1,
|
||||
ResourceFork = 2,
|
||||
RealName = 3,
|
||||
Comment = 4,
|
||||
Icon = 5,
|
||||
ColorIcon = 6,
|
||||
FileInfo = 7,
|
||||
FileDates = 8,
|
||||
FinderInfo = 9,
|
||||
MacFileInfo = 10,
|
||||
ProDOSFileInfo = 11,
|
||||
DOSFileInfo = 12,
|
||||
ShortName = 13,
|
||||
AfpFileInfo = 14,
|
||||
DirectoryID = 15
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: DOSFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct DOSFileInfo
|
||||
{
|
||||
public readonly ushort modificationDate;
|
||||
public readonly ushort modificationTime;
|
||||
public readonly ushort attributes;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: Entry
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Entry
|
||||
{
|
||||
public readonly uint id;
|
||||
public readonly uint offset;
|
||||
public readonly uint length;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: FileDates
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct FileDates
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: Header
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Header
|
||||
{
|
||||
@@ -477,22 +546,9 @@ public sealed class AppleSingle : IFilter
|
||||
public readonly ushort entries;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Entry
|
||||
{
|
||||
public readonly uint id;
|
||||
public readonly uint offset;
|
||||
public readonly uint length;
|
||||
}
|
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct FileDates
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
#region Nested type: MacFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct MacFileInfo
|
||||
@@ -503,21 +559,9 @@ public sealed class AppleSingle : IFilter
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct UnixFileInfo
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint accessDate;
|
||||
public readonly uint modificationDate;
|
||||
}
|
||||
#endregion
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct DOSFileInfo
|
||||
{
|
||||
public readonly ushort modificationDate;
|
||||
public readonly ushort modificationTime;
|
||||
public readonly ushort attributes;
|
||||
}
|
||||
#region Nested type: ProDOSFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct ProDOSFileInfo
|
||||
@@ -529,4 +573,18 @@ public sealed class AppleSingle : IFilter
|
||||
public readonly ushort fileType;
|
||||
public readonly uint auxType;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: UnixFileInfo
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct UnixFileInfo
|
||||
{
|
||||
public readonly uint creationDate;
|
||||
public readonly uint accessDate;
|
||||
public readonly uint modificationDate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -46,10 +46,14 @@ public class BZip2 : IFilter
|
||||
Stream _dataStream;
|
||||
Stream _innerStream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.BZip2_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("FCCFB0C3-32EF-40D8-9714-2333F6AC72A9");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -95,7 +99,7 @@ public class BZip2 : IFilter
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[4];
|
||||
var buffer = new byte[4];
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, 4);
|
||||
@@ -125,8 +129,8 @@ public class BZip2 : IFilter
|
||||
if(!File.Exists(path))
|
||||
return false;
|
||||
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
byte[] buffer = new byte[4];
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var buffer = new byte[4];
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, 4);
|
||||
@@ -214,11 +218,14 @@ public class BZip2 : IFilter
|
||||
if(BasePath?.EndsWith(".bz2", StringComparison.InvariantCultureIgnoreCase) == true)
|
||||
return BasePath[..^4];
|
||||
|
||||
return BasePath?.EndsWith(".bzip2", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^6]
|
||||
return BasePath?.EndsWith(".bzip2", StringComparison.InvariantCultureIgnoreCase) == true
|
||||
? BasePath[..^6]
|
||||
: BasePath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public sealed class ForcedSeekStream<T> : Stream where T : Stream
|
||||
|
||||
do
|
||||
{
|
||||
byte[] buffer = new byte[BUFFER_LEN];
|
||||
var buffer = new byte[BUFFER_LEN];
|
||||
read = _baseStream.EnsureRead(buffer, 0, BUFFER_LEN);
|
||||
_backStream.Write(buffer, 0, read);
|
||||
} while(read == BUFFER_LEN);
|
||||
@@ -132,13 +132,13 @@ public sealed class ForcedSeekStream<T> : Stream where T : Stream
|
||||
|
||||
_backStream.Position = _backStream.Length;
|
||||
long toPosition = position - _backStream.Position;
|
||||
int fullBufferReads = (int)(toPosition / BUFFER_LEN);
|
||||
int restToRead = (int)(toPosition % BUFFER_LEN);
|
||||
var fullBufferReads = (int)(toPosition / BUFFER_LEN);
|
||||
var restToRead = (int)(toPosition % BUFFER_LEN);
|
||||
byte[] buffer;
|
||||
int bufPos;
|
||||
int left;
|
||||
|
||||
for(int i = 0; i < fullBufferReads; i++)
|
||||
for(var i = 0; i < fullBufferReads; i++)
|
||||
{
|
||||
buffer = new byte[BUFFER_LEN];
|
||||
bufPos = 0;
|
||||
|
||||
@@ -47,10 +47,14 @@ public sealed class GZip : IFilter
|
||||
uint _decompressedSize;
|
||||
Stream _zStream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.GZip_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("F4996661-4A29-42C9-A2C7-3904EF40F3B0");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -83,7 +87,7 @@ public sealed class GZip : IFilter
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[3];
|
||||
var buffer = new byte[3];
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, 3);
|
||||
@@ -98,8 +102,8 @@ public sealed class GZip : IFilter
|
||||
if(!File.Exists(path))
|
||||
return false;
|
||||
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
byte[] buffer = new byte[3];
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var buffer = new byte[3];
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, 3);
|
||||
@@ -111,8 +115,8 @@ public sealed class GZip : IFilter
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(byte[] buffer)
|
||||
{
|
||||
byte[] mtimeB = new byte[4];
|
||||
byte[] isizeB = new byte[4];
|
||||
var mtimeB = new byte[4];
|
||||
var isizeB = new byte[4];
|
||||
|
||||
_dataStream = new MemoryStream(buffer);
|
||||
BasePath = null;
|
||||
@@ -123,8 +127,8 @@ public sealed class GZip : IFilter
|
||||
_dataStream.EnsureRead(isizeB, 0, 4);
|
||||
_dataStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
uint mtime = BitConverter.ToUInt32(mtimeB, 0);
|
||||
uint isize = BitConverter.ToUInt32(isizeB, 0);
|
||||
var mtime = BitConverter.ToUInt32(mtimeB, 0);
|
||||
var isize = BitConverter.ToUInt32(isizeB, 0);
|
||||
|
||||
_decompressedSize = isize;
|
||||
CreationTime = DateHandlers.UnixUnsignedToDateTime(mtime);
|
||||
@@ -138,8 +142,8 @@ public sealed class GZip : IFilter
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(Stream stream)
|
||||
{
|
||||
byte[] mtimeB = new byte[4];
|
||||
byte[] isizeB = new byte[4];
|
||||
var mtimeB = new byte[4];
|
||||
var isizeB = new byte[4];
|
||||
|
||||
_dataStream = stream;
|
||||
BasePath = null;
|
||||
@@ -150,8 +154,8 @@ public sealed class GZip : IFilter
|
||||
_dataStream.EnsureRead(isizeB, 0, 4);
|
||||
_dataStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
uint mtime = BitConverter.ToUInt32(mtimeB, 0);
|
||||
uint isize = BitConverter.ToUInt32(isizeB, 0);
|
||||
var mtime = BitConverter.ToUInt32(mtimeB, 0);
|
||||
var isize = BitConverter.ToUInt32(isizeB, 0);
|
||||
|
||||
_decompressedSize = isize;
|
||||
CreationTime = DateHandlers.UnixUnsignedToDateTime(mtime);
|
||||
@@ -165,8 +169,8 @@ public sealed class GZip : IFilter
|
||||
/// <inheritdoc />
|
||||
public ErrorNumber Open(string path)
|
||||
{
|
||||
byte[] mtimeB = new byte[4];
|
||||
byte[] isizeB = new byte[4];
|
||||
var mtimeB = new byte[4];
|
||||
var isizeB = new byte[4];
|
||||
|
||||
_dataStream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
BasePath = System.IO.Path.GetFullPath(path);
|
||||
@@ -177,8 +181,8 @@ public sealed class GZip : IFilter
|
||||
_dataStream.EnsureRead(isizeB, 0, 4);
|
||||
_dataStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
uint mtime = BitConverter.ToUInt32(mtimeB, 0);
|
||||
uint isize = BitConverter.ToUInt32(isizeB, 0);
|
||||
var mtime = BitConverter.ToUInt32(mtimeB, 0);
|
||||
var isize = BitConverter.ToUInt32(isizeB, 0);
|
||||
|
||||
_decompressedSize = isize;
|
||||
var fi = new FileInfo(path);
|
||||
@@ -212,11 +216,14 @@ public sealed class GZip : IFilter
|
||||
if(BasePath?.EndsWith(".gz", StringComparison.InvariantCultureIgnoreCase) == true)
|
||||
return BasePath[..^3];
|
||||
|
||||
return BasePath?.EndsWith(".gzip", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^5]
|
||||
return BasePath?.EndsWith(".gzip", StringComparison.InvariantCultureIgnoreCase) == true
|
||||
? BasePath[..^5]
|
||||
: BasePath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -47,10 +47,14 @@ public sealed class LZip : IFilter
|
||||
Stream _dataStream;
|
||||
Stream _innerStream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.LZip_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("09D715E9-20C0-48B1-A8D9-D8897CEC57C9");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -84,7 +88,7 @@ public sealed class LZip : IFilter
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[5];
|
||||
var buffer = new byte[5];
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, 5);
|
||||
@@ -99,8 +103,8 @@ public sealed class LZip : IFilter
|
||||
if(!File.Exists(path))
|
||||
return false;
|
||||
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
byte[] buffer = new byte[5];
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var buffer = new byte[5];
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(buffer, 0, 5);
|
||||
@@ -130,7 +134,7 @@ public sealed class LZip : IFilter
|
||||
BasePath = null;
|
||||
CreationTime = DateTime.UtcNow;
|
||||
LastWriteTime = CreationTime;
|
||||
byte[] tmp = new byte[8];
|
||||
var tmp = new byte[8];
|
||||
_dataStream.Seek(-16, SeekOrigin.End);
|
||||
_dataStream.EnsureRead(tmp, 0, 8);
|
||||
DataForkLength = BitConverter.ToInt64(tmp, 0);
|
||||
@@ -149,7 +153,7 @@ public sealed class LZip : IFilter
|
||||
var fi = new FileInfo(path);
|
||||
CreationTime = fi.CreationTimeUtc;
|
||||
LastWriteTime = fi.LastWriteTimeUtc;
|
||||
byte[] tmp = new byte[8];
|
||||
var tmp = new byte[8];
|
||||
_dataStream.Seek(-16, SeekOrigin.End);
|
||||
_dataStream.EnsureRead(tmp, 0, 8);
|
||||
DataForkLength = BitConverter.ToInt64(tmp, 0);
|
||||
@@ -182,11 +186,14 @@ public sealed class LZip : IFilter
|
||||
if(BasePath?.EndsWith(".lz", StringComparison.InvariantCultureIgnoreCase) == true)
|
||||
return BasePath[..^3];
|
||||
|
||||
return BasePath?.EndsWith(".lzip", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^5]
|
||||
return BasePath?.EndsWith(".lzip", StringComparison.InvariantCultureIgnoreCase) == true
|
||||
? BasePath[..^5]
|
||||
: BasePath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -1,81 +1,85 @@
|
||||
<root>
|
||||
<!-- ReSharper disable MarkupTextTypo -->
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<data name="AppleDouble_Name" xml:space="preserve">
|
||||
<!-- ReSharper disable MarkupTextTypo -->
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<data name="AppleDouble_Name" xml:space="preserve">
|
||||
<value>AppleDouble</value>
|
||||
</data>
|
||||
<data name="AppleSingle_Name" xml:space="preserve">
|
||||
<data name="AppleSingle_Name" xml:space="preserve">
|
||||
<value>AppleSingle</value>
|
||||
</data>
|
||||
<data name="Asynchronous_IO_is_not_supported" xml:space="preserve">
|
||||
<data name="Asynchronous_IO_is_not_supported" xml:space="preserve">
|
||||
<value>E/S asíncrona no soportada.</value>
|
||||
</data>
|
||||
<data name="BZip2_Name" xml:space="preserve">
|
||||
<data name="BZip2_Name" xml:space="preserve">
|
||||
<value>BZip2</value>
|
||||
</data>
|
||||
<data name="Cannot_read_past_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_read_past_stream_end" xml:space="preserve">
|
||||
<value>No se puede leer más allá del final de la secuencia.</value>
|
||||
</data>
|
||||
<data name="Cannot_seek_after_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_seek_after_stream_end" xml:space="preserve">
|
||||
<value>No se puede posicionar después del final de la secuencia.</value>
|
||||
</data>
|
||||
<data name="Cannot_seek_before_stream_start" xml:space="preserve">
|
||||
<data name="Cannot_seek_before_stream_start" xml:space="preserve">
|
||||
<value>No se puede posicionar antes del comienzo de la secuencia.</value>
|
||||
</data>
|
||||
<data name="Cannot_set_position_past_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_set_position_past_stream_end" xml:space="preserve">
|
||||
<value>No se puede establecer la posición más allá del final de la secuencia.</value>
|
||||
</data>
|
||||
<data name="Cannot_write_past_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_write_past_stream_end" xml:space="preserve">
|
||||
<value>No se puede escribir después del final de la secuencia.</value>
|
||||
</data>
|
||||
<data name="End_cant_be_a_negative_number" xml:space="preserve">
|
||||
<data name="End_cant_be_a_negative_number" xml:space="preserve">
|
||||
<value>El final no puede ser un número negativo.</value>
|
||||
</data>
|
||||
<data name="End_is_after_stream_end" xml:space="preserve">
|
||||
<data name="End_is_after_stream_end" xml:space="preserve">
|
||||
<value>El final está después del final de la secuencia.</value>
|
||||
</data>
|
||||
<data name="Growing_OffsetStream_is_not_supported" xml:space="preserve">
|
||||
<data name="Growing_OffsetStream_is_not_supported" xml:space="preserve">
|
||||
<value>No se puede agrandar un OffsetStream.</value>
|
||||
</data>
|
||||
<data name="GZip_Name" xml:space="preserve">
|
||||
<data name="GZip_Name" xml:space="preserve">
|
||||
<value>GZip</value>
|
||||
</data>
|
||||
<data name="LZip_Name" xml:space="preserve">
|
||||
<data name="LZip_Name" xml:space="preserve">
|
||||
<value>LZip</value>
|
||||
</data>
|
||||
<data name="MacBinary_Name" xml:space="preserve">
|
||||
<data name="MacBinary_Name" xml:space="preserve">
|
||||
<value>MacBinary</value>
|
||||
</data>
|
||||
<data name="Non_readable_streams_are_not_supported" xml:space="preserve">
|
||||
<data name="Non_readable_streams_are_not_supported" xml:space="preserve">
|
||||
<value>Las secuencias no legíbles no están soportadas.</value>
|
||||
</data>
|
||||
<data name="Non_seekable_streams_are_not_supported" xml:space="preserve">
|
||||
<data name="Non_seekable_streams_are_not_supported" xml:space="preserve">
|
||||
<value>Las secuencias no posicionables no están soportadas.</value>
|
||||
</data>
|
||||
<data name="PcExchange_Name" xml:space="preserve">
|
||||
<data name="PcExchange_Name" xml:space="preserve">
|
||||
<value>PCExchange</value>
|
||||
</data>
|
||||
<data name="Start_cant_be_a_negative_number" xml:space="preserve">
|
||||
<data name="Start_cant_be_a_negative_number" xml:space="preserve">
|
||||
<value>El comienzo no puede ser un número negativo.</value>
|
||||
</data>
|
||||
<data name="This_stream_is_read_only" xml:space="preserve">
|
||||
<data name="This_stream_is_read_only" xml:space="preserve">
|
||||
<value>Esta secuencia es de sólo lectura.</value>
|
||||
</data>
|
||||
<data name="XZ_Name" xml:space="preserve">
|
||||
<data name="XZ_Name" xml:space="preserve">
|
||||
<value>XZ</value>
|
||||
</data>
|
||||
<data name="ZZZNoFilter_Name" xml:space="preserve">
|
||||
<data name="ZZZNoFilter_Name" xml:space="preserve">
|
||||
<value>Sin filtro</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -1,90 +1,92 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
|
||||
<root>
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" id="root"
|
||||
xmlns="">
|
||||
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<data name="AppleDouble_Name" xml:space="preserve">
|
||||
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
|
||||
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"
|
||||
id="root"
|
||||
xmlns="">
|
||||
<xsd:element name="root" msdata:IsDataSet="true"></xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>1.3</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral,
|
||||
PublicKeyToken=b77a5c561934e089
|
||||
</value>
|
||||
</resheader>
|
||||
<data name="AppleDouble_Name" xml:space="preserve">
|
||||
<value>AppleDouble</value>
|
||||
</data>
|
||||
<data name="AppleSingle_Name" xml:space="preserve">
|
||||
<data name="AppleSingle_Name" xml:space="preserve">
|
||||
<value>AppleSingle</value>
|
||||
</data>
|
||||
<data name="BZip2_Name" xml:space="preserve">
|
||||
<data name="BZip2_Name" xml:space="preserve">
|
||||
<value>BZip2</value>
|
||||
</data>
|
||||
<data name="Cannot_seek_before_stream_start" xml:space="preserve">
|
||||
<data name="Cannot_seek_before_stream_start" xml:space="preserve">
|
||||
<value>Cannot seek before stream start.</value>
|
||||
</data>
|
||||
<data name="Cannot_seek_after_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_seek_after_stream_end" xml:space="preserve">
|
||||
<value>Cannot seek after stream end.</value>
|
||||
</data>
|
||||
<data name="GZip_Name" xml:space="preserve">
|
||||
<data name="GZip_Name" xml:space="preserve">
|
||||
<value>GZip</value>
|
||||
</data>
|
||||
<data name="LZip_Name" xml:space="preserve">
|
||||
<data name="LZip_Name" xml:space="preserve">
|
||||
<value>LZip</value>
|
||||
</data>
|
||||
<data name="MacBinary_Name" xml:space="preserve">
|
||||
<data name="MacBinary_Name" xml:space="preserve">
|
||||
<value>MacBinary</value>
|
||||
</data>
|
||||
<data name="Start_cant_be_a_negative_number" xml:space="preserve">
|
||||
<data name="Start_cant_be_a_negative_number" xml:space="preserve">
|
||||
<value>Start can't be a negative number.</value>
|
||||
</data>
|
||||
<data name="End_cant_be_a_negative_number" xml:space="preserve">
|
||||
<data name="End_cant_be_a_negative_number" xml:space="preserve">
|
||||
<value>End can't be a negative number.</value>
|
||||
</data>
|
||||
<data name="End_is_after_stream_end" xml:space="preserve">
|
||||
<data name="End_is_after_stream_end" xml:space="preserve">
|
||||
<value>End is after stream end.</value>
|
||||
</data>
|
||||
<data name="Cannot_set_position_past_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_set_position_past_stream_end" xml:space="preserve">
|
||||
<value>Cannot set position past stream end.</value>
|
||||
</data>
|
||||
<data name="Cannot_read_past_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_read_past_stream_end" xml:space="preserve">
|
||||
<value>Cannot read past stream end.</value>
|
||||
</data>
|
||||
<data name="Cannot_write_past_stream_end" xml:space="preserve">
|
||||
<data name="Cannot_write_past_stream_end" xml:space="preserve">
|
||||
<value>Cannot write past stream end.</value>
|
||||
</data>
|
||||
<data name="Growing_OffsetStream_is_not_supported" xml:space="preserve">
|
||||
<data name="Growing_OffsetStream_is_not_supported" xml:space="preserve">
|
||||
<value>Growing OffsetStream is not supported.</value>
|
||||
</data>
|
||||
<data name="PcExchange_Name" xml:space="preserve">
|
||||
<data name="PcExchange_Name" xml:space="preserve">
|
||||
<value>PCExchange</value>
|
||||
</data>
|
||||
<data name="Non_seekable_streams_are_not_supported" xml:space="preserve">
|
||||
<data name="Non_seekable_streams_are_not_supported" xml:space="preserve">
|
||||
<value>Non-seekable streams are not supported</value>
|
||||
</data>
|
||||
<data name="Non_readable_streams_are_not_supported" xml:space="preserve">
|
||||
<data name="Non_readable_streams_are_not_supported" xml:space="preserve">
|
||||
<value>Non-readable streams are not supported</value>
|
||||
</data>
|
||||
<data name="Asynchronous_IO_is_not_supported" xml:space="preserve">
|
||||
<data name="Asynchronous_IO_is_not_supported" xml:space="preserve">
|
||||
<value>Asynchronous I/O is not supported.</value>
|
||||
</data>
|
||||
<data name="This_stream_is_read_only" xml:space="preserve">
|
||||
<data name="This_stream_is_read_only" xml:space="preserve">
|
||||
<value>This stream is read-only</value>
|
||||
</data>
|
||||
<data name="XZ_Name" xml:space="preserve">
|
||||
<data name="XZ_Name" xml:space="preserve">
|
||||
<value>XZ</value>
|
||||
</data>
|
||||
<data name="ZZZNoFilter_Name" xml:space="preserve">
|
||||
<data name="ZZZNoFilter_Name" xml:space="preserve">
|
||||
<value>No filter</value>
|
||||
</data>
|
||||
</root>
|
||||
@@ -54,10 +54,14 @@ public sealed class MacBinary : IFilter
|
||||
long _rsrcForkOff;
|
||||
Stream _stream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.MacBinary_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("D7C321D3-E51F-45DF-A150-F6BFDF0D7704");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -93,8 +97,10 @@ public sealed class MacBinary : IFilter
|
||||
return new OffsetStream(_stream, _dataForkOff, _dataForkOff + _header.dataLength - 1);
|
||||
|
||||
if(_isPath)
|
||||
{
|
||||
return new OffsetStream(BasePath, FileMode.Open, FileAccess.Read, _dataForkOff,
|
||||
_dataForkOff + _header.dataLength - 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -130,8 +136,10 @@ public sealed class MacBinary : IFilter
|
||||
return new OffsetStream(_stream, _rsrcForkOff, _rsrcForkOff + _header.resourceLength - 1);
|
||||
|
||||
if(_isPath)
|
||||
{
|
||||
return new OffsetStream(BasePath, FileMode.Open, FileAccess.Read, _rsrcForkOff,
|
||||
_rsrcForkOff + _header.resourceLength - 1);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -146,13 +154,13 @@ public sealed class MacBinary : IFilter
|
||||
buffer.Length < 128)
|
||||
return false;
|
||||
|
||||
byte[] hdrB = new byte[128];
|
||||
var hdrB = new byte[128];
|
||||
Array.Copy(buffer, 0, hdrB, 0, 128);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
return _header.magic == MAGIC || (_header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
|
||||
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
|
||||
(_header.dataLength > 0 || _header.resourceLength > 0));
|
||||
return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
|
||||
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
|
||||
(_header.dataLength > 0 || _header.resourceLength > 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -162,14 +170,14 @@ public sealed class MacBinary : IFilter
|
||||
stream.Length < 128)
|
||||
return false;
|
||||
|
||||
byte[] hdrB = new byte[128];
|
||||
var hdrB = new byte[128];
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
stream.EnsureRead(hdrB, 0, 128);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
return _header.magic == MAGIC || (_header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
|
||||
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
|
||||
(_header.dataLength > 0 || _header.resourceLength > 0));
|
||||
return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
|
||||
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
|
||||
(_header.dataLength > 0 || _header.resourceLength > 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -183,15 +191,15 @@ public sealed class MacBinary : IFilter
|
||||
if(fstream.Length < 128)
|
||||
return false;
|
||||
|
||||
byte[] hdrB = new byte[128];
|
||||
var hdrB = new byte[128];
|
||||
fstream.EnsureRead(hdrB, 0, 128);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
fstream.Close();
|
||||
|
||||
return _header.magic == MAGIC || (_header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
|
||||
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
|
||||
(_header.dataLength > 0 || _header.resourceLength > 0));
|
||||
return _header.magic == MAGIC || _header.version == 0 && _header.filename[0] > 0 && _header.filename[0] < 64 &&
|
||||
_header.zero1 == 0 && _header is { zero2: 0, reserved: 0 } &&
|
||||
(_header.dataLength > 0 || _header.resourceLength > 0);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -200,7 +208,7 @@ public sealed class MacBinary : IFilter
|
||||
var ms = new MemoryStream(buffer);
|
||||
ms.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[128];
|
||||
var hdrB = new byte[128];
|
||||
ms.EnsureRead(hdrB, 0, 128);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
@@ -234,7 +242,7 @@ public sealed class MacBinary : IFilter
|
||||
{
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[128];
|
||||
var hdrB = new byte[128];
|
||||
stream.EnsureRead(hdrB, 0, 128);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
@@ -269,7 +277,7 @@ public sealed class MacBinary : IFilter
|
||||
var fs = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
fs.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
byte[] hdrB = new byte[128];
|
||||
var hdrB = new byte[128];
|
||||
fs.EnsureRead(hdrB, 0, 128);
|
||||
_header = Marshal.ByteArrayToStructureBigEndian<Header>(hdrB);
|
||||
|
||||
@@ -298,6 +306,10 @@ public sealed class MacBinary : IFilter
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: Header
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct Header
|
||||
{
|
||||
@@ -337,21 +349,24 @@ public sealed class MacBinary : IFilter
|
||||
/// <summary>0x65, Low byte of Finder flags</summary>
|
||||
public readonly byte finderFlags2;
|
||||
|
||||
#region MacBinary III
|
||||
#region MacBinary III
|
||||
|
||||
/// <summary>0x66, magic identifier, "mBIN"</summary>
|
||||
public readonly uint magic;
|
||||
/// <summary>0x6A, fdScript from fxInfo, identifies codepage of filename</summary>
|
||||
public readonly byte fdScript;
|
||||
/// <summary>0x6B, fdXFlags from fxInfo, extended Mac OS 8 finder flags</summary>
|
||||
public readonly byte fdXFlags;
|
||||
#endregion MacBinary III
|
||||
|
||||
#endregion MacBinary III
|
||||
|
||||
/// <summary>0x6C, unused</summary>
|
||||
public readonly ulong reserved;
|
||||
/// <summary>0x74, Total unpacked files</summary>
|
||||
public readonly uint totalPackedFiles;
|
||||
|
||||
#region MacBinary II
|
||||
#region MacBinary II
|
||||
|
||||
/// <summary>0x78, Length of secondary header</summary>
|
||||
public readonly ushort secondaryHeaderLength;
|
||||
/// <summary>0x7A, version number of MacBinary that wrote this file, starts at 129</summary>
|
||||
@@ -360,9 +375,12 @@ public sealed class MacBinary : IFilter
|
||||
public readonly byte minVersion;
|
||||
/// <summary>0x7C, CRC of previous bytes</summary>
|
||||
public readonly short crc;
|
||||
#endregion MacBinary II
|
||||
|
||||
#endregion MacBinary II
|
||||
|
||||
/// <summary>0x7E, Reserved for computer type and OS ID</summary>
|
||||
public readonly short computerID;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -55,10 +55,14 @@ public sealed class PcExchange : IFilter
|
||||
string _dataPath;
|
||||
string _rsrcPath;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.PcExchange_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("9264EB9F-D634-4F9B-BE12-C24CD44988C6");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -122,26 +126,26 @@ public sealed class PcExchange : IFilter
|
||||
|
||||
string baseFilename = System.IO.Path.GetFileName(path);
|
||||
|
||||
bool dataFound = false;
|
||||
bool rsrcFound = false;
|
||||
var dataFound = false;
|
||||
var rsrcFound = false;
|
||||
|
||||
var finderDatStream = new FileStream(System.IO.Path.Combine(parentFolder, FINDER_INFO), FileMode.Open,
|
||||
FileAccess.Read);
|
||||
|
||||
while(finderDatStream.Position + 0x5C <= finderDatStream.Length)
|
||||
{
|
||||
var datEntry = new Entry();
|
||||
byte[] datEntryB = new byte[Marshal.SizeOf(datEntry)];
|
||||
var datEntry = new Entry();
|
||||
var datEntryB = new byte[Marshal.SizeOf(datEntry)];
|
||||
finderDatStream.EnsureRead(datEntryB, 0, Marshal.SizeOf(datEntry));
|
||||
datEntry = Helpers.Marshal.ByteArrayToStructureBigEndian<Entry>(datEntryB);
|
||||
|
||||
// TODO: Add support for encoding on filters
|
||||
string macName = StringHandlers.PascalToString(datEntry.macName, Encoding.GetEncoding("macintosh"));
|
||||
|
||||
byte[] tmpDosNameB = new byte[8];
|
||||
byte[] tmpDosExtB = new byte[3];
|
||||
var tmpDosNameB = new byte[8];
|
||||
var tmpDosExtB = new byte[3];
|
||||
Array.Copy(datEntry.dosName, 0, tmpDosNameB, 0, 8);
|
||||
Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3);
|
||||
Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3);
|
||||
|
||||
string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + "." +
|
||||
Encoding.ASCII.GetString(tmpDosExtB).Trim();
|
||||
@@ -188,17 +192,17 @@ public sealed class PcExchange : IFilter
|
||||
|
||||
while(finderDatStream.Position + 0x5C <= finderDatStream.Length)
|
||||
{
|
||||
var datEntry = new Entry();
|
||||
byte[] datEntryB = new byte[Marshal.SizeOf(datEntry)];
|
||||
var datEntry = new Entry();
|
||||
var datEntryB = new byte[Marshal.SizeOf(datEntry)];
|
||||
finderDatStream.EnsureRead(datEntryB, 0, Marshal.SizeOf(datEntry));
|
||||
datEntry = Helpers.Marshal.ByteArrayToStructureBigEndian<Entry>(datEntryB);
|
||||
|
||||
string macName = StringHandlers.PascalToString(datEntry.macName, Encoding.GetEncoding("macintosh"));
|
||||
|
||||
byte[] tmpDosNameB = new byte[8];
|
||||
byte[] tmpDosExtB = new byte[3];
|
||||
var tmpDosNameB = new byte[8];
|
||||
var tmpDosExtB = new byte[3];
|
||||
Array.Copy(datEntry.dosName, 0, tmpDosNameB, 0, 8);
|
||||
Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3);
|
||||
Array.Copy(datEntry.dosName, 8, tmpDosExtB, 0, 3);
|
||||
|
||||
string dosName = Encoding.ASCII.GetString(tmpDosNameB).Trim() + "." +
|
||||
Encoding.ASCII.GetString(tmpDosExtB).Trim();
|
||||
@@ -242,6 +246,10 @@ public sealed class PcExchange : IFilter
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Nested type: Entry
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
readonly struct Entry
|
||||
{
|
||||
@@ -278,4 +286,6 @@ public sealed class PcExchange : IFilter
|
||||
/// <summary>Unknown, flags?</summary>
|
||||
public readonly byte unknown3;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
@@ -86,7 +86,7 @@ public class SplitJoinStream : Stream
|
||||
/// 4096.
|
||||
/// </param>
|
||||
/// <param name="options">A bitwise combination of the enumeration values that specifies additional file options.</param>
|
||||
public void Add(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize,
|
||||
public void Add(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize,
|
||||
FileOptions options) => Add(new FileStream(path, mode, access, share, bufferSize, options));
|
||||
|
||||
/// <summary>Adds the specified file to the end of the current stream</summary>
|
||||
@@ -229,7 +229,7 @@ public class SplitJoinStream : Stream
|
||||
/// <param name="basePath">Base file path, directory path only</param>
|
||||
/// <param name="counterFormat">Counter format, includes filename and a formatting string</param>
|
||||
/// <param name="counterStart">Counter start, defaults to 0</param>
|
||||
public void AddRange(string basePath, string counterFormat = "{0:D3}", int counterStart = 0,
|
||||
public void AddRange(string basePath, string counterFormat = "{0:D3}", int counterStart = 0,
|
||||
FileAccess access = FileAccess.Read)
|
||||
{
|
||||
while(true)
|
||||
@@ -311,7 +311,7 @@ public class SplitJoinStream : Stream
|
||||
/// <inheritdoc />
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
int read = 0;
|
||||
var read = 0;
|
||||
|
||||
while(count > 0)
|
||||
{
|
||||
|
||||
@@ -46,10 +46,14 @@ public sealed class XZ : IFilter
|
||||
Stream _dataStream;
|
||||
Stream _innerStream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.XZ_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("666A8617-0444-4C05-9F4F-DF0FD758D0D2");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -84,8 +88,8 @@ public sealed class XZ : IFilter
|
||||
/// <inheritdoc />
|
||||
public bool Identify(Stream stream)
|
||||
{
|
||||
byte[] buffer = new byte[6];
|
||||
byte[] footer = new byte[2];
|
||||
var buffer = new byte[6];
|
||||
var footer = new byte[2];
|
||||
|
||||
if(stream.Length < 8)
|
||||
return false;
|
||||
@@ -106,9 +110,9 @@ public sealed class XZ : IFilter
|
||||
if(!File.Exists(path))
|
||||
return false;
|
||||
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
byte[] buffer = new byte[6];
|
||||
byte[] footer = new byte[2];
|
||||
var stream = new FileStream(path, FileMode.Open, FileAccess.Read);
|
||||
var buffer = new byte[6];
|
||||
var footer = new byte[2];
|
||||
|
||||
if(stream.Length < 8)
|
||||
return false;
|
||||
@@ -187,7 +191,8 @@ public sealed class XZ : IFilter
|
||||
if(BasePath?.EndsWith(".xz", StringComparison.InvariantCultureIgnoreCase) == true)
|
||||
return BasePath[..^3];
|
||||
|
||||
return BasePath?.EndsWith(".xzip", StringComparison.InvariantCultureIgnoreCase) == true ? BasePath[..^5]
|
||||
return BasePath?.EndsWith(".xzip", StringComparison.InvariantCultureIgnoreCase) == true
|
||||
? BasePath[..^5]
|
||||
: BasePath;
|
||||
}
|
||||
}
|
||||
@@ -195,13 +200,15 @@ public sealed class XZ : IFilter
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
|
||||
#endregion
|
||||
|
||||
void GuessSize()
|
||||
{
|
||||
DataForkLength = 0;
|
||||
|
||||
// Seek to footer backwards size field
|
||||
_dataStream.Seek(-8, SeekOrigin.End);
|
||||
byte[] tmp = new byte[4];
|
||||
var tmp = new byte[4];
|
||||
_dataStream.EnsureRead(tmp, 0, 4);
|
||||
uint backwardSize = (BitConverter.ToUInt32(tmp, 0) + 1) * 4;
|
||||
|
||||
@@ -228,7 +235,8 @@ public sealed class XZ : IFilter
|
||||
{
|
||||
switch(sizeMax)
|
||||
{
|
||||
case 0: return 0;
|
||||
case 0:
|
||||
return 0;
|
||||
case > 9:
|
||||
sizeMax = 9;
|
||||
|
||||
@@ -236,7 +244,7 @@ public sealed class XZ : IFilter
|
||||
}
|
||||
|
||||
num = (ulong)(buf[0] & 0x7F);
|
||||
int i = 0;
|
||||
var i = 0;
|
||||
|
||||
while((buf[i++] & 0x80) == 0x80)
|
||||
{
|
||||
@@ -244,7 +252,7 @@ public sealed class XZ : IFilter
|
||||
buf[i] == 0x00)
|
||||
return 0;
|
||||
|
||||
num |= (ulong)(buf[i] & 0x7F) << (i * 7);
|
||||
num |= (ulong)(buf[i] & 0x7F) << i * 7;
|
||||
}
|
||||
|
||||
return i;
|
||||
|
||||
@@ -43,10 +43,14 @@ public sealed class ZZZNoFilter : IFilter
|
||||
{
|
||||
Stream _dataStream;
|
||||
|
||||
#region IFilter Members
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.ZZZNoFilter_Name;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("12345678-AAAA-BBBB-CCCC-123456789000");
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
@@ -136,4 +140,6 @@ public sealed class ZZZNoFilter : IFilter
|
||||
|
||||
/// <inheritdoc />
|
||||
public string ParentFolder => System.IO.Path.GetDirectoryName(BasePath);
|
||||
|
||||
#endregion
|
||||
}
|
||||
Reference in New Issue
Block a user