예제 #1
0
        private static string GetDSIOExceptionTypeActionString(DSIOExceptionType dsioExceptionType)
        {
            switch (dsioExceptionType)
            {
            case DSIOExceptionType.Read: return("read");

            case DSIOExceptionType.Write: return("write");

            default: return(null);
            }
        }
예제 #2
0
        private static string GetDSIOExceptionText(
            DSIOExceptionType dsioExceptionType,
            string message,
            string filePath,
            long fileOffset)
        {
            var sb = new StringBuilder();

            var actionTxt = GetDSIOExceptionTypeActionString(dsioExceptionType);

            sb.AppendLine($"Exception encountered during {actionTxt} operation at offset " +
                          $"0x{fileOffset:X} of file '{filePath}':");

            sb.AppendLine();
            sb.AppendLine(message ?? "[NULL]");


            return(sb.ToString());
        }
예제 #3
0
 public DSIOException(DSIOExceptionType dsioExceptionType, string message, string filePath, long fileOffset)
     : base(GetDSIOExceptionText(dsioExceptionType, message, filePath, fileOffset))
 {
 }