TinySite.Commands.LoadDocumentsCommand.GetLayouts C# (CSharp) Method

GetLayouts() private method

private GetLayouts ( string layoutName, string targetExtension, string file ) : IEnumerable
layoutName string
targetExtension string
file string
return IEnumerable
        private IEnumerable<LayoutFile> GetLayouts(string layoutName, string targetExtension, string file)
        {
            if (String.IsNullOrEmpty(layoutName) && this.DefaultLayoutForExtension != null)
            {
                if (!this.DefaultLayoutForExtension.TryGetValue(targetExtension, out layoutName))
                {
                    this.DefaultLayoutForExtension.TryGetValue("*", out layoutName);
                }
            }

            while (!String.IsNullOrEmpty(layoutName))
            {
                if (!this.Layouts.Contains(layoutName))
                {
                    Console.Error.WriteLine("Cannot find layout: '{0}' while processing file: {1}", layoutName, Path.GetFullPath(file));

                    break;
                }

                var layout = this.Layouts[layoutName];

                yield return layout;

                file = layout.SourcePath;

                layoutName = layout.Layout;
            }
        }