mirror of https://github.com/dahall/Vanara.git
Added BackgroundCopyJobCollection indexer for a job's display name.
parent
74bbe0f933
commit
0fd87e6870
|
@ -39,7 +39,7 @@ namespace Vanara.IO
|
|||
|
||||
/// <summary>Gets the <see cref="BackgroundCopyJob"/> object with the specified job identifier.</summary>
|
||||
/// <param name="jobId">Unique identifier of the job.</param>
|
||||
/// <returns>The referenced <see cref="BackgroundCopyJob"/> object if found, null if not.</returns>
|
||||
/// <returns>The referenced <see cref="BackgroundCopyJob"/> object if found, <see langword="null"/> if not.</returns>
|
||||
public BackgroundCopyJob this[Guid jobId]
|
||||
{
|
||||
get
|
||||
|
@ -49,6 +49,22 @@ namespace Vanara.IO
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the first <see cref="BackgroundCopyJob"/> object with the specified display name.</summary>
|
||||
/// <param name="displayName">The display name of the job.</param>
|
||||
/// <returns>The referenced <see cref="BackgroundCopyJob"/> object if found, <see langword="null"/> if not.</returns>
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a new upload or download transfer job.</summary>
|
||||
/// <param name="displayName">Name of the job.</param>
|
||||
/// <param name="description">Description of the job.</param>
|
||||
|
|
Loading…
Reference in New Issue