CSReportDll.cReportCompiler.resultTextReplace C# (CSharp) Méthode

resultTextReplace() private méthode

private resultTextReplace ( cReportFormulaInt fint ) : String
fint cReportFormulaInt
Résultat String
        private String resultTextReplace(cReportFormulaInt fint)
        {
            int i = 0;
            cReportControl ctrl = null;
            String text = "";
            List<String> collCtrlsToReplace = null;

            ctrl = pGetControl(m_ctrlName);
            if (ctrl == null)
            {
                return "";
            }

            text = ctrl.getLabel().getText();

            try
            {
                collCtrlsToReplace = m_collTextReplace[m_ctrlName];
            }
            catch
            {
                int lenText = 0;
                int pos = 0;
                int endpos = 0;

                collCtrlsToReplace = new List<String>();

                lenText = text.Length;
                while (i < lenText)
                {
                    pos = text.IndexOf(C_MACRO_CTRL, i + 1);
                    if (pos > 0)
                    {
                        endpos = text.IndexOf(C_MACRO_CTRL, pos + 1);

                        if (endpos > 0)
                        {
                            collCtrlsToReplace.Add(text.Substring(pos + 2, endpos - pos - 2));
                        }
                        i = endpos + 1;
                    }
                    else
                    {
                        i = lenText + 1;
                    }
                }

                m_collTextReplace.Add(m_ctrlName, collCtrlsToReplace);
            }

            cReportControl ctrlValue = null;
            for (i = 0; i < collCtrlsToReplace.Count; i++)
            {
                ctrlValue = pGetControl(collCtrlsToReplace[i]);
                if (ctrlValue != null)
                {
                    text = text.Replace(C_MACRO_CTRL + collCtrlsToReplace[i] + C_MACRO_CTRL,
                                        m_report.getValue(ctrlValue.getName(), false).ToString());
                }
            }
            return text;
        }