Exemplo n.º 1
0
 /// <summary>
 /// 加载资源信息到集合
 /// </summary>
 /// <param name="routeCollections"></param>
 private void LoadResoure(IVirtualFileRouteCollections routeCollections)
 {
     if (VirtualFileResoureInfos.ResoureInfo != null)
     {
         foreach (var resoureInfo in VirtualFileResoureInfos.ResoureInfo)
         {
             //初始化资源信息
             foreach (var item in resoureInfo.Names)
             {
                 routeCollections.Add($"{_virtualFileOptions.Value.RequestPath}/{resoureInfo.DirectoryName}/{item}", resoureInfo.DirectoryName, resoureInfo.MimeType);
             }
         }
         //清空数据
         VirtualFileResoureInfos.ResoureInfo.Clear();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="virtualFileOptions">配置参数</param>
        /// <param name="routeCollections">路由的集合</param>
        public DefaultVirtualFileResource(IOptions <VirtualFileOptions> virtualFileOptions, IVirtualFileRouteCollections routeCollections)
        {
            _virtualFileOptions     = virtualFileOptions;
            ResouresDirectoryPrefix = virtualFileOptions.Value.ResouresDirectoryPrefix;

            LoadResoure(routeCollections);
        }