ZeroInstall.Store.Model.Element.Normalize C# (CSharp) 메소드

Normalize() 공개 메소드

Sets missing default values and handles legacy elements.
This method should be called to prepare a Feed for solver processing. Do not call it if you plan on serializing the feed again since it may loose some of its structure.
public Normalize ( [ feedUri ) : void
feedUri [ The feed the data was originally loaded from.
리턴 void
        public virtual void Normalize([NotNull] FeedUri feedUri)
        {
            #region Sanity checks
            if (feedUri == null) throw new ArgumentNullException(nameof(feedUri));
            #endregion

            // Apply if-0install-version filter
            Commands.RemoveAll(FilterMismatch);
            Dependencies.RemoveAll(FilterMismatch);
            Restrictions.RemoveAll(FilterMismatch);
            Bindings.RemoveAll(FilterMismatch);

            // Convert legacy launch commands
            if (Main != null) Commands.Add(new Command {Name = Command.NameRun, Path = Main});
            if (SelfTest != null) Commands.Add(new Command {Name = Command.NameTest, Path = SelfTest});

            foreach (var command in Commands) command.Normalize();
            foreach (var dependency in Dependencies) dependency.Normalize();
            foreach (var restriction in Restrictions) restriction.Normalize();
        }