public PossibleLogger(Assembly assembly, Type typeInAssembly)
        {
            Assembly       = assembly;
            TypeInAssembly = typeInAssembly;

            ExtensionUri = typeInAssembly.GetCustomAttributes(typeof(ExtensionUriAttribute), false)
                           .OfType <ExtensionUriAttribute>()
                           .FirstOrDefault();
            FriendlyName = typeInAssembly.GetCustomAttributes(typeof(FriendlyNameAttribute), false)
                           .OfType <FriendlyNameAttribute>()
                           .FirstOrDefault();
        }
        public PossibleLogger(Assembly assembly, Type typeInAssembly)
        {
            Assembly = assembly;
            TypeInAssembly = typeInAssembly;

            ExtensionUri = typeInAssembly.GetCustomAttributes(typeof(ExtensionUriAttribute), false)
                            .OfType<ExtensionUriAttribute>()
                            .FirstOrDefault();
            FriendlyName = typeInAssembly.GetCustomAttributes(typeof(FriendlyNameAttribute), false)
                            .OfType<FriendlyNameAttribute>()
                            .FirstOrDefault();
        }
        /// <summary>
        /// Helper to get the Uri from the ExtensionUriAttribute on logger plugin.
        /// </summary>
        /// <param name="testLoggerType">Data type of the test logger</param>
        /// <returns>Uri identifying the test logger</returns>
        private static string GetExtensionUri(Type testLoggerType)
        {
            string extensionUri = string.Empty;

            object[] attributes = testLoggerType.GetTypeInfo().GetCustomAttributes(typeof(ExtensionUriAttribute), false).ToArray();
            if (attributes != null && attributes.Length > 0)
            {
                ExtensionUriAttribute extensionUriAttribute = (ExtensionUriAttribute)attributes[0];

                if (!string.IsNullOrEmpty(extensionUriAttribute.ExtensionUri))
                {
                    extensionUri = extensionUriAttribute.ExtensionUri;
                }
            }

            return(extensionUri);
        }
示例#4
0
        /// <summary>
        /// Helper to get the Uri from the ExtensionUriAttribute on logger plugin.
        /// </summary>
        /// <param name="testLoggerType">Data type of the test logger</param>
        /// <returns>Uri identifying the test logger</returns>
        private static string GetExtensionUri(Type testLoggerType)
        {
            string extensionUri = string.Empty;

            object[] attributes = testLoggerType.GetTypeInfo().GetCustomAttributes(typeof(ExtensionUriAttribute), false).ToArray();
            if (attributes != null && attributes.Length > 0)
            {
                ExtensionUriAttribute extensionUriAttribute = (ExtensionUriAttribute)attributes[0];

                if (!string.IsNullOrEmpty(extensionUriAttribute.ExtensionUri))
                {
                    extensionUri = extensionUriAttribute.ExtensionUri;
                }
            }

            if (EqtTrace.IsErrorEnabled && string.IsNullOrEmpty(extensionUri))
            {
                EqtTrace.Error("The type \"{0}\" defined in \"{1}\" does not have ExtensionUri attribute.", testLoggerType.ToString(), testLoggerType.Module.Name);
            }

            return(extensionUri);
        }