Auto updating feature implemented. More features/work needs to be done

to flesh it out.
dev
sigonasr2 7 years ago
parent d943cc8e01
commit ee60241edd
  1. BIN
      sigIRCv2.jar
  2. 8
      src/sig/MyPanel.java
  3. 16
      src/sig/sigIRC.java
  4. 4
      src/sig/utils/FileUtils.java

Binary file not shown.

@ -22,6 +22,8 @@ import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.io.File;
import java.io.IOException;
import javax.swing.JColorChooser;
import javax.swing.JMenuItem;
@ -30,6 +32,7 @@ import javax.swing.JPopupMenu;
import sig.modules.ChatLogModule;
import sig.modules.ChatLog.ChatLogMessage;
import sig.utils.FileUtils;
public class MyPanel extends JPanel implements MouseListener, ActionListener, MouseWheelListener, KeyListener, ComponentListener, WindowListener{
//List<String> messages = new ArrayList<String>();
@ -223,6 +226,11 @@ public class MyPanel extends JPanel implements MouseListener, ActionListener, Mo
m.windowClosed(ev);
}
sigIRC.config.saveProperties();
try {
FileUtils.copyFile(new File(sigIRC.PROGRAM_UPDATE_FILE), new File(sigIRC.BASEDIR+"sigIRCv2.jar"));
} catch (IOException e) {
e.printStackTrace();
}
}
@Override

@ -36,6 +36,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.Socket;
import java.net.URL;
@ -64,7 +65,9 @@ public class sigIRC{
final public static int BASESCROLLSPD = 4;
final public static int ROWSEPARATION = 64;
final public static String BASEDIR = "./";
final public static String PROGRAM_UPDATE_FILE = sigIRC.BASEDIR+"sigIRC/updates/sigIRCv2.jar";
final public static String WINDOWTITLE = "sigIRCv2";
public final static String PROGRAM_EXECUTABLE_URL = "https://github.com/sigonasr2/sigIRCv2/raw/master/sigIRCv2.jar";
public static ConfigFile config;
static String server;
static String nickname;
@ -245,9 +248,22 @@ public class sigIRC{
manager = new FileManager("backcolor.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("drag_bar.png"); manager.verifyAndFetchFileFromServer();
manager = new FileManager("WSplits"); manager.verifyAndFetchFileFromServer();
DownloadProgramUpdate();
System.out.println("Downloaded Dependencies.");
}
private static void DownloadProgramUpdate() {
File updatedir = new File(sigIRC.BASEDIR+"sigIRC/updates/");
updatedir.mkdirs();
File programFile = new File(sigIRC.BASEDIR+"sigIRC/updates/sigIRCv2.jar");
try {
programFile.createNewFile();
org.apache.commons.io.FileUtils.copyURLToFile(new URL(sigIRC.PROGRAM_EXECUTABLE_URL),programFile);
} catch (IOException e) {
e.printStackTrace();
}
}
private static void InitializeModules() {
try {
Module.IMG_DRAGBAR = ImageIO.read(new File(sigIRC.BASEDIR+"drag_bar.png"));

@ -146,8 +146,8 @@ public class FileUtils {
}
}
sb.append("}");
// System.out.println("=============");
System.out.println(sb.toString());
//System.out.println("=============");
//System.out.println(sb.toString());
return sb.toString();
}

Loading…
Cancel
Save