/// <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);
 }
Exemplo n.º 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);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="TextCompilerModule"/> class.
        /// </summary>
        protected CompilerModuleBase(Bootstrapper bootstrapper)
        {
            Assume.NotNull(bootstrapper, nameof(bootstrapper));

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