From 164b03138d5ba58712f3d13908ec267a84a43086 Mon Sep 17 00:00:00 2001 From: Anthony Truskinger Date: Tue, 24 Apr 2018 22:30:31 +1000 Subject: [PATCH] Fixed CSV class map predicate Changing the company name in 48cb49ff9712101783bad33ed95778ee616c2a30 accidnetly broke code that depended on the company name. --- src/Acoustics.Shared/Csv/Csv.cs | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Acoustics.Shared/Csv/Csv.cs b/src/Acoustics.Shared/Csv/Csv.cs index 0290717d6..090069092 100644 --- a/src/Acoustics.Shared/Csv/Csv.cs +++ b/src/Acoustics.Shared/Csv/Csv.cs @@ -44,14 +44,16 @@ static Csv() // Find all of our custom class maps var type = typeof(CsvClassMap); + + bool OurCodePredicate(Assembly a) + { + var assemblyCompanyAttribute = (AssemblyCompanyAttribute)a.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false).FirstOrDefault(); + return assemblyCompanyAttribute != null && assemblyCompanyAttribute.Company.Contains("QUT"); + } + var classMapTypes = AppDomain.CurrentDomain.GetAssemblies() - .Where( - a => - { - var assemblyCompanyAttribute = (AssemblyCompanyAttribute)a.GetCustomAttributes(typeof(AssemblyCompanyAttribute), false).FirstOrDefault(); - return assemblyCompanyAttribute != null && assemblyCompanyAttribute.Company == "QUT"; - }) + .Where(OurCodePredicate) .SelectMany(s => s.GetTypes()) .Where(type.IsAssignableFrom);