mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
* DiscImageChef.Filesystems/SFS.cs:
Code refactoring. * DiscImageChef.Filesystems/PFS.cs: Add volume name to XmlFs.
This commit is contained in:
@@ -33,7 +33,6 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef.Console;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace DiscImageChef.Filesystems
|
||||
@@ -223,7 +222,7 @@ namespace DiscImageChef.Filesystems
|
||||
|
||||
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname)).AppendLine();
|
||||
sbInformation.AppendFormat("Volume has {0} free sectors of {1}", rootBlock.blocksfree, rootBlock.diskSize).AppendLine();
|
||||
sbInformation.AppendFormat("Volme created on {0}", DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick)).AppendLine();
|
||||
sbInformation.AppendFormat("Volume created on {0}", DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick)).AppendLine();
|
||||
if(rootBlock.extension > 0)
|
||||
sbInformation.AppendFormat("Root block extension resides at block {0}", rootBlock.extension).AppendLine();
|
||||
|
||||
@@ -235,6 +234,7 @@ namespace DiscImageChef.Filesystems
|
||||
xmlFSType.FreeClustersSpecified = true;
|
||||
xmlFSType.Clusters = rootBlock.diskSize / imagePlugin.GetSectorSize();
|
||||
xmlFSType.ClusterSize = (int)imagePlugin.GetSectorSize();
|
||||
xmlFSType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname);
|
||||
}
|
||||
|
||||
public override Errno Mount()
|
||||
|
||||
@@ -31,26 +31,25 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Collections.Generic;
|
||||
using DiscImageChef.Console;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace DiscImageChef.Filesystems
|
||||
{
|
||||
class SFS : Filesystem
|
||||
{
|
||||
public SFS()
|
||||
{
|
||||
Name = "SmartFileSystem";
|
||||
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
||||
}
|
||||
class SFS : Filesystem
|
||||
{
|
||||
public SFS()
|
||||
{
|
||||
Name = "SmartFileSystem";
|
||||
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
||||
}
|
||||
|
||||
public SFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||
{
|
||||
Name = "SmartFileSystem";
|
||||
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
||||
}
|
||||
public SFS(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||
{
|
||||
Name = "SmartFileSystem";
|
||||
PluginUUID = new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
|
||||
}
|
||||
|
||||
[Flags]
|
||||
enum SFSFlags : byte
|
||||
@@ -59,9 +58,9 @@ namespace DiscImageChef.Filesystems
|
||||
CaseSensitive = 128
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct RootBlock
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct RootBlock
|
||||
{
|
||||
public uint blockId;
|
||||
public uint blockChecksum;
|
||||
public uint blockSelfPointer;
|
||||
@@ -88,36 +87,36 @@ namespace DiscImageChef.Filesystems
|
||||
public uint objectnoderoot;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
|
||||
public uint[] reserved4;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Identifier for SFS v1
|
||||
/// </summary>
|
||||
const uint SFS_MAGIC = 0x53465300;
|
||||
/// <summary>
|
||||
/// Identifier for SFS v1
|
||||
/// </summary>
|
||||
const uint SFS_MAGIC = 0x53465300;
|
||||
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||
{
|
||||
if(partitionStart >= partitionEnd)
|
||||
return false;
|
||||
public override bool Identify(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd)
|
||||
{
|
||||
if(partitionStart >= partitionEnd)
|
||||
return false;
|
||||
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
|
||||
|
||||
byte[] sector = imagePlugin.ReadSector(partitionStart);
|
||||
byte[] sector = imagePlugin.ReadSector(partitionStart);
|
||||
|
||||
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
|
||||
uint magic = BigEndianBitConverter.ToUInt32(sector, 0x00);
|
||||
|
||||
return magic == SFS_MAGIC;
|
||||
}
|
||||
}
|
||||
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
|
||||
{
|
||||
byte[] RootBlockSector = imagePlugin.ReadSector(partitionStart);
|
||||
RootBlock rootBlock = new RootBlock();
|
||||
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);
|
||||
public override void GetInformation(ImagePlugins.ImagePlugin imagePlugin, ulong partitionStart, ulong partitionEnd, out string information)
|
||||
{
|
||||
byte[] RootBlockSector = imagePlugin.ReadSector(partitionStart);
|
||||
RootBlock rootBlock = new RootBlock();
|
||||
rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(RootBlockSector);
|
||||
|
||||
StringBuilder sbInformation = new StringBuilder();
|
||||
StringBuilder sbInformation = new StringBuilder();
|
||||
|
||||
sbInformation.AppendLine("SmartFileSystem");
|
||||
sbInformation.AppendLine("SmartFileSystem");
|
||||
|
||||
sbInformation.AppendFormat("Volume version {0}", rootBlock.version).AppendLine();
|
||||
sbInformation.AppendFormat("Volume starts on device byte {0} and ends on byte {1}", rootBlock.firstbyte, rootBlock.lastbyte).AppendLine();
|
||||
@@ -137,69 +136,69 @@ namespace DiscImageChef.Filesystems
|
||||
xmlFSType = new Schemas.FileSystemType();
|
||||
xmlFSType.Type = "SmartFileSystem";
|
||||
xmlFSType.CreationDate = DateHandlers.UNIXUnsignedToDateTime(rootBlock.datecreated).AddYears(8);
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
xmlFSType.CreationDateSpecified = true;
|
||||
xmlFSType.Clusters = rootBlock.totalblocks;
|
||||
xmlFSType.ClusterSize = (int)rootBlock.blocksize;
|
||||
}
|
||||
}
|
||||
|
||||
public override Errno Mount()
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
public override Errno Mount()
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno Mount(bool debug)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
public override Errno Mount(bool debug)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno Unmount()
|
||||
{
|
||||
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 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 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 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 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 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 ReadDir(string path, ref List<string> contents)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno StatFs(ref FileSystemInfo stat)
|
||||
{
|
||||
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 Stat(string path, ref FileEntryInfo stat)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
|
||||
public override Errno ReadLink(string path, ref string dest)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
}
|
||||
public override Errno ReadLink(string path, ref string dest)
|
||||
{
|
||||
return Errno.NotImplemented;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user