Exemple #1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="item"></param>
        /// <param name="name"></param>
        public NameSpaceTreeNode(DataDictionary.Types.NameSpace item)
            : base(item, null, false)
        {
            subNameSpaces = new NameSpaceSubNameSpacesTreeNode(Item);
            ranges        = new RangesTreeNode(Item);
            enumerations  = new EnumerationsTreeNode(Item);
            structures    = new StructuresTreeNode(Item);
            collections   = new CollectionsTreeNode(Item);
            stateMachines = new StateMachinesTreeNode(Item);
            functions     = new FunctionsTreeNode(Item);
            procedures    = new NameSpaceProceduresTreeNode(Item);
            variables     = new NameSpaceVariablesTreeNode(Item);
            rules         = new NameSpaceRulesTreeNode(Item);

            Nodes.Add(subNameSpaces);
            Nodes.Add(ranges);
            Nodes.Add(enumerations);
            Nodes.Add(structures);
            Nodes.Add(collections);
            Nodes.Add(stateMachines);
            Nodes.Add(functions);
            Nodes.Add(procedures);
            Nodes.Add(variables);
            Nodes.Add(rules);
        }
Exemple #2
0
        /// <summary>
        /// Creates the stat message according to the list of namespaces provided
        /// </summary>
        /// <param name="paragraphs"></param>
        /// <returns></returns>
        public static string CreateStatMessage(List <DataDictionary.Types.NameSpace> namespaces, bool isFolder)
        {
            string result = "";

            int ranges       = 0;
            int enumerations = 0;
            int structures   = 0;
            int collections  = 0;
            int functions    = 0;
            int procedures   = 0;
            int variables    = 0;
            int rules        = 0;

            List <DataDictionary.Types.NameSpace> allNamespaces = new List <DataDictionary.Types.NameSpace>();

            foreach (DataDictionary.Types.NameSpace aNamespace in namespaces)
            {
                allNamespaces.AddRange(collectNamespaces(aNamespace));
            }

            foreach (DataDictionary.Types.NameSpace aNamespace in allNamespaces)
            {
                ranges       += aNamespace.Ranges.Count;
                enumerations += aNamespace.Enumerations.Count;
                structures   += aNamespace.Structures.Count;
                collections  += aNamespace.Collections.Count;
                functions    += aNamespace.Functions.Count;
                procedures   += aNamespace.Procedures.Count;
                variables    += aNamespace.Variables.Count;
                rules        += aNamespace.Rules.Count;
            }

            if (!isFolder)
            {
                result += "The namespace " + namespaces[0].Name + " contains ";
            }
            else
            {
                result += namespaces.Count + (namespaces.Count > 1 ? " namespaces " : " namespace ") + "selected, containing ";
            }

            result += (allNamespaces.Count - namespaces.Count) + (allNamespaces.Count - namespaces.Count > 1 ? " sub-namespaces, " : " sub-namespace, ") +
                      ranges + (ranges > 1 ? " ranges, " : " range, ") +
                      enumerations + (enumerations > 1 ? " enumerations, " : " enumeration, ") +
                      structures + (structures > 1 ? " structures, " : " structure, ") +
                      collections + (collections > 1 ? " collections, " : " collection, ") +
                      functions + (functions > 1 ? " functions, " : " function, ") +
                      procedures + (procedures > 1 ? " procedures, " : " procedure, ") +
                      variables + (variables > 1 ? " variables and " : " variable and ") +
                      rules + (rules > 1 ? " rules." : " rule.");

            return(result);
        }