public bool Identify(IMediaImage imagePlugin, Partition partition) { if (partition.Start > 0) { return(false); } if (imagePlugin.Info.SectorSize != 256) { return(false); } if (imagePlugin.Info.Sectors != 683 && imagePlugin.Info.Sectors != 768 && imagePlugin.Info.Sectors != 1366 && imagePlugin.Info.Sectors != 3200) { return(false); } byte[] sector; if (imagePlugin.Info.Sectors == 3200) { sector = imagePlugin.ReadSector(1560); Header cbmHdr = Marshal.ByteArrayToStructureLittleEndian <Header>(sector); if (cbmHdr.diskDosVersion == 0x44 && cbmHdr.dosVersion == 0x33 && cbmHdr.diskVersion == 0x44) { return(true); } } else { sector = imagePlugin.ReadSector(357); BAM cbmBam = Marshal.ByteArrayToStructureLittleEndian <BAM>(sector); if (cbmBam.dosVersion == 0x41 && (cbmBam.doubleSided == 0x00 || cbmBam.doubleSided == 0x80) && cbmBam.unused1 == 0x00 && cbmBam.directoryTrack == 0x12) { return(true); } } return(false); }
/// <summary> /// Creates and returns a new instance of BAM network </summary> /// <param name="inputNeuronsCount"> number of input neurons </param> /// <param name="outputNeuronsCount"> number of output neurons </param> /// <returns> instance of BAM network </returns> public static BAM createBam(int inputNeuronsCount, int outputNeuronsCount) { BAM nnet = new BAM(inputNeuronsCount, outputNeuronsCount); return(nnet); }
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding) { Encoding = new PETSCII(); byte[] sector; var sbInformation = new StringBuilder(); sbInformation.AppendLine("Commodore file system"); XmlFsType = new FileSystemType { Type = "Commodore file system", Clusters = imagePlugin.Info.Sectors, ClusterSize = 256 }; if (imagePlugin.Info.Sectors == 3200) { sector = imagePlugin.ReadSector(1560); Header cbmHdr = Marshal.ByteArrayToStructureLittleEndian <Header>(sector); sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmHdr.directoryTrack, cbmHdr.directorySector).AppendLine(); sbInformation.AppendFormat("Disk DOS Version: {0}", Encoding.ASCII.GetString(new[] { cbmHdr.diskDosVersion })).AppendLine(); sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new[] { cbmHdr.dosVersion })).AppendLine(); sbInformation.AppendFormat("Disk Version: {0}", Encoding.ASCII.GetString(new[] { cbmHdr.diskVersion })).AppendLine(); sbInformation.AppendFormat("Disk ID: {0}", cbmHdr.diskId).AppendLine(); sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, Encoding)). AppendLine(); XmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding); XmlFsType.VolumeSerial = $"{cbmHdr.diskId}"; } else { sector = imagePlugin.ReadSector(357); BAM cbmBam = Marshal.ByteArrayToStructureLittleEndian <BAM>(sector); sbInformation.AppendFormat("Directory starts at track {0} sector {1}", cbmBam.directoryTrack, cbmBam.directorySector).AppendLine(); sbInformation.AppendFormat("Disk DOS type: {0}", Encoding.ASCII.GetString(BitConverter.GetBytes(cbmBam.dosType))). AppendLine(); sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new[] { cbmBam.dosVersion })).AppendLine(); sbInformation.AppendFormat("Disk ID: {0}", cbmBam.diskId).AppendLine(); sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, Encoding)). AppendLine(); XmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding); XmlFsType.VolumeSerial = $"{cbmBam.diskId}"; } information = sbInformation.ToString(); }