예제 #1
0
        /// <summary>
        /// Assigns a method to be called whenever a log statement occurs in the internal
        /// network table library.
        /// </summary>
        /// <param name="func">The log function to assign.</param>
        /// <param name="minLevel">The minimum level to log.</param>
        public static void SetLogger(LoggerFunction func, LogLevel minLevel)
        {
            s_nativeLog = (level, file, line, msg) =>
            {
                string message = ReadUTF8String(msg);
                string fileName = ReadUTF8String(file);

                func((int)level, fileName, (int)line, message);
            };

            Interop.NT_SetLogger(s_nativeLog, (uint)minLevel);
        }
예제 #2
0
        /// <summary>
        /// Assigns a method to be called whenever a log statement occurs in the internal
        /// network table library.
        /// </summary>
        /// <param name="func">The log function to assign.</param>
        /// <param name="minLevel">The minimum level to log.</param>
        public static void SetLogger(LoggerFunction func, LogLevel minLevel)
        {
            s_nativeLog = (level, file, line, msg) =>
            {
                string message  = ReadUTF8String(msg);
                string fileName = ReadUTF8String(file);

                func((int)level, fileName, (int)line, message);
            };

            Interop.NT_SetLogger(s_nativeLog, (uint)minLevel);
        }
예제 #3
0
        static LoggerFunction delegateFunction = null;          //Logger function delegate

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="funct">Logger function</param>
        public PdfUtility(byte[] data, LoggerFunction funct)
        {
            try
            {
                if (data.Length == 0)
                {
                    throw new IOException();
                }

                //Delegating logger
                delegateFunction = funct;

                //Loading file
                memoryStream = new MemoryStream();
                reader       = new PdfReader(data);
                stamper      = new PdfStamper(reader, memoryStream);
            }catch (iTextSharp.text.exceptions.InvalidPdfException)
            {
                throw new FileNotFoundException("The given file isn't in pdf format.");
            }
        }