Exemplo n.º 1
0
        protected override void ShredMethod(StreamReader streamReader)
        {
            string line;

            string[] words;
            bool     methStart  = false;
            bool     methEnd    = false;
            bool     multyCom   = false;
            int      braceCount = 0;
            int      count      = 0;

            while ((line = streamReader.ReadLine()) != null)
            {
                if (line.IndexOf("(") != -1 && line.IndexOf("class") == -1 && line.IndexOf(".") == -1 &&
                    line.IndexOf("if") == -1 && line.IndexOf("=") == -1 && line.IndexOf("implements") == -1 &&
                    line.IndexOf("interface") == -1 && line.IndexOf("*") == -1 && line.IndexOf("//") == -1)
                {
                    words = line.Split(' ');
                    if (words.Length > 2)
                    {
                        if (methEnd)
                        {
                            methEnd = false;
                            count++;
                        }

                        Code code = new Code();
                        MethArr.Add(code);
                    }
                }

                if (line.IndexOf("{") != -1 && line.IndexOf("interface") == -1 &&
                    line.IndexOf("class") == -1 && !methStart && line.IndexOf("*") == -1 &&
                    line.IndexOf("implements") == -1 && line.IndexOf("//") == -1)
                {
                    methStart = true;
                }

                if (methStart && line != "")
                {
                    if (line.IndexOf("{") != -1)
                    {
                        braceCount++;
                    }

                    if (line.IndexOf("}") != -1)
                    {
                        braceCount--;
                    }

                    if (line.IndexOf("//") != -1)
                    {
                        line = line.Remove(line.IndexOf("//"));
                    }

                    if (line.IndexOf("/*") != -1)
                    {
                        multyCom = true;
                    }

                    if (!multyCom && line.Trim() != "")
                    {
                        try
                        {
                            MethArr[count].Add(line);
                        }
                        catch (Exception)
                        {
                            ErrorFinde = true;
                            break;
                        }
                    }

                    if (braceCount == 0)
                    {
                        methEnd   = true;
                        methStart = false;
                    }

                    if (line.IndexOf("*/") != -1)
                    {
                        multyCom = false;
                    }
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Метод отчитки всех контенеров
 /// </summary>
 public void ClearStore()
 {
     CodeArr.Clear();
     ClassArr.Clear();
     MethArr.Clear();
 }