static int Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); DecoderJob job = null; bool startJob = false; string cmd = String.Empty; if (args.Length > 0) { switch (args.Length) { case 1: cmd = args[0]; break; case 2: if (String.Equals(args[0], "/s", StringComparison.CurrentCultureIgnoreCase)) { startJob = true; cmd = args[1]; } break; } if (cmd.Length > 0) { if (cmd[0] != '/') { job = new DecoderJob(); job.SourcePath = cmd; job.DestinationPath = String.Concat(cmd, ".dump"); } else if (cmd.Length > 3) { switch (Char.ToLower(cmd[1])) { case 'd': job = new DecoderJob(); job.DecodingMode = JobDecodingMode.BatchDecoding; job.SourcePath = cmd.Substring(3); break; case 'j': job = DecoderJob.Load(cmd.Substring(3)) as DecoderJob; break; } } } } MainForm frm = new MainForm((job != null) ? job : new DecoderJob(), startJob); AssemblyVersionInfo vInfo = new AssemblyVersionInfo(typeof(DecoderApplication)); frm.Text = String.Format("{0} {1}.{2} - (build {3})", vInfo.Title, vInfo.Version.Major, vInfo.Version.Minor, vInfo.LastBuildDate.ToString("yyMMdd-HHmm")); Application.Run(frm); return (int)frm.ResultCode; }
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; } }