package com.brilliance.isc.tool.compareviewpage;

import java.io.IOException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;

public class SourceConfig {

    public static Map<String, String> transcode = new HashMap<String, String>();

    public static String sourceFolder;

    public static String targetFolder;

    public static Map<String, Integer> diff_count = new HashMap<String, Integer>();

    static {
        // 加载Properties文件
        Properties targetProp = new Properties();
        try {
            targetProp.load(SourceConfig.class.getClassLoader().getResourceAsStream("target.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        targetFolder = (String)targetProp.get("TARGET_FOLDER");
        sourceFolder = (String)targetProp.get("SOURCE_FOLDER");

        Properties transProp = new Properties();
        try {
            transProp.load(SourceConfig.class.getClassLoader().getResourceAsStream("trans_code.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        // TODO putAll()直接将所有键值对放进transCode中
        Enumeration<Object> keys = transProp.keys();
        while (keys.hasMoreElements()) {
            String key = (String) keys.nextElement();
            String value = transProp.getProperty(key);
            transcode.put(key, value);
        }
    }
}
