示例#1
0
        public JobDispatcher(IDecoderJob job)
        {
            _worker                            = new BackgroundWorker();
            _worker.DoWork                    += new DoWorkEventHandler(DoJob);
            _worker.RunWorkerCompleted        += new RunWorkerCompletedEventHandler(JobCompleted);
            _worker.ProgressChanged           += new ProgressChangedEventHandler(JobProgressChanged);
            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
            _job    = job;
            _status = new JobStatus();
            _logger = new BasicLogger();
            _ready  = true;

            AssemblyVersionInfo vInfo = new AssemblyVersionInfo(typeof(JobBase));

            _logger.WriteLogMessage(String.Format("*** {0} {1}.{2} - (build {3})", vInfo.Title, vInfo.Version.Major, vInfo.Version.Minor, vInfo.LastBuildDate.ToString("yyMMdd-HHmm")), LogLevel.Info);

            string[] shemas = CDR.Schema.CdrDefinitionProvider.Instance.AvailableSchemas();
            if ((shemas != null) && (shemas.Length > 0))
            {
                _logger.WriteLogMessage(String.Format("*** Definition XML Version: {0}", CDR.Schema.CdrDefinitionProvider.Instance.XmlVersion), LogLevel.Info, false);
                _logger.WriteLogMessage("*** Available Schemas:", LogLevel.Info, false);
                foreach (string s in shemas)
                {
                    _logger.WriteLogMessage(String.Format("> {0}", s), LogLevel.Info, false);
                }

                byte[] sign = CDR.Schema.CdrDefinitionProvider.Instance.AviableSignatures();
                if ((sign != null) && (sign.Length > 0))
                {
                    _logger.WriteLogMessage(String.Format("*** Available Signatures: {0}", BitConverter.ToString(sign).Replace("-", "; ")), LogLevel.Info, false);
                }
                else
                {
                    _logger.WriteLogMessage("!!! Signatures definition not found, check definition.xml", LogLevel.Error, false);
                    _ready = false;
                }
            }
            else
            {
                _logger.WriteLogMessage("!!! Schemas definition not found, check definition.xml", LogLevel.Error, false);
                _ready = false;
            }
        }
        public JobDispatcher(IDecoderJob job)
        {
            _worker = new BackgroundWorker();
            _worker.DoWork += new DoWorkEventHandler(DoJob);
            _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(JobCompleted);
            _worker.ProgressChanged += new ProgressChangedEventHandler(JobProgressChanged);
            _worker.WorkerReportsProgress = true;
            _worker.WorkerSupportsCancellation = true;
            _job = job;
            _status = new JobStatus();
            _logger = new BasicLogger();
            _ready = true;

            AssemblyVersionInfo vInfo = new AssemblyVersionInfo(typeof(JobBase));
            _logger.WriteLogMessage(String.Format("*** {0} {1}.{2} - (build {3})", vInfo.Title, vInfo.Version.Major, vInfo.Version.Minor, vInfo.LastBuildDate.ToString("yyMMdd-HHmm")), LogLevel.Info);

            string[] shemas = CDR.Schema.CdrDefinitionProvider.Instance.AvailableSchemas();
            if ((shemas != null) && (shemas.Length > 0))
            {
                _logger.WriteLogMessage(String.Format("*** Definition XML Version: {0}", CDR.Schema.CdrDefinitionProvider.Instance.XmlVersion), LogLevel.Info, false);
                _logger.WriteLogMessage("*** Available Schemas:", LogLevel.Info, false);
                foreach (string s in shemas)
                {
                    _logger.WriteLogMessage(String.Format("> {0}", s), LogLevel.Info, false);
                }

                byte[] sign = CDR.Schema.CdrDefinitionProvider.Instance.AviableSignatures();
                if ((sign != null) && (sign.Length > 0))
                {
                    _logger.WriteLogMessage(String.Format("*** Available Signatures: {0}", BitConverter.ToString(sign).Replace("-", "; ")), LogLevel.Info, false);
                }
                else
                {
                    _logger.WriteLogMessage("!!! Signatures definition not found, check definition.xml", LogLevel.Error, false);
                    _ready = false;
                }
            }
            else
            {
                _logger.WriteLogMessage("!!! Schemas definition not found, check definition.xml", LogLevel.Error, false);
                _ready = false;
            }
        }