Exemplo n.º 1
0
 public static bool IdentifyMainMethod(SourceCode aSourceCode, string aCurrentCodeLine, int aLinePosition)
 {
     bool result = false;
     if (aSourceCode.ContainKeyword(aCurrentCodeLine, "static") && aCurrentCodeLine.IndexOf("Main") > -1  && (aCurrentCodeLine.EndsWith("{") || aSourceCode.GetNextLine(aLinePosition).StartsWith("{")))
         result = true;
     return result;
 }
        public bool Identify(SourceCode aSourceCode, string aCurrentCodeLine, int aLinePosition)
        {
            bool result = false;
            if (aCurrentCodeLine.StartsWith("using") && aCurrentCodeLine.IndexOf("{") == -1 && !aSourceCode.GetNextLine(aLinePosition).StartsWith("{"))
                result = true;

            return result;
        }
Exemplo n.º 3
0
        public bool Identify(SourceCode aSourceCode, string aCurrentCodeLine, int aLinePosition)
        {
            bool result = false;

            if (aCurrentCodeLine.StartsWith("namespace") && (aCurrentCodeLine.EndsWith("{") || aSourceCode.GetNextLine(aLinePosition).StartsWith("{")))
                result = true;

            return result;
        }
 private int CountInterfaces(SourceCode aSourceCode)
 {
     int result = 0;
     int pos = 1;
     foreach(String line in aSourceCode.GetLines())
     {
         if (aSourceCode.ContainKeyword(line, "interface")  && (line.EndsWith("{") || aSourceCode.GetNextLine(pos).StartsWith("{")))
             result++;
         pos++;
     }
     return result;
 }
 public bool Identify(SourceCode aSourceCode, string aCurrentCodeLine, int aLinePosition)
 {
     bool result = false;
     if ((aCurrentCodeLine.StartsWith("public") ||
          aCurrentCodeLine.StartsWith("class") ||
          aCurrentCodeLine.StartsWith("protected") ||
          aCurrentCodeLine.StartsWith("private") ||
          aCurrentCodeLine.StartsWith("sealed") ||
          aCurrentCodeLine.StartsWith("internal") ||
          aCurrentCodeLine.StartsWith("iternal protected")) &&
         aSourceCode.ContainKeyword(aCurrentCodeLine, "class") &&
         (aCurrentCodeLine.EndsWith("{") || aSourceCode.GetNextLine(aLinePosition).StartsWith("{")))
         result = true;
     return result;
 }
        public bool Identify(SourceCode aSourceCode, string aCurrentCodeLine, int aLinePosition)
        {
            // TODO: We need to also cater for C# properties later on

            bool result = false;
            if (aSourceCode.CountTokens(aCurrentCodeLine, '(') == 1 &&
                aSourceCode.CountTokens(aCurrentCodeLine, ')') == 1 &&
                aCurrentCodeLine.IndexOf(aSourceCode.GetFileName()) == -1 &&
                !aSourceCode.ContainKeyword(aCurrentCodeLine, "class") &&
                aCurrentCodeLine.Split(' ').Length > 2 &&
                !MainMethodComp.IdentifyMainMethod(aSourceCode, aCurrentCodeLine, aLinePosition) &&
                (aCurrentCodeLine.EndsWith("{") || aSourceCode.GetNextLine(aLinePosition).StartsWith("{")))
                result = true;

            return result;
        }
        public string DoValidation(SourceCode aSourceCode)
        {
            String result = null;

            bool foundIndexers = false;
            int pos = 1;
            foreach (String line in aSourceCode.GetLines())
            {
                if (line.IndexOf("this[") > -1 && (line.EndsWith("{") || aSourceCode.GetNextLine(pos).StartsWith("{")))
                    foundIndexers = true;
                pos++;
            }

            if (foundIndexers)
                result = aSourceCode.GetFileName() + ": Java unfortunatly doesn't support C# indexers. ";

            return result;
        }