Esempio n. 1
0
        private ItemBuilder Patch(VersionBoundary from, string fromSrc, string to, string released, string description)
        {
            var patch = new SnPatch
            {
                ComponentId = _component.ComponentId,
                Version     = new Version(0, 0),
                Boundary    = new VersionBoundary
                {
                    MinVersion = new Version(0, 0),
                    MaxVersion = new Version(0, 0)
                }
            };

            var targetVersion = ParseVersion(to, patch);

            patch.Version     = targetVersion;
            patch.Boundary    = BuildBoundary(from ?? ParseFromVersion(fromSrc, patch), targetVersion);
            patch.ReleaseDate = ParseDate(released, patch);
            patch.Description = CheckDescription(description, patch);

            if (patch.Boundary.MinVersion != null)
            {
                if (targetVersion <= patch.Boundary.MinVersion)
                {
                    throw new InvalidPatchException(PatchErrorCode.TooSmallTargetVersion, patch,
                                                    "The 'Version' need to be higher than minimal version.");
                }
            }

            _patches.Add(patch);

            return(new ItemBuilder(patch, this));
        }
Esempio n. 2
0
 public DependencyBuilder Dependency(string componentId, VersionBoundary boundary)
 {
     Dependencies.Add(new Dependency {
         Id = componentId, Boundary = boundary
     });
     return(this);
 }
Esempio n. 3
0
 public IPatchInstanceBuilder DependsOn(string componentId, VersionBoundary boundary)
 {
     AddDependency(new Dependency {
         Id = componentId, Boundary = boundary
     });
     return(this);
 }
Esempio n. 4
0
 /// <summary>
 /// Defines a dependency for the current installer or patch.
 /// Use this method if you need to define a more complex boundary for the dependency.
 /// </summary>
 /// <param name="componentId">The component that this one depends on.</param>
 /// <param name="boundary">Version boundary for the dependency.</param>
 public PatchBuilderAfterPatch DependsOn(string componentId, VersionBoundary boundary)
 {
     AddDependency(new Dependency {
         Id = componentId, Boundary = boundary
     });
     return(this);
 }
Esempio n. 5
0
        private VersionBoundary BuildBoundary(VersionBoundary boundary, Version targetVersion)
        {
            if (boundary.MaxVersion == null)
            {
                boundary.MaxVersion            = targetVersion;
                boundary.MaxVersionIsExclusive = true;
            }

            return(boundary);
        }
Esempio n. 6
0
 public IPatchInstanceBuilder Patch(VersionBoundary from, string to, string released, string description)
 {
     return(Patch(from, null, to, released, description));
 }
Esempio n. 7
0
        /// <summary>
        /// Defines a patch for a component. A component may have multiple patches defined, even in separate assemblies.
        /// </summary>
        /// <param name="from">Patch version boundary. If the component version falls into this boundary,
        /// the patch will be executed.</param>
        /// <param name="to">The target version that will be set after a successful execution.</param>
        /// <param name="released">Release date.</param>
        /// <param name="description">Patch description.</param>
        /// <remarks>Use this method if you want to define a maximum version for the boundary that is
        /// different from the target version defined in the <see cref="to"/> parameter.</remarks>
        public PatchBuilderAfterPatch Patch(VersionBoundary from, string to, string released, string description)
        {
            var patch = BuildSnPatch(from, null, to, released, description);

            return(new PatchBuilderAfterPatch(patch, this));
        }