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);
            }
        }
示例#2
0
 internal ItemBuilder(SnPatchBase patch, PatchBuilder patchBuilder)
 {
     _patch        = patch;
     _patchBuilder = patchBuilder;
 }
示例#3
0
 public DependencyBuilder(PatchBuilder patchBuilder)
 {
     _patchBuilder = patchBuilder;
 }
示例#4
0
 internal PatchBuilderAfterAction(SnPatchBase patch, PatchBuilder patchBuilder)
 {
     _patch        = patch;
     _patchBuilder = patchBuilder;
 }