2012-04-25 03:17:23 +02:00
|
|
|
/*******************************************************************************
|
2012-06-03 06:21:20 +02:00
|
|
|
* Copyright (c) 2012 cpw. All rights reserved. This program and the accompanying materials are made available under the terms of the GNU Public License v3.0
|
|
|
|
* which accompanies this distribution, and is available at http://www.gnu.org/licenses/gpl.html
|
2012-06-26 22:12:36 +02:00
|
|
|
*
|
2012-06-03 06:21:20 +02:00
|
|
|
* Contributors: cpw - initial API and implementation
|
2012-04-25 03:17:23 +02:00
|
|
|
******************************************************************************/
|
2012-03-29 06:31:46 +02:00
|
|
|
package cpw.mods.ironchest;
|
|
|
|
|
2012-06-03 06:21:20 +02:00
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.InputStream;
|
|
|
|
import java.util.Properties;
|
|
|
|
import java.util.logging.Level;
|
|
|
|
|
|
|
|
import cpw.mods.fml.common.FMLCommonHandler;
|
2012-03-29 06:31:46 +02:00
|
|
|
|
|
|
|
public class Version {
|
2012-06-03 06:21:20 +02:00
|
|
|
private static String major;
|
|
|
|
private static String minor;
|
2012-06-26 22:12:36 +02:00
|
|
|
@SuppressWarnings("unused")
|
2012-06-03 06:21:20 +02:00
|
|
|
private static String rev;
|
2012-06-26 22:12:36 +02:00
|
|
|
@SuppressWarnings("unused")
|
2012-06-03 06:21:20 +02:00
|
|
|
private static String build;
|
2012-06-26 22:12:36 +02:00
|
|
|
@SuppressWarnings("unused")
|
2012-06-03 06:21:20 +02:00
|
|
|
private static String mcversion;
|
|
|
|
private static boolean loaded;
|
|
|
|
|
|
|
|
private static void init() {
|
|
|
|
InputStream stream = Version.class.getClassLoader().getResourceAsStream("ironchestversion.properties");
|
|
|
|
Properties properties = new Properties();
|
2012-06-26 22:12:36 +02:00
|
|
|
|
2012-06-03 06:21:20 +02:00
|
|
|
if (stream != null) {
|
|
|
|
try {
|
|
|
|
properties.load(stream);
|
|
|
|
major = properties.getProperty("ironchest.build.major.number");
|
|
|
|
minor = properties.getProperty("ironchest.build.minor.number");
|
|
|
|
rev = properties.getProperty("ironchest.build.revision.number");
|
|
|
|
build = properties.getProperty("ironchest.build.build.number");
|
|
|
|
mcversion = properties.getProperty("ironchest.build.mcversion");
|
|
|
|
} catch (IOException ex) {
|
|
|
|
FMLCommonHandler.instance().getFMLLogger().log(Level.SEVERE, "Could not get IronChest version information - corrupted installation detected!", ex);
|
|
|
|
throw new RuntimeException(ex);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
loaded = true;
|
|
|
|
}
|
|
|
|
public static final String version() {
|
|
|
|
if (!loaded) {
|
|
|
|
init();
|
|
|
|
}
|
2012-06-26 22:12:36 +02:00
|
|
|
return major+"."+minor;
|
2012-06-03 06:21:20 +02:00
|
|
|
}
|
2012-03-29 06:31:46 +02:00
|
|
|
}
|