Exemple #1
0
 public styleFourSide(styleTheme _theme, appendType __type)
 {
     type          = __type;
     theme         = _theme;
     themeCodeName = _theme.getCodeName();
     processType(__type);
 }
        //private void AppendPair(string v1, object p, bool v2, string v3)
        //{
        //    throw new NotImplementedException();
        //}

        //public override void open(String tag)
        //{
        //    String __op = String.Format(openTagFormat, tag);
        //    AppendLine(linePrefix + tabInsert + __op);
        //    openedTags.Push(tag);

        //}

        ///// <summary>
        ///// Dodaje HTML zatvaranje taga -- zatvara poslednji koji je otvoren
        ///// </summary>
        ///// <remarks>
        ///// Ako je prosledjeni tag none onda zatvara poslednji tag koji je otvoren.
        ///// </remarks>
        ///// <param name="tag"></param>
        //public override void close(String tag = "none")
        //{
        //    //tag = tag.checkForDefaultTag(reportOutputRoles.container);
        //    String __cl = String.Format(closeTagFormat, tag);

        //    if (tag == "none")
        //    {
        //        if (openedTags.Any())
        //        {
        //            tag = openedTags.Pop();
        //        }
        //        else
        //        {
        //            tag = "error";
        //        }
        //    }

        //    if (tag != "none")
        //    {
        //        AppendLine(linePrefix + tabInsert + __cl);
        //    }
        //}

        /// <summary>
        /// Appends inline or in new line
        /// </summary>
        /// <param name="content">String to add</param>
        /// <param name="type">Disabled</param>
        /// <param name="breakLine">On TRUE it will break into new line</param>
        public void Append(string content, appendType type = appendType.none, bool breakLine = false)
        {
            _AppendLine(imbStringCSSExtensions.renderCssBlockForTag(type, content));
            //_Append("/* ".a(content).Add(" */"));

            //Append(content.ensureEndsWith(";"),appendType.none, breakLine);
        }
Exemple #3
0
        /// <summary>
        /// The most common Append instruction: <see cref="docScriptInstruction"/> class.
        /// </summary>
        /// <remarks>
        /// Applicable with appendType: cite, code,
        /// </remarks>
        /// <param name="__type">The type.</param>
        /// <param name="__input">The input.</param>
        /// <param name="__isHorizontal">if set to <c>true</c> [is horizontal].</param>
        public docScriptInstruction(appendType __type, string __input, bool __isHorizontal = false)
        {
            type         = __type;
            input        = __input;
            isHorizontal = __isHorizontal;

            arg(d.dsa_w, 1).arg(d.dsa_h, 1);
        }
        public virtual appendType getAppendType(Int32 x, Int32 y)
        {
            appendType output = appendType.regular;

            throw new NotImplementedException();

            // output = getAppendRole(state(x, y)).convertRoleToType();
            return(output);
        }
        /// <summary>
        /// Renders the CSS block for tag.
        /// </summary>
        /// <param name="type">The type.</param>
        /// <param name="content">The content.</param>
        /// <returns></returns>
        public static string renderCssBlockForTag(this appendType type, String content)
        {
            String output = "";

            output.addLine(imbSciStringExtensions.add(toHtmlTagName(type), "{", " "));
            output.addLine(content);
            output.addLine("}");

            return(output);
        }
Exemple #6
0
        public styleFourSide getShotSet(appendType type) //, appendType type = appendType.none)
        {
            String key = styleFourSide.getCodeName(type, theme);

            if (!shots.ContainsKey(key))
            {
                styleFourSide tmp = new styleFourSide(theme, type);
                shots.Add(key, tmp);
            }
            return(shots[key]);
        }
        public styleTextShot getShotSet(appendRole role, appendType type = appendType.none)
        {
            String key = styleTextShot.getCodeName(role, type, theme);

            if (!shots.ContainsKey(key))
            {
                styleTextShot tmp = new styleTextShot(role, type, theme);
                shots.Add(key, tmp);
            }
            return(shots[key]);
        }
Exemple #8
0
        internal void processType(appendType __type)
        {
            type = __type;

            switch (type)
            {
            case appendType.c_table:
                setup(0, 25, acePaletteRole.colorDefault, 1, styleBorderType.Thin, styleSideDirection.left, styleSideDirection.right, styleSideDirection.top);
                setup(0, 25, acePaletteRole.colorDefault, 2, styleBorderType.Double, styleSideDirection.bottom);
                break;

            case appendType.c_section:
                setup(0, 25, acePaletteRole.colorDefault, 2, styleBorderType.Thin, styleSideDirection.left);
                break;

            default:
                break;
            }
        }
Exemple #9
0
        public override object AppendHeading(string content, int level = 1)
        {
            appendType hd = (appendType)appendType.heading + level;

            Boolean hadTab = (tabLevel > 0);

            prevTabLevel();

            Append(content, hd, true);
            AppendLine();

            if (hadTab)
            {
                nextTabLevel();
            }

            //_AppendLine(content.markdownText(hd));
            return("");
        }
        public static styleTextTypeEnum getSubset(this appendType type)
        {
            styleTextTypeEnum output = styleTextTypeEnum.none;

            switch (type)
            {
            default:
            case appendType.bold:
            case appendType.monospace:
            case appendType.striketrough:
            case appendType.squareQuote:
            case appendType.blockquote:
                if (Enum.TryParse <styleTextTypeEnum>(output.ToString(), out output))
                {
                    return(output);
                }
                break;

            case appendType.marked:
                return(styleTextTypeEnum.marked);

                break;

            case appendType.quotation:
            case appendType.italic:
                return(styleTextTypeEnum.italic);

                break;

            case appendType.math:
            case appendType.source:
            case appendType.sourceCS:
            case appendType.sourceJS:
            case appendType.sourcePY:
            case appendType.sourceXML:
                return(styleTextTypeEnum.source);

                break;
            }
            return(output);
        }
Exemple #11
0
        /// <summary>
        /// Converting heading tags into proper markdown
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="content"></param>
        /// <param name="sb"></param>
        /// <returns></returns>
        public static appendType detectMarkdownTagHeading(this String tag)
        {
            String     prefix = "";
            appendType output = appendType.none;

            tag = tag.ToLower();

            if (tag == "h")
            {
                return(appendType.heading);
            }

            if ((tag.Length == 2) && tag.StartsWith("h"))
            {
                Int32 hLevel = (Int32)imbSciStringExtensions.removeStartsWith(tag, "h").imbToNumber(typeof(Int32));
                prefix = "heading_" + hLevel.ToString();

                Enum.TryParse <appendType>(prefix, out output);
            }
            return(output);
        }
Exemple #12
0
        /// <summary>
        /// Detects proper companion to HTML tag
        /// </summary>
        /// <param name="tag"></param>
        /// <param name="content"></param>
        /// <param name="sb"></param>
        /// <returns></returns>
        public static appendType markdownTag(this String tag, String content, ITextRender sb)
        {
            String prefix = tag;

            appendType type = tag.detectMarkdownStructure();

            if (type != appendType.none)
            {
                sb.Append(content, type, true);
            }
            else
            {
                type = detectMarkdownTagHeading(tag);
            }

            if (type == appendType.none)
            {
                type = appendType.section;
            }

            return(type);
        }
Exemple #13
0
        protected appendType executeOnce(docScriptInstruction ins, appendTypeKind kind)
        {
            // log("--- execution method: " + kind.ToString());
            appendType output = ins.type;

            if (!settings.supportedAppends.Contains(ins.type))
            {
                log("Ignoring instruction: {0} ({2}) -- not supported by builder: {1}".f(ins.type.ToString(), render.GetType().Name, kind.ToString()));
                return(ins.type);
            }

            if (output != appendType.none)
            {
                output = runSpecialInstruction(ins);
            }
            if (output != appendType.none)
            {
                output = runOtherInstruction(ins);
            }

            return(output);
        }
        //public selectRangeArea getRowArea(Int32 y)
        //{
        //    cursorVariatorState currentState = state(area.x, y);
        //    appendRole role = getAppendRole(currentState);

        //    return output;
        //}

#pragma warning disable CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        /// <summary>
        /// Provides complete <see cref="styleShotSet"/> according to x,y coordinates and desired <see cref="aceCommonTypes.enums.appendType"/>.
        /// </summary>
        /// <param name="x">X (horizontal) position relative to <c>selectRangeArea</c> 0,0 point.</param>
        /// <param name="y">Y (vertical) position relative to <c>selectRangeArea</c> 0,0 point.</param>
        /// <param name="type">If <c>appendType.none</c> it will automatically find the best match</param>
        /// <returns></returns>
        public styleShotSet getStyleShot(Int32 x, Int32 y, appendType type = appendType.none)
#pragma warning restore CS1574 // XML comment has cref attribute 'appendType' that could not be resolved
        {
            cursorVariatorState currentState = state(x, y);

            appendRole role = getAppendRole(currentState);

            if (type == appendType.none)
            {
                throw new NotSupportedException("appendType is set to none!");
                //type = role.convertRoleToType();
            }

            acePaletteRole colorToUse = mainPaletteRole;

            if (currentState.useLayoutPalette)
            {
                colorToUse = layoutPaletteRole;
            }

            styleShotSet output = new styleShotSet(role, type, (acePaletteVariationRole)currentState.useColorIndex, colorToUse, currentState.useInvertedForeground, theme);

            return(output);
        }
        /// <summary>
        /// Converts <c>role</c> into <c>appendType</c>
        /// </summary>
        /// <param name="__role">The role.</param>
        /// <param name="__overrideResult">If not <c>none</c> it will override any conversion and return this as result</param>
        /// <param name="__defaultType">The default append Type to return if no rule is applicable.</param>
        /// <returns></returns>
        public static appendType convertRoleToType(this appendRole __role, appendType __overrideResult = appendType.none, appendType __defaultType = appendType.regular)
        {
            //appendType type = appendType.heading;

            //acePaletteVariationRole varRole = acePaletteVariationRole.normal;
            Boolean setType = (__overrideResult == appendType.none);

            appendType type = __defaultType;

            if (!setType)
            {
                type = __overrideResult;
                return(type);
            }

            switch (__role)
            {
            case appendRole.none:
                // type = appendType.regular;
                break;

            case appendRole.mergedHead:
                type = appendType.bold;
                break;

            case appendRole.mergedContent:
                type = appendType.regular;
                break;

            case appendRole.mergedFoot:
                type = appendType.italic;
                break;

            case appendRole.sectionHead:

                type = appendType.bold;

                break;

            case appendRole.sectionContent:
                type = appendType.regular;
                break;

            case appendRole.sectionFoot:

                type = appendType.italic;

                break;

            case appendRole.majorHeading:
                type = appendType.heading_1;
                break;

            case appendRole.minorHeading:
                type = appendType.heading_3;

                break;

            case appendRole.paragraph:
                type = appendType.paragraph;
                break;

            case appendRole.remark:
                type = appendType.italic;
                break;

            case appendRole.tableHead:
                type = appendType.bold;
                break;

            case appendRole.tableColumnHead:
                type = appendType.regular;
                break;

            case appendRole.tableColumnFoot:
                type = appendType.italic;
                break;

            case appendRole.tableCellValue:

                type = appendType.regular;
                break;

            case appendRole.tableCellAnnotation:
                type = appendType.comment;
                break;

            case appendRole.tableCellNovalue:
                // type = appendType.none;
                break;

            case appendRole.tableBetween:
                type = appendType.regular;
                break;

            case appendRole.tableFoot:
                type = appendType.italic;

                break;

            default:
                //type = appendType.regular;
                //throw new ArgumentOutOfRangeException();
                break;
            }
            return(type);
        }
        /// <summary>
        /// Returns appendTypeKind according to appendType
        /// </summary>
        /// <param name="type">The type.</param>
        /// <returns>Proper kind of append</returns>
        public static appendTypeKind getAppendTypeKind(this appendType type)
        {
            switch (type)
            {
            case appendType.none:
            case appendType.bypass:
                return(appendTypeKind.none);

                break;

            case appendType.c_data:
            case appendType.c_pair:
            case appendType.c_table:
            case appendType.c_link:
            case appendType.c_section:
            case appendType.footnote:
            case appendType.section:
            case appendType.c_open:
            case appendType.c_close:
            case appendType.c_line:
                return(appendTypeKind.complex);

                break;

            case appendType.source:
            case appendType.sourceCS:
            case appendType.sourceJS:
            case appendType.sourcePY:
            case appendType.sourceXML:
            case appendType.squareQuote:
            case appendType.striketrough:
            case appendType.subscript:
            case appendType.superscript:
            case appendType.comment:
            case appendType.blockquote:
            case appendType.bold:
            case appendType.heading:
            case appendType.heading_1:
            case appendType.heading_2:
            case appendType.heading_3:
            case appendType.heading_4:
            case appendType.heading_5:
            case appendType.heading_6:
            case appendType.italic:
            case appendType.marked:
            case appendType.math:
            case appendType.monospace:
            case appendType.paragraph:
            case appendType.quotation:
            case appendType.regular:
                return(appendTypeKind.simple);

                break;

            case appendType.i_chart:
            case appendType.i_external:
            case appendType.i_load:
            case appendType.i_page:
            case appendType.i_document:
            case appendType.i_meta:
            case appendType.i_function:
            case appendType.i_log:
            case appendType.x_directory:
            case appendType.x_save:
            case appendType.x_scopeIn:
            case appendType.x_scopeOut:
            case appendType.x_openTool:
            case appendType.x_export:
            case appendType.x_move:
            case appendType.x_data:
            case appendType.i_dataSource:
            case appendType.i_dataInDocument:
            case appendType.s_style:
                return(appendTypeKind.special);

                break;

            case appendType.s_alternate:
            case appendType.s_normal:
            case appendType.s_palette:
            case appendType.s_width:
            case appendType.s_variation:

            case appendType.s_zone:
                return(appendTypeKind.style);

                break;

                break;

                break;

            default:

                String name = type.ToString();

                if (name.StartsWith("i_"))
                {
                    return(appendTypeKind.special);
                }
                if (name.StartsWith("x_"))
                {
                    return(appendTypeKind.special);
                }

                if (name.StartsWith("s_"))
                {
                    return(appendTypeKind.style);
                }
                if (name.StartsWith("c_"))
                {
                    return(appendTypeKind.complex);
                }

                return(appendTypeKind.other);

                break;
            }
            return(appendTypeKind.other);
        }
Exemple #17
0
 /// <summary>
 /// Appends inline or new line content
 /// </summary>
 /// <param name="content">String content to be wrapped into container</param>
 /// <param name="type">Container type - for text it is always none</param>
 /// <param name="breakLine">Inline (FALSE) or new line (TRUE)</param>
 public override void Append(String content, appendType type = appendType.none, Boolean breakLine = false)
 {
     base._Append(content.markdownText(type), breakLine);
 }
Exemple #18
0
 /// <summary>
 /// Styling information based on <c>appendType</c> and <c>styleTheme</c>
 /// </summary>
 /// <param name="type">The type.</param>
 /// <param name="theme">The theme.</param>
 public styleTextShot(appendType type, styleTheme theme)
 {
     processType(type, theme);
     themeCodeName = theme.getCodeName();
 }
Exemple #19
0
        //public styleTextShot(appendType type, styleTheme theme)
        //{
        //    this.type = type;
        //    this.theme = theme;
        //}

        /// <summary>
        /// Processes the <c>appendType</c> and <c>styleTheme</c> to define all styling information
        /// </summary>
        /// <param name="__type">The type.</param>
        /// <param name="theme">The theme.</param>
        internal void processType(appendType __type, styleTheme theme)
        {
            type = __type;

            sizeEnum = imbStringMarkdownExtensions.getTextSizeEnum(type);

            fontStyle = new FontStyle();

            if (theme.fontSize.isThisHeading(sizeForFont))
            {
                font = theme.fontForHeadings.drawingFont;
            }
            else
            {
                font = theme.fontForText.drawingFont;
            }
            sizeForFont = theme.fontSize.headingSizes[sizeEnum.ToInt32()];

            doCallForInverse = theme.fontSize.isThisMajorHeading(sizeEnum);

            switch (type)
            {
            case appendType.squareQuote:
                fontStyle = FontStyle.Italic | FontStyle.Underline;
                break;

            case appendType.blockquote:
                fontStyle = FontStyle.Italic | FontStyle.Bold;
                break;

            case appendType.marked:
                fontStyle = FontStyle.Underline;
                break;

            case appendType.quotation:
            case appendType.italic:
                fontStyle = FontStyle.Italic;
                break;

            case appendType.bold:
                fontStyle = FontStyle.Bold;

                break;

            case appendType.monospace:
                fontStyle = FontStyle.Regular;

                //target.Font.SetFromFont(System.Drawing.SystemFonts.DefaultFont);
                break;

            case appendType.math:
            case appendType.source:
            case appendType.sourceCS:
            case appendType.sourceJS:
            case appendType.sourcePY:
            case appendType.sourceXML:

                break;

            case appendType.striketrough:
                fontStyle = FontStyle.Strikeout;
                break;

            case appendType.comment:
                modification = styleTextModificationEnum.smaller;
                break;
            }
        }
Exemple #20
0
        internal void processRole(appendRole __role, appendType __type, styleTheme theme)
        {
            role = __role;
            type = __type;

            Int32 sizeKWidth  = 8;
            Int32 sizeKHeight = 1;

            themeCodeName = theme.getCodeName();

            var sizeEnum = imbStringMarkdownExtensions.getTextSizeEnum(__type);
            var size     = theme.fontSize.headingSizes[sizeEnum.ToInt32()];

            fourSideSetting margin  = theme.fontSize.headingMargins[sizeEnum.ToInt32()];
            fourSideSetting padding = theme.fontSize.headingPaddings[sizeEnum.ToInt32()];

            sizeAndBorder.apply(margin, styleFourSideParameter.margin);
            sizeAndBorder.apply(padding, styleFourSideParameter.padding);

            String roleName = role.ToString();

            aligment = textCursorZoneCorner.Left;

            if (roleName.StartsWith("merged"))
            {
                doWrapText     = true;
                doCallForMerge = true;
            }

            if (roleName.StartsWith("section"))
            {
                doWrapText = true;
            }

            if (roleName.EndsWith("Head"))
            {
                aligment = textCursorZoneCorner.center;
                sizeAndBorder.bottom.type = styleBorderType.Thin;
            }

            if (roleName.EndsWith("Foot"))
            {
                aligment = textCursorZoneCorner.Left;
                sizeAndBorder.top.type = styleBorderType.Thin;
            }

            switch (role)
            {
            case appendRole.none:
                break;

            case appendRole.mergedHead:

                break;

            case appendRole.mergedContent:
                break;

            case appendRole.mergedFoot:

                break;

            case appendRole.sectionHead:

                break;

            case appendRole.sectionContent:
                break;

            case appendRole.sectionFoot:

                break;

            case appendRole.majorHeading:
                break;

            case appendRole.minorHeading:
                break;

            case appendRole.paragraph:
                break;

            case appendRole.remark:
                break;

            case appendRole.tableHead:
                sizeAndBorder.top.type = styleBorderType.Double;
                doWrapText             = true;
                doCallForMerge         = true;
                break;

            case appendRole.tableColumnHead:
                doWrapText = true;
                break;

            case appendRole.tableColumnFoot:
                sizeAndBorder.top.type = styleBorderType.Dotted;
                break;

            case appendRole.tableCellValue:
                break;

            case appendRole.tableCellAnnotation:
                sizeAndBorder.top.type    = styleBorderType.Dotted;
                sizeAndBorder.bottom.type = styleBorderType.Dotted;
                break;

            case appendRole.tableCellNovalue:

                break;

            case appendRole.tableBetween:
                sizeAndBorder.top.type    = styleBorderType.Dotted;
                sizeAndBorder.bottom.type = styleBorderType.Dotted;
                break;

            case appendRole.tableFoot:
                sizeAndBorder.bottom.type = styleBorderType.Double;
                break;

            case appendRole.i_container:
                break;

            case appendRole.i_margin:
                sizeKHeight = 1;
                sizeKWidth  = 1;
                break;

            case appendRole.i_line:
                break;

            default:
                break;
            }

            minSize         = new styleSize(size * sizeKWidth, size * sizeKHeight);
            minSize.width  += sizeAndBorder.left.padding + sizeAndBorder.right.padding;
            minSize.height += sizeAndBorder.top.padding + sizeAndBorder.bottom.padding;
        }
        /// <summary>
        /// Returns html tag name for appendType
        /// </summary>
        /// <param name="type"></param>
        /// <returns>only textual part of html tag</returns>
        public static string toHtmlTagName(this appendType type)
        {
            //if (type != appendType.bypass) content = content.markdownEscape();

            switch (type)
            {
            case appendType.blockquote:
                return("blockquote");

                break;

            case appendType.bold:
                return("b");

                break;

            case appendType.italic:
                return("i");

                break;

            case appendType.monospace:
                return("kbd");

                break;

            case appendType.striketrough:
                return("s");

                break;

            case appendType.subscript:
                return("sub");

                break;

            case appendType.superscript:
                return("sup");

                break;

            case appendType.marked:
                return("mark");

                break;

            case appendType.squareQuote:
                return("em");

                break;

            case appendType.heading:
                return("h1");

            case appendType.heading_1:
                return("h1");

            case appendType.heading_2:
                return("h2");

                break;

            case appendType.heading_3:
                return("h3");

                break;

            case appendType.heading_4:
                return("h4");

                break;

            case appendType.heading_5:
                return("h5");

                break;

            case appendType.heading_6:
                return("h6");

                break;

            case appendType.math:
                return("summary");

            case appendType.quotation:
                return("q");

            case appendType.source:
                return("code");

                break;

            case appendType.sourceJS:
                return("script");

                break;

            case appendType.sourcePY:
                return("code");

                break;

            case appendType.sourceCS:
                return("code");

                break;

            case appendType.sourceXML:
                return("code");    // "```xml".addLine(content).addLine("```");

                break;

            case appendType.paragraph:
                return("p");

                break;

            case appendType.section:
                //                    String prefix = Environment.NewLine;
                //                    prefix += Environment.NewLine;

                return("section");

                break;

            case appendType.regular:
                return("span");

                break;

            default:
                return("p");

                break;
            }
            //sb.AppendLine(linePrefix + tabInsert + content.ToUpper());
        }
Exemple #22
0
 /// <summary>
 /// Inverse call for markdownText extension
 /// </summary>
 /// <param name="type"></param>
 /// <param name="content">Content</param>
 /// <returns>Markdown code</returns>
 public static String plainText(this appendType type, String content)
 {
     return(content.plainText(type));
 }
Exemple #23
0
 /// <summary>
 /// Requires immediate <c>set()</c> call to set values for arguments
 /// </summary>
 /// <param name="__type">The type.</param>
 /// <param name="__arguments">The arguments.</param>
 public docScriptInstruction(appendType __type, params docScriptArguments[] __arguments)
 {
     args = __arguments.getFlatList <docScriptArguments>();
     type = __type;
 }
Exemple #24
0
        /// <summary>
        /// Deploying markdown wrapping syntax
        /// </summary>
        /// <param name="content"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static string plainText(this String content, appendType type)
        {
            if (type != appendType.bypass)
            {
                content = content.markdownEscape();
            }

            switch (type)
            {
            case appendType.marked:
                return("" + content + "[*]");

                break;

            case appendType.squareQuote:
                return("<<" + content + ">>");

                break;

            case appendType.heading:
            case appendType.heading_1:
            case appendType.heading_2:
                return(content.ToUpper());

                break;

            case appendType.quotation:
                return(imbSciStringExtensions.add(imbSciStringExtensions.add("\"", content, ""), "\"", ""));

            case appendType.sourceXML:
            case appendType.sourceCS:
            case appendType.sourcePY:
            case appendType.sourceJS:
            case appendType.source:
                return(imbSciStringExtensions.add(imbSciStringExtensions.add("[code]", content, ""), "[/code]", ""));

            case appendType.paragraph:
                return(Environment.NewLine.addLine(content));

                break;

            case appendType.section:
                String prefix = Environment.NewLine;
                prefix += Environment.NewLine;

                //return " > ".addLine(content);
                break;

            case appendType.regular:
                return(content);

                break;

            default:
                return(content);

                break;
            }

            return(content);
            //sb.AppendLine(linePrefix + tabInsert + content.ToUpper());
        }
Exemple #25
0
 public static String getCodeName(appendRole __role, appendType __type, styleTheme theme)
 {
     return(__role.ToString() + "_" + __type.ToString() + "_" + theme.getCodeName());
 }
        /// <summary>
        /// Executes the and save.
        /// </summary>
        /// <param name="report">The report.</param>
        /// <param name="runstamp">The runstamp.</param>
        /// <param name="__data">The data.</param>
        protected void execute(metaDocumentRootSet report, string runstamp, PropertyCollection __data = null)
        {
            dataDictionary = new PropertyCollectionDictionary();

            if (!unit.scriptFlags.HasFlag(docScriptFlags.disableGlobalCollection))
            {
                logStartPhase("Collect data", "#2 phase of data collecting");
                dataDictionary = report.collect(dataDictionary);
                logEndPhase();
            }
            else
            {
                log("Global data collection disabled by unit.scriptFlags");
            }

            logStartPhase("Script composing", "#3 phase of data composing");

            script       = new docScript("Script - unit[" + unit.name + "] - runstamp: " + runstamp);
            script.flags = unit.scriptFlags;

            script = report.compose(script);
            if (doBuildDeliveryMeta)
            {
                string scMeta = script.ToString(docScriptInstructionTextFormatEnum.meta);
                scMeta.saveStringToFile(directoryRoot.FullName.add("deliveryMeta.md", "\\"), getWritableFileMode.autoRenameExistingOnOtherDate, Encoding.UTF8);

                string csMeta = script.ToString(docScriptInstructionTextFormatEnum.cs_compose);
                csMeta.saveStringToFile(directoryRoot.FullName.add("deliveryMeta.cs", "\\"), getWritableFileMode.autoRenameExistingOnOtherDate, Encoding.UTF8);
            }

            logEndPhase();

            setup(unit.theme, data, renders.getTextRenders());

            logStartPhase("Script compilation", "#4 applying data to content");

            compiled = compile(script, dataDictionary);

            repo = new reportOutputRepository(directoryRoot, script.name);

            logStartPhase("Execute docScriptInstructions ", "5# executing scripttotal instructions (" + script.Count() + ")");

            index = 0;
            int tIndex = 1000;

            int mediumTimerLimit = 10;
            int mediumTimerIndex = 0;

            foreach (docScriptInstructionCompiled instruction in compiled)
            {
                try
                {
                    appendTypeKind kind = instruction.type.getAppendTypeKind();

                    if (doVerboseLog)
                    {
                        log(index.ToString("D4") + " " + instruction.ToString(docScriptInstructionTextFormatEnum.meta));
                    }

                    //afinal = appendType.none;

                    appendType final = executeOnce(instruction, kind);

                    if (final != appendType.none)
                    {
                        final = runStyleInstruction(instruction);
                    }

                    if (final == appendType.none)
                    {
                    }
                    else
                    {
                        var scopeLevel = scope.elementLevel;

                        foreach (var it in unit.outputByLevel[scopeLevel])
                        {
                            deliveryUnitItemSimpleRenderOutput output = it as deliveryUnitItemSimpleRenderOutput;

                            if (output != null)
                            {
                                output.executeScriptInstruction(this, instruction);
                                final = appendType.none;
                                //  builder = output.builder;
                            }
                        }
                    }

                    if (executionStopFlagCheck())
                    {
                        log("Execution is stopped by executionStopFlag!");
                        break;
                    }

                    index++;
                }
                catch (Exception ex)
                {
                    string msg = Environment.NewLine + "Report script execution [" + index + "/" + compiled.Count() + "] error. Instruction: [" + instruction.ToString(docScriptInstructionTextFormatEnum.cs_compose) + "]";
                    msg = msg.addLine("-- scoped meta object: path:[" + scope.path + "] -- [" + scope.name + "] -- [" + scope.GetType().Name + "]");
                    msg = msg.addLine("-- directory: [" + directoryScope.FullName + "]");
                    msg = msg.addLine("-- exception: [" + ex.GetType().Name + "] => [" + ex.Message + "]");

                    var axe = new aceReportException(msg + "Report instruction [" + instruction.type.ToString() + "] exception");
                    //if (axe.callInfo != null)
                    //{
                    //    msg = msg.addLine("-- source of ex: [" + axe.callInfo.sourceCodeLine + "]");
                    //    msg = msg.addLine("-- source file:  [" + axe.callInfo.Filepath + "]");
                    //    msg = msg.addLine("-- source line:  [" + axe.callInfo.line + "]");
                    //    msg = msg.addLine("-- source class:  [" + axe.callInfo.className + "]");
                    //}

                    log(msg + Environment.NewLine);
                    string path = "errorReport_" + index.ToString() + ".txt";
                    path = directoryScope.FullName.add(path, "\\");
                    msg.saveStringToFile(path, getWritableFileMode.autoRenameExistingOnOtherDate, Encoding.UTF8);

                    if (errorPolicy.doThrow())
                    {
                        throw axe;
                    }
                    executionError("Internal exception during an instruction execution", instruction, ex);
                }

                #region ----------------------------------

                if (compiled.Count() > 1000)
                {
                    if (tIndex > 0)
                    {
                        tIndex--;
                    }
                    else
                    {
                        mediumTimerIndex++;
                        double ratio = ((double)index) / ((double)compiled.Count());
                        aceLog.log("Report generation at [" + ratio.ToString("P") + "] done");
                        tIndex = 1000;
                    }
                }
                if (mediumTimerIndex > mediumTimerLimit)
                {
                    var memBefore = GC.GetTotalMemory(false);
                    GC.Collect();
                    var memBefore2 = memBefore - GC.GetTotalMemory(false);
                    aceLog.log("-- garbage collector invoked - memory released: " + memBefore2.getMByteCountFormated());
                    // aceLog.saveAllLogs(true);
                    mediumTimerIndex = 0;
                }

                #endregion ----------------------------------
            }

            GC.Collect();
            GC.WaitForFullGCComplete();

            logEndPhase();

            AppendPairs(data, false, " -> ");

            log("Completed");

            foreach (IDeliveryUnitItem item in unit.items)
            {
                item.reportFinishedOperation(this);
            }

            // aceLog.consoleControl.removeFromOutput(this);
        }
Exemple #27
0
 /// <summary>
 /// The prefered way of obtaining style information
 /// </summary>
 /// <param name="role">The role of particular append</param>
 /// <param name="__type">The type of particular append</param>
 /// <param name="theme">The theme to use fonts and size settings from</param>
 public styleTextShot(appendRole role, appendType __type, styleTheme theme)
 {
     processRole(role);
     processType(__type, theme);
     themeCodeName = theme.getCodeName();
 }
Exemple #28
0
 public static String getCodeName(appendType __type, styleTheme theme)
 {
     return(imbSciStringExtensions.add(__type.ToString(), theme.getCodeName(), "-"));
 }
Exemple #29
0
 public styleShotSet(appendRole role, appendType type, acePaletteVariationRole colorRole, acePaletteRole paletteRole, Boolean isInverse, styleTheme theme)
 {
     palette   = theme.palletes.getShotSet(colorRole, isInverse, paletteRole);
     text      = theme.textShotProvider.getShotSet(role, type);
     container = theme.styleContainerProvider.getShotSet(role, type);
 }
Exemple #30
0
 public styleContainerShot(appendRole __role, appendType __type, styleTheme theme)
 {
     processRole(__role, __type, theme);
 }