Esempio n. 1
0
 protected void InitFactory(Assembly assembly)
 {
     if (_factory == null)
     {
         _assembly = assembly;
         Type   factoryType = null;
         String prefix      = null;
         try
         {
             var config = TilesConfigurationSection.Get();
             factoryType = config.ResourceFactoryType;
             prefix      = config.FilePrefix;
             RefreshJob.REFRESH_INTERVAL = config.RefreshIntervalSeconds;
         }
         catch
         {
             Debug.WriteLine("No config section found for tiles, using assembly configuration");
         }
         _factory = factoryType == null
                        ?
                    new AssemblyLocatorFactory(_assembly, prefix).CloneForTagLib(_lib)
                        :
                    TileXmlConfigurator.GetCustomFactory(_lib, factoryType);
     }
 }
Esempio n. 2
0
        static TemplateField()
        {
            TagLib = new TagLib();

            TilesConfigurationSection config = TilesConfigurationSection.Get();
            var prefix = TemplateFieldPrefixHelper.BuildPrefix(HostingEnvironment.ApplicationPhysicalPath, config.FilePrefix);

            RefreshJob.REFRESH_INTERVAL = config.RefreshIntervalSeconds;
            _configuration = new TileXmlConfigurator(
                TagLib,
                config.ConfigFilePath,
                prefix
                );
            TILES = new TilesSet(_configuration);
        }
        private static string FilePrefix()
        {
            var path = HostingEnvironment.ApplicationPhysicalPath;
            //var path = HttpContext.Current.Server.MapPath("/");
            String filePrefix = null;

            try
            {
                filePrefix = TilesConfigurationSection.Get().FilePrefix;
            } catch
            {
                Debug.WriteLine("No prefix found");
            }
            if (!String.IsNullOrEmpty(filePrefix))
            {
                path = Path.Combine(path, filePrefix);
            }
            return(path);
        }