private void expandOrCollapseAll(LogItem i, bool expand) { if (expand) { i.Expand(); } else { i.Collapse(); } foreach (LogItem i2 in i.SubEvents) { expandOrCollapseAll(i2, expand); } }
/// <summary> /// starts the job provided as parameters /// </summary> /// <param name="job">the Job object containing all the parameters</param> /// <returns>success / failure indicator</returns> private bool startEncoding(TaggedJob job) { try { log = mainForm.Log.Info(string.Format("Log for {0} ({1}, {2} -> {3})", job.Name, job.Job.EncodingMode, job.InputFileName, job.OutputFileName)); log.LogEvent("Started handling job"); log.Expand(); status = JobWorkerStatus.Running; //Check to see if output file already exists before encoding. if (File.Exists(job.Job.Output) && !mainForm.DialogManager.overwriteJobOutput(job.Job.Output)) { throw new JobStartException("File exists and the user doesn't want to overwrite", ExceptionType.UserSkip); } // Get IJobProcessor currentProcessor = getProcessor(job.Job); if (currentProcessor == null) { throw new JobStartException("No processor could be found", ExceptionType.Error); } // Preprocess preprocessJob(job.Job); // Setup try { currentProcessor.setup(job.Job, new StatusUpdate(job.Name), log); } catch (JobRunException e) { throw new JobStartException("Calling setup of processor failed with error '" + e.Message + "'", ExceptionType.Error); } // Do JobControl setup currentProcessor.StatusUpdate += new JobProcessingStatusUpdateCallback(UpdateGUIStatus); // Progress window pw.setPriority(mainForm.Settings.DefaultPriority); if (mainForm.Settings.OpenProgressWindow && mainForm.Visible) { this.ShowProcessWindow(); } job.Status = JobStatus.PROCESSING; job.Start = DateTime.Now; status = JobWorkerStatus.Running; pauseStatus = PauseState.Encoding; currentJob = job; // Start try { currentProcessor.start(); } catch (JobRunException e) { throw new JobStartException("starting encoder failed with error '" + e.Message + "'", ExceptionType.Error); } log.LogEvent("Encoding started"); refreshAll(); return(true); } catch (JobStartException e) { mainForm.Log.LogValue("Error starting job", e); if (e.type == ExceptionType.Error) { job.Status = JobStatus.ERROR; } else // ExceptionType.UserSkip { job.Status = JobStatus.SKIP; } currentProcessor = null; currentJob = null; status = JobWorkerStatus.Idle; pauseStatus = PauseState.NotEncoding; refreshAll(); return(false); } }
/// <summary> /// starts the job provided as parameters /// </summary> /// <param name="job">the Job object containing all the parameters</param> /// <returns>success / failure indicator</returns> private bool StartEncoding(TaggedJob job) { try { log = mainForm.Log.Info(string.Format("Log for {0} ({1}, {2} -> {3})", job.Name, job.Job.EncodingMode, job.InputFileName, job.OutputFileName)); log.LogEvent("Started handling job"); log.Expand(); //Check to see if output file already exists before encoding. if (File.Exists(job.Job.Output) && (!Path.GetExtension(job.Job.Output).Equals(".lwi") && !Path.GetExtension(job.Job.Output).Equals(".ffindex") && !Path.GetExtension(job.Job.Output).Equals(".d2v") && !Path.GetExtension(job.Job.Output).Equals(".dgi")) && !mainForm.DialogManager.overwriteJobOutput(job.Job.Output)) { throw new JobStartException("File exists and the user doesn't want to overwrite", ExceptionType.UserSkip); } // Get IJobProcessor currentProcessor = GetProcessor(job.Job); if (currentProcessor == null) { throw new JobStartException("No processor could be found", ExceptionType.Error); } // Preprocess PreprocessJob(job.Job); // Setup try { currentProcessor.setup(job.Job, new StatusUpdate(job.Name), log); } catch (JobRunException e) { throw new JobStartException("Calling setup of processor failed with error '" + e.Message + "'", ExceptionType.Error); } if (currentProcessor == null) { throw new JobStartException("starting job failed", ExceptionType.Error); } // Do JobControl setup currentProcessor.StatusUpdate += new JobProcessingStatusUpdateCallback(UpdateGUIStatus); // Progress window WorkerPriority.GetJobPriority(job.Job, out WorkerPriorityType oPriority, out bool lowIOPriority); pw.setPriority(oPriority); if (mainForm.Settings.OpenProgressWindow && mainForm.Visible) { this.ShowProcessWindow(); } job.Start = DateTime.Now; currentJob = job; // Start try { currentProcessor.start(); } catch (JobRunException e) { throw new JobStartException("starting job failed with error '" + e.Message + "'", ExceptionType.Error); } RefreshAll(); MeGUI.core.util.WindowUtil.PreventSystemPowerdown(); return(true); } catch (JobStartException e) { this.HideProcessWindow(); log.LogValue("Error starting job", e); if (e.type == ExceptionType.Error) { job.Status = JobStatus.ERROR; } else // ExceptionType.UserSkip { job.Status = JobStatus.SKIP; } currentProcessor = null; currentJob = null; RefreshAll(); return(false); } }
private void expandOrCollapseAll(LogItem i, bool expand) { if (expand) i.Expand(); else i.Collapse(); foreach (LogItem i2 in i.SubEvents) expandOrCollapseAll(i2, expand); }