예제 #1
0
        /// <summary>
        /// Helper method that does the actual job -- calls <see cref="_Get"/> recursively
        /// as needed.
        /// </summary>
        static private void _Get(ArgData data, int sheetIndex)
        {
            if (sheetIndex > data.numSheets) // sheet indices are 1-based
            {
                return;                      // past last sheet
            }
            object tool = GetTool(data, sheetIndex);

            if (tool == null)
            {
                // This property sheet has no settings for this tool,
                // but perhaps the next one has.
                _Get(data, sheetIndex + 1);
                return;
            }

            List <string> list = data.propGetter(tool);

            if (list == null)
            {
                // This property sheet isn't customizing this particular setting,
                // but perhaps the next one does.
                _Get(data, sheetIndex + 1);
                return;
            }

            // If $(NoInherit) appears anywhere within the property, inheritance stops
            // right here, and even implicit $(Inherit) will be ignored.
            bool noInherit = list.Contains("$(NoInherit)");

            // Look for $(Inherit) elements and run recursively
            bool explicitInherit = false;

            foreach (string item in list)
            {
                if (!noInherit && item == "$(Inherit)")
                {
                    explicitInherit = true;
                    _Get(data, sheetIndex + 1); // inherit from next sheet
                }
                else
                {
                    data.result.Add(item);
                }
            }

            // If there was no explicit $(Inherit) anywhere in the property,
            // we "append" an implicit one at the end.
            if (!noInherit && !explicitInherit)
            {
                _Get(data, sheetIndex + 1); // inherit from next sheet
            }
        }
예제 #2
0
        /// <summary>
        /// Helper method that does the actual job -- calls <see cref="_Get"/> recursively
        /// as needed.
        /// </summary>
        private static void _Get(ArgData data, int sheetIndex)
        {
            if (sheetIndex > data.numSheets) // sheet indices are 1-based
                return; // past last sheet

            object tool = GetTool(data, sheetIndex);
            if (tool == null)
            {
                // This property sheet has no settings for this tool,
                // but perhaps the next one has.
                _Get(data, sheetIndex + 1);
                return;
            }

            List<string> list = data.propGetter(tool);
            if (list == null)
            {
                // This property sheet isn't customizing this particular setting,
                // but perhaps the next one does.
                _Get(data, sheetIndex + 1);
                return;
            }

            // If $(NoInherit) appears anywhere within the property, inheritance stops
            // right here, and even implicit $(Inherit) will be ignored.
            bool noInherit = list.Contains("$(NoInherit)");

            // Look for $(Inherit) elements and run recursively
            bool explicitInherit = false;
            foreach (string item in list)
            {
                if (!noInherit && item == "$(Inherit)")
                {
                    explicitInherit = true;
                    _Get(data, sheetIndex + 1); // inherit from next sheet
                }
                else
                {
                    data.result.Add(item);
                }
            }

            // If there was no explicit $(Inherit) anywhere in the property,
            // we "append" an implicit one at the end.
            if (!noInherit && !explicitInherit)
            {
                _Get(data, sheetIndex + 1); // inherit from next sheet
            }
        }