public IPatchInstanceBuilder DependsOn(string componentId, string minVersion) { return(DependsOn(componentId, new VersionBoundary { MinVersion = PatchBuilder.ParseVersion(minVersion, _patch) })); }
private bool CompareComponentVersion(string componentId, string versionSrc, VersionRelation relation) { var component = CurrentlyInstalledComponents .FirstOrDefault(x => x.ComponentId == componentId); if (component == null) { throw new PatchExecutionException( RepositoryIsRunning ? PatchExecutionErrorType.ExecutionErrorOnBefore : PatchExecutionErrorType.ExecutionErrorOnAfter, CurrentPatch, "Component not found: " + componentId); } var version = PatchBuilder.ParseVersion(versionSrc, CurrentPatch); var componentVersion = RepositoryIsRunning ? component.TempVersionAfter ?? component.Version : component.TempVersionBefore ?? component.Version; switch (relation) { case VersionRelation.LowerOrEqual: return(version >= componentVersion); case VersionRelation.Lower: return(version > componentVersion); case VersionRelation.Equal: return(version == componentVersion); case VersionRelation.Higher: return(version < componentVersion); case VersionRelation.HigherOrEqual: return(version <= componentVersion); default: throw new ArgumentOutOfRangeException(nameof(relation), relation, null); } }