protected virtual void ProcessFileContents(File file, Variables.Root variables)
        {
            string[] contents = file.Contents.Split('\n');

            int lineCount = 0, charCount = 0, maxCharsPerLine = 0;

            foreach(string line in contents){
                if (!line.Trim().Equals("{")){
                    ++lineCount;
                }

                if (line.Length > 0){
                    int realLength = ParseUtils.CountCharacters(line);

                    charCount += realLength;
                    maxCharsPerLine = Math.Max(maxCharsPerLine, realLength);
                }
            }

            variables.Increment(Key+"LinesTotal", lineCount);
            variables.Increment(Key+"CharsTotal", charCount);
            variables.Maximum(Key+"LinesMax", lineCount);
            variables.Maximum(Key+"CharsMax", charCount);
            variables.Maximum(Key+"CharsPerLineMax", maxCharsPerLine);

            State state = variables.GetStateObject<State>(stateOwner);

            FileIntValue fileLines = new FileIntValue(file, lineCount);
            state.MaxLines.Add(fileLines);
            state.MinLines.Add(fileLines);

            FileIntValue fileChars = new FileIntValue(file, charCount);
            state.MaxChars.Add(fileChars);
            state.MinChars.Add(fileChars);
        }
        public override void Process(File file, Variables.Root variables)
        {
            base.Process(file, variables);

            variables.Increment("fileTypeCode");
            variables.Increment(Key+"CodeFiles");

            ProcessFileContents(file, variables);
        }
        private static Variables.Root GenerateVariables(File file)
        {
            AbstractLanguageFileHandler handler = GetLanguageHandler(file);
            Variables.Root variables = new Variables.Root();

            handler.SetupProject(variables);
            handler.Process(file, variables);
            handler.FinalizeProject(variables);

            return variables;
        }
Beispiel #4
0
        public JavaFileInfo Process(File file)
        {
            JavaFileInfo info = new JavaFileInfo();
            fileInfo.Add(file, info);

            JavaCodeParser parser = new JavaCodeParser(JavaParseUtils.PrepareCodeFile(file.Contents));
            parser.AnnotationCallback += IncrementAnnotation;
            parser.CodeBlockCallback += blockParser => ReadCodeBlock(blockParser, GlobalInfo);

            ReadPackage(parser, info);
            ReadImportList(parser, info);
            ReadTopLevelTypes(parser, info);

            UpdateLocalData(info);

            return info;
        }
 public override void Process(File file, Variables.Root variables)
 {
     base.Process(file, variables);
     variables.Increment("fileTypeUnknown");
 }
Beispiel #6
0
 public JavaFileInfo GetFile(File file)
 {
     return fileInfo[file];
 }
Beispiel #7
0
 public static IFileHandler GetFileHandler(File file)
 {
     IFileHandler handler;
     return FileHandlers.TryGetValue(file.Ext, out handler) ? handler : UnknownFileHandler;
 }
 public virtual void Process(File file, Variables.Root variables)
 {
     variables.Increment("dirStructureFiles");
 }
Beispiel #9
0
 public FileIntValue(File file, int value)
 {
     this.File = file;
     this.Value = value;
 }
 public abstract IEnumerable<Node> GenerateTreeViewData(Variables.Root variables, File file);
 private static AbstractLanguageFileHandler GetLanguageHandler(File file)
 {
     return (AbstractLanguageFileHandler)HandlerList.GetFileHandler(file);
 }
 public RelativeFile(string root, File file)
 {
     this.File = file;
     this.RelativePath = File.FullPath.Substring(root.Length+1);
 }