Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reflection_Engine: Add a check to filter out non-BH Types from the IsPrototype check #2920

Merged
merged 5 commits into from
Oct 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .ci/Datasets/Reflection_Engine/Query/IsPrototype.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{ "_t" : "BH.oM.Data.Library.Dataset", "BHoM_Guid" : "737dc236-b6e3-4883-95fc-e3ca29e7420b", "Name" : "IsPrototype", "Fragments" : [], "Tags" : [], "CustomData" : { }, "SourceInformation" : { "_t" : "BH.oM.Data.Library.Source", "BHoM_Guid" : "aa4bd1b3-a69c-4c70-88ef-9d6bd3ca337b", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "SourceLink" : "https://", "Title" : "IsPrototype", "Author" : "Fraser Greenroyd", "ItemReference" : "", "Version" : "", "Publisher" : "", "Schema" : "", "Language" : "", "Location" : "", "Copyright" : "", "Contributors" : "", "Confidence" : "High" }, "TimeOfCreation" : { "$date" : 1664893959917 }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.UnitTest", "BHoM_Guid" : "3aa5ffca-3a1d-4911-bacc-a9c58482a072", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Method" : { "_t" : "System.Reflection.MethodBase", "TypeName" : "{ \"_t\" : \"System.Type\", \"Name\" : \"BH.Engine.Reflection.Query, Reflection_Engine, Version=6.0.0.0, Culture=neutral, PublicKeyToken=null\", \"_bhomVersion\" : \"6.0\" }", "MethodName" : "IsPrototype", "Parameters" : ["{ \"_t\" : \"System.Type\", \"Name\" : \"System.Object, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089\", \"_bhomVersion\" : \"6.0\" }"], "_bhomVersion" : "6.0" }, "Data" : [{ "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "530a3796-1f91-44c8-9a90-15fa3a68389f", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "System.Decimal, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "_bhomVersion" : "6.0" }], "Outputs" : [false] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "f2ec5feb-4b6a-4164-ba36-d1b152891e52", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.UnitTest.Results.ComparisonDifference", "_bhomVersion" : "6.0" }], "Outputs" : [true] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "42503ef1-6c6e-4d7f-b5e2-7a2f69245684", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.LifeCycleAssessment.LateralStructuralMaterial", "_bhomVersion" : "6.0" }], "Outputs" : [false] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "8f433c90-e9c7-4be6-aad9-1479ae4a0010", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "BH.oM.Environment.Elements.Panel", "_bhomVersion" : "6.0" }], "Outputs" : [false] }, { "_t" : "BH.oM.Test.UnitTests.TestData", "BHoM_Guid" : "0e0302aa-42a2-4326-a38b-af08fb0824c4", "Name" : "", "Fragments" : [], "Tags" : [], "CustomData" : { }, "Inputs" : [{ "_t" : "System.Type", "Name" : "System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", "_bhomVersion" : "6.0" }], "Outputs" : [false] }] }], "_bhomVersion" : "6.0" }
3 changes: 3 additions & 0 deletions Reflection_Engine/Query/IsPrototype.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ public static bool IsPrototype(this object item)
if (m_CoreAssemblyPaths == null)
ExtractCoreAssemblyPaths();

if (item is Type)
return BH.Engine.Base.Query.BHoMTypeList().Contains(item as Type) && m_CoreAssemblyPaths.Count > 0 && !m_CoreAssemblyPaths.Contains(System.IO.Path.GetFileName(item.IAssemblyPath()));

return m_CoreAssemblyPaths.Count > 0 && !m_CoreAssemblyPaths.Contains(System.IO.Path.GetFileName(item.IAssemblyPath()));
}

Expand Down