Exemplo n.º 1
0
 /// <summary> Deletes the file. </summary>
 /// <seealso cref="M:System.IDisposable.Dispose()"/>
 void IDisposable.Dispose()
 {
     if (!IsDisposed)
     {
         Disposed.Raise(this);
         try { _Data.Dispose(); }
         finally { _Data = null; }
     }
 }
Exemplo n.º 2
0
        // --------------------------------------------------------------------------------------------------------------------

        /// <summary> Constructor. </summary>
        /// <exception cref="ArgumentNullException"> Thrown when one or more required arguments are null. </exception>
        /// <exception cref="ArgumentException"> Thrown when one or more arguments have unsupported or illegal values. </exception>
        /// <param name="directory"> The parent directory. </param>
        /// <param name="filename"> Filename of the file. </param>
        internal VirtualFileInfo(VirtualDirectoryNode directory, string filename)
        {
            Changed  = new WeakEventHandler <VirtualFileInfo, VirtualFileInfo>(this);
            Disposed = new WeakEventHandler <VirtualFileInfo, VirtualFileInfo>(this);

            _Directory = directory ?? throw new ArgumentNullException(nameof(directory));
            _Name      = filename;

            _Data           = new VirtualFileData(this);
            _Data.Changed  += d => Changed.Raise(this);
            _Data.Disposed += d => Disposed.Raise(this);
        }