Skip to content

Commit 8e1ba2e

Browse files
authored
Update README.md
1 parent fdcca96 commit 8e1ba2e

1 file changed

Lines changed: 39 additions & 0 deletions

File tree

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,41 @@
11
# GithubUpdateCheck
22
NuGet package to check if an update is available. Always compares to the latest github release
3+
4+
## Usage
5+
Create an instance of the `GithubUpdateCheck` and specify your Github username and Github repository, as seen in the url.
6+
```cs
7+
GithubUpdateCheck update = new GithubUpdateCheck("Mayerch1", "GithubUpdateCheck");
8+
bool isUpdate = update.IsUpdateAvailable("1.0.0", VersionChange.Minor);
9+
bool isAsyncUpdate = await update.IsUpdateAvailable("1.0.0.5", VersionChange.Revision);
10+
```
11+
12+
The version will be compared to the latest release on Github (e.g. https://github.com/Mayerch1/GithubUpdateCheck/releases/latest).
13+
Allowed are the following patterns
14+
```
15+
1.0.0
16+
1.0.0.0
17+
18+
v.1.0.0.0
19+
v.1.0.0
20+
21+
v1.0.0.0
22+
v1.0.0
23+
```
24+
(`v` can be any non-digit)
25+
The version string and the tag of the github release must comply with those patterns, otherwise a `InvalidVersionException` will be thrown.
26+
27+
The second argument `VersionChange changeLevel` specifies the level of comparison.
28+
29+
30+
</br>For `Major`, only the first number will be compared (x.0.0.0)
31+
</br>For `Minor`, the first and second number will be compared (x.y.0.0)
32+
</br>For `Build`, the numbers 1-3 will be compared (x.y.z.0)
33+
</br>For `Revision`, all numbers will be compared (x.y.z.a)
34+
35+
36+
37+
All numbers below the specified level (all 0 is this example) will be ignored.
38+
If the remote or local version has a lower level than the specified compare Method (e.g. `1.2.0` at `Revision`), only
39+
the present version levels will be compared.
40+
41+
The prefix `v.` can be present on none, one or both sides.

0 commit comments

Comments
 (0)