示例#1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="aceGeneralException"/> class.
        /// </summary>
        /// <param name="__message">The message.</param>
        /// <param name="__innerException">The inner exception.</param>
        public aceGeneralException(String __message = "", Exception __innerException = null, Object __callerInstane = null, String __title = "", Int32 stacks = 0) : base(__message, __innerException)
        {
            Int32 stackSkip = 1 + stacks;


            while (__innerException != null)
            {
                __innerException = __innerException.InnerException as aceGeneralException;
                stackSkip++;
            }


            _stackTrace = new StackTrace(true);
            //_stackFrame = _stackTrace.GetFrame(0);
            _stackFrame = getFirstFrameWithSource(_stackTrace, stackSkip);
            _message    = __message;
            title       = __title;

            if (_stackTrace == null)
            {
                _stackTraceText = Environment.StackTrace;
            }
            else
            {
                _stackTraceText = _stackTrace.ToString();
            }

            callInfo = callerInfo.getCallerInfo(_stackFrame, true);
            info     = callInfo.AppendDataFields(info);
            info     = callInfo.AppendDataFieldsOfMethod(info);


            if (InnerException != null)
            {
                if (imbSciStringExtensions.isNullOrEmptyString(__message))
                {
                    _message += Environment.NewLine + InnerException.Message;
                }
                if (imbSciStringExtensions.isNullOrEmptyString(title))
                {
                    title = "Exception: " + InnerException.GetType().Name + " in " + callInfo.className;
                }
            }
            var ex = InnerException;

            imbSCI.Core.reporting.render.builders.builderForMarkdown md = new builderForMarkdown();
            Int32 c = 1;

            while (ex != null)
            {
                ex.reportSummary(md, "Inner exception [" + c + "]");
                ex = ex.InnerException;
                c++;
            }
            _message = _message.addLine(md.ContentToString());

            HelpLink = Directory.GetCurrentDirectory() + "\\diagnostics\\index.html";
        }
示例#2
0
        /// <summary>
        /// Generates the folder readme.
        /// </summary>
        /// <param name="folders">The folders.</param>
        /// <param name="folder">The folder.</param>
        /// <returns></returns>
        protected String generateFolderReadme(IEnumerable <folderNode> folders, folderNode folder = null)
        {
            builderForMarkdown builder = new builderForMarkdown();


            if (folder != null)
            {
                builder.AppendHeading("Folder structure", 2);
                builder.AppendLine();


                builder.AppendHeading(folder.name, 3);
                builder.AppendLine(" > " + folder.path);
                builder.AppendLine(" > " + folder.description);
                builder.AppendLine();


                builder.AppendHorizontalLine();
            }
            else
            {
                builder.AppendHeading("Folder structure", 2);
                builder.AppendLine();

                builder.AppendParagraph("Application directory structure");
                builder.AppendHorizontalLine();

                foreach (var fold in folders)
                {
                    //    builder.nextTabLevel();
                    builder.AppendHeading(fold.name, 3);
                    builder.AppendLine(" > " + fold.path);
                    builder.AppendLine(" > " + fold.description);
                    builder.AppendLine();
                    //  builder.prevTabLevel();
                }
            }



            builder.AppendLine();
            builder.AppendHorizontalLine();

            PropertyCollection pc = notation.buildPropertyCollection <PropertyCollection>(false, false, "cite");

            builder.AppendPairs(pc, false);


            builder.AppendLine();
            builder.AppendHorizontalLine();

            builder.AppendLine("File generated: ".add(DateTime.Now.ToLongDateString(), " ").add(DateTime.Now.ToLongTimeString()));
            builder.AppendLine("Application: <<".add(name, " ").add(">>", " "));


            return(builder.ContentToString(true));
        }
        //public String makeFolderSignature()

        public void scopeOutOperation(IRenderExecutionContext context, IMetaContentNested oldScope)
        {
            if (context.directoryScope.FullName == context.directoryRoot.FullName)
            {
            }
            else
            {
                builderForMarkdown dirReadMe = new builderForMarkdown();

                dirReadMe.AppendHorizontalLine();

                dirReadMe.AppendHeading("Directory for [" + oldScope.name + "]", 3);

                dirReadMe.AppendLine("Report: {{{test_caption}}},  {{{sys_time}}}, {{{sys_date}}}");

                dirReadMe.AppendLine("> Open 'index.html' for report content");

                dirReadMe.AppendHorizontalLine();

                dirReadMe.AppendHeading("Report element description", 2);

                dirReadMe.AppendPair("Element class type", oldScope.GetType().Name, true, " \t\t = \t");
                dirReadMe.AppendPair("Element logical level", oldScope.elementLevel.ToString(), true, " \t\t = \t");
                dirReadMe.AppendPair("Element logical path", oldScope.path, true, " \t\t = \t"); //.elementLevel.ToString());
                dirReadMe.AppendPair("Element isRoot", oldScope.isThisRoot, true, " \t\t = \t"); //.elementLevel.ToString());

                dirReadMe.AppendHorizontalLine();

                dirReadMe.AppendHeading("Element data dump", 2);

                var pc = oldScope.AppendDataFields(null);
                dirReadMe.AppendPairs(pc, false, " \t\t = \t");

                dirReadMe.AppendHorizontalLine();

                dirReadMe.AppendHeading("Contextual data contextual dump", 2);

                var p2c = context.data;
                dirReadMe.AppendPairs(p2c, false, " \t\t = \t");

                dirReadMe.AppendHorizontalLine();

                dirReadMe.AppendLine("File created: {{{sys_time}}}, {{{sys_date}}}, {{{meta_year}}}");
                dirReadMe.AppendLine("By: {{{meta_softwareName}}}");
                dirReadMe.AppendLine("{{{meta_copyright}}}, {{{meta_author}}}, {{{meta_organization}}}");

                dirReadMe.AppendHorizontalLine();

                dirReadMe.AppendLine("File system path: " + context.directoryScope.FullName);
                dirReadMe.AppendLine("Report root path: " + context.directoryRoot.FullName);

                string content = dirReadMe.ContentToString(true, reportOutputFormatName.markdown);
                content = content.applyToContent(pc);
                content = content.applyToContent(p2c);

                string path = context.directoryScope.FullName.add("readme.md", "\\");

                content.saveStringToFile(path, getWritableFileMode.overwrite, Encoding.UTF8);

                // leaving the directory
                context.directoryScope = context.directoryScope.Parent;
            }
            setRelPath(context);
        }