public static int ConvertToInteger(string rawValue) {
try {
if (string.IsNullOrEmpty(rawValue)) {
throw new XmpException("Empty convert-string", XmpError.BADVALUE);
}
if (rawValue.StartsWith("0x")) {
return Convert.ToInt32(rawValue.Substring(2), 16);
}
return Convert.ToInt32(rawValue);
}
catch (FormatException) {
throw new XmpException("Invalid integer string", XmpError.BADVALUE);
}
}