public static Task InitialiseWithCommandsAsync(this TexoEngine engine, SimpleIoc container) { TexoConfiguration.Builder configuration = TexoConfiguration.CreateDefault().ToBuilder(); string solutionFile = container.GetInstance <ISolutionPathProvider>().GetPath(); if (!string.IsNullOrEmpty(solutionFile)) { configuration.Environment.Variables.Add(VsVariableNames.SOLUTION_FILE, solutionFile); } configuration.Runtime.Commands.AddRange(new[] { ReferenceCheckCommand.BuildConfiguration(), CommandLineCommand.BuildConfiguration(), FileManagerBuilder.BuildCommand(), NugetManagerBuilder.BuildCommand(), CalcCommand.BuildConfiguration(), //ClipboardBuilder.BuildCommand(), FunctionsBuilder.BuildCommand(), CodeBaseSearchBuilder.BuildCommand(), SpinSportBuilder.BuildCommand() }); return(engine.InitialiseAsync(configuration.ToImmutable())); }
public static void InitialiseWithCommands(this TexoEngine engine) { engine.Initialise( ReferenceCheckCommand.BuildConfiguration(), CommandLineCommand.BuildConfiguration(), FileManagerBuilder.BuildCommand(), NugetManagerBuilder.BuildCommand()); }
public static Task InitialiseWithCommandsAsync(this TexoEngine engine) { return(engine.InitialiseAsync( ReferenceCheckCommand.BuildConfiguration(), CommandLineCommand.BuildConfiguration(), FileManagerBuilder.BuildCommand(), NugetManagerBuilder.BuildCommand(), CalcCommand.BuildConfiguration(), ClipboardBuilder.BuildCommand(), FunctionsBuilder.BuildCommand(), //CodeBaseSearchBuilder.BuildCommand(), SpinSportBuilder.BuildCommand())); }
private static void Startup() { SimpleIoc container = new SimpleIoc(); container.Register <ServiceMessageBus>(); container.Register <IServiceMessageBus>(() => container.GetInstance <ServiceMessageBus>()); container.Register <IServiceMessageBusRegister>(() => container.GetInstance <ServiceMessageBus>()); container.Register <ILogService, DebugLogService>(); container.Register <IInputParseService, InputParseService>(); container.Register <IInputEvaluationService, InputEvaluationService>(); container.Register <IEnvironmentService, EnvironmentService>(); container.Register <ISettingService, SettingService>(); container.Register <ICommandManagementService, SingletonCommandManagementService>(); container.Register <IResultProcessingService, ResultProcessingService>(); container.Register <IMarkdownService, MarkdownService>(); container.Register <IConsoleRenderService, ConsoleMarkdownRenderService>(); container.Register <ConsoleViewService>(); container.Register <IViewService>(() => container.GetInstance <ConsoleViewService>()); container.Register <IPromptableViewService>(() => container.GetInstance <ConsoleViewService>()); // PowerShell Fallback container.Register <IPowerShellResultBuilder, PowerShellResultMarkdownBuilder>(); container.Register <IFallbackService, PowerShellFallbackService>(); // Core commands container.Register <CurrentDirectoryCommand>(); container.Register <TexoCommand>(); container.Register <HelpCommand>(); container.Register <ClearCommand>(); // Simple commands container.Register <ReferenceCheckCommand>(); container.Register <CommandLineCommand>(); // File manager container.Register <ISerialisationService, JsonSerialisationService>(); container.Register <IStageService, StageService>(); container.Register <IStashService, StashService>(); container.Register <FileManagerCommand>(); // Nuget manager container.Register <IProjectManagementService, ProjectManagementService>(); container.Register <IPackageManagementService, PackageManagementService>(); container.Register <IConfigManagementService, ConfigManagementService>(); container.Register <ISourceManagementService, SourceManagementService>(); container.Register <IManagementService, ManagementService>(); container.Register <Commands.NugetManager.Stage.IStageService, Commands.NugetManager.Stage.StageService>(); container.Register <NugetManagerCommand>(); CommandFactory commandFactory = new CommandFactory(); container.Register <ITexoFactory <object, string> >(() => commandFactory); commandFactory.Register(CommandKeys.CURRENT_DIRECTORY, () => container.GetInstance <CurrentDirectoryCommand>()); commandFactory.Register(CommandKeys.TEXO, () => container.GetInstance <TexoCommand>()); commandFactory.Register(CommandKeys.HELP, container.GetInstance <HelpCommand>); commandFactory.Register(CommandKeys.CLEAR, container.GetInstance <ClearCommand>); commandFactory.Register(ReferenceCheckConstants.REF_CHECK, () => container.GetInstance <ReferenceCheckCommand>()); commandFactory.Register("command-line", () => container.GetInstance <CommandLineCommand>()); commandFactory.Register("file-manager", () => container.GetInstance <FileManagerCommand>()); commandFactory.Register("nuget-manager", () => container.GetInstance <NugetManagerCommand>()); ServiceMessageBus messageBus = container.GetInstance <ServiceMessageBus>(); var engineBuilder = new TexoEngineBuilder(messageBus, messageBus) .WithLogService(container.GetInstance <ILogService>()) .WithInputParseService(container.GetInstance <IInputParseService>()) .WithInputEvaluationService(container.GetInstance <IInputEvaluationService>()) .WithEnvironmentService(container.GetInstance <IEnvironmentService>()) .WithSettingService(container.GetInstance <ISettingService>()) .WithCommandManagementService(container.GetInstance <ICommandManagementService>()) .WithResultProcessingService(container.GetInstance <IResultProcessingService>()) .WithFallbackService(container.GetInstance <IFallbackService>()); var locator = engineBuilder.GetServiceLocator(); container.Register(locator.ActionProvider); container.Register(locator.ActionRegister); engine = engineBuilder.Build(commandFactory, container.GetInstance <IViewService>()); var config = TexoConfiguration.CreateDefault().ToBuilder(); config.Runtime.Commands.Add(ReferenceCheckCommand.BuildConfiguration()); config.Runtime.Commands.Add(CommandLineCommand.BuildConfiguration()); config.Runtime.Commands.Add(FileManagerBuilder.BuildCommand()); config.Runtime.Commands.Add(NugetManagerBuilder.BuildCommand()); engine.Initialise(config.ToImmutable()); }