Jump to content

Version Checker


Reid
 Share

Recommended Posts

Enjoy :)
 

	/**
	 * @author Reid (PurpleKush)
	 * @param currVersion
	 * @param txtLoc
	 * @throws IOException
	 */
	public static void versionCheck(final String currVersion,
		final String txtLoc) throws IOException {
		final URL url = new URL(txtLoc);
		final BufferedReader file = new BufferedReader(new InputStreamReader(url.openStream()));
		final String onlineVersion = file.readLine();
		file.close();
		if (!onlineVersion.equals(currVersion)) {
			System.out.println("Version is Out of date");
			JOptionPane.showMessageDialog(null,"Script is Out of date, get latest jar from thread!!!");
		} else {
			System.out.println("Version is Up to date");
		}
	}

 

Link to comment
Share on other sites

uh

how do I run dat doe

call versionCheck(final String currVersion, final String txtLoc) where currVersion is the local script's current version, and txtLoc is the location of an online .txt file containing only the version number (or a blank HTML site containing the same thing).

Poor implementation, imo. Should be a boolean returning if it's current, not a void.

Edited by Toph
Link to comment
Share on other sites

call versionCheck(final String currVersion, final String txtLoc) where currVersion is the local script's current version, and txtLoc is the location of an online .txt file containing only the version number (or a blank HTML site containing the same thing).

Poor implementation, imo. Should be a boolean returning if it's current, not a void.

 

Agreed, this was one of my first java project lol i haven't updated it

  • Like 1
Link to comment
Share on other sites

soo how do I use this? I have own website where I can host a html file containing the current version, but how do I get it to this script? Do I have to replace te textLoc and  currVersion with something? please someone help me

txtLoc is the location of the file with the version and current version is....the current version

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...