void OutputLines(IDrawer2D drawer, string[] lines, int *lineLens, int usedLines, int maxLines, int charsPerLine)
        {
            int totalChars = charsPerLine * maxLines;

            for (int i = 0; i < totalChars; i++)
            {
                if (value[i] == '\0')
                {
                    value[i] = ' ';
                }
            }
            // convert %0-f to &0-f for colour preview.
            for (int i = 0; i < totalChars - 1; i++)
            {
                if (value[i] == '%' && IDrawer2D.ValidColCode(value[i + 1]))
                {
                    value[i] = '&';
                }
            }

            usedLines = Math.Max(1, usedLines);
            for (int i = 0; i < usedLines; i++)
            {
                lines[i] = new String(value, i * charsPerLine, lineLens[i]);
            }
        }
Ejemplo n.º 2
0
        public unsafe string Substring(int offset, int len)
        {
            if (len == 0)
            {
                return("");
            }
            char *tmp = stackalloc char[len];

            // convert %0-f to &0-f for colour preview.
            for (int i = 0; i < len; i++)
            {
                tmp[i] = value[offset + i];
                if (tmp[i] != '%' || (i + 1) >= len)
                {
                    continue;
                }
                if (IDrawer2D.ValidColCode(value[offset + i + 1]))
                {
                    tmp[i] = '&';
                }
            }
            return(new String(tmp, 0, len));
        }