If you want to auto update your program, but don't know how or you don't have money to pay for server to host your files this is just right for you. GitHub hosts files for project so why not use that service?
How does it work?
When program starts it looks for file named Version.txt both on GitHub and in local directory. It compares version numbers and notifies user that there is new update available along with change log description. Then downloads Update.zip file to temporary directory and extracts it. In that file there is Instructions.txt which guides Auto Updater to know which files to delete, move, copy, paste, create.
How to use?
Creating Version.txt file:
- First row is version number like 1.2.3.
- Second row is change log description.
- Upload file to your GitHub project or server.
* Version numbers aren't numbers, but strings so checking is done if strings are same.
Creating Instructions.txt file:
Files that are extracted from Update.zip go to "tmp" folder.
Add few instructions to list and save it.
Example
Instruction.instructions.Add(new Instruction(InstructionType.delete, "TestDummy.exe"));
Instruction.instructions.Add(new Instruction(InstructionType.move, "tmp/TestDummy.exe", "TestDummy.exe"));
// creates Instructions.txt file
Instruction.Save();
Uploading update to server/GitHub
Zip up files along with Instructions.txt to a file named Update.zip and upload it.
In example that I have included it replaces main application with updated one.
Programming language: c#, windows forms
Project: https://github.com/Stock84-dev/Auto-Updater
Posted on Utopian.io - Rewarding Open Source Contributors