Thursday, April 16, 2015

Patcher Done!

There are a LOT of ways you can choose to update a game.  You could have a installer that is downloaded every time there is a update available.  You could download a file with a version number that tells you if you need to update your version with the server's and then download all the necessary files.  OR you could use existing technologies that have proven reliable.  Subversion, or SVN, is a very very useful way to keep files updated.  It also allows you to revert a file to a previous revision in case mistakes were made.  SVN is what I chose to go with for a patcher because you can even create "patch" files with SVN.

To accomplish this I used a library called SharpSVN which is a .NET library written to use SVN simple and easily.  Best thing about it is you do not have to have SVN installed on your system.

An example is below to show you just how easily it is to get started.
using (var svn = new SvnClient ()) {
  svn.Configuration.LogMessageRequired = false;
  svn.Authentication.Clear ();
  svn.Authentication.AddConsoleHandlers ();
 svn.Authentication.DefaultCredentials = new NetworkCredential ("test_user", "abc123*");
 

  svn.CheckOut (remoteTarget, localPath);