Joyce Posted August 19, 2015 Author Share Posted August 19, 2015 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.> 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 Link to comment Share on other sites More sharing options...
Daneta Posted August 19, 2015 Share Posted August 19, 2015 I don't get how this works, I am clueless XDDDD Link to comment Share on other sites More sharing options...
Growlith1223 Posted August 20, 2015 Share Posted August 20, 2015 Looks good, joyce, nice job on making it! i'll try and see if i can spot any errors Link to comment Share on other sites More sharing options...
Joyce Posted August 20, 2015 Author Share Posted August 20, 2015 @'artix5455':> I don't get how this works, I am clueless XDDDDWhich part exactly do you not understand? @'Growlith1223':> Looks good, joyce, nice job on making it! i'll try and see if i can spot any errorsThere might be a couple! I've tested it a few times and it came out pretty well though. :) 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!) Link to comment Share on other sites More sharing options...
Joyce Posted August 20, 2015 Author Share Posted August 20, 2015 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) Link to comment Share on other sites More sharing options...
Helladen Posted October 1, 2015 Share Posted October 1, 2015 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. Link to comment Share on other sites More sharing options...
Dialectics Posted October 2, 2015 Share Posted October 2, 2015 When will you people learn not to publicly expose fields, especially when they are collections. Link to comment Share on other sites More sharing options...
jcsnider Posted October 2, 2015 Share Posted October 2, 2015 Whenever Visual Studio refuses to compile due to publicly exposed fields :D Link to comment Share on other sites More sharing options...
Joyce Posted October 15, 2015 Author Share Posted October 15, 2015 @'Helladen':> 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. :) I'll be sure to see what you make of it when the game comes out!@'Dialectics':> When will you people learn not to publicly expose fields, especially when they are collections.@'jcsnider':> Whenever Visual Studio refuses to compile due to publicly exposed fields :DAs far as I am aware I barely expose anything in this project, although I did miss a private on my Dictionary. Link to comment Share on other sites More sharing options...
abhi2011 Posted October 16, 2015 Share Posted October 16, 2015 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? Link to comment Share on other sites More sharing options...
Joyce Posted October 16, 2015 Author Share Posted October 16, 2015 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. Link to comment Share on other sites More sharing options...
Helladen Posted October 20, 2015 Share Posted October 20, 2015 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. Link to comment Share on other sites More sharing options...
Joyce Posted October 20, 2015 Author Share Posted October 20, 2015 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. Link to comment Share on other sites More sharing options...
Helladen Posted November 10, 2015 Share Posted November 10, 2015 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. :P Link to comment Share on other sites More sharing options...
Joyce Posted November 10, 2015 Author Share Posted November 10, 2015 I saw, I may or may not have decompiled it. ;) And if Robin cursed at it tell him I'm sorry. :PFair enough on the CRC32! Everyone has their own preferences regarding these things. Link to comment Share on other sites More sharing options...
Helladen Posted November 10, 2015 Share Posted November 10, 2015 @'Joyce':> I saw, I may or may not have decompiled it. ;) And if Robin cursed at it tell him I'm sorry. :P> > 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. Link to comment Share on other sites More sharing options...
Exception Posted November 10, 2015 Share Posted November 10, 2015 @'Helladen':> 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.aspxhttp://www.jetbrains.com/decompiler/http://www.red-gate.com/products/reflector/http://wiki.sharpdevelop.net/ilspy.ashx Link to comment Share on other sites More sharing options...
Helladen Posted November 11, 2015 Share Posted November 11, 2015 I know how to decompile. :P Link to comment Share on other sites More sharing options...
Joyce Posted November 11, 2015 Author Share Posted November 11, 2015 I grabbed the executable and decompiled it. :P 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! Link to comment Share on other sites More sharing options...
Helladen Posted November 11, 2015 Share Posted November 11, 2015 I use dotPeek. Link to comment Share on other sites More sharing options...
Escanor Posted December 19, 2016 Share Posted December 19, 2016 I do not know if someone uses this updater but I've a problem.I followed the steps and it shows me this error message :![](http://image.noelshack.com/fichiers/2016/51/1482177602-capture.png)I looked at the source level but I do not master the C # so I do not find the problemThe part of the code where the error message appears:```private void CompareFiles(Object sender, DoWorkEventArgs e) { var files = e.Argument as XElement; var total = files.Elements().Count(); var current = 0; this.ThreadSafe(() => { TotalProgress.Maximum = total; }); try { foreach (var file in files.Elements()) { var dir = AppDomain.CurrentDomain.BaseDirectory + "\\"; var name = file.Attribute("name").Value; var rhash = file.Attribute("hash").Value; var download = false; this.ThreadSafe(() => { ContentLabel.Content = String.Format("Checking {0}...", name); }); if (!File.Exists(dir + name)) { download = true; } else { using (var f = File.OpenRead(dir + name)) { var lhash = f.ToSha256(); if (!String.Equals(lhash, rhash)) download = true; } } if (download) { this.ThreadSafe(() => { ContentLabel.Content = String.Format("Downloading {0}...", name); }); if (!Directory.Exists(System.IO.Path.GetDirectoryName(dir + name))) Directory.CreateDirectory(System.IO.Path.GetDirectoryName(dir + name)); if (File.Exists(dir + name)) File.Delete(dir + name); using (var client = new WebClient()) { try { client.DownloadFile(Options["RemoteDirectory"] + name, dir + name); } catch { ReportError(String.Format("An error has occured while attempting to download '{0}'", name)); return; } } } current++; this.ThreadSafe(() => { TotalProgress.Value = current; }); } } catch { ReportError("A fatal error has occured while attempting to process the updates."); return; } }```Someone can help me ? Link to comment Share on other sites More sharing options...
Guest Posted December 19, 2016 Share Posted December 19, 2016 @'Escanor':> I do not know if someone uses this updater but I've a problem.> > I followed the steps and it shows me this error message :> > ![](http://image.noelshack.com/fichiers/2016/51/1482177602-capture.png)> > I looked at the source level but I do not master the C # so I do not find the problem> > The part of the code where the error message appears:> > ```> private void CompareFiles(Object sender, DoWorkEventArgs e) {> var files = e.Argument as XElement;> var total = files.Elements().Count();> var current = 0;> this.ThreadSafe(() => { TotalProgress.Maximum = total; });> try {> foreach (var file in files.Elements()) {> var dir = AppDomain.CurrentDomain.BaseDirectory + "\\";> var name = file.Attribute("name").Value;> var rhash = file.Attribute("hash").Value;> var download = false;> this.ThreadSafe(() => { ContentLabel.Content = String.Format("Checking {0}...", name); });> if (!File.Exists(dir + name)) {> download = true;> } else {> using (var f = File.OpenRead(dir + name)) {> var lhash = f.ToSha256();> if (!String.Equals(lhash, rhash)) download = true;> }> }> > if (download) {> this.ThreadSafe(() => { ContentLabel.Content = String.Format("Downloading {0}...", name); });> if (!Directory.Exists(System.IO.Path.GetDirectoryName(dir + name))) Directory.CreateDirectory(System.IO.Path.GetDirectoryName(dir + name));> if (File.Exists(dir + name)) File.Delete(dir + name);> using (var client = new WebClient()) {> try {> client.DownloadFile(Options["RemoteDirectory"] + name, dir + name);> } catch { ReportError(String.Format("An error has occured while attempting to download '{0}'", name)); return; }> }> }> > current++;> this.ThreadSafe(() => { TotalProgress.Value = current; });> }> } catch { ReportError("A fatal error has occured while attempting to process the updates."); return; }> }> ```> Someone can help me ?Change this line of the source:```} catch { ReportError("A fatal error has occured while attempting to process the updates."); return; }```to```} catch (Exception e) { ReportError("A fatal error has occured while attempting to process the updates.\r\n" + e.ToString()); return; }```recompile, run it again, and post the error here Link to comment Share on other sites More sharing options...
Escanor Posted December 20, 2016 Share Posted December 20, 2016 The new message of error :![](http://image.noelshack.com/fichiers/2016/51/1482237038-capture.png) Link to comment Share on other sites More sharing options...
PhenomenalDev Posted December 20, 2016 Share Posted December 20, 2016 Just use another updater lmao there are tons of them. (Damian literally just released one on agd lmao and I think one was released here a week ago) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now