// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // The QueueTask. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrakeWPF.Services.Queue.Model { using HandBrake.ApplicationServices.Model; using HandBrakeWPF.Utilities; using EncodeTask = HandBrakeWPF.Services.Encode.Model.EncodeTask; /// /// The QueueTask. /// public class QueueTask : PropertyChangedBase { #region Constants and Fields /// /// The status. /// private QueueItemStatus status; #endregion #region Properties /// /// Initializes a new instance of the class. /// public QueueTask() { this.Status = QueueItemStatus.Waiting; } /// /// Initializes a new instance of the class. /// /// /// The task. /// /// /// The configuration. /// /// /// The scanned Source Path. /// public QueueTask(EncodeTask task, HBConfiguration configuration, string scannedSourcePath) { this.Task = task; this.Configuration = configuration; this.Status = QueueItemStatus.Waiting; this.ScannedSourcePath = scannedSourcePath; } /// /// Gets or sets ScannedSource. /// public string ScannedSourcePath { get; set; } /// /// Gets or sets Status. /// public QueueItemStatus Status { get { return this.status; } set { this.status = value; this.NotifyOfPropertyChange(() => this.Status); } } /// /// Gets or sets the task. /// public EncodeTask Task { get; set; } /// /// Gets or sets the configuration. /// public HBConfiguration Configuration { get; set; } #endregion /// /// The equals. /// /// /// The other. /// /// /// The . /// protected bool Equals(QueueTask other) { return Equals(this.ScannedSourcePath, other.ScannedSourcePath) && Equals(this.Task, other.Task) && this.status == other.status; } /// /// The equals. /// /// /// The obj. /// /// /// The . /// public override bool Equals(object obj) { if (ReferenceEquals(null, obj)) { return false; } if (ReferenceEquals(this, obj)) { return true; } if (obj.GetType() != this.GetType()) { return false; } return this.Equals((QueueTask)obj); } /// /// The get hash code. /// /// /// The . /// public override int GetHashCode() { unchecked { int hashCode = (this.ScannedSourcePath != null ? this.ScannedSourcePath.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (this.Task != null ? this.Task.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (int)this.status; return hashCode; } } } }