public override Expression Build(IEnumerable <Expression> arguments) { var source = arguments.First(); var hubFinder = new HubFinder(); hubFinder.GetUpstreamHub(source); if (hubFinder.Hub == null) { throw new Bonsai.WorkflowBuildException("Upstream TS4321V1Device does not have valid hardware link."); } DataClockHz = hubFinder.Hub.ClockHz; var thisType = GetType(); var method = thisType.GetMethod(nameof(Process)); var instance = Expression.Constant(this); return(Expression.Call(instance, method, new[] { source })); }
public void Generate(SignalRTypingsCreatorConfig config) { if (config == null) { throw new Exception("Config cannot be null"); } var assembly = AppDomain.CurrentDomain.Load(config.AssemblyName); if (assembly == null) { throw new Exception("Assembly not found"); } var hubFinder = new HubFinder(); var hubs = hubFinder.FindHubs(assembly); var generator = new TypeScriptHubListFactory(); var typeScriptClasses = generator.Create(hubs); var writer = new TypingsFileWriter(); writer.WriteFiles(config.ProjectRootDir, config.RelativeOutputDir, typeScriptClasses.GetTypeScriptHubClasses()); }