12345678910111213141516171819202122232425262728293031 |
- using System;
- using System.Collections.Generic;
- using System.IO;
- using System.Reflection;
- using System.Text;
- using Utilities;
- namespace SMBLibrary
- {
- public class IOExceptionHelper
- {
- public static ushort GetWin32ErrorCode(IOException ex)
- {
- int hResult = GetExceptionHResult(ex);
-
- return (ushort)(hResult & 0x0000FFFF);
- }
- public static int GetExceptionHResult(IOException ex)
- {
- PropertyInfo hResult = ex.GetType().GetProperty("HResult", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance);
- return (int)hResult.GetValue(ex, null);
- }
- }
- }
|