Esempio n. 1
0
        public static List <MethodDeclarationInfo> FindMethods(string[] files, string[] searchFors, string[] searchForTypes)
        {
            SimpleReflector reflector = CreateReflector();

            try
            {
                return(reflector.FindMethods(files, searchFors, searchForTypes, null, null));
            }
            catch
            {
                throw;
            }
            finally
            {
                foreach (string file in files)
                {
                    reflector.UnloadAssembly(file);
                }
            }
        }
Esempio n. 2
0
        private void DoSearch(string fileName)
        {
            List <MethodDeclarationInfo> list = _reflector.FindMethods(new string[] { fileName },
                                                                       new string[] { cboSearchFor.Text.Trim() },
                                                                       null,
                                                                       _host,
                                                                       new SimpleReflector.IsCancelPendingDelegate(IsCancelPending));

            SimpleTextbox.AppendText(txtInfo, String.Format("Total {0} errors found.\r\n\r\n", list.Count));

            if (rbToScreen.Checked)
            {
                foreach (MethodDeclarationInfo info in list)
                {
                    SimpleTextbox.AppendText(txtInfo, info.Name);
                    SimpleTextbox.AppendText(txtInfo, "\r\n");
                    SimpleTextbox.AppendText(txtInfo, info.Body);
                    SimpleTextbox.AppendText(txtInfo, "\r\n\r\n\r\n");
                    Application.DoEvents();
                }
            }

            if (rbToFile.Checked)
            {
                string outputFile = GetLogFileName(fileName);
                using (StreamWriter sw = File.CreateText(outputFile))
                {
                    sw.WriteLine(String.Format("File {0}", fileName));
                    sw.WriteLine(String.Format("Total {0} errors found.\r\n\r\n", list.Count));

                    foreach (MethodDeclarationInfo info in list)
                    {
                        sw.WriteLine(info.Name);
                        sw.WriteLine(info.Body);
                        sw.WriteLine();
                        sw.WriteLine();
                        Application.DoEvents();
                    }
                }
            }
        }