Exemplo n.º 1
0
        public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
                                   Encoding encoding)
        {
            Encoding = Encoding.GetEncoding("koi8-r");
            byte[]          sector = imagePlugin.ReadSector(0);
            AODOS_BootBlock bb     = Marshal.ByteArrayToStructureLittleEndian <AODOS_BootBlock>(sector);

            StringBuilder sbInformation = new StringBuilder();

            sbInformation.AppendLine("Alexander Osipov DOS file system");

            XmlFsType = new FileSystemType
            {
                Type                  = "Alexander Osipov DOS file system",
                Clusters              = imagePlugin.Info.Sectors,
                ClusterSize           = imagePlugin.Info.SectorSize,
                Files                 = bb.files,
                FilesSpecified        = true,
                FreeClusters          = imagePlugin.Info.Sectors - bb.usedSectors,
                FreeClustersSpecified = true,
                VolumeName            = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding),
                Bootable              = true
            };

            sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine();
            sbInformation.AppendFormat("{0} used sectors on volume", bb.usedSectors).AppendLine();
            sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, Encoding))
            .AppendLine();

            information = sbInformation.ToString();
        }
Exemplo n.º 2
0
        public bool Identify(IMediaImage imagePlugin, Partition partition)
        {
            // Does AO-DOS support hard disks?
            if (partition.Start > 0)
            {
                return(false);
            }

            // How is it really?
            if (imagePlugin.Info.SectorSize != 512)
            {
                return(false);
            }

            // Does AO-DOS support any other kind of disk?
            if (imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600)
            {
                return(false);
            }

            byte[]          sector = imagePlugin.ReadSector(0);
            AODOS_BootBlock bb     = Marshal.ByteArrayToStructureLittleEndian <AODOS_BootBlock>(sector);

            return(bb.identifier.SequenceEqual(AODOSIdentifier));
        }
Exemplo n.º 3
0
        public bool Identify(IMediaImage imagePlugin, Partition partition)
        {
            // Does AO-DOS support hard disks?
            if (partition.Start > 0)
            {
                return(false);
            }

            // How is it really?
            if (imagePlugin.Info.SectorSize != 512)
            {
                return(false);
            }

            // Does AO-DOS support any other kind of disk?
            if (imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600)
            {
                return(false);
            }

            byte[]          sector = imagePlugin.ReadSector(0);
            AODOS_BootBlock bb     = new AODOS_BootBlock();
            IntPtr          bbPtr  = Marshal.AllocHGlobal(Marshal.SizeOf(bb));

            Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb));
            bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock));
            Marshal.FreeHGlobal(bbPtr);

            return(bb.identifier.SequenceEqual(AODOSIdentifier));
        }
Exemplo n.º 4
0
        public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
                                   Encoding encoding)
        {
            Encoding = Encoding.GetEncoding("koi8-r");
            byte[]          sector = imagePlugin.ReadSector(0);
            AODOS_BootBlock bb     = new AODOS_BootBlock();
            IntPtr          bbPtr  = Marshal.AllocHGlobal(Marshal.SizeOf(bb));

            Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb));
            bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock));
            Marshal.FreeHGlobal(bbPtr);

            StringBuilder sbInformation = new StringBuilder();

            sbInformation.AppendLine("Alexander Osipov DOS file system");

            XmlFsType = new FileSystemType
            {
                Type                  = "Alexander Osipov DOS file system",
                Clusters              = (long)imagePlugin.Info.Sectors,
                ClusterSize           = (int)imagePlugin.Info.SectorSize,
                Files                 = bb.files,
                FilesSpecified        = true,
                FreeClusters          = (long)(imagePlugin.Info.Sectors - bb.usedSectors),
                FreeClustersSpecified = true,
                VolumeName            = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding),
                Bootable              = true
            };

            sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine();
            sbInformation.AppendFormat("{0} used sectors on volume", bb.usedSectors).AppendLine();
            sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, Encoding))
            .AppendLine();

            information = sbInformation.ToString();
        }