Ejemplo n.º 1
0
        private void getPublicMethodsWithMethodsNameList(List <NumberOfPublicMethodInfo> item, string fullPath, string fileName)
        {
            string fileText = System.IO.File.ReadAllText(fullPath);

            string pattern = @"public.*\(.*\s*\)";
            // (private|public).*\(.*\s*\)
            MatchCollection matches       = Regex.Matches(fileText, pattern, RegexOptions.Multiline);
            string          methodPattern = @"[_a-zA-Z0-9]*\(.*\)";

            if (matches.Count > 0)
            {
                foreach (Match ItemMatch in matches)
                {
                    Match match = Regex.Match(ItemMatch.Value, methodPattern);

                    var methodNameWithOutParam = match.Value.Substring(0, match.Value.IndexOf("(", StringComparison.Ordinal));

                    NumberOfPublicMethodInfo info = new NumberOfPublicMethodInfo
                    {
                        MethodsName            = match.Value,
                        ClassName              = fileName,
                        Count                  = matches.Count,
                        MethodNameWithOutParam = methodNameWithOutParam
                    };
                    item.Add(info);
                }
            }
        }
Ejemplo n.º 2
0
        private NumberOfPublicMethodInfo getPublicmethods(string fileName)
        {
            string fileText = System.IO.File.ReadAllText(fileName);

            string          pattern = @"public.*\(.*\s*\)";
            MatchCollection matches = Regex.Matches(fileText, pattern, RegexOptions.Multiline);
            var             item    = new NumberOfPublicMethodInfo();

            if (matches.Count > 0)
            {
                item.ClassName = fileName;
                item.Count     = matches.Count;
            }
            else
            {
                item.ClassName = fileName;
                item.Count     = 0;
            }
            return(item);
        }