Esempio n. 1
0
        private void _ReadXmlSettings()
        {
            if (File.Exists(_xmlFilePath))
            {
                _sSettingsDocument = new XmlDocument();
                _sSettingsDocument.Load(_xmlFilePath);

                XmlNode tempNode = _sSettingsDocument.GetElementsByTagName("AppName").Item(0);
                _appName = tempNode != null ? tempNode.InnerText : "GatApplication";

                tempNode             = _sSettingsDocument.GetElementsByTagName("AppStartTime").Item(0);
                ApplicationStartTime = tempNode != null?TimeSpan.Parse(tempNode.InnerText) : TimeSpan.Zero;

                tempNode           = _sSettingsDocument.GetElementsByTagName("AppEndTime").Item(0);
                ApplicationEndTime = tempNode != null?TimeSpan.Parse(tempNode.InnerText) : TimeSpan.Zero;

                tempNode = _sSettingsDocument.GetElementsByTagName("DaysBack").Item(0);
                if (tempNode != null)
                {
                    int.TryParse(tempNode.InnerText, out DaysBack);
                }

                tempNode = _sSettingsDocument.GetElementsByTagName("SpecificDate").Item(0);
                if (tempNode != null)
                {
                    if (!DateTime.TryParse(tempNode.InnerText, out _specificDate))
                    {
                        _specificDate = DateTime.Now;
                    }
                }

                GatLogger = new GatLoggerSettings(_sSettingsDocument.GetElementsByTagName("Logging"));

                tempNode = _sSettingsDocument.GetElementsByTagName("CommandServerDetails").Item(0);
                if (tempNode != null)
                {
                    WbCommandServer = new WbCommandServerSettings(_sSettingsDocument);
                }

                //_GetCommandServerSettings(ref _sSettingsDocument);

                tempNode = _sSettingsDocument.GetElementsByTagName("CommandClientDetails").Item(0);
                if (tempNode != null)
                {
                    WbCommandClient = new WBCommandClientSettings(tempNode);
                }

                //_GetCommandClientSettings(ref _sSettingsDocument);

                _GetActiveDb(_sSettingsDocument.GetElementsByTagName("DbSettings"));
                _LoadFixSettings(_sSettingsDocument);

                WbEmail = new WbEmailSettings(_sSettingsDocument);
            }
            else
            {
                _sSettingsDocument = null;
                GatLogger          = new GatLoggerSettings(null);
            }
        }
Esempio n. 2
0
        private void _GetCommandClientSettings(ref XmlDocument settingsDocument)
        {
            XmlNode commandClientNode = settingsDocument.GetElementsByTagName("CommandClientDetails").Item(0);

            if (commandClientNode != null)
            {
                WbCommandClient = new WBCommandClientSettings(commandClientNode);
            }
        }