示例#1
0
        public Dictionary <int, string> GetSourceCodeBookmark(string domainId, CodeBookmark bookmark, int offset)
        {
            string siteId    = bookmark.CodeFragment.CodeFile.GetSiteId();
            string fileId    = bookmark.CodeFragment.CodeFile.GetFileId();
            int    startLine = bookmark.CodeFragment.StartLine;
            int    endLine   = bookmark.CodeFragment.EndLine;

            try
            {
                using (var castRepository = GetRepository())
                {
                    Dictionary <int, string> codeLines = new Dictionary <int, string>();
                    int idx = startLine - offset;
                    if (idx < 0)
                    {
                        idx = startLine;
                    }

                    List <string> lines = castRepository.GetFileContent(domainId, siteId, fileId, idx, endLine + offset);
                    for (int i = 0; i <= 2 * offset; i++)
                    {
                        codeLines.Add(idx, lines[i]);
                        idx++;
                    }
                    return(codeLines);
                }
            }
            catch (Exception ex)
            {
                LogHelper.Instance.LogInfo(ex.Message);
                return(null);
            }
        }
示例#2
0
        public Dictionary <int, string> GetSourceCodeBookmark(string domainId, CodeBookmark bookmark, int offset)
        {
            Dictionary <int, string> sources = new Dictionary <int, string>
            {
                { 1197, "PreparedStatement statement = null;" },
                { 1198, "        try" },
                { 1199, "        {" },
                { 1200, "            statement = consolidatedConn.prepareStatement(insertMessage); " },
                { 1201, "            statement.setString(1, message); " },
                { 1202, "            statement.executeUpdate(); " },
                { 1203, "        }" }
            };

            return(sources);
        }