/// <summary> /// Use given IOServer for the Host /// </summary> /// <param name="builder">Builder for the host</param> /// <typeparam name="T">IOServer</typeparam> /// <returns>Builder for the host</returns> public static SuitHostBuilder UseIO <T>(this SuitHostBuilder builder) where T : IIOServer { builder ??= new SuitHostBuilder(); builder.IOServer = typeof(T); return(builder); }
/// <summary> /// Use given BuildInCommandServer for the Host /// </summary> /// <param name="builder">Builder for the host</param> /// <typeparam name="T">BuildInCommandServer</typeparam> /// <returns>Builder for the host</returns> public static SuitHostBuilder UseBuildInCommand <T>(this SuitHostBuilder builder) where T : IBuildInCommandServer { builder ??= new SuitHostBuilder(); builder.BuildInCommandServer = typeof(T); return(builder); }
/// <summary> /// Use given PromptServer for the Host /// </summary> /// <param name="builder">Builder for the host</param> /// <typeparam name="T">PromptServer</typeparam> /// <returns>Builder for the host</returns> public static SuitHostBuilder UsePrompt <T>(this SuitHostBuilder builder) where T : IPromptServer { builder ??= new SuitHostBuilder(); builder.PromptServer = typeof(T); return(builder); }
/// <summary> /// Get the host under the configuration of the builder /// </summary> /// <param name="builder">the builder</param> /// <typeparam name="T">Type to drive</typeparam> /// <returns></returns> public static IMobileSuitHost Build <T>(this SuitHostBuilder builder) where T : new() => builder?.Build(typeof(T).GetConstructor(Array.Empty <Type>())?.Invoke(null) ?? new object()) ?? new SuitHost(new object(), ILogger.OfTemp(), Suit.GeneralIO, typeof(BuildInCommandServer), IPromptServer.DefaultPromptServer);