Exemple #1
0
        /// <summary>
        /// Disposes of underlying resources.
        /// </summary>
        /// <param name="disposing">Set to <c>true</c> if called within Dispose(),
        /// else <c>false</c>.</param>
        protected override void Dispose(bool disposing)
        {
            try
            {
                if (disposing)
                {
                    if (_file != null)
                    {
                        _file.Dispose();
                    }

                    _file = null;
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the Disk class.
 /// </summary>
 /// <param name="file">The contents of the disk.</param>
 private Disk(DiskImageFile file)
 {
     _file = file;
 }
Exemple #3
0
        /// <summary>
        /// Initializes a new instance of the Disk class.
        /// </summary>
        /// <param name="path">The path to the disk image</param>
        /// <param name="access">The access requested to the disk</param>
        public Disk(string path, FileAccess access)
        {
            FileShare share = (access == FileAccess.Read) ? FileShare.Read : FileShare.None;

            _file = new DiskImageFile(new FileStream(path, FileMode.Open, access, share), Ownership.Dispose, null);
        }
Exemple #4
0
 /// <summary>
 /// Initializes a new instance of the Disk class.
 /// </summary>
 /// <param name="path">The path to the disk image</param>
 public Disk(string path)
 {
     _file = new DiskImageFile(new FileStream(path, FileMode.Open, FileAccess.ReadWrite, FileShare.None), Ownership.Dispose, null);
 }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the Disk class.
 /// </summary>
 /// <param name="stream">The stream to read</param>
 /// <param name="ownsStream">Indicates if the new instance should control the lifetime of the stream.</param>
 /// <param name="geometry">The emulated geometry of the disk.</param>
 public Disk(Stream stream, Ownership ownsStream, Geometry geometry)
 {
     _file = new DiskImageFile(stream, ownsStream, geometry);
 }
Exemple #6
0
 /// <summary>
 /// Initializes a stream as an unformatted floppy disk.
 /// </summary>
 /// <param name="stream">The stream to initialize.</param>
 /// <param name="ownsStream">Indicates if the new instance controls the lifetime of the stream.</param>
 /// <param name="type">The type of floppy disk image to create</param>
 /// <returns>An object that accesses the stream as a disk</returns>
 public static Disk Initialize(Stream stream, Ownership ownsStream, FloppyDiskType type)
 {
     return(new Disk(DiskImageFile.Initialize(stream, ownsStream, type)));
 }
Exemple #7
0
 /// <summary>
 /// Initializes a stream as an unformatted disk.
 /// </summary>
 /// <param name="stream">The stream to initialize.</param>
 /// <param name="ownsStream">Indicates if the new instance controls the lifetime of the stream.</param>
 /// <param name="capacity">The desired capacity of the new disk</param>
 /// <param name="geometry">The desired geometry of the new disk, or <c>null</c> for default</param>
 /// <returns>An object that accesses the stream as a disk</returns>
 public static Disk Initialize(Stream stream, Ownership ownsStream, long capacity, Geometry geometry)
 {
     return(new Disk(DiskImageFile.Initialize(stream, ownsStream, capacity, geometry)));
 }