Example #1
0
        public void Dispose()
        {
            SalaryRecordManager.RemoveAll();
            AssessmentManager.RemoveAll();
            EmployeeManager.RemoveAll();
            DepartmentManager.RemoveAll();

            PostManager.RemoveAll();
            LevelManager.RemoveAll();
            PerformanceManager.RemoveAll();
            BenefitManager.RemoveAll();
            try
            {
                FileInfo file   = new FileInfo("../../TestUnint.sql");
                string   script = file.OpenText().ReadToEnd();

                SystemDB db = new SystemDB();

                db.Database.ExecuteSqlCommand(script);
            }
            catch (Exception e)
            {
                Trace.WriteLine(Model.Utility.Utility.GetExceptionMsg(e));
            }
        }
Example #2
0
    //private float _gcTime;

    void Awake()
    {
        if (_instance != null)
        {
            GameObject.Destroy(_instance.gameObject);
        }

        _instance = this;


        /*
         * _maxAirSec = (float)UnityEngine.Random.Range(570,630) * 0.1f;
         * _maxFixedYSec = (float)UnityEngine.Random.Range(150,200) * 0.1f;
         * _maxHighYSec = (float)UnityEngine.Random.Range(10,20) * 0.1f;
         * _maxAllkillCount = UnityEngine.Random.Range(300,400);
         */
        //	_gcTime = 0;
        checkurls = new List <string>();
        checkurls.Add("/system/bin/su");
        checkurls.Add("/system/xbin/su");
        checkurls.Add("/system/app/superuser.apk");
        checkurls.Add("/data/data/com.noshufou.android.su");

        _lowPc  = (PlayerPrefs.GetInt("LOWPC", WSDefine.NO) == WSDefine.YES)?true:false;
        isLowPc = _lowPc;
    }
Example #3
0
 private void Awake()
 {
     instance = this;
     Clear();
     StartCoroutine(BulkLoop());
     StartCoroutine(PreWarmRoutine());
 }
Example #4
0
        public XmasHell()
#endif
        {
            Graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

#if ANDROID
            Graphics.SupportedOrientations = DisplayOrientation.Portrait;
            _activity = activity;

            // Used for bloom effect
            Graphics.PreferredDepthStencilFormat = DepthFormat.Depth16;

            Graphics.IsFullScreen = true;
            Graphics.ApplyChanges();
#else
            Graphics.IsFullScreen    = false;
            Window.AllowUserResizing = true;
            IsMouseVisible           = true;
            //Graphics.PreferredBackBufferWidth = GameConfig.VirtualResolution.X;
            //Graphics.PreferredBackBufferHeight = GameConfig.VirtualResolution.Y;

            Graphics.PreferredBackBufferWidth  = 480;
            Graphics.PreferredBackBufferHeight = 853;

            // Unlock FPS
            //IsFixedTimeStep = false;
            //Graphics.SynchronizeWithVerticalRetrace = false;
#endif

            GameManager        = new GameManager(this);
            SpriteBatchManager = new SpriteBatchManager(this);
            PerformanceManager = new PerformanceManager(this);
        }
    private float helper;       // used for some calculations

    public override void CustomStart()
    {
        base.CustomStart();

        perfManager = GameObject.FindObjectOfType <PerformanceManager>();
        if (perfManager == null)    // the performance manager singleton is very important. If there isn't a performance manager in the scene a new one is loaded from the Resources folder.
        {
            GameObject pmTemp = Instantiate(Resources.Load("PerformanceManager", typeof(GameObject))) as GameObject;
            perfManager = pmTemp.GetComponent <PerformanceManager>();
        }

        resolutionWidthMultiplierMinMax  = new Vector2(Mathf.Clamp(resolutionWidthMultiplierMinMax.x, 0.01f, 20), Mathf.Clamp(resolutionWidthMultiplierMinMax.y, 0.01f, 20));   // the resolution multipliers need to be clamped
        resolutionHeightMultiplierMinMax = new Vector2(Mathf.Clamp(resolutionHeightMultiplierMinMax.x, 0.01f, 20), Mathf.Clamp(resolutionHeightMultiplierMinMax.y, 0.01f, 20)); // the resolution multipliers need to be clamped

        for (int i = 0; i < 8; i++)
        {
            camerasGO[i].gameObject.GetComponent <Camera>().aspect = (float)(Screen.width * 3f / 8f) / (float)(Screen.height / 3f);  // the aspect ratio of the camera needs to be explicitly set
        }
        if (onlySetAtStart)
        {
            RecreateRendTex();
        }
        else
        {
            RecreateRendTex();
            StartCoroutine("AdaptResolution");
        }
    }
    private float helper;                   // used for some calculations

    void Start()
    {
        perfManager = GameObject.FindObjectOfType <PerformanceManager>();
        if (perfManager == null)    // the performance manager singleton is very important. If there isn't a performance manager in the scene a new one is loaded from the Resources folder.
        {
            GameObject pmTemp = Instantiate(Resources.Load("PerformanceManager", typeof(GameObject))) as GameObject;
            perfManager = pmTemp.GetComponent <PerformanceManager>();
        }
        GetComponent <Camera>().aspect = (float)Screen.width / (float)Screen.height;       // the aspect ratio of the camera needs to be explicitly set
        if (resolutionWidthMultiplierMinMax.x > resolutionWidthMultiplierMinMax.y)
        {
            float temp = resolutionWidthMultiplierMinMax.x;
            resolutionWidthMultiplierMinMax.x = resolutionWidthMultiplierMinMax.y;
            resolutionWidthMultiplierMinMax.y = temp;
        }
        if (resolutionHeightMultiplierMinMax.x > resolutionHeightMultiplierMinMax.y)
        {
            float temp = resolutionHeightMultiplierMinMax.x;
            resolutionHeightMultiplierMinMax.x = resolutionHeightMultiplierMinMax.y;
            resolutionHeightMultiplierMinMax.y = temp;
        }
        resolutionWidthMultiplierMinMax  = new Vector2(Mathf.Clamp(resolutionWidthMultiplierMinMax.x, 0.01f, 20), Mathf.Clamp(resolutionWidthMultiplierMinMax.y, 0.01f, 20));   // the resolution multipliers need to be clamped
        resolutionHeightMultiplierMinMax = new Vector2(Mathf.Clamp(resolutionHeightMultiplierMinMax.x, 0.01f, 20), Mathf.Clamp(resolutionHeightMultiplierMinMax.y, 0.01f, 20)); // the resolution multipliers need to be clamped
        if (onlySetAtStart)
        {
            RecreateRendTex();
        }
        else
        {
            RecreateRendTex();
            StartCoroutine("AdaptResolution");
        }
    }
Example #7
0
        public OpenProductionUnitsStatsViewModel GetProductionUnitStats()
        {
            var db    = new ApplicationDbContext();
            var stats = PerformanceManager.GetNetworkStatistics(db);

            return(stats);
        }
        public ActionResult GetProductionUnitDetailPopUp(int id)
        {
            var db = new ApplicationDbContext();

            var productionUnits = db.ProductionUnits.Where(p => p.Id == id)
                                  .Include(p => p.owner.preferedMoment)
                                  .Include(p => p.productionUnitType)
                                  .Include(p => p.productionUnitStatus).ToList();

            var productionUnit = productionUnits.FirstOrDefault();

            if (productionUnit == null)
            {
                return(Json(""));
            }

            var options = db.OptionLists.Include(o => o.productionUnit)
                          .Include(o => o.option)
                          .Where(o => o.productionUnit.Id == productionUnit.Id)
                          .Select(o => o.option);

            var optionList = string.Empty;

            if (options.Count() > 0)
            {
                options.ToList().ForEach(o => { optionList += o.name + "/"; });
            }

            var averageMonthlyProduction = PerformanceManager.GetEstimatedMonthlyProduction(productionUnit.productionUnitType.Id);
            var onlineSinceWeeks         = Math.Round((DateTime.Now - productionUnit.startDate).TotalDays / 7);
            var averageMonthlySparedCO2  = PerformanceManager.GetEstimatedMonthlySparedCO2(averageMonthlyProduction);

            var results = new object();

            results = new
            {
                AverageMonthlySparedCO2  = averageMonthlySparedCO2,
                OnlineSinceWeeks         = onlineSinceWeeks,
                AverageMonthlyProduction = averageMonthlyProduction,
                PioneerCitizenName       = productionUnit.owner.pioneerCitizenName,
                PioneerCitizenNumber     = productionUnit.owner.pioneerCitizenNumber,
                ProductionUnitStartDate  = productionUnit.startDate,
                ProductionUnitInfo       = productionUnit.info,
                ProductionUnitTypeName   = productionUnit.productionUnitType.name,
                ProductionUnitTypeImage  = productionUnit.productionUnitType.imagePath,
                ProductionUnitStatus     = productionUnit.productionUnitStatus.name,

                PhoneNumber = productionUnit.owner.phoneNumber == null ? "00 33 3 67 37 00 56" : productionUnit.owner.phoneNumber,
                ContactMail = productionUnit.owner.contactMail == null ? "*****@*****.**" : productionUnit.owner.contactMail,
                PicturePath = productionUnit.picturePath == null ? "NoImage.png" : productionUnit.picturePath,

                PreferedMoment = productionUnit.owner.preferedMoment == null ? "" : productionUnit.owner.preferedMoment.name,
                Location       = productionUnit.owner.location == null ? "" : productionUnit.owner.location,

                ProductionUnitOptions = optionList,
            };

            return(Json(results));
        }
Example #9
0
 public ResourcesController(
     IHttpContextAccessor accessor,
     IHostingEnvironment hostingEnvironment,
     PerformanceManager pm,
     IOptions <ManagerConfig> cfg)
 {
     _pm  = pm;
     _cfg = cfg.Value;
 }
    void Start()
    {
        perfManager = Object.FindObjectOfType <PerformanceManager>();
        if (perfManager == null)
        {
            Debug.LogWarning("Add PerformanceManager Singleton to the scene!");
        }

        StartPerformanceTest();
    }
Example #11
0
        public ActionResult GetConnectivityStats()
        {
            ApplicationDbContext db = new ApplicationDbContext();

            var stats = PerformanceManager.GetConnectivityStatistics(db);

            return(Json(new
            {
                Stats = stats
            }, JsonRequestBehavior.AllowGet));
        }
Example #12
0
        public ActionResult GetNetworkScore()
        {
            ApplicationDbContext db = new ApplicationDbContext();

            var score = PerformanceManager.GetNetworkScore(db);

            return(Json(new
            {
                NetworkScore = score,
            }, JsonRequestBehavior.AllowGet));
        }
 public HealthCheckController(
     IHttpContextAccessor accessor,
     IHostingEnvironment hostingEnvironment,
     ProcessManager pm,
     BlockSyncManager bs,
     PerformanceManager prm,
     IOptions <ManagerConfig> cfg)
 {
     _pm  = pm;
     _bs  = bs;
     _cfg = cfg.Value;
     _prm = prm;
 }
        public static IEnumerableAsync <TResult> Throttle <TSource, TResult, TThrottle>(this IEnumerable <TSource> enumerable,
                                                                                        Func <TSource, IManagePerformance <TThrottle>, Task <TResult> > selectKey,
                                                                                        int desiredRunCount = 1,
                                                                                        ILogger log         = default(ILogger))
        {
            var throttler = new PerformanceManager <TThrottle>(desiredRunCount, log);
            var runList   = new List <Task>();

            return(enumerable
                   .Select(
                       item => throttler.RunTask(() => selectKey(item, throttler)))
                   .AsyncEnumerable());
        }
Example #15
0
        public ActionResult GetAllEntities()
        {
            OperateResult or = PerformanceManager.GetAll();

            if (or.status == OperateStatus.Success &&
                or.data != null)
            {
                return(Json(or.data, JsonRequestBehavior.AllowGet));
            }


            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Example #16
0
 private void Awake()
 {
     // Wont need this just for clarification.
     if (_instance != null && _instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         // If the singleton hasn't been initialized yet
         _instance = this;
     }
 }
Example #17
0
        public CommandGenerator(CommandBuffer commandBuffer, RendererSystemContext rendererContext, VoiceContext voiceContext, MixContext mixContext, EffectContext effectContext, SinkContext sinkContext, SplitterContext splitterContext, PerformanceManager performanceManager)
        {
            _commandBuffer      = commandBuffer;
            _rendererContext    = rendererContext;
            _voiceContext       = voiceContext;
            _mixContext         = mixContext;
            _effectContext      = effectContext;
            _sinkContext        = sinkContext;
            _splitterContext    = splitterContext;
            _performanceManager = performanceManager;

            _commandBuffer.GenerateClearMixBuffer(Constants.InvalidNodeId);
        }
Example #18
0
        public ActionResult GetNetworkStats()
        {
            ApplicationDbContext db = new ApplicationDbContext();

            var stats = PerformanceManager.GetNetworkStatistics(db);

            return(Json(new
            {
                ProductionUnitNumber = stats.productionUnitNumber,
                TotalMonthlyProduction = stats.totalMonthlyProduction,
                TotalMonthlySparedCO2 = stats.totalMonthlySparedCO2,
            }, JsonRequestBehavior.AllowGet));
        }
Example #19
0
        public ActionResult GetNetworkStatsAndIncidents()
        {
            ApplicationDbContext db = new ApplicationDbContext();

            var stats = PerformanceManager.GetNetworkStatisticsAndIncidents(db);

            return(Json(new
            {
                ProductionUnitNumber = stats.productionUnitNumber,
                TotalMonthlyIncident = stats.totalMonthlyIncident,
                TotalAnnuallyIncident = stats.totalAnnuallyIncident,
            }, JsonRequestBehavior.AllowGet));
        }
Example #20
0
    void Awake()
    {
        if (!_instance)
        {
            _instance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        DontDestroyOnLoad(_instance);
    }
Example #21
0
        public ActionResult GetEntities(Pager pager)
        {
            OperateResult or = PerformanceManager.GetByPager(new QueryParam {
                pager = pager
            });

            if (or.status == OperateStatus.Success &&
                or.data != null)
            {
                return(Json(or.data, JsonRequestBehavior.AllowGet));
            }

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
    /// <Summary>
    /// パフォーマンス計測のマネージャーへの参照を取得し、対象の配列を取得します。
    /// </Summary>
    protected void SetTargetArrayReference()
    {
        // マネージャーオブジェクトへの参照を取得します。
        GameObject managerObj = GameObject.Find("PerformanceManager");

        // マネージャースクリプトへの参照を取得します。
        PerformanceManager performanceManager = managerObj.GetComponent <PerformanceManager>();

        // マネージャースクリプトにアタッチされた計測用配列への参照をセットします。
        targetArrays = performanceManager.arrayHolders;

        // インデックスをセットします。
        index = 0;
    }
Example #23
0
        public ActionResult EditEntity(PerformanceInfo model)
        {
            if (!ModelState.IsValid)
            {
                return(Json(
                           new OperateResult
                {
                    content = Model.Utility.GetModelStateErrors(ModelState),
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = PerformanceManager.Update(model);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
Example #24
0
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "访问错误",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = PerformanceManager.GetById(id.Value);

            return(View(or.data));
        }
Example #25
0
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(Json(
                           new OperateResult
                {
                    content = "访问错误",
                },
                           JsonRequestBehavior.AllowGet
                           ));
            }

            OperateResult or = PerformanceManager.Remove(id.Value);

            return(Json(or, JsonRequestBehavior.AllowGet));
        }
        /// <summary>
        /// Read remarks.
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <typeparam name="TResult"></typeparam>
        /// <typeparam name="TThrottle"></typeparam>
        /// <param name="enumerable"></param>
        /// <param name="selectKey"></param>
        /// <param name="initialBandwidth"></param>
        /// <param name="tag"></param>
        /// <returns></returns>
        /// <remarks>
        /// Throttling can only slow down iteration. Throttling cannot accelerate/force iteration. Therefore, unless the
        /// calling method requests the tasks in the returned enumeration faster than the tasks' Results are awaited,
        /// the iteration will be sequention and Throttle will have a negligable effect. More specifically,
        /// be sure to call a method such as Prespool, Batch, Array, etc before calling Await on the throttled IEnumerableAsync<Task<TResult>>.
        /// </remarks>
        public static IEnumerableAsync <Task <TResult> > Throttle <TSource, TResult, TThrottle>(this IEnumerableAsync <TSource> enumerable,
                                                                                                Func <TSource, IManagePerformance <TThrottle>, Task <TResult> > selectKey,
                                                                                                int desiredRunCount = 1,
                                                                                                ILogger log         = default(ILogger))
        {
            var logScope  = log.CreateScope($"Throttle[{Guid.NewGuid()}]");
            var throttler = new PerformanceManager <TThrottle>(desiredRunCount, logScope);

            return(enumerable
                   .Batch()
                   .SelectMany(
                       items =>
            {
                return items
                .Select(item => throttler.RunTask(() => selectKey(item, throttler)));
            }));
        }
        internal bool IsHostHealthy(bool throwWhenUnhealthy = false)
        {
            if (!_config.HostHealthMonitorEnabled || !_settingsManager.IsAzureEnvironment)
            {
                return(true);
            }

            var exceededCounters = new Collection <string>();

            if (PerformanceManager.IsUnderHighLoad(exceededCounters))
            {
                string formattedCounters = string.Join(", ", exceededCounters);
                if (throwWhenUnhealthy)
                {
                    throw new InvalidOperationException($"Host thresholds exceeded: [{formattedCounters}]");
                }
                return(false);
            }

            return(true);
        }
        internal bool IsHostHealthy(bool throwWhenUnhealthy = false)
        {
            if (!ShouldMonitorHostHealth)
            {
                return(true);
            }

            var exceededCounters = new Collection <string>();

            if (PerformanceManager.IsUnderHighLoad(exceededCounters))
            {
                string formattedCounters = string.Join(", ", exceededCounters);
                if (throwWhenUnhealthy)
                {
                    throw new InvalidOperationException($"Host thresholds exceeded: [{formattedCounters}]. For more information, see https://aka.ms/functions-thresholds.");
                }
                return(false);
            }

            return(true);
        }
Example #29
0
        public void ConfigureThreadPoolWithoutMultiplier()
        {
            var valuesSet = new PerformanceConfiguration
            {
                UseCoreMultiplier          = false,
                MinimumWorkerThreads       = 40,
                MinimumIoCompletionThreads = 20,
                MaximumWorkerThreads       = 80,
                MaximumIoCompletionThreads = 60
            };

            PerformanceManager.ConfigureThreadPool(valuesSet);

            ThreadPool.GetMinThreads(out var minimumWorkerThreads, out var minimumCompletionThreads);
            ThreadPool.GetMaxThreads(out var maximumWorkerThreads, out var maximumCompletionThreads);

            Assert.IsTrue(valuesSet.MaximumIoCompletionThreads.Value == maximumCompletionThreads, "Not set maximum completion not expected");
            Assert.IsTrue(valuesSet.MaximumWorkerThreads.Value == maximumWorkerThreads, "Not set maximum worker not expected");
            Assert.IsTrue(valuesSet.MinimumIoCompletionThreads.Value == minimumCompletionThreads, "Not set minimum completion not expected");
            Assert.IsTrue(valuesSet.MinimumWorkerThreads.Value == minimumWorkerThreads, "Not set minimum worker not expected");
        }
Example #30
0
        public bool PerformanceAddStub()
        {
            for (var i = 0; i < PerformanceStubSize; i++)
            {
                PerformanceInfo e = new PerformanceInfo();

                e.code = "P-" + i;
                e.performanceRewards = 2000 + i * 500;
                OperateResult or = PerformanceManager.Add(e);
                if (or.status == OperateStatus.Error)
                {
                    StackTrace st  = new StackTrace(new StackFrame(true));
                    string     msg = $"App Trace >>> in file: {st.GetFrame(0).GetFileName()} " +
                                     $"line {st.GetFrame(0).GetFileLineNumber()} message: {or.content}";
                    Trace.WriteLine(msg);
                    return(false);
                }
            }

            return(true);
        }
    public override void CustomStart()
    {
        base.CustomStart();

        perfManager = Object.FindObjectOfType<PerformanceManager>();
        if (perfManager == null)     // the performance manager singleton is very important. If there isn't a performance manager in the scene a new one is loaded from the Resources folder.
        {
            GameObject pmTemp = Instantiate(Resources.Load("PerformanceManager", typeof(GameObject))) as GameObject;
            perfManager = pmTemp.GetComponent<PerformanceManager>();
        }
        resolutionWidthMultiplierMinMax = new Vector2(Mathf.Clamp(resolutionWidthMultiplierMinMax.x, 0.01f, 20), Mathf.Clamp(resolutionWidthMultiplierMinMax.y, 0.01f, 20));    // the resolution multipliers need to be clamped
        resolutionHeightMultiplierMinMax = new Vector2(Mathf.Clamp(resolutionHeightMultiplierMinMax.x, 0.01f, 20), Mathf.Clamp(resolutionHeightMultiplierMinMax.y, 0.01f, 20));     // the resolution multipliers need to be clampe

        if(onlySetAtStart)
        {
            RecreateRendTex();
        }
        else
        {
            RecreateRendTex();
            StartCoroutine("AdaptResolution");
        }
    }
Example #32
0
 // Use this for initialization
 void Start()
 {
     PM = this.gameObject.GetComponent<PerformanceManager>();
 }
Example #33
0
    /// <summary>
    /// Set player info.
    /// </summary>
    /// <param name="username">Player's username.</param>
    /// <param name="playerNumber">Player's number.</param>
    public void Initialize(string username, int playerNumber)
    {
        playerInfo = new PlayerInfo(username, playerNumber);
        name = username;

        // set up
        myExperience.Load(0);
        myMoney = new MoneyManager(playerInfo.username);
        myPerformance = new PerformanceManager(playerInfo.username);
        myScore = new ScoreManager(playerInfo.username);
        myStats.Initialize(playerInfo.username);

        StartInitialState(null);
    }