Simple Updater is a library created to help you building an Updater in a few lines of code (for your game launcher or other projects).
This library is built in C# (.NET ≥ 4.6) and JAVA (JRE ≥ 1.8_80).
Just download the library, reference it to your project and you are good to go !
Check the documention bellow to start using it ! (An example project is provided in the source for each langage)
- Developped both in C# and JAVA
- No extra libraries ! All is native.
- Easy integration
- Keep the client updated with the server
- Delete old or unwanted files that doesn't match with the server
- Ignore list
- Webclient configuration
- Can cache the server result for x minutes/seconds (Optional - can have a long time response if disabled with a lot of files)
- Trigger event for each step (Checking files, downloading, ...)
- Status code
- Download progression
- Asynchronous download
- Example projects fully commented
Any contribution is welcome !
Current Version: 1.1
- Presentation
- Table of contents
- Installation
- Web server
- Client integration
- C#
- JAVA
- Code documentation
- Example Project
- Credit
- License
You will need a webserver to host files that the updater will download.
- Clone/Download the project
- Upload files that are in 'PHP - Server files' to your webserver
- Check the index.php for configuration
- Create a folder named 'files' in the same directory as the index.php file
- Place all files that you want to download in that 'files' folder
- Go to the release page and download the Simple Updater library.
- Reference it in your project (Microsoft tutorial)
- Use the Object SimpleUpdater (see the documentation bellow)
- Go to the release page and download the Simple Updater library.
- Add it in your project (A tutorial)
- Use the Object SimpleUpdater (see the documentation bellow)
// We will keep 'updater' on all the documentation
SimpleUpdater updater = new SimpleUpdater(server_url, installation_path);
Params | Type | Description |
---|---|---|
server_url | string / String |
The url of the server on which files will be download |
installation_path | string / String |
The path where files will be downloaded (be careful if not set correctly it can delete wrong files) |
updater.CheckFilesFromServerAndDeleteOutdated();
Description: This function will contact the server to get all files and search through all local files and directories which files need to be deleted, downloaded or ignored. Files that needs to be deleted will be automaticaly deleted.
This function must be called before downloading files.
updater.DownloadFiles();
Description:
This will download all files that needs to be downloaded to the installation_path
provided with the creation of the SimpleUpdater object.
Name (C#) | Function (JAVA) | Type | Description |
---|---|---|---|
Server_Url | getServerUrl() |
string / String |
The url of the server on which files will be downloaded |
Installation_path | getInstallationPath() |
string / String |
The path where files will be download |
CanDownload | CanDownload() |
bool / Boolean |
Check whether you can start the download of files |
CanCheck | CanCheck() |
bool / Boolean |
Check whether you can start the verification process of local files |
NumberOfBytesToDownload | getNumberOfBytesToDownlaod() |
long |
Get the number of bytes that will be downloaded |
StatusCode | getStatusCode() |
int |
Get the status code |
Name | Args | Description |
---|---|---|
OnCheckFinished | int nbrLocalFiles int nbrServerFiles int nbrFilesToDownload int nbrFilesDeleted long numberOfBytesToDownload |
Event triggered when the verification process ends |
OnDownloadFinished | long TotalBytesDownloaded |
Event triggered when the download ends |
OnDownloadProgressChanged | long TotalBytesDownloaded float percent |
Event triggered each time the download progress changed |
OnStatusChanged | int code |
Event triggered when the status of the updater change |
In the JAVA version you need to create a class and implement the
SimpleUpdaterEvents
class to it. Create an instance of this class and add it to listeners ofSimpleUpdater
Object withupdater.addListener(yourEventClassObject)
.
Check the JAVA example project for more information.
Code | Description |
---|---|
0 | Waiting for action |
1 | Contacting server for files to parse |
2 | Search and delete local files |
3 | Check finished Triggered after Check_Finished(...) |
4 | Download started |
5 | A file has been successfully downloaded |
6 | An error occurered when downloading a file |
7 | An error occured will trying to access the server |
8 | Download finished Triggered after Download_Finished(...) |
The example project is fully commented. You can find it in C# - Example Project Simple Updater.
This example project if fully commented. It prints debug to the console. You can find it in 'JAVA - Simple Updater Library'.
- en0 - Flavien Darche