private void LoadDisk(DiskImage image, bool readOnly) { if (!string.IsNullOrEmpty(image.FileName)) { OpenFileName(image.FileName, readOnly); } else { image.SetPhysics(80, 2); image.FormatTrdos(); } }
private void loadFromStream(Stream stream) { int cylCount = (int)stream.Length / (256 * 16 * 2); if ((stream.Length % (256 * 16 * 2)) > 0) { _diskImage.SetPhysics(cylCount + 1, 2); } else { _diskImage.SetPhysics(cylCount, 2); } _diskImage.FormatTrdos(); int i = 0; while (stream.Position < stream.Length) { byte[] snbuf = new byte[256]; stream.Read(snbuf, 0, 256); _diskImage.WriteLogicalSector(i >> 13, (i >> 12) & 1, ((i >> 8) & 0x0F) + 1, snbuf); i += 0x100; } }