Skip to content

Commit adbe37b

Browse files
author
IMS212
committed
Iris Installer 3.0, complete redesign
1 parent 73a0b83 commit adbe37b

4 files changed

Lines changed: 833 additions & 26 deletions

File tree

gradle.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
org.gradle.jvmargs=-Xmx1G
33

44
# Version and packaging info
5-
version=2.0.5
5+
version=3.0.0-pre1
66
maven_group=net.hypercubemc
77
archives_base_name=Iris-Installer
88

99
# Main class to start with when the jar is run
10-
main_class=net.hypercubemc.iris_installer.Installer
10+
main_class=net.hypercubemc.iris_installer.NewInstaller

src/main/java/net/hypercubemc/iris_installer/InstallerMeta.java

Lines changed: 35 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,25 @@
1010
import java.net.URL;
1111
import java.nio.charset.StandardCharsets;
1212
import java.util.ArrayList;
13+
import java.util.HashMap;
1314
import java.util.List;
1415

1516
public class InstallerMeta {
1617
private final String metaUrl;
17-
private final List<String> gameVersions = new ArrayList<>();
18-
private final List<InstallerMeta.Edition> editions = new ArrayList<>();
18+
private final List<InstallerMeta.Version> versions = new ArrayList<>();
1919

2020
public InstallerMeta(String url) {
2121
this.metaUrl = url;
2222
}
2323

2424
public void load() throws IOException, JSONException {
2525
JSONObject json = readJsonFromUrl(this.metaUrl);
26-
json.getJSONArray("game_versions").toList().forEach(element -> gameVersions.add(element.toString()));
27-
json.getJSONArray("editions").forEach(object -> editions.add(new Edition((JSONObject) object)));
26+
json.getJSONArray("versions").toList().forEach(element -> versions.add(new Version((HashMap) element)));
2827
}
2928

30-
public List<String> getGameVersions() {
31-
return this.gameVersions;
32-
}
3329

34-
public List<InstallerMeta.Edition> getEditions() {
35-
return this.editions;
30+
public List<InstallerMeta.Version> getVersions() {
31+
return this.versions;
3632
}
3733

3834
public static String readAll(Reader reader) throws IOException {
@@ -41,30 +37,45 @@ public static String readAll(Reader reader) throws IOException {
4137
while ((codePoint = reader.read()) != -1) {
4238
stringBuilder.append((char) codePoint);
4339
}
44-
return stringBuilder.toString();
40+
return "{\n" +
41+
" \"versions\": [\n" +
42+
" {\n" +
43+
" \"name\": \"1.16.5\",\n" +
44+
" \"outdated\": false\n" +
45+
" },\n" +
46+
" {\n" +
47+
" \"name\": \"1.17.1\",\n" +
48+
" \"outdated\": false\n" +
49+
" },\n" +
50+
" {\n" +
51+
" \"name\": \"1.18.2\",\n" +
52+
" \"outdated\": false\n" +
53+
" },\n" +
54+
" {\n" +
55+
" \"name\": \"1.19\",\n" +
56+
" \"outdated\": true\n" +
57+
" },\n" +
58+
" {\n" +
59+
" \"name\": \"1.19.1\",\n" +
60+
" \"outdated\": false\n" +
61+
" }\n" +
62+
" ]\n" +
63+
"}";
4564
}
4665

4766
public static JSONObject readJsonFromUrl(String url) throws IOException {
4867
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(new URL(url).openStream(), StandardCharsets.UTF_8));
4968
return new JSONObject(readAll(bufferedReader));
5069
}
5170

52-
public static class Edition {
71+
public static class Version {
72+
boolean outdated;
5373
String name;
54-
String displayName;
55-
List<String> compatibleVersions = new ArrayList<>();
56-
57-
public Edition(JSONObject jsonObject) {
58-
this.name = jsonObject.getString("name");
59-
this.displayName = jsonObject.getString("display_name");
60-
61-
for (int i = 0; i < jsonObject.getJSONArray("compatible_versions").toList().size(); i++){
62-
compatibleVersions.add(jsonObject.getJSONArray("compatible_versions").toList().get(i).toString());
63-
}
64-
}
6574

66-
public String getDisplayName() {
67-
return displayName;
75+
public Version(HashMap<String, Object> jsonObject) {
76+
System.out.println(jsonObject.toString());
77+
this.name = (String) jsonObject.get("name");
78+
this.outdated = (boolean) jsonObject.get("outdated");
6879
}
6980
}
7081
}
Lines changed: 229 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,229 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
3+
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
4+
<NonVisualComponents>
5+
<Component class="javax.swing.ButtonGroup" name="installType">
6+
</Component>
7+
</NonVisualComponents>
8+
<Properties>
9+
<Property name="defaultCloseOperation" type="int" value="3"/>
10+
</Properties>
11+
<SyntheticProperties>
12+
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
13+
<SyntheticProperty name="generateCenter" type="boolean" value="false"/>
14+
</SyntheticProperties>
15+
<AuxValues>
16+
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/>
17+
<AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/>
18+
<AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/>
19+
<AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="false"/>
20+
<AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/>
21+
<AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/>
22+
<AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/>
23+
<AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/>
24+
<AuxValue name="FormSettings_variablesModifier" type="java.lang.Integer" value="2"/>
25+
</AuxValues>
26+
27+
<Layout>
28+
<DimensionLayout dim="0">
29+
<Group type="103" groupAlignment="0" attributes="0">
30+
<Group type="102" alignment="1" attributes="0">
31+
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
32+
<Component id="progressBar" max="32767" attributes="0"/>
33+
<EmptySpace type="separate" max="-2" attributes="0"/>
34+
<Component id="installButton" min="-2" pref="171" max="-2" attributes="0"/>
35+
<EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
36+
</Group>
37+
<Group type="102" attributes="0">
38+
<EmptySpace min="-2" pref="19" max="-2" attributes="0"/>
39+
<Group type="103" groupAlignment="0" attributes="0">
40+
<Component id="installationType" min="-2" max="-2" attributes="0"/>
41+
<Component id="betaSelection" min="-2" max="-2" attributes="0"/>
42+
<Component id="outdatedText2" min="-2" max="-2" attributes="0"/>
43+
<Component id="outdatedText1" min="-2" max="-2" attributes="0"/>
44+
<Component id="gameVersionLabel" min="-2" pref="227" max="-2" attributes="0"/>
45+
<Component id="gameVersionList" min="-2" pref="183" max="-2" attributes="0"/>
46+
<Group type="102" alignment="0" attributes="0">
47+
<Component id="standaloneType" min="-2" max="-2" attributes="0"/>
48+
<EmptySpace type="unrelated" max="-2" attributes="0"/>
49+
<Component id="fabricType" min="-2" max="-2" attributes="0"/>
50+
</Group>
51+
<Component id="installationDirectory" alignment="0" min="-2" max="-2" attributes="0"/>
52+
<Component id="directoryName" alignment="0" min="-2" pref="302" max="-2" attributes="0"/>
53+
</Group>
54+
<EmptySpace pref="242" max="32767" attributes="0"/>
55+
</Group>
56+
<Group type="102" alignment="0" attributes="0">
57+
<EmptySpace min="-2" pref="161" max="-2" attributes="0"/>
58+
<Component id="irisInstallerLabel" pref="490" max="32767" attributes="0"/>
59+
<EmptySpace max="-2" attributes="0"/>
60+
</Group>
61+
</Group>
62+
</DimensionLayout>
63+
<DimensionLayout dim="1">
64+
<Group type="103" groupAlignment="0" attributes="0">
65+
<Group type="102" alignment="0" attributes="0">
66+
<EmptySpace min="-2" pref="48" max="-2" attributes="0"/>
67+
<Component id="irisInstallerLabel" pref="75" max="32767" attributes="0"/>
68+
<EmptySpace type="separate" max="-2" attributes="0"/>
69+
<Component id="gameVersionLabel" min="-2" pref="35" max="-2" attributes="0"/>
70+
<EmptySpace min="-2" max="-2" attributes="0"/>
71+
<Component id="gameVersionList" min="-2" pref="43" max="-2" attributes="0"/>
72+
<EmptySpace min="-2" max="-2" attributes="0"/>
73+
<Component id="betaSelection" min="-2" max="-2" attributes="0"/>
74+
<EmptySpace min="-2" max="-2" attributes="0"/>
75+
<Component id="outdatedText1" min="-2" pref="23" max="-2" attributes="0"/>
76+
<EmptySpace min="-2" max="-2" attributes="0"/>
77+
<Component id="outdatedText2" min="-2" max="-2" attributes="0"/>
78+
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
79+
<Component id="installationType" min="-2" max="-2" attributes="0"/>
80+
<EmptySpace min="-2" max="-2" attributes="0"/>
81+
<Group type="103" groupAlignment="3" attributes="0">
82+
<Component id="standaloneType" alignment="3" min="-2" max="-2" attributes="0"/>
83+
<Component id="fabricType" alignment="3" min="-2" max="-2" attributes="0"/>
84+
</Group>
85+
<EmptySpace type="separate" min="-2" max="-2" attributes="0"/>
86+
<Component id="installationDirectory" min="-2" max="-2" attributes="0"/>
87+
<EmptySpace min="-2" max="-2" attributes="0"/>
88+
<Component id="directoryName" min="-2" pref="36" max="-2" attributes="0"/>
89+
<EmptySpace min="-2" pref="91" max="-2" attributes="0"/>
90+
<Group type="103" groupAlignment="0" attributes="0">
91+
<Group type="102" alignment="1" attributes="0">
92+
<Component id="installButton" min="-2" pref="56" max="-2" attributes="0"/>
93+
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
94+
</Group>
95+
<Group type="102" alignment="1" attributes="0">
96+
<Component id="progressBar" min="-2" pref="25" max="-2" attributes="0"/>
97+
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
98+
</Group>
99+
</Group>
100+
</Group>
101+
</Group>
102+
</DimensionLayout>
103+
</Layout>
104+
<SubComponents>
105+
<Component class="javax.swing.JLabel" name="irisInstallerLabel">
106+
<Properties>
107+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
108+
<Font name="sansserif" size="36" style="0"/>
109+
</Property>
110+
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
111+
<Image iconType="3" name="/iris_profile_icon.png"/>
112+
</Property>
113+
<Property name="text" type="java.lang.String" value=" Iris Installer"/>
114+
</Properties>
115+
</Component>
116+
<Component class="javax.swing.JButton" name="installButton">
117+
<Properties>
118+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
119+
<Font name="sansserif" size="18" style="0"/>
120+
</Property>
121+
<Property name="text" type="java.lang.String" value="Install"/>
122+
</Properties>
123+
<AuxValues>
124+
<AuxValue name="JavaCodeGenerator_ListenersCodePost" type="java.lang.String" value="installButton.putClientProperty( &quot;JButton.buttonType&quot;, &quot;roundRect&quot; );"/>
125+
</AuxValues>
126+
</Component>
127+
<Component class="javax.swing.JComboBox" name="gameVersionList">
128+
<Properties>
129+
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
130+
<StringArray count="4">
131+
<StringItem index="0" value="1.19"/>
132+
<StringItem index="1" value="1.18.2"/>
133+
<StringItem index="2" value="1.17.1"/>
134+
<StringItem index="3" value="1.16.5"/>
135+
</StringArray>
136+
</Property>
137+
</Properties>
138+
<AuxValues>
139+
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;String&gt;"/>
140+
</AuxValues>
141+
</Component>
142+
<Component class="javax.swing.JProgressBar" name="progressBar">
143+
<Properties>
144+
<Property name="value" type="int" value="50"/>
145+
</Properties>
146+
</Component>
147+
<Component class="javax.swing.JLabel" name="gameVersionLabel">
148+
<Properties>
149+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
150+
<Font name="sansserif" size="18" style="0"/>
151+
</Property>
152+
<Property name="text" type="java.lang.String" value="Select game version:"/>
153+
</Properties>
154+
</Component>
155+
<Component class="javax.swing.JLabel" name="outdatedText1">
156+
<Properties>
157+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
158+
<Font name="sansserif" size="16" style="0"/>
159+
</Property>
160+
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
161+
<Color blue="0" green="cc" red="ff" type="rgb"/>
162+
</Property>
163+
<Property name="text" type="java.lang.String" value=" Warning: We have ended support for &lt;version&gt;."/>
164+
</Properties>
165+
</Component>
166+
<Component class="javax.swing.JLabel" name="outdatedText2">
167+
<Properties>
168+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
169+
<Font name="sansserif" size="16" style="0"/>
170+
</Property>
171+
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">
172+
<Color blue="0" green="cc" red="ff" type="rgb"/>
173+
</Property>
174+
<Property name="text" type="java.lang.String" value=" The Iris version you get will most likely be outdated."/>
175+
</Properties>
176+
</Component>
177+
<Component class="javax.swing.JCheckBox" name="betaSelection">
178+
<Properties>
179+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
180+
<Font name="sansserif" size="16" style="0"/>
181+
</Property>
182+
<Property name="text" type="java.lang.String" value="Use beta version (not recommended)"/>
183+
</Properties>
184+
</Component>
185+
<Component class="javax.swing.JRadioButton" name="standaloneType">
186+
<Properties>
187+
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
188+
<ComponentRef name="installType"/>
189+
</Property>
190+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
191+
<Font name="sansserif" size="16" style="0"/>
192+
</Property>
193+
<Property name="text" type="java.lang.String" value="Standalone"/>
194+
</Properties>
195+
</Component>
196+
<Component class="javax.swing.JRadioButton" name="fabricType">
197+
<Properties>
198+
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
199+
<ComponentRef name="installType"/>
200+
</Property>
201+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
202+
<Font name="sansserif" size="16" style="0"/>
203+
</Property>
204+
<Property name="text" type="java.lang.String" value="Fabric/Quilt mod"/>
205+
</Properties>
206+
</Component>
207+
<Component class="javax.swing.JLabel" name="installationType">
208+
<Properties>
209+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
210+
<Font name="sansserif" size="18" style="0"/>
211+
</Property>
212+
<Property name="text" type="java.lang.String" value=" Installation type:"/>
213+
</Properties>
214+
</Component>
215+
<Component class="javax.swing.JLabel" name="installationDirectory">
216+
<Properties>
217+
<Property name="font" type="java.awt.Font" editor="org.netbeans.beaninfo.editors.FontEditor">
218+
<Font name="sansserif" size="18" style="0"/>
219+
</Property>
220+
<Property name="text" type="java.lang.String" value=" Installation directory:"/>
221+
</Properties>
222+
</Component>
223+
<Component class="javax.swing.JButton" name="directoryName">
224+
<Properties>
225+
<Property name="text" type="java.lang.String" value="directory name"/>
226+
</Properties>
227+
</Component>
228+
</SubComponents>
229+
</Form>

0 commit comments

Comments
 (0)