상속: System.ComponentModel.Component, ISupportLifecycle, ISupportInitialize, IProvideStatus, IPersistSettings
        /// <summary>
        /// Creates a new instance of the <see cref="HistorianSetupScreen"/>.
        /// </summary>
        public HistorianSetupScreen()
        {
            m_parametersScreen = new HistorianConnectionStringScreen();
            m_historianAdapters = new List<HistorianAdapter>();

            // This can fail if user is not running under proper credentials
            try
            {
                foreach (Type type in GetHistorianTypes())
                {
                    m_historianAdapters.Add(new HistorianAdapter(type));
                }
            }
            catch (Exception ex)
            {
                LogFile logger = new LogFile();
                logger.FileName = FilePath.GetAbsolutePath("ErrorLog.txt");
                logger.WriteTimestampedLine(ErrorLogger.GetExceptionInfo(ex, false));
                logger.Dispose();
            }

            if (m_historianAdapters.Count > 0)
            {
                m_defaultAdapter = m_historianAdapters.Find(adapter => adapter.TypeName == "HistorianAdapters.LocalOutputAdapter");

                if (m_defaultAdapter == null)
                    m_defaultAdapter = m_historianAdapters[0];

                m_assemblyName = m_defaultAdapter.AssemblyName;
                m_typeName = m_defaultAdapter.TypeName;
            }

            if (m_defaultAdapter == null)
            {
                m_assemblyName = FilePath.GetAbsolutePath("HistorianAdapters.dll");
                m_typeName = "HistorianAdapters.LocalOutputAdapter";
            }

            InitializeComponent();
        }
예제 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ServiceHelper"/> class.
        /// </summary>
        public ServiceHelper()
        {
            m_telnetSessionPassword = "******";
            m_logStatusUpdates = DefaultLogStatusUpdates;
            m_maxStatusUpdatesLength = DefaultMaxStatusUpdatesLength;
            m_maxStatusUpdatesFrequency = DefaultMaxStatusUpdatesFrequency;
            m_monitorServiceHealth = DefaultMonitorServiceHealth;
            m_healthMonitorInterval = DefaultHealthMonitorInterval;
            m_requestHistoryLimit = DefaultRequestHistoryLimit;
            m_supportFileManagementCommands = DefaultSupportFileManagementCommands;
            m_supportTelnetSessions = DefaultSupportTelnetSessions;
            m_supportSystemCommands = DefaultSupportSystemCommands;
            m_secureRemoteInteractions = DefaultSecureRemoteInteractions;
            m_serializationFormat = DefaultSerializationFormat;
            m_persistSettings = DefaultPersistSettings;
            m_settingsCategory = DefaultSettingsCategory;
            m_processes = new List<ServiceProcess>();
            m_remoteClients = new List<ClientInfo>();
            m_clientRequestHistory = new List<ClientRequestInfo>();
            m_serviceComponents = new List<object>();
            m_clientRequestHandlers = new List<ClientRequestHandler>();
            m_componentEnabledStates = new Dictionary<ISupportLifecycle, bool>();

            m_clientStatusUpdateLookup = new Dictionary<Guid, ClientStatusUpdateConfiguration>();
            m_threadScheduler = new LogicalThreadScheduler();
            m_threadScheduler.UnhandledException += LogicalThread_ProcessException;
            m_statusUpdateThread = m_threadScheduler.CreateThread(2);
            m_statusUpdateQueue = new List<StatusUpdate>();

            // Components
            m_statusLog = new LogFile();
            m_statusLog.FileName = "StatusLog.txt";
            m_statusLog.SettingsCategory = "StatusLog";
            m_statusLog.LogException += StatusLog_LogException;

            m_processScheduler = new ScheduleManager();
            m_processScheduler.SettingsCategory = "ProcessScheduler";
            m_processScheduler.ScheduleDue += Scheduler_ScheduleDue;

            m_errorLogger = new ErrorLogger();
            m_errorLogger.ExitOnUnhandledException = false;
            m_errorLogger.SettingsCategory = "ErrorLogger";
            m_errorLogger.ErrorLog.SettingsCategory = "ErrorLog";
            m_errorLogger.LoggingException += ErrorLogger_LoggingException;
        }
예제 #3
0
파일: ErrorLogger.cs 프로젝트: avs009/gsf
        /// <summary>
        /// Initializes a new instance of the <see cref="ErrorLogger"/> class.
        /// </summary>
        public ErrorLogger()
        {
            m_logToUI = DefaultLogToUI;
            m_logToFile = DefaultLogToFile;
            m_logToEmail = DefaultLogToEmail;
            m_logToEventLog = DefaultLogToEventLog;
            m_logToDatabase = DefaultLogToDatabase;
            m_logUserInfo = DefaultLogUserInfo;
            m_databaseLogSize = DefaultDatabaseLogSize;
            m_smtpServer = DefaultSmtpServer;
            m_contactName = DefaultContactName;
            m_contactEmail = DefaultContactEmail;
            m_contactPhone = DefaultContactPhone;
            m_persistSettings = DefaultPersistSettings;
            m_settingsCategory = DefaultSettingsCategory;
            m_handleUnhandledException = DefaultHandleUnhandledException;
            m_exitOnUnhandledException = DefaultExitOnUnhandledException;

            // Initialize delegate methods.
            m_errorTextMethod = GetErrorText;
            m_scopeTextMethod = GetScopeText;
            m_actionTextMethod = GetActionText;
            m_moreInfoTextMethod = GetMoreInfoText;

            // Initialize the error log file.
            m_errorLog = new LogFile();
            m_errorLog.FileName = "ErrorLog.txt";

            // Initialize all logger methods.
            m_loggers = new List<Action<Exception>>();
            m_loggers.Add(ExceptionToDatabase);
            m_loggers.Add(ExceptionToEventLog);
            m_loggers.Add(ExceptionToEmail);
            m_loggers.Add(ExceptionToFile);
            m_loggers.Add(ExceptionToUI);
        }