/// <summary>
 /// Initializes a new instance of the <see cref="CsvCompilerModule"/> class.
 /// </summary>
 public CSharpCompilerModule(Bootstrapper bootstrapper)
     : base(bootstrapper)
 {
     compiler = new CSharpCompiler();
     workspace = new AdhocWorkspace();
     project = workspace.AddProject("CSharpProject", LanguageNames.CSharp);
     document = project.AddDocument("current", "");
     context = new CompilationContext(workspace, document);
 }
示例#2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            InitializeComponent();

            stopwatch = new Stopwatch();

            var assemblies = new[] {Assembly.Load("CodeSharper.Core"), Assembly.Load("CodeSharper.Languages"), Assembly.Load("CodeSharper.Languages.CSharp"), Assembly.GetExecutingAssembly()};
            var runnableTypeResolver = new AutoRunnableResolver();
            var valueConverter = new IntegerValueConverter();
            var interactiveService = new ReplaceTextInteractiveService(this);

            var serviceFactory = new SimpleServiceFactory();
            serviceFactory.RegisterInteractiveService(interactiveService);

            var runnableFactory = new DefaultRunnableFactory(runnableTypeResolver.ResolveRunnableTypes(assemblies), valueConverter, serviceFactory: serviceFactory);
            var fileDescriptorRepository = new FileDescriptorRepository("descriptors.json", assemblies);
            var autoDescriptorRepository = new AutoCommandDescriptorRepository(assemblies.SelectMany(assembly => assembly.GetTypes()));
            var descriptorRepository = new MultiDescriptorRepository(
                Array<IDescriptorRepository>(fileDescriptorRepository, autoDescriptorRepository)
            );

            Bootstrapper = new Bootstrapper(runnableFactory, descriptorRepository);
            compilerModule = new TextCompilerModule(Bootstrapper);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="TextCompilerModule"/> class.
        /// </summary>
        protected CompilerModuleBase(Bootstrapper bootstrapper)
        {
            Assume.NotNull(bootstrapper, nameof(bootstrapper));

            this.bootstrapper = bootstrapper;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="CsvCompilerModule"/> class.
 /// </summary>
 public CsvCompilerModule(Bootstrapper bootstrapper) : base(bootstrapper)
 {
     csvCompiler = new CsvCompiler();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextCompilerModule"/> class.
 /// </summary>
 public TextCompilerModule(Bootstrapper bootstrapper) : base(bootstrapper)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CsvCompilerModule"/> class.
 /// </summary>
 public JsonCompilerModule(Bootstrapper bootstrapper)
     : base(bootstrapper)
 {
     jsonCompiler = new JsonCompiler();
 }
示例#7
0
 /// <summary>
 /// Creates the specified bootstrapper.
 /// </summary>
 public static BootstrapperBuilder Create(Bootstrapper bootstrapper)
 {
     return new BootstrapperBuilder(bootstrapper);
 }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BootstrapperBuilder"/> class.
 /// </summary>
 private BootstrapperBuilder(Bootstrapper bootstrapper)
 {
     this.bootstrapper = bootstrapper;
 }