Yxxe Posted September 10, 2011 Author Share Posted September 10, 2011 **Updater Add-Ons Index**Below is a list of compiled tutorials by various authors for Robin's autoupdater.**Client File Functionality**_Author: Lightning_This tutorial allows control of the client-side files through the use of a downloaded command file.>! Seeing as I'm off to university soon, I won't be around as much as I have been. I thought I'd share this little snippet with you. It gives the autoupdater a little more functionality and control over your client files. Who knows, in the future there may be some files in the client which aren't needed any more, or need to be moved elsewhere. This is where this bit of code comes in handy. It allows you do delete files and folders, and move files to other places in the client with a few short commands.>! It's tried and tested with Yami's autoupdater, but it should work with Robins also, seeing as Yami's is based off of that.>! **The Code:**>! Go to Project > References and added "Microsoft Scripting Runtime", then click "OK".>! Place this in modMain:>! WARNING: Some filepaths will need to be changed in order for it to work for you.>! ```Sub RunCommandFile()  Dim ReadCommand As String  Dim CurrentCommand() As String  Dim fpath As New FileSystemObject  If FileExist(App.Path & "\bin\command.txt") Then    Open App.Path & "\bin\command.txt" For Input As #1      While EOF(1) = False        Line Input #1, ReadCommand        'Split the command        CurrentCommand = Split(ReadCommand, " ")        'First word is keyword        Select Case CurrentCommand(0)          Case "del"            If FileExist(App.Path & CurrentCommand(1)) = True Then              Call Kill(App.Path & CurrentCommand(1))            End If          Case "delfolder"            If fpath.FolderExists(App.Path & CurrentCommand(1)) = True Then              Call fpath.DeleteFolder(App.Path & CurrentCommand(1), True)            End If          Case "move"            'First, copy the file            If FileExist(App.Path & CurrentCommand(1)) Then              If FileExist(App.Path & CurrentCommand(2)) = False Then                If fpath.FolderExists(App.Path & CurrentCommand(2)) Then                  Call fpath.MoveFile(App.Path & CurrentCommand(1), App.Path & CurrentCommand(2))                End If              End If            End If        End Select      Wend    Close #1    'Delete the command file    Call Kill(App.Path & "\bin\command.txt")  End If>! End Sub>! ```Find "Public Sub RunUpdates" in modMain. At the end of the loop, above "Next":>! ```Call RunCommandFile```The procedure will run every time an update is downloaded. If a command file is not present, the procedure will basically skip it.>! **How to make a command file:**>! Make a blank text document called "command.txt". Open it up.Type each command on a seperate line. They will be executed one at a time.>! ```del test.txtdelfolder \bin\oldmove File.exe \bin\exe\File.exe```In this example, test.txt is deleted. Afterwards, the folder called "old" in the "bin" folder is deleted. "File.exe" is then moved to "\bin\exe\".>! Once your command file is ready, place it in with your patch data in the RAR archive. Make sure the command file is extracted to the root location the RAR archive is downloaded to.>! **And finally:**Here is the command data:>! Deleting a file:```del [filepath]```Deleting a folder:```delfolder [filepath]```Moving a file:```move [source filepath] [destination filepath]```Enjoy,>! Lightning**Updater First-Time Use**_Author: = Not 7_Almost identical to my code for OTLR's updater, this checks the updater for first time use. If so, it prompts the user to install the game's run-time files.>! Firstly, in config.ini, add under the options:```[Updater]FirstTime=0```When the person first loads the updater, it calls sub main. So, we need to make a check that checks whether it's their first time loading the updater itself, and if so, exit the sub, so it doesn't carry on with the rest.>! So, we need to add…```  If GetVar((App.Path & "\bin\Data Files\config.ini"), "Updater", "FirstTime") = 0 Then    Call FirstLoad    Exit Sub  End If```This checks the FirstTime, and whether it's 0\. If so, it stops the sub, as said, and instead loads a prompt. You can have whatever you wish for this prompt. In my case, I have it ask whether you have installed the library files.>! So, add…```Public Sub FirstLoad()MsgBox "Hello. This appears to be the first time you have ran GAMENAMEHERE!", vbOKOnly, "GAMENAMEHERE">! If MsgBox("GAMENAMEHERE requires a series of files called Dynamic Link Libraries to run! Have you installed the Eclipse Library Installer?", vbYesNo, "GAMENAMEHERE") = vbNo Then  MsgBox "OK. Please install the library files!", vbOKOnly, GAMENAMEHERE  Shell (App.Path & "\bin\ELI.exe")  PutVar (App.Path & "\bin\Data Files\config.ini"), "Updater", "FirstTime", 1  DestroyUpdater  Exit SubElse  MsgBox "OK. Have fun on Iron Prelude!", vbOKOnly, GAMENAMEHERE  PutVar (App.Path & "\bin\Data Files\config.ini"), "Updater", "FirstTime", 1  Call MainEnd If>! End Sub```If the client has not installed the library files, it actually closes the updater, and runs the Eclipse Library Installer!After running for the first time, it changes the FirstTime to 1, and won't prompt again, from that point, unless if you directly change config.ini back to 0! Link to comment Share on other sites More sharing options...
Carim123 Posted September 10, 2011 Share Posted September 10, 2011 Nice, I can definitely see use from this…mind if I share some of my code too for tutorial use, Lightning? I don't see the need for a separate thread, if it's on the updater... Link to comment Share on other sites More sharing options...
Yxxe Posted September 10, 2011 Author Share Posted September 10, 2011 @=:> Nice, I can definitely see use from this…mind if I share some of my code too for tutorial use, Lightning? I don't see the need for a separate thread, if it's on the updater...I'm guessing you are thinking of some other functions? Just send me the functions via PM and I'll code them myself thanks. ;] Link to comment Share on other sites More sharing options...
Carim123 Posted September 10, 2011 Share Posted September 10, 2011 @Lightning:> I'm guessing you are thinking of some other functions? Just send me the functions via PM and I'll code them myself thanks. ;]No, I mean just share other snippets of code that can be used on the Autoupdater too. Just for whoever wants to use it, it saves the need for needing to create a new thread, and maybe you could make this sort of like an index for various functions for use. I wouldn't mind helping too, I've been meaning to make a tutorial for a few updater things, for a while now. Link to comment Share on other sites More sharing options...
Yxxe Posted September 10, 2011 Author Share Posted September 10, 2011 @=:> No, I mean just share other snippets of code that can be used on the Autoupdater too. Just for whoever wants to use it, it saves the need for needing to create a new thread, and maybe you could make this sort of like an index for various functions for use. I wouldn't mind helping too, I've been meaning to make a tutorial for a few updater things, for a while now.Oh, ok. Send me the tutorials via PM and I'll add them to the OP. :] Link to comment Share on other sites More sharing options...
Yxxe Posted September 21, 2011 Author Share Posted September 21, 2011 Bump! ;] Link to comment Share on other sites More sharing options...
Robin Posted September 21, 2011 Share Posted September 21, 2011 Make it so the autoupdater can update itself. That's something I'll be adding to my own updater. Very useful for big changes like a new interface.Isn't there a better way to delete a directory without adding more dependencies? Link to comment Share on other sites More sharing options...
Yxxe Posted September 21, 2011 Author Share Posted September 21, 2011 @Robin:> Make it so the autoupdater can update itself. That's something I'll be adding to my own updater. Very useful for big changes like a new interface.I wrote an application for that already, but was planning to keep it to myself. ;] It's untested, but once I test it I may release the source for it.@Robin:> Isn't there a better way to delete a directory without adding more dependencies?If you do then I'll gladly update the tutorial. Link to comment Share on other sites More sharing options...
Robin Posted September 21, 2011 Share Posted September 21, 2011 I have no idea. Was simply curious. I'll be re-writing my updater for Crystalshire soon. If I come across anything ground breaking I'll throw it your way. Or I might just re-release an updated version of my updater. This stuff should really be in by default. Link to comment Share on other sites More sharing options...
Yxxe Posted September 21, 2011 Author Share Posted September 21, 2011 @Robin:> I have no idea. Was simply curious. I'll be re-writing my updater for Crystalshire soon. If I come across anything ground breaking I'll throw it your way. Or I might just re-release an updated version of my updater. This stuff should really be in by default.Well that's what I thought. The basis of just downloading and extracting files seemed a little primitive, so I thought I'd release this source code so the patcher had a little more control over the client files. I'll send you the source to the Patcher Updater if you like. Link to comment Share on other sites More sharing options...
Robin Posted September 22, 2011 Share Posted September 22, 2011 No thanks. Other people's code never sits well with me. I like to program things myself. Link to comment Share on other sites More sharing options...
Yxxe Posted September 22, 2011 Author Share Posted September 22, 2011 @Robin:> No thanks. Other people's code never sits well with me. I like to program things myself.Whatever floats your boat. Link to comment Share on other sites More sharing options...
Robin Posted September 22, 2011 Share Posted September 22, 2011 Better off dumping file list in to an array, loop & kill, then use rmDir to get rid of the directory itself.No reason to add more dependencies for it.Also, the RAR system causes huge amounts of unneeded data transfer due to download old versions of files. Looking in to caching the check-sum of files on the server and having the updater compare against the ones in the client and only download files which have changed.I'll release a copy of it once I'm done. Link to comment Share on other sites More sharing options...
Yxxe Posted September 22, 2011 Author Share Posted September 22, 2011 @Robin:> Better off dumping file list in to an array, loop & kill, then use rmDir to get rid of the directory itself.> > No reason to add more dependencies for it.> > Also, the RAR system causes huge amounts of unneeded data transfer due to download old versions of files. Looking in to caching the check-sum of files on the server and having the updater compare against the ones in the client and only download files which have changed.> > I'll release a copy of it once I'm done.So basically instead of hosting patches, you would hold the most up-to-date copy of the client on your patch file host. I'm guessing you would go about comparing file dates (or something along those lines) or a checksum like you stated. You'd then just go and take the files that have changed from the client on the patch site? Link to comment Share on other sites More sharing options...
Robin Posted September 22, 2011 Share Posted September 22, 2011 Pretty much. Although using BMPs would give a much larger download time than the previous .rar system up to a certain point. This system will only really start giving an advantage when you've got to the point where people are downloading 20mB+ of outdated files only to replace them a couple of minutes later.Luckily with PNGs already being compressed it'll give instant benefits with a dx8 game.Using check-sums would require a PHP file to be run every time you upload new files so that it can dump all the strings in to a .ini for the client to read, but that shouldn't be a problem on most setups. Link to comment Share on other sites More sharing options...
Carim123 Posted September 29, 2011 Share Posted September 29, 2011 > I'll release a copy of it once I'm done.Any updates on that front? I'm really interested in the way your updater works, and it'd be nice to get some insight into the way (and how) it was done. =D Link to comment Share on other sites More sharing options...
Robin Posted September 30, 2011 Share Posted September 30, 2011 Once I've ironed out any bugs in it. Had one or two people have file access issues, so I need to know if that's them just screwing up running it or a problem with the program.I also haven't got around to adding file kill lists yet. Link to comment Share on other sites More sharing options...
Carim123 Posted October 7, 2011 Share Posted October 7, 2011 @Robin:> Once I've ironed out any bugs in it. Had one or two people have file access issues, so I need to know if that's them just screwing up running it or a problem with the program.> > I also haven't got around to adding file kill lists yet.Not to be off topic, but does that mean that we'll have to download a new updater for CS, or have you somehow made a mystical system that makes it update itself? Link to comment Share on other sites More sharing options...
Robin Posted October 7, 2011 Share Posted October 7, 2011 It's been out in Crystalshire for weeks.You needed to delete the game and re-download for v1.5.0 but the latest updater has the ability to replace itself. Link to comment Share on other sites More sharing options...
Carim123 Posted October 7, 2011 Share Posted October 7, 2011 @Robin:> It's been out in Crystalshire for weeks.> > You needed to delete the game and re-download for v1.5.0 but the latest updater has the ability to replace itself.Ah, right, nice. =D 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