// // FileMapIOException.cs // // Implementation of a library to use Win32 Memory Mapped // Files from within .NET applications // // COPYRIGHT (C) 2001, Tomas Restrepo (tomasr@mvps.org) // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // using System; using System.IO; using System.Runtime.InteropServices; namespace DTS.Common.Utilities.IO.MemoryMap { /// Exception class thrown by the library /// /// Represents an exception occured as a result of an /// invalid IO operation on any of the File mapping classes /// It wraps the error message and the underlying Win32 error /// code that caused the error. /// // TODO: Make Serializable! public class FileMapIOException : IOException { // // properties // private int m_win32Error = 0; /// /// the Win32 Error code describing the error. /// http://msdn.microsoft.com/en-us/library/ms681381%28VS.85%29.aspx /// public int Win32ErrorCode => m_win32Error; /// /// A description of the error. /// public override string Message { get { if (Win32ErrorCode != 0) return base.Message + " (" + Win32ErrorCode + ")"; else return base.Message; } } /// /// Construct a /// /// win32 error code describing error public FileMapIOException(int error) : base() { m_win32Error = error; } /// /// Construct a /// /// description of error public FileMapIOException(string message) : base(message) { } /// /// Construct a /// /// description of error /// exception causing the error public FileMapIOException(string message, Exception innerException) : base(message, innerException) { } } // class FileMapIOException } // namespace Winterdom.IO.FileMap