Jump to content




Update Check

lua computer

  • You cannot reply to this topic
3 replies to this topic

#1 Ziriee

  • Members
  • 47 posts

Posted 02 September 2013 - 11:30 AM

Anybody knows how to check for updates for a program on pastebin? I would like to keep my program up to date whenever I choose to update the program

#2 tesla1889

  • Members
  • 351 posts
  • LocationSt. Petersburg

Posted 02 September 2013 - 12:00 PM

create a custom header system and put all of the metadata at the top:
--[[
Program Name
version:
release:
patch:
--]]

then, parse the download for the version, release, and patch numbers to check if you need to update

#3 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 September 2013 - 12:01 PM

The easiest method would be to download the pastebin contents and compare it to the file itself... So if you open the file read all its contents and then read all the contents from pastebin, they should be the same, if they aren't, then the versions of the file are different.

There are other better ways to check for updates, but all of them either require a 3rd party API or require the use of another website, instead of pastebin... For example I have been known in the past to have a CSV file on my Dropbox that contains program names and their current versions, then using my very old version API where I could quickly check the state of all the files with function calls.

EDIT: You can do what tesla posted, but in the time it would take you to parse the string and then compare, you may as well just compare the 2 files directly. It'd be much quicker.

Edited by theoriginalbit, 02 September 2013 - 12:02 PM.


#4 Ziriee

  • Members
  • 47 posts

Posted 02 September 2013 - 12:06 PM

Thanks guys.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users