Esempio n. 1
0
        public static List <String> loadSourceFileIntoList(String pathToSourceCodeFile, bool useFileCacheIfPossible)
        {
            if (useFileCacheIfPossible && DI.dFilesLines.ContainsKey(pathToSourceCodeFile))
            {
                return(DI.dFilesLines[pathToSourceCodeFile]);
            }
            // in case the file is a reference, try to map it
            string mappedSourceCodeFile = SourceCodeMappingsUtils.mapFile(pathToSourceCodeFile);
            var    lsSourceCode         = new List <string>();
            string sFileContents        = getFileContents(mappedSourceCodeFile);

            if (sFileContents != "")
            {
                sFileContents = sFileContents.Replace("\r\n", "\n").Replace("\n", Environment.NewLine);
                // fix the files only use \n for line breaks
                lsSourceCode.AddRange(sFileContents.Split(new[] { Environment.NewLine }, StringSplitOptions.None));
                if (false == DI.dFilesLines.ContainsKey(pathToSourceCodeFile))
                {
                    DI.dFilesLines.Add(pathToSourceCodeFile, lsSourceCode);
                }
                else
                {
                    DI.dFilesLines[pathToSourceCodeFile] = lsSourceCode;
                }
            }
            return(lsSourceCode);
        }
Esempio n. 2
0
 public static string tryToResolveFileLocation(string fileToMap, Control hostControl)
 {
     if (autoTryToFixSourceCodeFileReferences && false == File.Exists(fileToMap) && false == Directory.Exists(fileToMap))
     {
         return(SourceCodeMappingsUtils.mapFile(fileToMap, hostControl));
     }
     return(fileToMap);
 }
        }                                               // populated dinamically

        public override string ToString()
        {
            var mappedFile = SourceCodeMappingsUtils.mapFile(File);

            if (mappedFile.fileExists())
            {
                return(mappedFile.fileContents().lines(false)[Line - 1]);
            }
            return(Signature ?? "...Signature value not set...");
        }
Esempio n. 4
0
        public static long getFileSize(string fileToProcess)
        {
            string mappedSourceCodeFile = SourceCodeMappingsUtils.mapFile(fileToProcess);

            if (File.Exists(mappedSourceCodeFile))
            {
                var fileInfo = new FileInfo(mappedSourceCodeFile);
                return(fileInfo.Length);
            }
            return(-1);
        }
Esempio n. 5
0
        public static long getFilesSize(List <string> filesToProcess)
        {
            long filesSize = 0;

            foreach (var file in filesToProcess)
            {
                string mappedSourceCodeFile = SourceCodeMappingsUtils.mapFile(file);
                if (File.Exists(mappedSourceCodeFile))
                {
                    var fileInfo = new FileInfo(mappedSourceCodeFile);
                    filesSize += fileInfo.Length;
                }
            }
            return((filesSize == 0) ? -1 : filesSize);
        }
        }                                               // populated dinamically

        public override string ToString()
        {
            var mappedFile = SourceCodeMappingsUtils.mapFile(File);

            try
            {
                if (mappedFile.fileExists())
                {
                    return(mappedFile.fileContents().lines(false).value(Line - 1));
                }
            }
            catch (Exception ex)
            {
                ex.log();
            }
            return(Signature ?? "...Signature value not set...");
        }