BitMiracle.LibTiff.Classic.Tiff.ErrorExt C# (CSharp) Method

ErrorExt() public static method

Invokes the library-wide error handling methods to (normally) write an error message to the Console.Error.

The format is a composite format string that uses the same format as O:System.String.Format method. The method parameter, if not null, is printed before the message; it typically is used to identify the method in which an error is detected.

The clientData parameter can be anything you want. It will be passed unchanged to the error handler. Default error handler does not use it. Only custom error handlers may make use of it.

Applications that desire to capture control in the event of an error should use SetErrorHandler to override the default error and warning handler.

public static ErrorExt ( Tiff tif, object clientData, string method, string format ) : void
tif Tiff An instance of the class. Can be null.
clientData object The client data to be passed to error handler.
method string The method where an error is detected.
format string A composite format string (see Remarks).
return void
        public static void ErrorExt(Tiff tif, object clientData, string method, string format, params object[] args)
        {
            TiffErrorHandler errorHandler = getErrorHandler(tif);
            if (errorHandler == null)
                return;

            errorHandler.ErrorHandler(tif, method, format, args);
            errorHandler.ErrorHandlerExt(tif, clientData, method, format, args);
        }

Same methods

Tiff::ErrorExt ( object clientData, string method, string format ) : void

Usage Example

        private static int checkInkNamesString(Tiff tif, int slen, string s)
        {
            bool  failed = false;
            short i      = tif.m_dir.td_samplesperpixel;

            if (slen > 0)
            {
                int endPos = slen;
                int pos    = 0;

                for (; i > 0; i--)
                {
                    for (; s[pos] != '\0'; pos++)
                    {
                        if (pos >= endPos)
                        {
                            failed = true;
                            break;
                        }
                    }

                    if (failed)
                    {
                        break;
                    }

                    pos++; // skip \0
                }

                if (!failed)
                {
                    return(pos);
                }
            }

            Tiff.ErrorExt(tif, tif.m_clientdata, "TIFFSetField",
                          "{0}: Invalid InkNames value; expecting {1} names, found {2}",
                          tif.m_name, tif.m_dir.td_samplesperpixel, tif.m_dir.td_samplesperpixel - i);
            return(0);
        }
All Usage Examples Of BitMiracle.LibTiff.Classic.Tiff::ErrorExt
Tiff