Auto updater for c# apps via GitHub repositoriessteemCreated with Sketch.

in #utopian-io6 years ago (edited)

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:

  1. First row is version number like 1.2.3.
  2. Second row is change log description.
  3. 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

Sort:  

Hey @stock84 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • This is your first accepted contribution here in Utopian. Welcome!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Congratulations @stock84! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

Award for the number of upvotes

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

By upvoting this notification, you can help all Steemit users. Learn how here!

Your contribution cannot be approved yet.

  • Please choose a different descriptive title.

It seems it's an example of auto-updating mechanism for c# apps via github repositories. If you indicate that in the title, that would be better for readers.

Please edit the post's title via utopian.io and reply this comment when you're done.

You can contact us on Discord.
[utopian-moderator]

Thanks, title changed.

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

Coin Marketplace

STEEM 0.27
TRX 0.12
JST 0.032
BTC 61769.55
ETH 2910.04
USDT 1.00
SBD 3.64