Bloom.Api.BrandingApi.RegisterWithServer C# (CSharp) Method

RegisterWithServer() public method

public RegisterWithServer ( EnhancedImageServer server ) : void
server EnhancedImageServer
return void
        public void RegisterWithServer(EnhancedImageServer server)
        {
            server.RegisterEndpointHandler(kBrandingImageUrlPart, request =>
            {
                var fileName = request.RequiredFileNameOrPath("id");

                var path = BloomFileLocator.GetOptionalBrandingFile(_collectionSettings.BrandingProjectName, fileName.NotEncoded);
                if(string.IsNullOrEmpty(path))
                {
                    request.Failed("");
                    // the HTML will need to be able to handle this invisibly... see http://stackoverflow.com/questions/22051573/how-to-hide-image-broken-icon-using-only-css-html-without-js
                    return;
                }
                request.ReplyWithImage(path);
            });
        }