コード例 #1
0
        private Event GetEvent(string eventName, string agentVersion)
        {
            var version   = new Version(agentVersion);
            var version13 = new Version("1.3.0");
            var version12 = new Version("1.2.0");
            var version11 = new Version("1.1.0");
            var version10 = new Version("1.0.0");

            // Version 1.2
            var    config     = v12EventsConfiguration;
            string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "v12events.config");

            // Version 1.3
            if (version >= version13)
            {
                config     = v13EventsConfiguration;
                configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "v13events.config");
            }

            // Read the EventsConfiguration file
            if (config == null)
            {
                config = EventsConfiguration.Get(configPath);
            }
            if (config != null)
            {
                if (version >= version13)
                {
                    v13EventsConfiguration = config;
                }
                else
                {
                    v12EventsConfiguration = config;
                }

                if (!string.IsNullOrEmpty(eventName))
                {
                    return(config.Events.Find(o => o.Name.ToLower() == eventName.ToLower()));
                }
            }

            return(null);
        }
コード例 #2
0
        private List <Event> GetEvents(string agentVersion)
        {
            var version   = new Version(agentVersion);
            var version13 = new Version("1.3.0");
            var version12 = new Version("1.2.0");
            var version11 = new Version("1.1.0");
            var version10 = new Version("1.0.0");

            // Version 1.2
            var    config     = v12EventsConfiguration;
            string configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "v12events.config");

            // Version 1.3
            if (version >= version13)
            {
                config     = v13EventsConfiguration;
                configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "v13events.config");
            }

            // Read the EventsConfiguration file
            if (config == null)
            {
                config = EventsConfiguration.Get(configPath);
            }
            if (config != null)
            {
                if (version >= version13)
                {
                    v13EventsConfiguration = config;
                }
                else
                {
                    v12EventsConfiguration = config;
                }

                return(config.Events);
            }

            return(null);
        }