public IList <ITemplate> GetTemplatesAndLangpacksFromDir(IMountPoint source, out IList <ILocalizationLocator> localizations)
        {
            IDirectory folder = source.Root;

            Regex localeFileRegex = new Regex(@"
                ^
                (?<locale>
                    [a-z]{2}
                    (?:-[A-Z]{2})?
                )
                \."
                                              + Regex.Escape(TemplateConfigFileName)
                                              + "$"
                                              , RegexOptions.IgnorePatternWhitespace);

            IList <ITemplate> templateList = new List <ITemplate>();

            localizations = new List <ILocalizationLocator>();

            foreach (IFile file in folder.EnumerateFiles("*" + TemplateConfigFileName, SearchOption.AllDirectories))
            {
                if (string.Equals(file.Name, TemplateConfigFileName, StringComparison.OrdinalIgnoreCase))
                {
                    IFile hostConfigFile = file.MountPoint.EnvironmentSettings.SettingsLoader.FindBestHostTemplateConfigFile(file);

                    if (TryGetTemplateFromConfigInfo(file, out ITemplate template, hostTemplateConfigFile: hostConfigFile))
                    {
                        templateList.Add(template);
                    }

                    continue;
                }

                Match localeMatch = localeFileRegex.Match(file.Name);
                if (localeMatch.Success)
                {
                    string locale = localeMatch.Groups["locale"].Value;

                    if (TryGetLangPackFromFile(file, out ILocalizationModel locModel))
                    {
                        ILocalizationLocator locator = new LocalizationLocator()
                        {
                            Locale           = locale,
                            MountPointId     = source.Info.MountPointId,
                            ConfigPlace      = file.FullPath,
                            Identity         = locModel.Identity,
                            Author           = locModel.Author,
                            Name             = locModel.Name,
                            Description      = locModel.Description,
                            ParameterSymbols = locModel.ParameterSymbols
                        };
                        localizations.Add(locator);
                    }

                    continue;
                }
            }

            return(templateList);
        }
        public IList <ITemplate> GetTemplatesAndLangpacksFromDir(IMountPoint source, out IList <ILocalizationLocator> localizations)
        {
            IDirectory folder = source.Root;

            Regex localeFileRegex = new Regex(@"
                ^
                (?<locale>
                    [a-z]{2}
                    (?:_[a-z]{2})?
                )
                \.netnew\.json
                $"
                                              , RegexOptions.IgnoreCase | RegexOptions.IgnorePatternWhitespace);

            IList <ITemplate> templateList = new List <ITemplate>();

            localizations = new List <ILocalizationLocator>();

            foreach (IFile file in folder.EnumerateFiles("*.netnew.json", SearchOption.AllDirectories))
            {
                if (string.Equals(file.Name, ".netnew.json", StringComparison.OrdinalIgnoreCase))
                {
                    ITemplate template;
                    if (TryGetTemplateFromConfigInfo(file, out template))
                    {
                        templateList.Add(template);
                    }

                    continue;
                }

                Match localeMatch = localeFileRegex.Match(file.Name);
                if (localeMatch.Success)
                {
                    string locale = localeMatch.Groups["locale"].Value;

                    ILocalizationModel locModel;
                    if (TryGetLangPackFromFile(file, out locModel))
                    {
                        ILocalizationLocator locator = new LocalizationLocator()
                        {
                            Locale       = locale,
                            MountPointId = source.Info.MountPointId,
                            ConfigPlace  = file.FullPath,
                            Identity     = locModel.Identity,
                        };
                        localizations.Add(locator);
                    }

                    continue;
                }
            }

            return(templateList);
        }