//private void bw_DoWorkRefresh(object sender, DoWorkEventArgs e) //{ // Tracer.Verbose("ProjectService:bw_DoWorkRefresh", "START"); // try // { // CecilAssemblyParser parser = new CecilAssemblyParser((BackgroundWorker)sender, e); // foreach (AssemblyType typ in ((ProjectEntity)e.Argument).Assemblies) // parser.RefreshAssembly(typ); // } // catch (Exception err) // { // Tracer.Error("ProjectService.bw_DoWorkRefresh", err); // } // finally // { // Tracer.Verbose("ProjectService:bw_DoWorkRefresh", "END"); // //be sure progress is stoped // EventDispatcher.Instance.RaiseStatus("", StatusEventType.StopProgress); // } //} #endregion #region ----------------ADD/REMOVE ASSEMBLIES---------------- /// <summary> /// Add an assembly from a given filename /// </summary> /// <param name="pathFile"></param> public void AddAssembly(string pathFile) { if (Current == null) { return; } DiskContent dc = new DiskContent(pathFile); string dest = Path.Combine(Current.SubFolderProfiled, dc.Name); File.Copy(pathFile, dest); EventDispatcher.Instance.RaiseStatus(Resources.CORE_PARSING_START, StatusEventType.StartProgress); //ask for a worker to parse the assembly AssemblyBackgroundWorkerParser parser = AssemblyParserFactory.GetBackgroundWorkerParser(eParserType.CecilParser); parser.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ParsingWorkCompleted); parser.Parse(dest); ////Init the background worker process //BackgroundWorker worker = new BackgroundWorker(); //worker.DoWork += new DoWorkEventHandler(bw_DoWorkParse); //worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ParsingWorkCompleted); //worker.RunWorkerAsync(pathFile); }
public void AddAssembly(string filePath) { Tracer.Verbose("AssemblyExplorer:AddAssembly", "Parsing the file {0}", filePath); try { using (new LongOperation(this, "Parsing the assembly")) { IAssemblyParser parser = AssemblyParserFactory.GetParser(eParserType.NetParser); NetAssembly ass = parser.LoadAssemblyRecursively(filePath); // net assembly or parsing ok if (ass != null) { BindingView.Instance.Workspace.Assemblies.Add(ass); treeViewAss.AddItem(null, ass.Name, ass); } } } catch (Exception err) { Tracer.Error("AssemblyExplorer.AddAssembly", err); } finally { Tracer.Verbose("AssemblyExplorer:AddAssembly", "END"); } }
/// <summary> /// Refresh the projects assemblies by parsing the original ones in a background thread /// </summary> public void Refresh() { if (Current != null) { //EventDispatcher.Instance.RaiseStatus(Resources.CORE_PARSING_START, StatusEventType.StartProgress); //ask for a worker to parse the assembly AssemblyBackgroundWorkerParser parser = AssemblyParserFactory.GetBackgroundWorkerParser(eParserType.CecilParser); parser.RunWorkerCompleted += new RunWorkerCompletedEventHandler(ParsingWorkCompleted); parser.Refresh(ProjectService.Instance.Current.Assemblies); ////Init the background worker process //BackgroundWorker worker = new BackgroundWorker(); //worker.DoWork += new DoWorkEventHandler(bw_DoWorkRefresh); //worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); //worker.RunWorkerAsync(ProjectService.Instance.Current.Assemblies); } }