private static void IncludeTemplateFiles(FileNameSet fs, TemplateInfo templateInfo, bool includeGeneratedFiles = true)
 {
     fs.Include(templateInfo.FileName);
     if (templateInfo.Dependencies != null && templateInfo.Dependencies.Length > 0)
     {
         foreach (var dep in templateInfo.Dependencies)
         {
             if (dep != null)
             {
                 fs.Include(dep.FileName);
             }
         }
     }
     fs.Include(templateInfo.EffectiveComponentFile);
     if (includeGeneratedFiles && templateInfo.GeneratedHDFiles != null && templateInfo.GeneratedHDFiles.Length > 0)
     {
         foreach (var f in templateInfo.GeneratedHDFiles)
         {
             if (f != null)
             {
                 fs.Include(f.FileName);
             }
         }
     }
 }
        private string[] GetFiles(bool includeGeneratedFiles = true)
        {
            FileNameSet fs = new FileNameSet();

            IncludeTemplateFiles(fs, MainTemplate, includeGeneratedFiles);
            if (_additionalHDFiles != null && _additionalHDFiles.Length > 0)
            {
                foreach (var f in _additionalHDFiles)
                {
                    if (f != null)
                    {
                        fs.Include(f.FileName);
                    }
                }
            }
            if (_otherTemplates != null && _otherTemplates.Length > 0)
            {
                foreach (var ti in _otherTemplates)
                {
                    if (ti != null)
                    {
                        IncludeTemplateFiles(fs, ti, includeGeneratedFiles);
                    }
                }
            }
            return(fs.ToArray());
        }