D.IO.FloppyDisk.ReadIMDHeader(System.IO.Stream)

Here are the examples of the csharp api D.IO.FloppyDisk.ReadIMDHeader(System.IO.Stream) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : FloppyDisk.cs
with BSD 2-Clause "Simplified" License
from livingcomputermuseum

private void LoadIMD(Stream s)
        {
            _imdHeader = ReadIMDHeader(s);

            //
            // Read each track in and place it in memory.
            // We replacedume that there will be no more than 77 cylinders
            // and no more than 2 tracks.  We also do a basic sanity
            // check that no track appears more than once.
            //
            while (true)
            {
                Track t = new Track(s);

                if (t.Cylinder < 0 || t.Cylinder > 76)
                {
                    throw new InvalidOperationException(String.Format("Invalid cylinder value {0}", t.Cylinder));
                }

                if (t.Head < 0 || t.Head > 1)
                {
                    throw new InvalidOperationException(String.Format("Invalid head value {0}", t.Head));
                }

                if (_tracks[t.Head, t.Cylinder] != null)
                {
                    throw new InvalidOperationException(String.Format("Duplicate head/track", t.Head, t.Cylinder));
                }
                
                if (t.Head != 0)
                {
                    // Got a track on side 1, this must be a double-sided disk.
                    _isSingleSided = false;
                }

                _tracks[t.Head, t.Cylinder] = t;

                if (s.Position == s.Length)
                {
                    // End of file.
                    break;
                }
            }
        }