# Sammidysam/GameUpdater

A game updater library. It can be used for any type of file, whether that be .exe, .jar, .txt, or more.
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.

# GameUpdater

A game updater library created in C#. It can be used for any type of file, whether that be .exe, .jar, or .txt.

This library figures out if an update is necessary by checking the time of the most recent update and updating if the time of the most recent update is later than the time when last updated (the time on the file at the same directory as the game). When using the update() method, the updater will automatically timestamp the update with the current system time at the time of the update.

How to use:

To update, you must make a new Updater. There are only three arguments in making a new Updater: the file name, the date file name, and the path of where to update the files to. The path is an absolute path. It must be absolute or else an error will arise. The reason why it is absolute and not relative is because this will not be called in games that are played by non-developers. You will call this method if you are a developer and make sure it is not called when you release your game. If it were non-absolute, then it would be much harder to update the files to the right path. Files cannot be uploaded directly to the website. Instead, you will update it to your website location on your computer and from there update the website. After creating a new Updater, you will call the Update() method in Updater and it will update the file and date file at the absolute location specified.

This program will detect if the computer in use has internet. If it does, it will attempt to download the files necessary. If it doesn't it will not. This allows you, the developer, to only need to call the CheckForUpdate() method. The program detects if internet is available by pinging google.com . This is a lot faster and more efficient than the previous method of downloading google.com's source code.

If you are using this library, please make your launcher application a different application than your actual game. This will allow the library to update it, as it can't update itself! Here is some example code that will show you what I did to get the library going:

  	Downloader downloader = new Downloader("text.txt", "date.txt", "http://sammidysam.github.com/text.txt", "http://sammidysam.github.com/date.txt");
Updater updater = new Updater("text.txt", "date.txt", "C:\\Users\\Sam\\Documents\\Website\\Sammidysam.github.com\\");
updater.Update();


That's how simple it is.

	Downloader downloader = new Downloader("hgbg1.0.2.zip", "date.txt", "http://sammidysam.github.com/hgbg1.0.2.zip", "http://sammidysam.github.com/date.txt");