Exemplo n.º 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 (_content != null)
                    {
                        _content.Dispose();
                        _content = null;
                    }

                    if (_file != null)
                    {
                        if (_file.Second == Ownership.Dispose)
                        {
                            _file.First.Dispose();
                        }

                        _file = null;
                    }
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
Exemplo n.º 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 = new DiscUtils.Tuple<DiskImageFile, Ownership>(file, Ownership.Dispose);
 }
Exemplo n.º 3
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)
 {
     DiskImageFile file = new DiskImageFile(path, FileAccess.Read);
     _file = new DiscUtils.Tuple<DiskImageFile, Ownership>(file, Ownership.Dispose);
 }
Exemplo n.º 4
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 (_content != null)
                    {
                        _content.Dispose();
                        _content = null;
                    }

                    if (_file != null)
                    {

                        if (_file.Second == Ownership.Dispose)
                        {
                            _file.First.Dispose();
                        }

                        _file = null;
                    }
                }
            }
            finally
            {
                base.Dispose(disposing);
            }
        }
Exemplo n.º 5
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 = new DiscUtils.Tuple <DiskImageFile, Ownership>(file, Ownership.Dispose);
 }
Exemplo n.º 6
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)
        {
            DiskImageFile file = new DiskImageFile(path, FileAccess.Read);

            _file = new DiscUtils.Tuple <DiskImageFile, Ownership>(file, Ownership.Dispose);
        }