Esempio n. 1
0
        /// <summary>
        /// Write the parameter set
        /// </summary>
        /// <param name="subSet">The parameter subset</param>
        /// <param name="strings">List of strings</param>
        /// <param name="elem">XML element name</param>
        /// <param name="indent">The XML indentation</param>
        private void WriteParamSet(ParameterSet subSet, List <string> strings, string elem, int indent)
        {
            string lineStr;
            int    idx;

            if (!subSet.NodeIsRoot())
            {
                strings.Add(string.Empty);
            }

            lineStr = new string(' ', indent) + "<" + elem + " name=\"" + subSet.EnglishName + "\"";
            if (subSet.NodeIsRoot())
            {
                lineStr += " version=\"" + subSet.Version + "\">";
            }
            else
            {
                if (subSet.LocaleCount() > 0)
                {
                    lineStr += " locales=\"" + subSet.GetLocale(0);
                    for (idx = 1; idx <= subSet.LocaleCount() - 1; idx++)
                    {
                        lineStr += ";" + subSet.GetLocale(idx);
                    }
                    lineStr += "\"";
                }
                lineStr += ">";
            }
            strings.Add(lineStr);

            if (subSet.TranslationCount() > 0)
            {
                for (idx = 0; idx <= subSet.TranslationCount() - 1; idx++)
                {
                    lineStr = new string(' ', indent + 2) + "<translate lang=\"" +
                              subSet.GetTranslation(idx).Lang + "\">" +
                              EscapeText(subSet.GetTranslation(idx).Text) + "</translate>";
                    strings.Add(lineStr);
                }
            }

            for (idx = 0; idx <= subSet.DefinitionCount() - 1; idx++)
            {
                this.WriteParameters(subSet, subSet.GetDefinition(idx), strings, indent + 2);
            }
            for (idx = 0; idx <= subSet.ChildCount() - 1; idx++)
            {
                this.WriteParamSet(subSet.GetChild(idx), strings, "set", indent + 2);
            }

            lineStr = new string(' ', indent) + "</" + elem + ">";
            if (!subSet.NodeIsRoot() && (subSet.ChildCount() > 0))
            {
                lineStr += "<!-- " + subSet.EnglishName + " -->";
            }

            strings.Add(lineStr);
        }