Пример #1
0
        public void Initialize(InitializationEngine context)
        {
            var hostingEnvironment = ServiceLocator.Current.GetInstance <IHostingEnvironment>();

            if (hostingEnvironment == null)
            {
                return;
            }

            var provider = new VirtualPathMappedProvider("JOS.LoginScreen", new NameValueCollection());

            MapBackgroundImages(hostingEnvironment, provider);
            MapLogo(hostingEnvironment, provider);
            hostingEnvironment.RegisterVirtualPathProvider(provider);
        }
Пример #2
0
        public void Initialize(InitializationEngine context)
        {
            var host = ServiceLocator.Current.GetInstance <IHostingEnvironment>();

            if (host == null)
            {
                return;
            }

            var virtualPathMappedProvider = new VirtualPathMappedProvider("LoginImage", new NameValueCollection());

            virtualPathMappedProvider.PathMappings.Add("/Util/images/login/Pictures_Page_1-min.jpg", Constants.LocalImageLocation + Constants.LocalImageFilename);
            virtualPathMappedProvider.PathMappings.Add("/Util/images/login/Pictures_Page_2-min.jpg", Constants.LocalImageLocation + Constants.LocalImageFilename);
            virtualPathMappedProvider.PathMappings.Add("/Util/images/login/Pictures_Page_3-min.jpg", Constants.LocalImageLocation + Constants.LocalImageFilename);

            host.RegisterVirtualPathProvider(virtualPathMappedProvider);
        }
Пример #3
0
        private static void MapLogo(IHostingEnvironment hostingEnvironment, VirtualPathMappedProvider provider)
        {
            var imagesPath = GetImageFolderPath(hostingEnvironment);

            if (Directory.Exists(imagesPath))
            {
                var logoPath = Directory.GetFiles(imagesPath, "epi_login_logo.svg").FirstOrDefault();

                if (string.IsNullOrWhiteSpace(logoPath))
                {
                    return;
                }

                var logoUrl = UrlifyPath(logoPath, hostingEnvironment.ApplicationPhysicalPath);
                provider.PathMappings.Add("/Util/images/login/DXC_long.svg", logoUrl);
            }
            else
            {
                Console.WriteLine($"Path {imagesPath} does not exists.");
            }
        }
Пример #4
0
        private static void MapBackgroundImages(IHostingEnvironment hostingEnvironment, VirtualPathMappedProvider provider)
        {
            var imagesFolderPath = GetImageFolderPath(hostingEnvironment);
            var images           = GetImages(imagesFolderPath).ToList();

            if (!images.Any())
            {
                return;
            }

            for (var i = 0; i < NumberOfStockImages; i++)
            {
                var image    = images.Count > i ? images[i] : images.First();
                var imageUrl = UrlifyPath(image, hostingEnvironment.ApplicationPhysicalPath);
                var epiPath  = $"/Util/images/login/Pictures_Page_{i + 1}-min.jpg";
                provider.PathMappings.Add(epiPath, imageUrl);
            }
        }