Пример #1
0
 static PMC_STATUS_CODE()
 {
     PMC_STATUS_OK = new PMC_STATUS_CODE("PMC_STATUS_OK");
     PMC_STATUS_DIVISION_BY_ZERO = new PMC_STATUS_CODE("PMC_STATUS_DIVISION_BY_ZERO");
     PMC_STATUS_OVERFLOW         = new PMC_STATUS_CODE("PMC_STATUS_OVERFLOW");
     PMC_STATUS_ARGUMENT_ERROR   = new PMC_STATUS_CODE("PMC_STATUS_ARGUMENT_ERROR");
     PMC_STATUS_PARSING_ERROR    = new PMC_STATUS_CODE("PMC_STATUS_PARSING_ERROR");
 }
Пример #2
0
        protected static void HandleResultCode(PMC_STATUS_CODE result_code)
        {
            switch (result_code)
            {
            case PMC_STATUS_CODE.PMC_STATUS_OK:
                return;

            case PMC_STATUS_CODE.PMC_STATUS_ARGUMENT_ERROR:
                throw new ArgumentException();

            case PMC_STATUS_CODE.PMC_STATUS_ARGUMENT_NULL_ERROR:
                throw new ArgumentNullException();

            case PMC_STATUS_CODE.PMC_STATUS_ARGUMENT_OUT_OF_RANGE_ERROR:
                throw new ArgumentOutOfRangeException();

            case PMC_STATUS_CODE.PMC_STATUS_OVERFLOW:
                throw new OverflowException();

            case PMC_STATUS_CODE.PMC_STATUS_DIVISION_BY_ZERO:
                throw new DivideByZeroException();

            case PMC_STATUS_CODE.PMC_STATUS_ARITHMETIC_ERROR:
                throw new ArithmeticException();

            case PMC_STATUS_CODE.PMC_STATUS_FORMAT_ERROR:
                throw new FormatException();

            case PMC_STATUS_CODE.PMC_STATUS_INSUFFICIENT_BUFFER:
                throw new InsufficientBufferException();

            case PMC_STATUS_CODE.PMC_STATUS_NOT_ENOUGH_MEMORY:
                throw new InsufficientMemoryException();

            case PMC_STATUS_CODE.PMC_STATUS_NOT_SUPPORTED:
                throw new NotSupportedException();

            case PMC_STATUS_CODE.PMC_STATUS_KEY_NOT_FOUND:
                throw new KeyNotFoundException();

            case PMC_STATUS_CODE.PMC_STATUS_INVALID_OPERATION:
                throw new InvalidOperationException();

            case PMC_STATUS_CODE.PMC_STATUS_INTERNAL_ERROR:
                throw new InternalErrorException();

            case PMC_STATUS_CODE.PMC_STATUS_BAD_BUFFER:
                throw new BadBufferException();

            case PMC_STATUS_CODE.PMC_STATUS_SEH:
                throw new SEHException();

            default:
                throw new InternalErrorException(string.Format("未知の例外が発生しました。: code={0}", result_code));
            }
        }