Exemple #1
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            app.UseGleamTech();

            var gleamTechConfig = Hosting.ResolvePhysicalPath("~/App_Data/GleamTech.config");

            if (File.Exists(gleamTechConfig))
            {
                GleamTechConfiguration.Current.Load(gleamTechConfig);
            }

            var fileUltimateConfig = Hosting.ResolvePhysicalPath("~/App_Data/FileUltimate.config");

            if (File.Exists(fileUltimateConfig))
            {
                FileUltimateConfiguration.Current.Load(fileUltimateConfig);
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseGleamTech();

            var licenseFile = Hosting.ResolvePhysicalPath("~/App_Data/License.dat");

            if (File.Exists(licenseFile))
            {
                FileUltimateConfiguration.Current.LicenseKey = File.ReadAllText(licenseFile);
            }

            app.UseStaticFiles();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });
        }
Exemple #3
0
        // Get the document information required for the current input file.
        // This is called before loading the document for determining the cache key and document format.
        //
        // inputFile parameter will be the value that was set in DocumentViewer.Document property, i.e.
        // the input file that was requested to be loaded in DocumentViewer
        //
        // Return a DocumentInfo instance initialized with required information from this method.
        public DocumentInfo GetInfo(string inputFile, DocumentHandlerParameters handlerParameters)
        {
            var physicalPath = Hosting.ResolvePhysicalPath(inputFile);
            var fileInfo     = new FileInfo(physicalPath);

            return(new DocumentInfo(
                       // uniqueId parameter (required):
                       // The unique identifier that will be used for generating the cache key for this document.
                       // For instance, it can be an ID from your database table or a simple file name;
                       // you just need to make sure this ID varies for each different document so that they are cached correctly.
                       // For example for files on disk,
                       // we internally use a string combination of file extension, file size and file date for uniquely
                       // identifying them, this way cache collisions do not occur and we can resuse the cached file
                       // even if the file name before extension is changed (because it's still the same document).
                       string.Concat(
                           fileInfo.Extension.ToLowerInvariant(),
                           fileInfo.Length,
                           fileInfo.LastWriteTimeUtc.Ticks),

                       // fileName parameter (optional but recommended):
                       // The file name which will be used for display purposes such as when downloading the document
                       // within DocumentViewer> or for the subfolder name prefix in cache folder.
                       // It will also be used to determine the document format from extension if format
                       // parameter is not specified. If not specified or empty, uniqueId will be used
                       // as the file name.
                       fileInfo.Name
                       ));
        }
Exemple #4
0
        // Open a readable stream for the current input file.
        //
        // inputFile parameter will be the value that was set in DocumentViewer.Document property, i.e.
        // the input file that was requested to be loaded in DocumentViewer
        //
        // inputOptions parameter will be determined according to the input document format
        // Usually you will not need to check this parameter as inputFile parameter should be sufficient
        // for you to locate and open a corresponding stream.
        //
        // Return a StreamResult instance initialized with a readable System.IO.Stream object.
        public StreamResult OpenRead(string inputFile, InputOptions inputOptions, DocumentHandlerParameters handlerParameters)
        {
            var physicalPath = Hosting.ResolvePhysicalPath(inputFile);
            var stream       = File.OpenRead(physicalPath);

            return(new StreamResult(stream));
        }
        protected void Application_Start(object sender, EventArgs e)
        {
            var licenseFile = Hosting.ResolvePhysicalPath("~/App_Data/License.dat");

            if (File.Exists(licenseFile))
            {
                FileUltimateConfiguration.Current.LicenseKey = File.ReadAllText(licenseFile);
            }
        }
Exemple #6
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();

            RegisterRoutes(RouteTable.Routes);

            var licenseFile = Hosting.ResolvePhysicalPath("~/App_Data/License.dat");

            if (File.Exists(licenseFile))
            {
                FileUltimateConfiguration.Current.LicenseKey = File.ReadAllText(licenseFile);
            }
        }
Exemple #7
0
        protected void Application_Start(object sender, EventArgs e)
        {
            var gleamTechConfig = Hosting.ResolvePhysicalPath("~/App_Data/GleamTech.config");

            if (File.Exists(gleamTechConfig))
            {
                GleamTechConfiguration.Current.Load(gleamTechConfig);
            }

            var documentUltimateConfig = Hosting.ResolvePhysicalPath("~/App_Data/DocumentUltimate.config");

            if (File.Exists(documentUltimateConfig))
            {
                DocumentUltimateConfiguration.Current.Load(documentUltimateConfig);
            }
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            var videoPath         = exampleFileSelector.SelectedFile;
            var fileInfo          = new FileInfo(videoPath);
            var thumbnailCacheKey = new FileCacheKey(new FileCacheSourceKey(fileInfo.Name, fileInfo.Length, fileInfo.LastWriteTimeUtc), "jpg");
            var cacheItem         = ThumbnailCache.GetOrAdd(
                thumbnailCacheKey,
                thumbnailStream => GetAndSaveThumbnail(videoPath, thumbnailStream)
                );

            ThumbnailUrl = ExamplesConfiguration.GetDownloadUrl(
                Hosting.ResolvePhysicalPath(ThumbnailCachePath.Append(cacheItem.RelativeName)),
                thumbnailCacheKey.FullValue
                );

            VideoInfo = GetVideoInfo(videoPath);
        }
Exemple #9
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            var gleamTechConfig = Hosting.ResolvePhysicalPath("~/App_Data/GleamTech.config");

            if (File.Exists(gleamTechConfig))
            {
                GleamTechConfiguration.Current.Load(gleamTechConfig);
            }

            var fileUltimateConfig = Hosting.ResolvePhysicalPath("~/App_Data/FileUltimate.config");

            if (File.Exists(fileUltimateConfig))
            {
                FileUltimateConfiguration.Current.Load(fileUltimateConfig);
            }
        }
Exemple #10
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseGleamTech();

            var gleamTechConfig = Hosting.ResolvePhysicalPath("~/App_Data/GleamTech.config");

            if (File.Exists(gleamTechConfig))
            {
                GleamTechConfiguration.Current.Load(gleamTechConfig);
            }

            var fileUltimateConfig = Hosting.ResolvePhysicalPath("~/App_Data/FileUltimate.config");

            if (File.Exists(fileUltimateConfig))
            {
                FileUltimateConfiguration.Current.Load(fileUltimateConfig);
            }

            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }