Ejemplo n.º 1
0
        private Tuple <string, OutputLevel> CreateFile(string name, CounterGroup counterGroup)
        {
            var config        = _configBusiness.LoadFiles(new string[] { });
            var counterGroups = _counterBusiness.GetPerformanceCounterGroups(config).ToArray();

            if (counterGroups.Any(x => x.Name == counterGroup.Name))
            {
                return(new Tuple <string, OutputLevel>(string.Format("There is already a counter group named {0}.", counterGroup.Name), OutputLevel.Error));
            }

            if (!_configBusiness.CreateConfig(name + ".xml", new List <ICounterGroup> {
                counterGroup
            }))
            {
                return(new Tuple <string, OutputLevel>(string.Format("Did not create {0}, the file {0}.xml" + " already exists.", name), OutputLevel.Error));
            }

            return(new Tuple <string, OutputLevel>(string.Format("Created counter config {0}.", name), OutputLevel.Information));
        }