Example #1
0
        public bool Identify(IMediaImage imagePlugin, Partition partition)
        {
            if (1 + partition.Start >= partition.End)
            {
                return(false);
            }

            if (imagePlugin.Info.SectorSize < 512)
            {
                return(false);
            }

            byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);

            GCHandle       handle = GCHandle.Alloc(bk0, GCHandleType.Pinned);
            MicroDOSBlock0 block0 =
                (MicroDOSBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDOSBlock0));

            handle.Free();

            return(block0.label == MAGIC && block0.mklabel == MAGIC2);
        }
Example #2
0
        public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
                                   Encoding encoding)
        {
            Encoding    = encoding ?? Encoding.GetEncoding("koi8-r");
            information = "";

            StringBuilder sb = new StringBuilder();

            byte[] bk0 = imagePlugin.ReadSector(0 + partition.Start);

            GCHandle       handle = GCHandle.Alloc(bk0, GCHandleType.Pinned);
            MicroDOSBlock0 block0 =
                (MicroDOSBlock0)Marshal.PtrToStructure(handle.AddrOfPinnedObject(), typeof(MicroDOSBlock0));

            handle.Free();

            sb.AppendLine("MicroDOS filesystem");
            sb.AppendFormat("Volume has {0} blocks ({1} bytes)", block0.blocks, block0.blocks * 512).AppendLine();
            sb.AppendFormat("Volume has {0} blocks used ({1} bytes)", block0.usedBlocks, block0.usedBlocks * 512)
            .AppendLine();
            sb.AppendFormat("Volume contains {0} files", block0.files).AppendLine();
            sb.AppendFormat("First used block is {0}", block0.firstUsedBlock).AppendLine();

            XmlFsType = new FileSystemType
            {
                Type                  = "MicroDOS",
                ClusterSize           = 512,
                Clusters              = block0.blocks,
                Files                 = block0.files,
                FilesSpecified        = true,
                FreeClusters          = block0.blocks - block0.usedBlocks,
                FreeClustersSpecified = true
            };

            information = sb.ToString();
        }