Create an account


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
C# Updater - SHA256 based

#1
It's another updater, this one compares hashes of files and decides whether or not to download the update that way though. Enjoy! I threw this together during today's breaks at work, don't expect it to magically catch all errors, it basically catches none and may crash if you do something wrong. I haven't written a full piece of documentation for it, probably never will. But if you need help with getting it to run just ask.
Quote:Usage
Preparing an Update
  1. Open the Hash Calculator.
  2. Select your Game Client folder (including the latest update, minus the patcher!)
  3. Hit Go! and wait for it to finish.
  4. Copy output.xml from the Hash Calculator folder to the folder you selected earlier and rename output.xml to Checksums.xml
  5. Upload the entire folder you selected earlier to the location you pointed your updater to.

Getting an Update
  1. Make sure you have completed the previous steps, and configured your Patcher (see: https://github.com/Azurebeats/YAGP#configuration).
  2. Run your patcher and sit back!

You can find the download and source over here: https://github.com/Azurebeats/YAGP
Reply

#2
I don't get how this works, I am clueless XDDDD
Reply

#3
Looks good, joyce, nice job on making it! i'll try and see if i can spot any errors
Reply

#4
(08-19-2015, 11:13 PM)artix5455 Wrote: I don't get how this works, I am clueless XDDDD

Which part exactly do you not understand? 

(08-20-2015, 03:12 AM)Growlith1223 Wrote: Looks good, joyce, nice job on making it! i'll try and see if i can spot any errors
There might be a couple! I've tested it a few times and it came out pretty well though. Smile It can take a while to compare/download updates on very large clients though which -can- be a little annoying since it will do this every time it starts. (Of course you could edit it in such a way to only do this when a new version has been uploaded!)
Reply

#5
Pushed a small fix to the repo just now along with a change that makes invokes a little cleaner.

(Cleaned up the repo itself as well, and added some lovely .gitignore goodness)
Reply

#6
Thanks Joyce, we're using this for our game. I prefer C# over PureBasic, the one we had was in VB6 then we went to PureBasic and now finally to C#. SHA256 is probably way better than our old method, which was using a CRC.PHP file in the webhost that anyone could run. It was pretty unsafe if people were aware of it, they could abuse it.
Reply

#7
When will you people learn not to publicly expose fields, especially when they are collections.
Reply

#8
Whenever Visual Studio refuses to compile due to publicly exposed fields Big Grin
[Image: logo.png][Image: logo.png]
Reply

#9
(10-01-2015, 02:32 PM)Helladen Wrote: Thanks Joyce, we're using this for our game. I prefer C# over PureBasic, the one we had was in VB6 then we went to PureBasic and now finally to C#. SHA256 is probably way better than our old method, which was using a CRC.PHP file in the webhost that anyone could run. It was pretty unsafe if people were aware of it, they could abuse it.
Oh neat! Never thought I'd see someone use it for something besides a small project! And seeing how you came from a similar system you should already be aware that it takes a little time to compare local files to remote hashes. Smile I'll be sure to see what you make of it when the game comes out!

(10-02-2015, 05:58 AM)Dialectics Wrote: When will you people learn not to publicly expose fields, especially when they are collections.
(10-02-2015, 07:13 AM)jcsnider Wrote: Whenever Visual Studio refuses to compile due to publicly exposed fields Big Grin
As far as I am aware I barely expose anything in this project, although I did miss a private on my Dictionary.
Reply

#10
Why use SHA-256? The chances of a collision happening are slim. Wouldn't it be better to use CRC32 or some other, less resource-intensive algorithm?
Reply

#11
You could do that, it honestly won't matter much which hashing method you prefer to use here. I just went with this as I had the extension to copy/paste.. I know, lazy.
Reply

#12
We are actually going to change SHA-256 to CRC-32. It is a better algorithm for this type of behavior. SHA-256 is better for security though. I plan to make it look really pretty, and I may end up open-source and pushing it to your source-code branch or making a new one based on it. I will of course put you in the credits. I was planning to make the type of hashing optional - but have a CRC.php included for those who prefer to use a webserver over a .EXE. It isn't that I can't code, I just don't like to reinvent the wheel. A lot of time is wasted by people trying to reinvent the wheel instead of working together to make great projects.
Reply

#13
Haha, that'd work. But wouldn't picking up something lighter (in regards to SHA) like MD5 work just as well (which .net already has a class for, much like SHA256) rather than using php files? More of a personal preference though, I do quite like keeping things together.

I agree lots of time is lost with folks creating different things that all end up doing the same thing though. Rooting for one guy's project for an engine right now, but seeing how he didn't want to tie it to any existing site or project I don't feel comfortable just throwing links around.. I do nudge him on Skype from time to time about his ideas though. Seems like an interesting project.
Reply

#14
Yeah we refactored your updater a lot. Robin actually contributed massively to it as well. I think we're going to keep it closed-source, but I do thank you for the work. It helped get me into C#. I was on the fence for a long time messing around with the Authentication Server we had, but this really helped get me in for good. It looks almost entirely like a different program now, but it was a good spot to start off. I hate writing anything from scratch, I like a base to work with and to refactor it. We switched it from YAML to WinForms simply due to WinForms being a better choice for this type of software in our opinion.

The reason to use CRC-32 is simply due to what we used in the past. We use what has worked for us. Tongue
Reply

#15
I saw, I may or may not have decompiled it. Wink And if Robin cursed at it tell him I'm sorry. Tongue

Fair enough on the CRC32! Everyone has their own preferences regarding these things.
Reply

#16
(11-10-2015, 12:49 PM)Joyce Wrote: I saw, I may or may not have decompiled it. Wink And if Robin cursed at it tell him I'm sorry. Tongue

Fair enough on the CRC32! Everyone has their own preferences regarding these things.

How did you decompile? :O I never released it to the public, maybe you downloaded it from the FTP directly. Robin doesn't mind much, he hates doing the grunt work.
Reply

#17
(11-10-2015, 04:58 PM)Helladen Wrote: How did you decompile?

Programs written with the .NET framework are (practically) fully decompilable to C#/VB.NET/CIL itself/IronPython/etc.

http://www.telerik.com/products/decompiler.aspx
http://www.jetbrains.com/decompiler/
http://www.red-gate.com/products/reflector/
http://wiki.sharpdevelop.net/ilspy.ashx
Reply

#18
I know how to decompile. Tongue
Reply

#19
I grabbed the executable and decompiled it. Tongue And yeah, it's rather simple to decompile any .Net application. Generally it takes very little work to get it to compile again unless whoever wrote it used some obscure assemblies. I tend to use ILSpy when I look at how someone wrote something, it's never a perfect representation of how the code was written by the original author but it works well enough to see the general structure of an application and what it does.

http://ilspy.net/

And woo, I don't have to worry about Robin bashing down my door for being a complete fuckup just yet!
Reply

#20
I use dotPeek.
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
Wink Platformer - EO based Dragon Ball Engine Coyote 21 5,309 07-18-2017, 04:42 AM
Last Post: Azvd
  C# Launcher & Updater Xam 22 4,809 04-29-2016, 07:53 PM
Last Post: Xam
  C# Updater Joyce 10 2,738 08-25-2015, 04:24 PM
Last Post: joaovitor1819
  C# File Updater Matt 9 1,843 08-21-2015, 10:36 PM
Last Post: Matt
  LTGUpdater ~ MD5 MMO Auto Updater [console based] lexkymbeth 3 1,707 11-22-2013, 01:06 PM
Last Post: lexkymbeth

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum software by © MyBB 1.8.4 Theme © iAndrew 2016