-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve generation of invocations for static methods
- Loading branch information
Showing
12 changed files
with
146 additions
and
126 deletions.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
sources/RevitDBExplorer/Domain/DataModel/Accessors/ExecuteResultCollection.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace RevitDBExplorer.Domain.DataModel.Accessors | ||
{ | ||
internal class ExecuteResultCollection | ||
{ | ||
public List<(object Arg, object Result)> Results { get; } = new List<(object, object)> (); | ||
public string Label { get; init; } | ||
public string Param_0_Name { get; init; } | ||
|
||
|
||
public static ExecuteResultCollection Create<T>(string param_0_Name) | ||
{ | ||
return new ExecuteResultCollection() | ||
{ | ||
Param_0_Name = param_0_Name, | ||
Label = $"[{typeof(T).GetCSharpName()}]", | ||
}; | ||
} | ||
|
||
|
||
public void Add<TParam0Type, TReturnType>(TParam0Type arg, TReturnType result) | ||
{ | ||
Results.Add ((arg, result)); | ||
} | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
sources/RevitDBExplorer/Domain/DataModel/Members/Accessors/MemberAccessorByFuncUltra.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Autodesk.Revit.DB; | ||
using RevitDBExplorer.Domain.DataModel.Accessors; | ||
using RevitDBExplorer.Domain.DataModel.ValueContainers.Base; | ||
|
||
// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md | ||
|
||
namespace RevitDBExplorer.Domain.DataModel.Members.Accessors | ||
{ | ||
internal class MemberAccessorByFuncUltra<TSnoopedObjectType, TParam0Type, TReturnType> : MemberAccessorTypedWithDefaultPresenter<TSnoopedObjectType> | ||
{ | ||
private readonly Func<Document, TSnoopedObjectType, TParam0Type, TReturnType> get; | ||
private readonly IEnumerable<TParam0Type> param_0_arguments; | ||
private readonly string param_0_Name; | ||
|
||
|
||
public MemberAccessorByFuncUltra(Func<Document, TSnoopedObjectType, TParam0Type, TReturnType> get, IEnumerable<TParam0Type> param_0_arguments, string param_0_Name) | ||
{ | ||
this.get = get; | ||
this.param_0_arguments = param_0_arguments; | ||
this.param_0_Name = param_0_Name; | ||
} | ||
|
||
|
||
protected override ReadResult Read(SnoopableContext context, TSnoopedObjectType snoopedObject) | ||
{ | ||
var value = new ValueContainer<ExecuteResultCollection>(); | ||
var resultCollection = ExecuteResultCollection.Create<TReturnType>(param_0_Name); | ||
|
||
foreach (var arg in param_0_arguments) | ||
{ | ||
var result = get(context.Document, snoopedObject, arg); | ||
resultCollection.Add(arg, result); | ||
} | ||
|
||
value.SetValueTyped(context, resultCollection); | ||
|
||
return new ReadResult(value.ValueAsString, "[ByFuncUltra] " + value.TypeHandlerName, value.CanBeSnooped, value.CanBeVisualized, value); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 0 additions & 27 deletions
27
...mbersTemplates/Accessors/AnalyticalToPhysicalAssociationManager_GetAssociatedElementId.cs
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...bersTemplates/Accessors/AnalyticalToPhysicalAssociationManager_GetAssociatedElementIds.cs
This file was deleted.
Oops, something went wrong.
27 changes: 0 additions & 27 deletions
27
...Model/MembersTemplates/Accessors/AnalyticalToPhysicalAssociationManager_HasAssociation.cs
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
...vitDBExplorer/Domain/DataModel/MembersTemplates/Accessors/HostObjectUtils_GetSideFaces.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
sources/RevitDBExplorer/Domain/DataModel/ValueContainers/ExecuteResultCollectionHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Collections; | ||
using RevitDBExplorer.Domain.DataModel.Accessors; | ||
using RevitDBExplorer.Domain.DataModel.ValueContainers.Base; | ||
|
||
// (c) Revit Database Explorer https://github.com/NeVeSpl/RevitDBExplorer/blob/main/license.md | ||
|
||
namespace RevitDBExplorer.Domain.DataModel.ValueContainers | ||
{ | ||
internal class ExecuteResultCollectionHandler : TypeHandler<ExecuteResultCollection> | ||
{ | ||
protected override bool CanBeSnoooped(SnoopableContext context, ExecuteResultCollection value) | ||
{ | ||
return value.Results.Count > 0; | ||
} | ||
protected override string ToLabel(SnoopableContext context, ExecuteResultCollection value) | ||
{ | ||
return value.Label; | ||
} | ||
|
||
protected override IEnumerable<SnoopableObject> Snooop(SnoopableContext context, ExecuteResultCollection value) | ||
{ | ||
foreach (var pair in value.Results) | ||
{ | ||
var subObjects = new List<SnoopableObject>(); | ||
|
||
if (pair.Result is IEnumerable enumerable) | ||
{ | ||
foreach (var item in enumerable) | ||
{ | ||
subObjects.Add(new SnoopableObject(context.Document, item)); | ||
} | ||
} | ||
else | ||
{ | ||
subObjects.Add(new SnoopableObject(context.Document, pair.Result)); | ||
} | ||
|
||
yield return new SnoopableObject(context.Document, pair.Arg, subObjects) { NamePrefix = value.Param_0_Name + " = " } ; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters