示例#1
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml = new XmlDocument();

            if (config.Length > 0)
            {
                try
                {
                    configXml.LoadXml(config);
                }
                catch
                {
                    configXml.LoadXml(Properties.Resources.PerfCounterNotifierEmptyConfig);
                }
            }
            else
            {
                configXml.LoadXml(Properties.Resources.PerfCounterNotifierEmptyConfig);
            }
            ReadConfiguration(configXml);

            EditConfig editConfig = new EditConfig();

            editConfig.SelectedCategory = category;
            if (editConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                category = editConfig.SelectedCategory;
                config   = GetCustomConfig();
            }
            return(config);
        }
示例#2
0
        public override string ConfigureAgent(string config)
        {
            EditConfig  editConfig = new EditConfig();
            XmlDocument configXml  = new XmlDocument();

            if (config.Length > 0)
            {
                try
                {
                    configXml.LoadXml(config);
                }
                catch
                {
                    configXml.LoadXml(Properties.Resources.QMEventLogNotifierDefaultConfig);
                }
            }
            else
            {
                configXml.LoadXml(Properties.Resources.QMEventLogNotifierDefaultConfig);
            }

            ReadConfiguration(configXml);
            editConfig.SelectedEventLogNotifierConfig = eventLogNotifierConfig;
            if (editConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                config = editConfig.SelectedEventLogNotifierConfig.ToConfig();
            }
            return(config);
        }
示例#3
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml = new XmlDocument();

            if (config.Length > 0)
            {
                configXml.LoadXml(config);
            }
            else
            {
                configXml.LoadXml(GetDefaultOrEmptyConfigString());
            }
            ReadConfiguration(configXml);
            EditConfig editConfig = new EditConfig();

            editConfig.BizTalkGroup = BizTalkGroup;
            if (editConfig.ShowConfig() == System.Windows.Forms.DialogResult.OK)
            {
                XmlNode root = configXml.DocumentElement.SelectSingleNode("bizTalkGroup");
                root.SetAttributeValue("sqlServer", editConfig.BizTalkGroup.SqlServer);
                root.SetAttributeValue("mgmtDb", editConfig.BizTalkGroup.MgmtDBName);
                root.SetAttributeValue("allReceiveLocations", editConfig.BizTalkGroup.AllReceiveLocations.ToString());
                root.SetAttributeValue("allSendPorts", editConfig.BizTalkGroup.AllSendPorts.ToString());
                root.SetAttributeValue("allOrchestrations", editConfig.BizTalkGroup.AllOrchestrations.ToString());

                //Receive locations
                XmlNode receiveLocationsNode = root.SelectSingleNode("receiveLocations");
                receiveLocationsNode.InnerXml = "";
                foreach (string rl in editConfig.BizTalkGroup.ReceiveLocations)
                {
                    XmlElement receiveLocationNode = configXml.CreateElement("receiveLocation");
                    receiveLocationNode.SetAttributeValue("name", rl);
                    receiveLocationsNode.AppendChild(receiveLocationNode);
                }

                //Send ports
                XmlNode sendPortsNode = root.SelectSingleNode("sendPorts");
                sendPortsNode.InnerXml = "";
                foreach (string s in editConfig.BizTalkGroup.SendPorts)
                {
                    XmlElement sendPortNode = configXml.CreateElement("sendPort");
                    sendPortNode.SetAttributeValue("name", s);
                    sendPortsNode.AppendChild(sendPortNode);
                }

                //Orchestrations
                XmlNode orchestrationsNode = root.SelectSingleNode("orchestrations");
                orchestrationsNode.InnerXml = "";
                foreach (string s in editConfig.BizTalkGroup.Orchestrations)
                {
                    XmlElement orchestrationNode = configXml.CreateElement("orchestration");
                    orchestrationNode.SetAttributeValue("name", s);
                    orchestrationsNode.AppendChild(orchestrationNode);
                }

                config = configXml.OuterXml;
            }
            return(config);
        }
示例#4
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml = new XmlDocument();

            if (config.Length > 0)
            {
                configXml.LoadXml(config);
            }
            else
            {
                configXml.LoadXml(GetDefaultOrEmptyConfigString());
            }
            ReadConfiguration(configXml);

            EditConfig editConfig = new EditConfig();

            editConfig.DatabaseSizeConfig = DatabaseSizeConfig;
            //editConfig.SqlServer = DatabaseSizeConfig.SqlServer;
            //editConfig.IntegratedSec = DatabaseSizeConfig.IntegratedSec;
            //editConfig.UserName = DatabaseSizeConfig.UserName;
            //editConfig.Password = DatabaseSizeConfig.Password;
            //editConfig.Databases = DatabaseSizeConfig.Databases;
            //editConfig.CmndTimeOut = DatabaseSizeConfig.CmndTimeOut;
            if (editConfig.ShowConfig() == System.Windows.Forms.DialogResult.OK)
            {
                DatabaseSizeConfig = editConfig.DatabaseSizeConfig;
                //DatabaseSizeConfig.SqlServer = editConfig.SqlServer;
                //DatabaseSizeConfig.IntegratedSec = editConfig.IntegratedSec;
                //DatabaseSizeConfig.UserName = editConfig.UserName;
                //DatabaseSizeConfig.Password = editConfig.Password;
                //DatabaseSizeConfig.Databases = editConfig.Databases;

                XmlElement root           = configXml.DocumentElement;
                XmlNode    connectionNode = root.SelectSingleNode("connection");
                connectionNode.SetAttributeValue("sqlServer", DatabaseSizeConfig.SqlServer);
                connectionNode.SetAttributeValue("integratedSec", DatabaseSizeConfig.IntegratedSec.ToString());
                connectionNode.SetAttributeValue("userName", DatabaseSizeConfig.UserName);
                connectionNode.SetAttributeValue("password", DatabaseSizeConfig.Password);
                connectionNode.SetAttributeValue("cmndTimeOut", DatabaseSizeConfig.CmndTimeOut.ToString());
                connectionNode.InnerXml = "";

                foreach (var database in DatabaseSizeConfig.Databases)
                {
                    XmlElement databaseNode = configXml.CreateElement("database");
                    databaseNode.SetAttributeValue("name", database.Name);
                    databaseNode.SetAttributeValue("warningSizeMB", database.WarningSizeMB.ToString());
                    databaseNode.SetAttributeValue("errorSizeMB", database.ErrorSizeMB.ToString());

                    connectionNode.AppendChild(databaseNode);
                }
                config = configXml.OuterXml;
            }
            return(config);
        }
示例#5
0
        public override string ConfigureAgent(string config)
        {
            EditConfig editConfig = new EditConfig();

            editConfig.CustomConfig = config;
            if (editConfig.ShowConfig() == System.Windows.Forms.DialogResult.OK)
            {
                config = editConfig.CustomConfig;
            }
            return(config);
        }
示例#6
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml  = new XmlDocument();
            EditConfig  editConfig = new EditConfig();

            if (config.Length > 0)
            {
                try
                {
                    configXml.LoadXml(config);
                }
                catch
                {
                    configXml.LoadXml(Properties.Resources.DatabaseNotifierEmptyConfig_xml);
                }
            }
            else
            {
                configXml.LoadXml(Properties.Resources.DatabaseNotifierEmptyConfig_xml);
            }

            ReadConfiguration(configXml);
            editConfig.DbSettings = dbSettings;

            if (editConfig.ShowConfig() == System.Windows.Forms.DialogResult.OK)
            {
                dbSettings = editConfig.DbSettings;
                XmlElement root           = configXml.DocumentElement;
                XmlNode    connectionNode = root.SelectSingleNode("connection");
                connectionNode.SetAttributeValue("sqlServer", dbSettings.SqlServer);
                connectionNode.SetAttributeValue("database", dbSettings.Database);
                connectionNode.SetAttributeValue("integratedSec", dbSettings.IntegratedSec.ToString());
                connectionNode.SetAttributeValue("userName", dbSettings.UserName);
                connectionNode.SetAttributeValue("password", dbSettings.Password);
                XmlNode cmndNode = connectionNode.SelectSingleNode("command");
                cmndNode.SetAttributeValue("cmndTimeOut", dbSettings.CmndTimeOut.ToString());
                cmndNode.SetAttributeValue("useSP", dbSettings.UseSP.ToString());
                cmndNode.SetAttributeValue("value", dbSettings.CmndValue);
                cmndNode.SetAttributeValue("alertFieldName", dbSettings.AlertFieldName);
                cmndNode.SetAttributeValue("collectorTypeFieldName", dbSettings.CollectorTypeFieldName);
                cmndNode.SetAttributeValue("categoryFieldName", dbSettings.CategoryFieldName);
                cmndNode.SetAttributeValue("previousStateFieldName", dbSettings.PreviousStateFieldName);
                cmndNode.SetAttributeValue("currentStateFieldName", dbSettings.CurrentStateFieldName);
                cmndNode.SetAttributeValue("detailsFieldName", dbSettings.DetailsFieldName);
                cmndNode.SetAttributeValue("useSPForViewer", dbSettings.UseSPForViewer.ToString());
                cmndNode.SetAttributeValue("viewer", dbSettings.ViewerName);
                cmndNode.SetAttributeValue("dateTimeFieldName", dbSettings.DateTimeFieldName);
                config = configXml.OuterXml;
            }
            return(config);
        }
示例#7
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml  = new XmlDocument();
            EditConfig  editConfig = new EditConfig();

            if (config.Length > 0)
            {
                try
                {
                    configXml.LoadXml(config);
                }
                catch
                {
                    configXml.LoadXml(Properties.Resources.SMTPNotifierEmptyConfig_xml);
                }
            }
            else
            {
                configXml.LoadXml(Properties.Resources.SMTPNotifierEmptyConfig_xml);
            }

            ReadConfiguration(configXml);
            editConfig.MailSettings = mailSettings;

            if (editConfig.ShowConfig() == System.Windows.Forms.DialogResult.OK)
            {
                mailSettings = editConfig.MailSettings;
                XmlElement root           = configXml.DocumentElement;
                XmlNode    connectionNode = root.SelectSingleNode("smtp");
                connectionNode.SetAttributeValue("hostServer", mailSettings.HostServer);
                connectionNode.SetAttributeValue("useDefaultCredentials", mailSettings.UseDefaultCredentials.ToString());
                connectionNode.SetAttributeValue("domain", mailSettings.Domain);
                connectionNode.SetAttributeValue("userName", mailSettings.UserName);
                connectionNode.SetAttributeValue("password", mailSettings.Password);
                connectionNode.SetAttributeValue("fromAddress", mailSettings.FromAddress);
                connectionNode.SetAttributeValue("toAddress", mailSettings.ToAddress);
                connectionNode.SetAttributeValue("senderAddress", mailSettings.SenderAddress);
                connectionNode.SetAttributeValue("replyToAddress", mailSettings.ReplyToAddress);
                connectionNode.SetAttributeValue("mailPriority", mailSettings.MailPriority);
                connectionNode.SetAttributeValue("isBodyHtml", mailSettings.IsBodyHtml.ToString());
                connectionNode.SetAttributeValue("subject", mailSettings.Subject);
                connectionNode.SetAttributeValue("body", mailSettings.Body);
                connectionNode.SetAttributeValue("useTLS", mailSettings.UseTLS.ToString());
                connectionNode.SetAttributeValue("port", mailSettings.Port.ToString());
                config = configXml.OuterXml;
            }
            return(config);
        }
示例#8
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configXml = new XmlDocument();

            if (config.Length > 0)
            {
                configXml.LoadXml(config);
            }
            else
            {
                configXml.LoadXml(Properties.Resources.RSSFeedConfigTemplate_xml);
            }
            ReadConfiguration(configXml);
            EditConfig editConfig = new EditConfig();

            editConfig.RSSConfig = rssConfig;
            if (editConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                rssConfig = editConfig.RSSConfig;
                configXml = new XmlDocument();
                configXml.LoadXml(Properties.Resources.RSSFeedConfigTemplate_xml);
                XmlElement root          = configXml.DocumentElement;
                XmlNode    rssConfigNode = root.SelectSingleNode("rssConfig");
                rssConfigNode.SetAttributeValue("rssFilePath", rssConfig.RSSFilePath);
                rssConfigNode.SetAttributeValue("title", rssConfig.Title);
                rssConfigNode.SetAttributeValue("link", rssConfig.Link);
                rssConfigNode.SetAttributeValue("description", rssConfig.Description);
                rssConfigNode.SetAttributeValue("language", rssConfig.Language);
                rssConfigNode.SetAttributeValue("generator", rssConfig.Generator);
                rssConfigNode.SetAttributeValue("keepEntriesDays", rssConfig.KeepEntriesDays.ToString());
                rssConfigNode.SetAttributeValue("lineTitle", rssConfig.LineTitle);
                rssConfigNode.SetAttributeValue("lineCategory", rssConfig.LineCategory);
                //rssConfigNode.SetAttributeValue("lineComments", rssConfig.LineComments);
                rssConfigNode.SetAttributeValue("lineDescription", rssConfig.LineDescription);
                config = configXml.OuterXml;
            }
            return(config);
        }
示例#9
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configDoc = new XmlDocument();

            if (config.Length > 0)
            {
                configDoc.LoadXml(config);
            }
            else
            {
                configDoc.LoadXml(GetDefaultOrEmptyConfigString());
            }
            ReadConfiguration(configDoc);
            EditConfig editConfig = new EditConfig();

            editConfig.SelectedSoapWebServicePingConfig = SoapWebServicePingConfig;
            if (editConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                config = editConfig.SelectedSoapWebServicePingConfig.ToConfig();
            }

            return(config);
        }
示例#10
0
        public override string ConfigureAgent(string config)
        {
            XmlDocument configDoc = new XmlDocument();

            if (config.Length > 0)
            {
                configDoc.LoadXml(config);
            }
            else
            {
                configDoc.LoadXml(Properties.Resources.PerfCounterEmptyConfig);
            }
            ReadConfiguration(configDoc);

            EditConfig editConfig = new EditConfig();

            editConfig.PFConfig = PerfCounterConfig;
            if (editConfig.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                config = editConfig.PFConfig.ToConfig();
            }

            return(config);
        }