SIPSorcery.AppServer.DialPlan.DialPlanEngine.ReloadCommonRubyScript C# (CSharp) Method

ReloadCommonRubyScript() private method

private ReloadCommonRubyScript ( object sender, FileSystemEventArgs e ) : void
sender object
e System.IO.FileSystemEventArgs
return void
        private void ReloadCommonRubyScript(object sender, FileSystemEventArgs e)
        {
            try
            {
                if (m_rubyCommonLastReload == null || DateTime.Now.Subtract(m_rubyCommonLastReload.Value).TotalSeconds > RUBY_COMMON_RELOAD_INTERVAL)
                {
                    m_rubyCommonLastReload = DateTime.Now;

                    logger.Debug("Ruby common script file changed, reloading ruby common script.");

                    File.Copy(m_rubyScriptCommonPath, m_rubyScriptCommonPath + RUBY_COMMON_COPY_EXTEN, true);
                    StreamReader proxyRuntimeReader = new StreamReader(m_rubyScriptCommonPath + RUBY_COMMON_COPY_EXTEN);
                    string rubyScriptCommon = proxyRuntimeReader.ReadToEnd();
                    proxyRuntimeReader.Close();

                    m_rubyScriptCommon = rubyScriptCommon;
                }
            }
            catch (Exception excp)
            {
                logger.Error("Exception rubyScriptWatcher_Changed. " + excp);
            }
        }