Ejemplo n.º 1
0
        public IComment Reply(string businessKey, string body, int commenterId, string creator = null, bool?encrypted = false)
        {
            if (!AllComments.ContainsKey(businessKey))
            {
                return(null);
            }
            var comment = AllComments[businessKey];

            Notifiers.Add(creator);
            return(comment.Reply(body, commenterId, creator, encrypted));
        }
Ejemplo n.º 2
0
        public IComment Reply(string body, int commenterId, string creator = null, bool?encrypted = false)
        {
            if (!CanReply())
            {
                return(null);
            }
            var newComment = Comment.Create(body, commenterId, creator, encrypted);

            Comments.Add((Comment)newComment);
            Notifiers.Add(creator);
            return(newComment);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Loading QuickMon monitor pack file
        /// </summary>
        /// <param name="configurationFile">Serialzed monitor pack file</param>
        public void Load(string configurationFile)
        {
            XmlDocument configurationXml = new XmlDocument();

            configurationXml.LoadXml(System.IO.File.ReadAllText(configurationFile, Encoding.UTF8));
            XmlElement root = configurationXml.DocumentElement;

            Name               = root.Attributes.GetNamedItem("name").Value;
            Enabled            = bool.Parse(root.Attributes.GetNamedItem("enabled").Value);
            AgentsAssemblyPath = root.ReadXmlElementAttr("agentRegistrationPath");

            string defaultViewerNotifierName = root.ReadXmlElementAttr("defaultViewerNotifier");

            RunCorrectiveScripts = bool.Parse(root.ReadXmlElementAttr("runCorrectiveScripts", "false"));
            foreach (XmlElement xmlCollectorEntry in root.SelectNodes("collectorEntries/collectorEntry"))
            {
                CollectorEntry newCollectorEntry = CollectorEntry.FromConfig(xmlCollectorEntry);
                ApplyCollectorConfig(newCollectorEntry);
                Collectors.Add(newCollectorEntry);
            }
            foreach (XmlElement xmlNotifierEntry in root.SelectNodes("notifierEntries/notifierEntry"))
            {
                NotifierEntry     newNotifierEntry = NotifierEntry.FromConfig(xmlNotifierEntry);
                AgentRegistration currentNotifier  = null;
                if (AgentRegistrations != null)
                {
                    currentNotifier = (from o in AgentRegistrations
                                       where o.IsNotifier && o.Name == newNotifierEntry.NotifierRegistrationName
                                       select o).FirstOrDefault();
                }
                if (currentNotifier != null)
                {
                    newNotifierEntry.Notifier = NotifierEntry.CreateNotifierEntry(currentNotifier.AssemblyPath, currentNotifier.ClassName);
                    XmlDocument configDoc = new XmlDocument();
                    configDoc.LoadXml(newNotifierEntry.Configuration);
                    try
                    {
                        newNotifierEntry.Notifier.ReadConfiguration(configDoc);
                    }
                    catch                     // (Exception ex)
                    {
                        newNotifierEntry.Enabled = false;
                    }
                }
                else
                {
                    newNotifierEntry.Enabled = false;
                }
                Notifiers.Add(newNotifierEntry);
                if (newNotifierEntry.Name.ToUpper() == defaultViewerNotifierName.ToUpper())
                {
                    DefaultViewerNotifier = newNotifierEntry;
                }
            }
            MonitorPackPath = configurationFile;
            RaiseMonitorPackPathChanged(MonitorPackPath);
            if (Properties.Settings.Default.recentMonitorPacks == null)
            {
                Properties.Settings.Default.recentMonitorPacks = new System.Collections.Specialized.StringCollection();
            }
            if (!Properties.Settings.Default.recentMonitorPacks.Contains(configurationFile))
            {
                Properties.Settings.Default.recentMonitorPacks.Add(configurationFile);
                Properties.Settings.Default.Save();
            }
            InitializeGlobalPerformanceCounters();
        }