Beispiel #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,
            ILoggerFactory loggerFactory,
            CacheTimer cacheTimer)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));
            //loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseBrowserLink();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();

            app.UseExceptionLoggingHandler();

            app.UseMvc(routes =>
            {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
            });

            cacheTimer.StartTimer();
        }
Beispiel #2
0
    /// <summary>
    /// Generates a new ZombieCorpsePositioner, that relies on real 7D2D code to perform its function.
    /// </summary>
    /// <returns>A new zombie corpse positioner.</returns>
    public static ZombieCorpsePositioner GenerateNewPositioner()
    {
        GroundFinder.IsMovementRestrictingBlock isMovementRestrictingBlock = location => GetBlockAt(location).IsCollideMovement;
        ZombieCorpsePositioner.Logger           log = msg => Debug.Log("Corpse Disintigration Fix: " + msg);

        ICacheTimer         cacheTimer   = new CacheTimer(CONFIG.CACHE_PERSISTANCE, () => GameTimer.Instance.ticks);
        GroundPositionCache cache        = new GroundPositionCache(cacheTimer);
        IGroundFinder       groundFinder = new GroundFinder(CONFIG, isMovementRestrictingBlock, cache);

        return(new ZombieCorpsePositioner(log, IsStableBlock, IsValidSpawnPointForCorpseBlock, groundFinder, CONFIG));
    }
 private void Add(K item, V data, int frequency, Func <V> updateOnExpire = null, bool force = true)
 {
     if (item != null && !string.IsNullOrWhiteSpace(item.ToString()))
     {
         var cacheData = new CacheData <V>(data, frequency);
         cacheData.OnExpire = updateOnExpire;
         if (ActiveCount < _cacheSize)
         {
             if (_cacheDic.TryAdd(item, cacheData))
             {
                 _cacheDic[item] = cacheData;
                 _timerDic.TryRemove(item, out Timer t);
                 var timer = new CacheTimer <K>(item, _activeCacheExpire);
                 timer.Elapsed += new ElapsedEventHandler(Elapsed_Event);
                 timer.Start();
                 _timerDic.TryAdd(item, timer);
                 var dic = ReadBinary();
                 dic.TryRemove(item, out cacheData);
                 WriteBinary(dic);
                 return;
             }
         }
         else
         {
             if (!force)
             {
                 return;
             }
             if (PerformLFUAndReplace(item, cacheData))
             {
             }
             else
             {
                 WriteBinary(item, cacheData);
             }
         }
     }
 }