-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from atc-net/feature/improve-workflow
feat: WIP on pre-integration
- Loading branch information
Showing
8 changed files
with
174 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
namespace Atc.Installer.Integration.Helpers; | ||
|
||
public static class VersionHelper | ||
{ | ||
[SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "OK.")] | ||
public static bool IsSourceNewerThanDestination( | ||
string? sourceVersion, | ||
string? destinationVersion) | ||
{ | ||
if (sourceVersion is null || | ||
destinationVersion is null || | ||
sourceVersion == destinationVersion) | ||
{ | ||
return false; | ||
} | ||
|
||
try | ||
{ | ||
return IsSourceNewerThanDestination( | ||
new Version(sourceVersion), | ||
new Version(destinationVersion)); | ||
} | ||
catch | ||
{ | ||
var sortedSet = new SortedSet<string>(StringComparer.Ordinal) | ||
{ | ||
sourceVersion, | ||
destinationVersion, | ||
}; | ||
|
||
return destinationVersion == sortedSet.First(); | ||
} | ||
} | ||
|
||
public static bool IsSourceNewerThanDestination( | ||
Version? sourceVersion, | ||
Version? destinationVersion) | ||
{ | ||
if (sourceVersion is null || | ||
destinationVersion is null || | ||
sourceVersion == destinationVersion) | ||
{ | ||
return false; | ||
} | ||
|
||
return sourceVersion.IsNewerThan(destinationVersion); | ||
} | ||
|
||
public static bool IsDefault( | ||
Version? sourceVersion, | ||
Version? destinationVersion) | ||
{ | ||
if (sourceVersion is null || | ||
destinationVersion is null) | ||
{ | ||
return false; | ||
} | ||
|
||
return "1.0.0.0".Equals(sourceVersion.ToString(), StringComparison.Ordinal) && | ||
"1.0.0.0".Equals(destinationVersion.ToString(), StringComparison.Ordinal); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters