package space.signux;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

public class Synchronizer {

	private ConnectionSettings inputConnection;
	private ConnectionSettings outputConnection;

	public static void main(String[] args) {
		Synchronizer synchronizer = new Synchronizer();
		if (!synchronizer.loadSettings(args)) {
			return;
		}

	}

	private boolean loadSettings(String[] args) {

		String filename = "settings.txt";
		if (args.length > 0) {
			filename = args[0];
		}
		File settingsFile = new File(filename);

		if (!settingsFile.exists()) {
			System.out.println("settings file: " + filename + " doesn't exist!");
			return false;
		}

		FileInputStream in;
		try {
			System.out.println("load settings from file: " + filename);
			in = new FileInputStream(settingsFile);
			Properties properties = new Properties();
			properties.load(in);
			inputConnection = SettingsReader.CreateInputConnectionSettings(properties);
			outputConnection = SettingsReader.CreateOutputConnectionSettings(properties);
		} catch (FileNotFoundException e) {
			System.out.println("Can't find file: " + filename);
			return false;
		} catch (IOException e) {
			System.out.println("Can't load file: " + filename);
			return false;
		}
		return true;
	}
}

@@ -285,16 +285,197 @@
 ection;%0A
+%09%0A%09private static String tmpDirPath = %22ncds%22;%0A%09private File tempDir; %0A%0A%09public Synchronizer(String%5B%5D args) %7B%0A%09%09if (!loadSettings(args)) %7B%0A%09%09%09return;%0A%09%09%7D%0A%09%09createTempFolder();%0A%09%7D%0A%09%0A%09
 %0A%09public
@@ -560,18 +560,17 @@
 zer(
+args
 );%0A%09%09
-if (!
 sync
@@ -582,49 +582,31 @@
 zer.
-loadSettings(args)) %7B%0A%09%09%09return
+synchronizeData()
 ;%0A
-%09
 %09%7D%0A
-%0A%09%7D%0A
+%09
 %0A%09pr
@@ -1505,10 +1505,281 @@
 rue;%0A%09%7D%0A
+%09%0A%09private void createTempFolder() %7B%0A%09%09String path = System.getProperty(%22java.io.tmpdir%22);%0A%09%09tempDir = new File(path+%22/%22+tmpDirPath);%0A%09%09if (!tempDir.exists()) %7B%0A%09%09%09tempDir.mkdirs();%0A%09%09%7D%0A%09%09tempDir.deleteOnExit();%0A%09%7D%0A%0A%09private boolean synchronizeData() %7B%0A%09%09return true;%0A%09%7D%0A
 %7D%0A

create temp folder for data transfer added