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