Collects information about a potential candidate for an entry point. The subclass type determines the type of executable (native binary, interpreted script, etc.).
コード例 #1
0
ファイル: Candidate.cs プロジェクト: 0install/0install-win
 protected bool Equals(Candidate other)
 {
     if (other == null) return false;
     return
         string.Equals(RelativePath, other.RelativePath) &&
         string.Equals(Name, other.Name) &&
         string.Equals(Summary, other.Summary) &&
         string.Equals(Category, other.Category) &&
         Equals(Version, other.Version) &&
         Architecture == other.Architecture &&
         NeedsTerminal == other.NeedsTerminal;
 }
コード例 #2
0
ファイル: FeedBuilder.cs プロジェクト: 0install/0install-win
        /// <summary>
        /// Detects <see cref="Candidates"/> in the <see cref="ImplementationDirectory"/>.
        /// </summary>
        /// <param name="handler">A callback object used when the the user needs to be informed about IO tasks.</param>
        /// <exception cref="InvalidOperationException"><see cref="ImplementationDirectory"/> is <c>null</c> or empty.</exception>
        /// <exception cref="OperationCanceledException">The user canceled the task.</exception>
        /// <exception cref="IOException">There was a problem generating the manifest or detectng the executables.</exception>
        /// <exception cref="UnauthorizedAccessException">Write access to temporary files was not permitted.</exception>
        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();
        }