コード例 #1
0
        //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);
        }
コード例 #2
0
        /// <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);
            }
        }