Exemple #1
0
 public override string ToString()
 {
     foreach (FieldInfo info in typeof(Standard.HRESULT).GetFields(BindingFlags.Public | BindingFlags.Static))
     {
         if (info.FieldType == typeof(Standard.HRESULT))
         {
             Standard.HRESULT hresult = (Standard.HRESULT)info.GetValue(null);
             if (hresult == this)
             {
                 return(info.Name);
             }
         }
     }
     if (this.Facility == Standard.Facility.Win32)
     {
         foreach (FieldInfo info2 in typeof(Standard.Win32Error).GetFields(BindingFlags.Public | BindingFlags.Static))
         {
             if (info2.FieldType == typeof(Standard.Win32Error))
             {
                 Standard.Win32Error error = (Standard.Win32Error)info2.GetValue(null);
                 if (((Standard.HRESULT)error) == this)
                 {
                     return("HRESULT_FROM_WIN32(" + info2.Name + ")");
                 }
             }
         }
     }
     return(string.Format(CultureInfo.InvariantCulture, "0x{0:X8}", new object[] { this._value }));
 }
 static Win32Error()
 {
     ERROR_SUCCESS = new Standard.Win32Error(0);
     ERROR_INVALID_FUNCTION = new Standard.Win32Error(1);
     ERROR_FILE_NOT_FOUND = new Standard.Win32Error(2);
     ERROR_PATH_NOT_FOUND = new Standard.Win32Error(3);
     ERROR_TOO_MANY_OPEN_FILES = new Standard.Win32Error(4);
     ERROR_ACCESS_DENIED = new Standard.Win32Error(5);
     ERROR_INVALID_HANDLE = new Standard.Win32Error(6);
     ERROR_OUTOFMEMORY = new Standard.Win32Error(14);
     ERROR_NO_MORE_FILES = new Standard.Win32Error(0x12);
     ERROR_SHARING_VIOLATION = new Standard.Win32Error(0x20);
     ERROR_INVALID_PARAMETER = new Standard.Win32Error(0x57);
     ERROR_INSUFFICIENT_BUFFER = new Standard.Win32Error(0x7a);
     ERROR_NESTING_NOT_ALLOWED = new Standard.Win32Error(0xd7);
     ERROR_KEY_DELETED = new Standard.Win32Error(0x3fa);
     ERROR_NOT_FOUND = new Standard.Win32Error(0x490);
     ERROR_NO_MATCH = new Standard.Win32Error(0x491);
     ERROR_BAD_DEVICE = new Standard.Win32Error(0x4b0);
     ERROR_CANCELLED = new Standard.Win32Error(0x4c7);
     ERROR_CLASS_ALREADY_EXISTS = new Standard.Win32Error(0x582);
     ERROR_INVALID_DATATYPE = new Standard.Win32Error(0x70c);
 }