Example #1
0
        // reads all the templates and langpacks for the current dir.
        // stores info about them in static members.
        // can't correctly write locale cache(s) until all of both are read.
        public static void Scan(string templateDir)
        {
            foreach (IMountPointFactory factory in SettingsLoader.Components.OfType <IMountPointFactory>())
            {
                IMountPoint mountPoint;
                if (factory.TryMount(null, templateDir, out mountPoint))
                {
                    SettingsLoader.AddMountPoint(mountPoint);

                    foreach (IGenerator generator in SettingsLoader.Components.OfType <IGenerator>())
                    {
                        IList <ILocalizationLocator> localizationInfo;
                        IEnumerable <ITemplate>      templateList = generator.GetTemplatesAndLangpacksFromDir(mountPoint, out localizationInfo);

                        foreach (ILocalizationLocator locator in localizationInfo)
                        {
                            AddLocalizationToMemoryCache(locator);
                        }

                        foreach (ITemplate template in templateList)
                        {
                            AddTemplateToMemoryCache(template);
                        }
                    }
                }
            }
        }
Example #2
0
 public static void Scan(string templateDir)
 {
     foreach (IMountPointFactory factory in SettingsLoader.Components.OfType <IMountPointFactory>())
     {
         IMountPoint mountPoint;
         if (factory.TryMount(null, templateDir, out mountPoint))
         {
             foreach (IGenerator generator in SettingsLoader.Components.OfType <IGenerator>())
             {
                 foreach (ITemplate template in generator.GetTemplatesFromSource(mountPoint))
                 {
                     SettingsLoader.AddTemplate(template);
                     SettingsLoader.AddMountPoint(mountPoint);
                 }
             }
         }
     }
 }