001    /******************************************************************************
002     * Copyright (C) MActor Developers. All rights reserved.                        *
003     * ---------------------------------------------------------------------------*
004     * This file is part of MActor.                                               *
005     *                                                                            *
006     * MActor is free software; you can redistribute it and/or modify             *
007     * it under the terms of the GNU General Public License as published by       *
008     * the Free Software Foundation; either version 2 of the License, or          *
009     * (at your option) any later version.                                        *
010     *                                                                            *
011     * MActor is distributed in the hope that it will be useful,                  *
012     * but WITHOUT ANY WARRANTY; without even the implied warranty of             *
013     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the              *
014     * GNU General Public License for more details.                               *
015     *                                                                            *
016     * You should have received a copy of the GNU General Public License          *
017     * along with MActor; if not, write to the Free Software                      *
018     * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA *
019     ******************************************************************************/
020    package org.mactor.ui.gui;
021    
022    import java.net.URL;
023    import java.util.Properties;
024    
025    public class VersionUtil {
026            public static String getVersion() {
027                    try {
028                            Properties props = new Properties();
029                            props.load(VersionUtil.class.getResourceAsStream("/version.properties"));
030                            return props.getProperty("version");
031                    } catch (Exception e) {
032                            return "unknown version";
033                    }
034            }
035            public static String getLatestVersion() {
036                    try {
037                            Properties props = new Properties();
038                            props.load(new URL("http://mactor.sourceforge.net/version.properties").openStream());
039                            return props.getProperty("version");
040                    } catch (Exception e) {
041                            return null;
042                    }
043            }
044    }