Ejemplo n.º 1
0
        private void CreateConverter()
        {
            if (!_converter.Equals(IntPtr.Zero))
            {
                PechkinStatic.DestroyConverter(_converter);

                if (_log.IsTraceEnabled)
                {
                    _log.Trace("T:" + Thread.CurrentThread.Name + " Destroyed previous converter");
                }
            }

            // the damn lib... we can't reuse anything
            _globalConfigUnmanaged = _globalConfig.CreateGlobalConfig();
            _converter             = PechkinStatic.CreateConverter(_globalConfigUnmanaged);

            if (_log.IsTraceEnabled)
            {
                _log.Trace("T:" + Thread.CurrentThread.Name + " Created converter");
            }

            PechkinStatic.SetErrorCallback(_converter, _errorCallback);
            PechkinStatic.SetWarningCallback(_converter, _warningCallback);
            PechkinStatic.SetPhaseChangeCallback(_converter, _phaseChangedCallback);
            PechkinStatic.SetProgressChangeCallback(_converter, _progressChangedCallback);
            PechkinStatic.SetFinishedCallback(_converter, _finishedCallback);

            if (_log.IsTraceEnabled)
            {
                _log.Trace("T:" + Thread.CurrentThread.Name + " Added callbacks to converter");
            }

            _reinitConverter = false;
        }