I'm new to C #, and so forgive me if I come up with some of my concepts. I work with Canon EDSDK, and to make life easier, I would like to see error messages as text, not hexadecimal. The EDSDK.cs file contains a long list of errors, such as:
public const uint EDS_ERR_TAKE_PICTURE_CARD_NG = 0x00008D07;
public const uint EDS_ERR_TAKE_PICTURE_CARD_PROTECT_NG = 0x00008D08;
Ideally, I would like to put all this in some sort of lookup table so that I can enter the HEX error code and return the actual message as a string. for instance
Hashtable EDSDKErrorCodes = new Hashtable();
EDSDKErrorCodes.Add("0x00008D01", "EDS_ERR_TAKE_PICTURE_AF_NG");
EDSDKErrorCodes.Add("0x00008D08", "EDS_ERR_TAKE_PICTURE_CARD_PROTECT_NG");
etc etc...
Later in my code, I could receive the error message returned by one of the EDSDK methods and display it in a user-friendly form:
errorcode= EDSDK.EdsInitializeSDK();
MessageBox.Show(Convert.ToString(EDSDKErrorCodes[errorcode]));
... , ? , - , Add?