Opc.Ua.ConfigurationWatcher.Watcher_Changed C# (CSharp) Method

Watcher_Changed() private method

Handles a file changed event.
private Watcher_Changed ( object state ) : void
state object
return void
        private void Watcher_Changed(object state)
        {
            try
            {
                FileInfo fileInfo = new FileInfo(m_configuration.SourceFilePath);

                if (!fileInfo.Exists)
                {
                    return;
                }

                if (fileInfo.LastWriteTimeUtc <= m_lastWriteTime)
                {
                    return;
                }

                m_lastWriteTime = fileInfo.LastWriteTimeUtc;

                EventHandler<ConfigurationWatcherEventArgs> callback = m_Changed;

                if (callback != null)
                {
                    callback(this, new ConfigurationWatcherEventArgs(m_configuration, m_configuration.SourceFilePath));
                }
            }
            catch (Exception exception)
            {
                Utils.Trace(exception, "Unexpected error raising configuration file changed event.");
            }
        }
        #endregion