public CurrencyService(
     IMemoryCache memoryCache,
     IOptions <ExplorerSettings> settings) : base(settings.Value.Currency?.ApiUrl)
 {
     this.memoryCache = memoryCache;
     this.settings    = settings.Value;
 }
Exemple #2
0
 public ViewCell(FileSystemInfo fsi, ExplorerSettings settings)
 {
     _settings     = settings;
     FullPath      = fsi.FullName;
     Name          = fsi.Name;
     LastWriteTime = fsi.LastWriteTime;
     CreationTime  = fsi.CreationTime;
     Attributes    = fsi.Attributes;
     CanDelete     = Name.ToLower().EndsWith(".vpk") || _settings.UseHighestPermission;
 }
Exemple #3
0
 public DataUpdateService(
     ILogger <DataUpdateService> log,
     BlockIndexService blockIndexService,
     TickerService tickerService,
     IMemoryCache memoryCache,
     IOptions <ExplorerSettings> settings)
 {
     this.log               = log;
     this.tickerService     = tickerService;
     this.blockIndexService = blockIndexService;
     this.memoryCache       = memoryCache;
     this.settings          = settings.Value;
 }
 public ApiController(
     ILogger <ApiController> log,
     TickerService tickerService,
     CurrencyService currencyService,
     IMemoryCache memoryCache,
     IOptions <ExplorerSettings> settings)
 {
     this.log             = log;
     this.tickerService   = tickerService;
     this.currencyService = currencyService;
     this.memoryCache     = memoryCache;
     this.settings        = settings.Value;
 }
 public HomeController(IMemoryCache memoryCache,
                       ILogger <HomeController> log,
                       TickerService tickerService,
                       WeightService weightService,
                       CurrencyService currencyService,
                       IOptions <ExplorerSettings> settings,
                       IOptions <ChainSettings> chainSettings)
 {
     this.memoryCache     = memoryCache;
     this.log             = log;
     this.settings        = settings.Value;
     this.chainSettings   = chainSettings.Value;
     this.tickerService   = tickerService;
     this.weightService   = weightService;
     this.currencyService = currencyService;
 }
Exemple #6
0
        public DataUpdateService(
            ILogger <DataUpdateService> log,
            BlockIndexService blockIndexService,
            TickerService tickerService,
            WeightService weightService,
            IMemoryCache memoryCache,
            IOptions <ExplorerSettings> settings, IOptions <ChainSettings> chainSettings)
        {
            this.log               = log;
            this.tickerService     = tickerService;
            this.weightService     = weightService;
            this.blockIndexService = blockIndexService;
            this.memoryCache       = memoryCache;
            this.settings          = settings.Value;

            this.log.LogInformation($"CHAIN SYMBOL: {chainSettings.Value.Symbol}");
        }
        public BlockExplorerController(IMemoryCache memoryCache,
                                       BlockIndexService indexService,
                                       IOptions <ExplorerSettings> settings,
                                       IOptions <ChainSettings> chainSettings)
        {
            this.memoryCache = memoryCache;

            if (this.memoryCache.Get("BlockchainStats") != null)
            {
                stats = JsonConvert.DeserializeObject <Status>(this.memoryCache.Get("BlockchainStats").ToString());
            }
            else
            {
                stats = new Status {
                    Error = "BlockchainStats not available yet."
                };
            }

            this.indexService  = indexService;
            this.settings      = settings.Value;
            this.chainSettings = chainSettings.Value;
        }
Exemple #8
0
        public FileCell(FileInfo fileInfo, ExplorerSettings settings) : base(fileInfo, settings)
        {
            File           = fileInfo;
            Extension      = fileInfo.Extension.Trim('.');
            FileSize       = fileInfo.Length;
            FileSizeString = Explorer.ToSizeString(FileSize);
            var savePath = Path.Combine(Explorer.IconCachePath, Extension + ".png");

            if (!Explorer.IconCache.ContainsKey(Extension.ToLower()))
            {
                if (!System.IO.File.Exists(savePath) && System.IO.File.Exists(FullPath))
                {
                    Explorer.IconCache.Add(Extension, Icon.ExtractAssociatedIcon(FullPath).ToBitmap());

                    Explorer.IconCache[Extension].Save(savePath);
                }
            }

            if (System.IO.File.Exists(FullPath))
            {
                FileIcon = Explorer.IconCache[Extension.ToLower()];
            }
        }
 public TickerService(IMemoryCache memoryCache, IOptions <ExplorerSettings> settings) : base(settings.Value.Indexer?.ApiUrl)
 {
     this.memoryCache = memoryCache;
     this.settings    = settings.Value;
 }
Exemple #10
0
 public DirectoryCell(DirectoryInfo directory, ExplorerSettings settings) : base(directory, settings)
 {
     Directory = directory;
 }
Exemple #11
0
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.EnvironmentName == "Developer")
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.Map("/favicon", config => config.UseMiddleware <FavoriteIconHandler>());

            app.UseStaticFiles();

            //app.UseCors("ExplorerPolicy");

            app.UseRouting();

            // Set the API URL unless overridden
            ExplorerSettings settings = app.ApplicationServices.GetService <IOptions <ExplorerSettings> >().Value;

            if (string.IsNullOrWhiteSpace(settings.Setup.DocumentationUrl))
            {
                // Anyone who build and deploy their own forks of this, should simply specify the DocumentationUrl for their own API docs.
                settings.Setup.DocumentationUrl = settings.Indexer.ApiUrl.Replace("/api", "/docs");
            }

            // Add Culture Detection Support
            var allCultures    = CultureInfo.GetCultures(CultureTypes.AllCultures).Where(x => !x.IsNeutralCulture).ToList();
            var defaultCulture = new RequestCulture("en-US");

            defaultCulture.UICulture.NumberFormat.CurrencySymbol = "$";

            // Add some known cultures that doesn't parse well in Chrome/Firefox.
            foreach (KeyValuePair <string, string> culture in CurrencyService.CustomCultures)
            {
                allCultures.Add(new CultureInfo(culture.Key));
            }

            var requestOptions = new RequestLocalizationOptions
            {
                DefaultRequestCulture = defaultCulture,
                SupportedCultures     = allCultures,
                SupportedUICultures   = allCultures
            };

            requestOptions.RequestCultureProviders = new List <IRequestCultureProvider>
            {
                new QueryStringRequestCultureProvider {
                    Options = requestOptions
                },
                new CookieRequestCultureProvider {
                    Options = requestOptions
                },
                new AcceptLanguageHeaderRequestCultureProvider {
                    Options = requestOptions
                }
            };

            app.UseRequestLocalization(requestOptions);

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
            });

            //app.UseSwagger(c =>
            //{
            //   c.RouteTemplate = "docs/{documentName}/openapi.json";
            //});

            //app.UseSwaggerUI(c =>
            //{
            //   c.RoutePrefix = "docs";
            //   c.SwaggerEndpoint("/docs/explorer/openapi.json", "Blockcore Explorer API");
            //});
        }
 public CoinTagHelper(IOptions <ExplorerSettings> settings, IOptions <ChainSettings> chainSettings, ILogger <CoinTagHelper> log)
 {
     this.settings      = settings.Value;
     this.chainSettings = chainSettings.Value;
     this.log           = log;
 }
 public BlockIndexService(IOptions <ExplorerSettings> settings) : base(settings.Value.Indexer?.ApiUrl)
 {
     this.settings = settings.Value;
 }