diff --git a/BITS/BackgroundCopyJobCollection.cs b/BITS/BackgroundCopyJobCollection.cs index 5d1e7146..3c44f7b8 100644 --- a/BITS/BackgroundCopyJobCollection.cs +++ b/BITS/BackgroundCopyJobCollection.cs @@ -39,7 +39,7 @@ namespace Vanara.IO /// Gets the object with the specified job identifier. /// Unique identifier of the job. - /// The referenced object if found, null if not. + /// The referenced object if found, if not. public BackgroundCopyJob this[Guid jobId] { get @@ -49,6 +49,22 @@ namespace Vanara.IO } } + /// Gets the first object with the specified display name. + /// The display name of the job. + /// The referenced object if found, if not. + public BackgroundCopyJob this[string displayName] + { + get + { + var ijobs = BackgroundCopyManager.EnumJobs((BG_JOB_ENUM)JobListRights); + IBackgroundCopyJob[] jobs; + while ((jobs = ijobs.Next(1)).Length == 1) + if (jobs[0].GetDisplayName() == displayName) + return new(jobs[0]); + return null; + } + } + /// Creates a new upload or download transfer job. /// Name of the job. /// Description of the job.