ZeroInstall.Publish.FeedBuilder.DetectCandidates C# (CSharp) Method

DetectCandidates() public method

Detects Candidates in the ImplementationDirectory.
is null or empty. The user canceled the task. There was a problem generating the manifest or detectng the executables. Write access to temporary files was not permitted.
public DetectCandidates ( ITaskHandler handler ) : void
handler ITaskHandler A callback object used when the the user needs to be informed about IO tasks.
return void
        public void DetectCandidates(ITaskHandler handler)
        {
            #region Sanity checks
            if (handler == null) throw new ArgumentNullException(nameof(handler));
            if (string.IsNullOrEmpty(ImplementationDirectory)) throw new InvalidOperationException("Implementation directory is not set.");
            #endregion

            _candidates.Clear();

            handler.RunTask(new SimpleTask(Resources.DetectingCandidates,
                () => _candidates.AddRange(Detection.ListCandidates(new DirectoryInfo(ImplementationDirectory)))));

            MainCandidate = _candidates.FirstOrDefault();
        }
        #endregion

Usage Example

Ejemplo n.º 1
0
 public void TestDetectCandidates()
 {
     _builder.ImplementationDirectory = _implementationDir;
     _builder.DetectCandidates(new SilentTaskHandler());
 }