ConversionServer

public static class ConversionServer
This static class collects and maintains all conversion logic.

Properties

Actions

#
public static IEnumerable<ConversionAction> Actions { get; }
Enumerate over all registered actions. Note that some actions are created on an as-needed basis so this collection may change over time even without new plugins getting loaded.

Methods

Convert

#
public static bool Convert(object source, Type targetType, out object target, out Merit merit, out string explanation)
Try and convert between weakly typed values.
source (object)
targetType (Type)
target (out object)
merit (out Merit)
explanation (out string)

Convert

#
public static bool Convert(object source, Type targetType, out object target)
Try and convert between weakly typed values.
source (object)
targetType (Type)
target (out object)

Convert<TTarget>

#
public static bool Convert<TTarget>(object source, out TTarget target, out Merit merit, out string explanation)
Try and convert to a strongly typed value.
source (object)
target (out TTarget)
merit (out Merit)
explanation (out string)

Convert<TTarget>

#
public static bool Convert<TTarget>(object source, out TTarget target)
Try and convert to a strongly typed value.
source (object)
target (out TTarget)

ConvertIfBetter<TTarget>

#
public static bool ConvertIfBetter<TTarget>(object source, ref object target, ref Merit merit)
Perform a conversion provided the merit improves.
source (object)Source value.
target (ref object)Target value to optionally overwrite.
merit (ref Merit)Merit to beat.
True if a better conversion was found.

ConvertPear

#
public static bool ConvertPear(IPear source, Type targetType, out IPear target, out Merit merit, out string explanation)
Try and convert between weakly typed values.
source (IPear)
targetType (Type)
target (out IPear)
merit (out Merit)
explanation (out string)

ConvertPear

#
public static bool ConvertPear(IPear source, Type targetType, out IPear target)
Try and convert between weakly typed values.
source (IPear)
targetType (Type)
target (out IPear)

ConvertPear<TTarget>

#
public static bool ConvertPear<TTarget>(IPear source, out Pear<TTarget> target, out Merit merit, out string explanation)
Try and convert to a strongly typed value.
source (IPear)
target (out Pear<TTarget>)
merit (out Merit)
explanation (out string)

ConvertPear<TTarget>

#
public static bool ConvertPear<TTarget>(IPear source, out Pear<TTarget> target)
Try and convert to a strongly typed value.
source (IPear)
target (out Pear<TTarget>)

ConvertPearStrong<TSource, TTarget>

#
public static bool ConvertPearStrong<TSource, TTarget>(Pear<TSource> source, out Pear<TTarget> target, out Merit merit, out string explanation)
Try and convert between strongly typed values.
source (Pear<TSource>)
target (out Pear<TTarget>)
merit (out Merit)
explanation (out string)

ConvertPearStrong<TSource, TTarget>

#
public static bool ConvertPearStrong<TSource, TTarget>(Pear<TSource> source, out Pear<TTarget> target)
Try and convert between strongly typed values.
source (Pear<TSource>)
target (out Pear<TTarget>)

ConvertTQ<TSource, TTarget>

#
public static bool ConvertTQ<TSource, TTarget>(TSource source, out TTarget target, out Merit merit, out string explanation)
Try and convert between strongly typed values.
source (TSource)
target (out TTarget)
merit (out Merit)
explanation (out string)

ConvertTQ<TSource, TTarget>

#
public static bool ConvertTQ<TSource, TTarget>(TSource source, out TTarget target)
Try and convert between strongly typed values.
source (TSource)
target (out TTarget)

DowngradeType

#
public static object DowngradeType(object value)
Downgrade a type used in Grasshopper 2 to an equivalent type in Grasshopper 1.
value (object)

FindConversion

#
public static ConversionAction FindConversion(Type sourceType, Type targetType)
Get conversion action between two types.
sourceType (Type)
targetType (Type)

FindConversion<TSource, TTarget>

#
public static ConversionAction<TSource, TTarget> FindConversion<TSource, TTarget>()
Get conversion action between two types.

ShowDiagram

#
public static void ShowDiagram()

TryAddConversion

#
public static bool TryAddConversion(MethodInfo method)
Attempt to add a conversion delegate. The method must point to a ConversionDelegate<TSource, TTarget> compliant method and have at least a MeritAttribute attached to it.
method (MethodInfo)

UpgradeType

#
public static object UpgradeType(object value)
Upgrade a type used in Grasshopper 1 to an equivalent type in Grasshopper 2.
value (object)