private static Template.TemplateInfo ReadInfo(XElement xeInfo, ErrorCollector errorCollector)
        {
            Template.TemplateInfo info = new Template.TemplateInfo();

            if (xeInfo.Element("DebugMode") != null && errorCollector.XEleGetBool(xeInfo.Element("DebugMode"), xeInfo))
            {
                errorCollector.SetDebugMode();
            }

            foreach (XElement xe in xeInfo.Elements())
            {
                if (xe.Value == null)
                {
                    continue;
                }
                switch (GetXEleName(xe))
                {
                case "Name": info.name = xe.Value; break;

                case "Title": info.title = xe.Value; break;

                case "Subtitle": info.subtitle = xe.Value; break;

                case "Button": info.button = xe.Value; break;

                case "Description": info.description = xe.Value; break;

                case "GeneralDescription": info.generalDescription = xe.Value; break;

                case "MinFiles": info.minFiles = errorCollector.XEleGetInt(xe, xeInfo); break;

                case "MaxFiles": info.maxFiles = errorCollector.XEleGetInt(xe, xeInfo); break;

                case "HideMainSelectorForSingleFilePackage": info.HideMainSelectorForSingleFilePackage = errorCollector.XEleGetBool(xe, xeInfo); break;

                case "TemplateType": info.templateType = errorCollector.XEleGetEnum <HardDefinitions.TemplateType>(xe, xeInfo); break;

                case "AdditionalCalculationLevels": info.calculationLevels = ReadElementGroup(xe, ReadCalculationLevel, errorCollector); break;

                case "RequiredVariables": info.requiredVariables = ReadElementGroup(xe, ReadRequiredVariable, errorCollector); break;

                case "OptionalVariables": info.optionalVariables = ReadElementGroup(xe, ReadOptionalVariable, errorCollector); break;

                case "UserVariables": info.userVariables = ReadElementGroup(xe, ReadUserVariable, errorCollector); break;

                case "SDCDefinition": ReadTemplateInfoSDCDefinition(errorCollector, info, xe); break;

                case "ExportDescriptionMode": info.exportDescriptionMode = errorCollector.XEleGetEnum <HardDefinitions.ExportDescriptionMode>(xe, xeInfo); break;

                case "DebugMode": break;

                default: errorCollector.AddXmlUnkownEleError(xe, xeInfo); break;
                }
            }
            ;
            return(info);
        }
        private static Template.TemplateInfo.UserVariable ReadUserVariable(XElement xeUV, ErrorCollector errorCollector)
        {
            Template.TemplateInfo.UserVariable uv = new Template.TemplateInfo.UserVariable();
            foreach (XElement xe in xeUV.Elements())
            {
                if (xe.Value == null)
                {
                    continue;
                }
                switch (GetXEleName(xe))
                {
                case "UserInputType": uv.inputType = errorCollector.XEleGetEnum <HardDefinitions.UserInputType>(xe, xeUV, uv.name); break;

                case "Name": uv.name = xe.Value; break;

                case "Description": uv.description = xe.Value; break;

                case "Title": uv.title = xe.Value; break;

                case "DefaultValue": uv.defaultValue = xe.Value; break;

                case "DisplayDescription": uv.displayDescription = errorCollector.XEleGetBool(xe, xeUV, uv.name); break;

                case "ComboItems": uv.comboItems = ReadElementGroup(xe, ReadComboItem, errorCollector); break;

                default: errorCollector.AddXmlUnkownEleError(xe, xeUV, uv.name); break;
                }
            }
            return(uv);
        }
        private static Template.Action ReadAction(XElement xeAction, ErrorCollector errorCollector)
        {
            Template.Action action = new Template.Action();
            foreach (XElement xe in xeAction.Elements())
            {
                if (xe.Value == null)
                {
                    continue;
                }
                switch (GetXEleName(xe))
                {
                case "CalculationLevel": action._calculationLevel = xe.Value; break;

                case "CalculationType": action.calculationType = errorCollector.XEleGetEnum <HardDefinitions.CalculationType>(xe, xeAction); break;

                case "OutputVar": action.outputVar = xe.Value; break;

                case "FormulaString": action.formulaString = xe.Value; break;

                case "Filter": action.filter = ReadFilter(xe, errorCollector); break;

                case "Reform": action._reform = errorCollector.XEleGetBool(xe, xeAction); break;

                case "SaveResults": action._saveResult = errorCollector.XEleGetBool(xe, xeAction); break;

                case "BlendParameters": action._blendParameters = errorCollector.XEleGetBool(xe, xeAction); break;

                case "Parameters": action.parameters = ReadElementGroup(xe, ReadParameter, errorCollector); break;

                default: errorCollector.AddXmlUnkownEleError(xe, xeAction); break;
                }
            }
            return(action);
        }
        private static Template.Page.Table ReadTable(XElement xeTable, ErrorCollector errorCollector)
        {
            Template.Page.Table table = new Template.Page.Table();
            foreach (XElement xe in xeTable.Elements())
            {
                if (xe.Value == null)
                {
                    continue;
                }
                switch (GetXEleName(xe))
                {
                case "Name": table.name = xe.Value; break;

                case "Title": table.title = xe.Value; break;

                case "Subtitle": table.subtitle = xe.Value; break;

                case "Description": table.description = xe.Value; break;

                case "StringFormat": table.stringFormat = xe.Value; break;

                case "ColumnGrouping": table.columnGrouping = errorCollector.XEleGetEnum <HardDefinitions.ColumnGrouping>(xe, xeTable, table.name); break;

                case "Visible": table.visible = errorCollector.XEleGetBool(xe, xeTable, table.name); break;

                case "Action": table.action = ReadAction(xe, errorCollector); break;

                case "Graph": table.graph = ReadGraph(xe, errorCollector); break;

                case "Rows": table.rows = ReadElementGroup(xe, ReadRow, errorCollector); break;

                case "Columns": table.columns = ReadElementGroup(xe, ReadColumn, errorCollector); break;

                case "ReformColumns": table.reformColumns = ReadElementGroup(xe, ReadColumn, errorCollector); break;

                case "Cells": table.cells = ReadElementGroup(xe, ReadCell, errorCollector); break;

                case "ReformCells": table.reformCells = ReadElementGroup(xe, ReadCell, errorCollector); break;

                case "SDCDefinition": table.sdcDefinition = ReadTableSDCDefinition(errorCollector, xe); break;

                default: errorCollector.AddXmlUnkownEleError(xe, xeTable, table.name); break;
                }
            }
            return(table);
        }