Ejemplo n.º 1
0
        public LinkerOptions CreateLinkerOptions()
        {
            var c   = app.Config <LinkerConfig>();
            var opt = new LinkerOptions();
            var svc = app.GetService <IPathService>();

            c.Directories.ForEach(d => opt.CodeBase.Directories.Add(svc.ResolvePathMacros(d)));
            opt.CodeBase.LookupStartupDirectory = c.LookupStartupDirectory;
            opt.ForceRecompile     = c.ForceRecompile;
            opt.NoWarnings         = c.NoWarnings;
            opt.WarningsAsErrors   = c.WarningsAsErrors;
            opt.SkipTimeStampCheck = c.SkipTimeStampCheck;
            return(opt);
        }
Ejemplo n.º 2
0
        public void GenerateEil()
        {
            var cfg  = app.Config <EilGeneratorConfig>();
            var opts = cfg.GenerateInDebugMode ? new ExtendedOption[] { ElaCodeBuilder.ForceRecompile }
                : new ExtendedOption[] { ElaCodeBuilder.NoDebug, ElaCodeBuilder.ForceRecompile };

            var asm = app.GetService <ICodeBuilderService>().
                      RunBuilder <CompiledAssembly>(sci.Text, app.Document(), BuildOptions.Output | BuildOptions.ErrorList, opts);

            if (asm != null)
            {
                var frame = asm.Assembly.GetRootModule();
                var gen   = new EilGeneratorHelper(app);
                gen.PrintOffsets    = cfg.IncludeCodeOffsets;
                gen.IgnoreDebugInfo = !cfg.GenerateInDebugMode;
                var src = gen.Generate(frame);

                var editor = (EditorInfo)app.GetService <IEditorService>().GetInfo("editors", "EilCode");

                var fi  = new FileInfo(app.Document().Title);
                var doc = editor.Instance.CreateDocument(fi.Name.Replace(fi.Extension, editor.FileExtension));
                app.GetService <IDocumentService>().AddDocument(doc);
                ((ITextEditor)editor.Instance).SetContent(doc, src);
            }
        }
Ejemplo n.º 3
0
        public override void Initialize(IApp app)
        {
            base.Initialize(app);
            var _ = FontHelper.MonospaceFonts;

            var con = app.Config<StylesConfig>();
            Groups
                .Where(c => !con.Styles.ContainsKey(c.Key))
                .ForEach(c => con.Styles.Add(c.Key, c.StyleItems.ToList()));
        }
Ejemplo n.º 4
0
        public override void Initialize(IApp app)
        {
            base.Initialize(app);
            var _ = FontHelper.MonospaceFonts;

            var con = app.Config <StylesConfig>();

            Groups
            .Where(c => !con.Styles.ContainsKey(c.Key))
            .ForEach(c => con.Styles.Add(c.Key, c.StyleItems.ToList()));
        }
Ejemplo n.º 5
0
        public virtual void Initialize(IApp app)
        {
            App = app;

            this.sci.SavePointReached += (o, e) => WithCurrentDocument(d => d.IsDirty = false);
            this.sci.SavePointLeft    += (o, e) => WithCurrentDocument(d => d.IsDirty = true);
            this.sci.DocumentAttached += (o, e) =>
            {
                var def = App.Config <TextEditorsConfig>().Default;
                var c   = App.Config <TextEditorsConfig>().Configs[editorKey];
                sci.UseTabs    = c.UseTabs == null ? def.UseTabs.Value : c.UseTabs.Value;
                sci.TabSize    = c.TabSize == null ? def.TabSize.Value : c.TabSize.Value;
                sci.IndentSize = c.IndentSize == null ? def.IndentSize.Value : c.IndentSize.Value;
            };
            App.GetService <IConfigService>().ConfigUpdated += ConfigUpdated;

            var srv = App.GetService <IStylesConfigService>();

            srv.EnumerateStyleItems(editorKey).UpdateStyles(sci);
            InternalInitialize();
            UpdateTextEditorSettings();

            this.sci.ContextMenuStrip = BuildContextMenu();
        }