Beispiel #1
0
        /// <summary>
        /// Find all non-arrays and add them to our ungrouped group. Since this
        /// grouping is what drives the class generation, this is very much something
        /// we have to do! :-)
        /// </summary>
        /// <param name="masterClass"></param>
        /// <param name="groupToAddTo">What is the name of the group we should add them to?</param>
        private void AddNonArrays(ROOTClassShell masterClass, List <ArrayGroup> groups, string groupToAddTo)
        {
            ///
            /// First, get all non-arrays. Arrays are all declared with [] right now,
            /// so we need only look for that.
            ///

            var nonarrays = (from item in masterClass.Items
                             where !item.ItemType.Contains("[]")
                             select item.Name).ToArray();

            if (nonarrays.Length == 0)
            {
                return;
            }

            ///
            /// Turn the names into variables
            ///

            var varInfo = nonarrays.ToVariableInfo();

            ///
            /// See if the group we should add them to exists.
            ///

            var grp = (from g in groups
                       where g.Name == groupToAddTo
                       select g).FirstOrDefault();

            if (grp == null)
            {
                grp = new ArrayGroup()
                {
                    Name = groupToAddTo, Variables = varInfo.ToArray()
                };
                groups.Add(grp);
            }
            else
            {
                grp.Variables = (grp.Variables.Concat(varInfo)).ToArray();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Find all non-arrays and add them to our ungrouped group. Since this
        /// grouping is what drives the class generation, this is very much something
        /// we have to do! :-)
        /// </summary>
        /// <param name="masterClass"></param>
        /// <param name="groupToAddTo">What is the name of the group we should add them to?</param>
        private void AddNonArrays(ROOTClassShell masterClass, List<ArrayGroup> groups, string groupToAddTo)
        {
            ///
            /// First, get all non-arrays. Arrays are all declared with [] right now,
            /// so we need only look for that.
            /// 

            var nonarrays = (from item in masterClass.Items
                             where !item.ItemType.Contains("[]")
                             select item.Name).ToArray();
            if (nonarrays.Length == 0)
                return;

            ///
            /// Turn the names into variables
            /// 

            var varInfo = nonarrays.ToVariableInfo();

            ///
            /// See if the group we should add them to exists.
            ///

            var grp = (from g in groups
                       where g.Name == groupToAddTo
                       select g).FirstOrDefault();
            if (grp == null)
            {
                grp = new ArrayGroup() { Name = groupToAddTo, Variables = varInfo.ToArray() };
                groups.Add(grp);
            }
            else
            {
                grp.Variables = (grp.Variables.Concat(varInfo)).ToArray();
            }
        }