Esempio n. 1
0
        protected Runtime.Object ContentWithPathComponent(Path.Component component)
        {
            if (component.isIndex)
            {
                if (component.index >= 0 && component.index < content.Count)
                {
                    return(content [component.index]);
                }

                // When path is out of range, quietly return nil
                // (useful as we step/increment forwards through content)
                else
                {
                    return(null);
                }
            }

            else if (component.isParent)
            {
                return(this.parent);
            }

            else
            {
                INamedContent foundContent = null;
                if (namedContent.TryGetValue(component.name, out foundContent))
                {
                    return((Runtime.Object)foundContent);
                }
                else
                {
                    throw new StoryException("Content '" + component.name + "' not found at path: '" + this.path + "'");
                }
            }
        }
Esempio n. 2
0
        protected Object ContentWithPathComponent(Path.Component component)
        {
            if (component.isIndex)
            {
                if (component.index >= 0 && component.index < content.Count)
                {
                    return(content[component.index]);
                }

                // When path is out of range, quietly return nil
                // (useful as we step/increment forwards through content)
                else
                {
                    return(null);
                }
            }

            else if (component.isParent)
            {
                return(this.parent);
            }

            else
            {
                INamedContent foundContent = null;
                if (namedContent.TryGetValue(component.name, out foundContent))
                {
                    return((Object)foundContent);
                }
                else
                {
                    return(null);
                }
            }
        }