SpeckleGrasshopper/ObjectCreation/ConvertSpeckleObject.cs
/// <summary>
/// Makes sure we deserialise correctly, and reinstate everything there is to reinstate:
/// - selected type properties
/// </summary>
/// <param name="reader"></param>
/// <returns></returns>
Makes sure we deserialise correctly, and reinstate everything there is to reinstate:
selected type properties
Makes sure we deserialise correctly and reinstate everything there is to reinstate : selected type properties
public override bool Read(GH_IReader reader) 
    {
      bool isInit = reader.GetBoolean("init");
      if (isInit)
      {
        var selectedTypeName = reader.GetString("type");
        var selectedTypeAssembly = reader.GetString("assembly");
        var selectedType = SpeckleCore.SpeckleInitializer.GetTypes().FirstOrDefault(t => t.Name == selectedTypeName && t.AssemblyQualifiedName == selectedTypeAssembly);
        if (selectedType != null)
          SwitchToType(selectedType);
        else
        {
          AddRuntimeMessage(GH_RuntimeMessageLevel.Error, string.Format("Type {0} from the {1} kit was not found. Are you sure you have it installed?", selectedTypeName, selectedTypeAssembly));
        }
      }
      return base.Read(reader);
    }
public override bool Read ( GH_IReader reader ) { bool isInit = reader . GetBoolean ( " " ) ; if ( isInit ) { var selectedTypeName = reader . GetString ( " " ) ; var selectedTypeAssembly = reader . GetString ( " " ) ; var selectedType = SpeckleCore . SpeckleInitializer . GetTypes ( ) . FirstOrDefault ( t => t . Name == selectedTypeName && t . AssemblyQualifiedName == selectedTypeAssembly ) ; if ( selectedType != null ) SwitchToType ( selectedType ) ; else { AddRuntimeMessage ( GH_RuntimeMessageLevel . Error , string . Format ( " " , selectedTypeName , selectedTypeAssembly ) ) ; } } return base . Read ( reader ) ; }
Makes sure we deserialise correctly, and reinstate everything there is to reinstate:
 selected type properties
Makes sure we deserialise correctly and reinstate everything there is to reinstate : selected type properties
None
reader
GH_IReader
None