/**
 * CraftenLauncher is an alternative Launcher for Minecraft developed by Mojang.
 * Copyright (C) 2013  Johannes "redbeard" Busch, Sascha "saschb2b" Becker
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 * 
 * VersionLoader Class:
 * 
 * Simple loader to load the version file
 * into an array of strings
 * 
 * @auhtor redbeard
 */
package de.craften.craftenlauncher.logic.download;

import java.util.ArrayList;
import java.util.Scanner;

public class VersionLoader {
	public static ArrayList<String> getVersionStringList() {
		ArrayList<String> versions = new ArrayList<String>();
		
		String versionsJSON = DownloadHelper.downloadFileToString("https://s3.amazonaws.com/Minecraft.Download/versions/versions.json");
		
		Scanner s = new Scanner(versionsJSON);
		
		//TODO: Should use json splitting instead of this.
		while (s.hasNextLine()) {
			String nextLine = s.nextLine();
			
			if(nextLine.contains("id")) {
				String[] split = nextLine.split(":");
				
				String version = split[1].substring(2, split[1].indexOf("\"", 3));
				
				versions.add(version);
			}
		}
		
		s.close();
		return versions;
	}
}

@@ -1,992 +1,154 @@
-/**%0A * CraftenLauncher is an alternative Launcher for Minecraft developed by Mojang.%0A * Copyright (C) 2013  Johannes %22redbeard%22 Busch, Sascha %22saschb2b%22 Becker%0A *%0A * This program is free software: you can redistribute it and/or modify%0A * it under the terms of the GNU General Public License as published by%0A * the Free Software Foundation, either version 3 of the License, or%0A * (at your option) any later version.%0A *%0A * This program is distributed in the hope that it will be useful,%0A * but WITHOUT ANY WARRANTY; without even the implied warranty of%0A * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the%0A * GNU General Public License for more details.%0A *%0A * You should have received a copy of the GNU General Public License%0A * along with this program.  If not, see %3Chttp://www.gnu.org/licenses/%3E.%0A * %0A * VersionLoader Class:%0A * %0A * Simple loader to load the version file%0A * into an array of strings%0A * %0A * @auhtor redbeard%0A */%0Apackage de.craften.craftenlauncher.logic.download
+package de.craften.craftenlauncher.logic.download;%0A%0Aimport com.google.gson.Gson;%0Aimport com.google.gson.JsonElement;%0Aimport com.google.gson.JsonObject
 ;%0A%0Ai
@@ -191,23 +191,20 @@
 va.util.
-Scanner
+List
 ;%0A%0Apubli
@@ -227,17 +227,20 @@
 oader %7B%0A
-%09
+    
 public s
@@ -245,21 +245,16 @@
  static 
-Array
 List%3CStr
@@ -287,88 +287,33 @@
 ) %7B%0A
-%09%09ArrayList%3CString%3E versions = new ArrayList%3CString%3E();%0A%09%09%0A%09%09String versionsJSON
+        String jsonString
  = D
@@ -422,385 +422,318 @@
 %22);%0A
-%09%09%0A%09%09Scanner s = new Scanner(versionsJSON);%0A%09%09%0A%09%09//TODO: Should use json splitting instead of this.%0A%09%09while (s.hasNextLine()) %7B%0A%09%09%09String nextLine = s.nextLine();%0A%09%09%09%0A%09%09%09if(nextLine.contains(%22id%22)) %7B%0A%09%09%09%09String%5B%5D split = nextLine.split(%22:%22);%0A%09%09%09%09%0A%09%09%09%09String version = split%5B1%5D.substring(2, split%5B1%5D.indexOf(%22%5C%22%22, 3));%0A%09%09%09%09%0A%09%09%09%09versions.add(version);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09%0A%09%09s.close();%0A%09%09
+        JsonObject versionsJson = new Gson().fromJson(jsonString, JsonObject.class);%0A%0A        List%3CString%3E versions = new ArrayList%3C%3E();%0A        for (JsonElement version : versionsJson.getAsJsonArray(%22versions%22)) %7B%0A            versions.add(version.getAsJsonObject().get(%22id%22).getAsString());%0A        %7D%0A        
 retu
@@ -749,9 +749,12 @@
 ns;%0A
-%09
+    
 %7D%0A%7D%0A

Refactor VersionLoader.