    001/*
    002 * Forge Mod Loader
    003 * Copyright (c) 2012-2013 cpw.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the GNU Lesser Public License v2.1
    006 * which accompanies this distribution, and is available at
    007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    008 *
    009 * Contributors:
    010 *     cpw - implementation
    011 */
    012
    013package cpw.mods.fml.relauncher;
    014
    015import java.io.File;
    016import java.io.IOException;
    017import java.io.InputStream;
    018import java.util.ArrayList;
    019import java.util.List;
    020import java.util.Properties;
    021import java.util.logging.Level;
    022
    023public class FMLInjectionData
    024{
    025    static File minecraftHome;
    026    static String major;
    027    static String minor;
    028    static String rev;
    029    static String build;
    030    static String mccversion;
    031    static String mcpversion;
    032    static String deobfuscationDataHash;
    033
    034    public static List<String> containers = new ArrayList<String>();
    035
    036    static void build(File mcHome, RelaunchClassLoader classLoader)
    037    {
    038        minecraftHome = mcHome;
    039        InputStream stream = classLoader.getResourceAsStream("fmlversion.properties");
    040        Properties properties = new Properties();
    041
    042        if (stream != null)
    043        {
    044            try
    045            {
    046                properties.load(stream);
    047            }
    048            catch (IOException ex)
    049            {
    050                FMLRelaunchLog.log(Level.SEVERE, ex, "Could not get FML version information - corrupted installation detected!");
    051            }
    052        }
    053
    054        major = properties.getProperty("fmlbuild.major.number", "missing");
    055        minor = properties.getProperty("fmlbuild.minor.number", "missing");
    056        rev = properties.getProperty("fmlbuild.revision.number", "missing");
    057        build = properties.getProperty("fmlbuild.build.number", "missing");
    058        mccversion = properties.getProperty("fmlbuild.mcversion", "missing");
    059        mcpversion = properties.getProperty("fmlbuild.mcpversion", "missing");
    060        deobfuscationDataHash = properties.getProperty("fmlbuild.deobfuscation.hash","deadbeef");
    061    }
    062
    063    static String debfuscationDataName()
    064    {
    065        return "deobfuscation_data_"+mccversion+".zip";
    066    }
    067    public static Object[] data()
    068    {
    069        return new Object[] { major, minor, rev, build, mccversion, mcpversion, minecraftHome, containers };
    070    }
    071}