コード例 #1
0
ファイル: MainForm.cs プロジェクト: szabototo89/CodeSharper
        /// <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);
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: szabototo89/CodeSharper
 private void cToolStripMenuItem_Click(object sender, EventArgs e)
 {
     compilerModule = new CSharpCompilerModule(Bootstrapper);
 }