private void _bAddNet_Click(object button, EventArgs e) { using var d = new System.Windows.Forms.OpenFileDialog { InitialDirectory = AFolders.ThisApp, Filter = "Dll|*.dll|All files|*.*", Multiselect = true }; if (d.ShowDialog(this) != DialogResult.OK) { return; } var a = d.FileNames; foreach (var v in a) { if (MetaReferences.IsDotnetAssembly(v)) { continue; } ADialog.ShowError("Not a .NET assembly.", v, owner: this); return; } //remove path and ext if need var thisApp = AFolders.ThisAppBS; if (a[0].Starts(thisApp, true)) { for (int i = 0; i < a.Length; i++) { a[i] = a[i].Substring(thisApp.Length); } } _meta.r.AddRange(a); _Added(button, _meta.r); }
public static void UiLoaded() { //warm up //Task.Delay(100).ContinueWith(_1 => { Task.Run(() => { //var p1 = APerf.Create(); try { var code = @"//. using Au; using Au.Types; using System; using System.Collections.Generic; class Script : AScript { [STAThread] static void Main(string[] a) => new Script(a); Script(string[] args) { AOutput.Write(""t"" + 'c' + 1); }}"; var refs = new MetaReferences().Refs; int position = code.IndexOf('}'); ProjectId projectId = ProjectId.CreateNewId(); DocumentId documentId = DocumentId.CreateNewId(projectId); using var ws = new AdhocWorkspace(); var sol = ws.CurrentSolution .AddProject(projectId, "p", "p", LanguageNames.CSharp) .AddMetadataReferences(projectId, refs) .AddDocument(documentId, "f.cs", code); var document = sol.GetDocument(documentId); //p1.Next(); //_ = document.GetSemanticModelAsync().Result; //p1.Next(); Program.MainForm.BeginInvoke(new Action(() => { //APerf.Next('w'); _isWarm = true; ReadyForStyling?.Invoke(); Panels.Editor.ZActiveDocChanged += Stop; Program.Timer025sWhenVisible += _Timer025sWhenVisible; })); //p1.Next(); //1000.ms(); //p1.Next(); //Compiler.Warmup(document); //don't need. Later fast enough. Now just uses more memory and CPU at startup. //p1.NW('w'); //APerf.NW(); //EdUtil.MinimizeProcessPhysicalMemory(500); //with this later significantly slower } catch (Exception ex) { ADebug.Print(ex); } }); }