Exemplo n.º 1
0
        public FileSystemWatcher(String dir, int interval, String pyLoc, String scriptLoc, String logLoc)
        {
            FILE_TRACKER  = new NewFileTracker(dir);
            SCRIPT_CALLER = new ScriptCaller(pyLoc, scriptLoc);

            JsonReader configReader;

            try
            {
                configReader = new JsonReader(".");
            }
            catch (FileNotFoundException ex)
            {
                // Rethrow the exception to contain a more useful error message
                throw new FileNotFoundException("The FileSystemWatcher config could not be found! Make sure it is in the current directory: " + Directory.GetCurrentDirectory());
            }

            SMALLKEY_LOC = new String[] {
                configReader.GetToken("smallkeyPath")[0].ToString(),
                configReader.GetToken("smallkeyPath")[1].ToString()
            };

            PUB_STATUS_LOC = new String[] {
                configReader.GetToken("pubStatus")[0].ToString(),
                configReader.GetToken("pubStatus")[1].ToString()
            };

            HASH_LOC = new String[] {
                configReader.GetToken("hashPath")[0].ToString(),
                configReader.GetToken("hashPath")[1].ToString()
            };

            SERVER_NAME         = configReader.GetValue("serverName");
            PORT                = configReader.GetValue("port");
            TEMPLATE_PATH       = configReader.GetValue("templatePath");
            CONN_FILE_PATH      = configReader.GetValue("connFilePath");
            CHECK_HASH          = Boolean.Parse(configReader.GetValue("checkHash"));
            LOG_FILE_PATH       = logLoc;
            FOLDER              = configReader.GetValue("folder");
            MAKE_DESCRIPTOR_URL = ""; //deprecated
            GEOCAT_URL          = configReader.GetValue("geocatUrl");

            GEOCAT_USERNAME = configReader.GetValue("geocatUsername");
            GEOCAT_PASSWORD = configReader.GetValue("geocatPassword");

            AGS_USERNAME = configReader.GetValue("agsUsername");
            AGS_PASSWORD = configReader.GetValue("agsPassword");

            EMAIL_SERVER      = configReader.GetValue("smtpservername");
            EMAIL_FROMADDRESS = configReader.GetValue("fromaddress");
            EMAIL_TOADDRESSES = configReader.GetValue("toaddresses");

            METADATA_URL = configReader.GetValue("metaDataUrl");

            WEBADAPTOR_NAME = configReader.GetValue("webAdaptorName");
            timer.Elapsed  += new ElapsedEventHandler(timer_Elapsed);
            timer.Interval  = interval;
        }
Exemplo n.º 2
0
        public FileSystemWatcher(String dir, int interval, String pyLoc, String scriptLoc, String logLoc)
        {
            FILE_TRACKER = new NewFileTracker(dir);
            SCRIPT_CALLER = new ScriptCaller(pyLoc, scriptLoc);

            JsonReader configReader;
            try
            {
                configReader = new JsonReader(".");
            }
            catch (FileNotFoundException ex)
            {
                // Rethrow the exception to contain a more useful error message
                throw new FileNotFoundException("The FileSystemWatcher config could not be found! Make sure it is in the current directory: " + Directory.GetCurrentDirectory());
            }

            SMALLKEY_LOC = new String[] {
                    configReader.GetToken("smallkeyPath")[0].ToString(),
                    configReader.GetToken("smallkeyPath")[1].ToString()
                };

            PUB_STATUS_LOC = new String[] {
                configReader.GetToken("pubStatus")[0].ToString(),
                configReader.GetToken("pubStatus")[1].ToString()
            };

            HASH_LOC = new String[] {
                configReader.GetToken("hashPath")[0].ToString(),
                configReader.GetToken("hashPath")[1].ToString()
            };

            SERVER_NAME = configReader.GetValue("serverName");
            PORT = configReader.GetValue("port");
            TEMPLATE_PATH = configReader.GetValue("templatePath");
            CONN_FILE_PATH = configReader.GetValue("connFilePath");
            CHECK_HASH = Boolean.Parse(configReader.GetValue("checkHash"));
            LOG_FILE_PATH = logLoc;
            FOLDER = configReader.GetValue("folder");
            MAKE_DESCRIPTOR_URL = ""; //deprecated
            GEOCAT_URL = configReader.GetValue("geocatUrl");

            GEOCAT_USERNAME = configReader.GetValue("geocatUsername");
            GEOCAT_PASSWORD = configReader.GetValue("geocatPassword");

            AGS_USERNAME = configReader.GetValue("agsUsername");
            AGS_PASSWORD = configReader.GetValue("agsPassword");

            EMAIL_SERVER = configReader.GetValue("smtpservername");
            EMAIL_FROMADDRESS = configReader.GetValue("fromaddress");
            EMAIL_TOADDRESSES = configReader.GetValue("toaddresses");

            METADATA_URL = configReader.GetValue("metaDataUrl");

            WEBADAPTOR_NAME = configReader.GetValue("webAdaptorName");
            timer.Elapsed += new ElapsedEventHandler(timer_Elapsed);
            timer.Interval = interval;
        }